diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/CMakeLists.txt dde-calendar-5.10.0/3rdparty/kcalendarcore/CMakeLists.txt --- dde-calendar-5.9.1/3rdparty/kcalendarcore/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/CMakeLists.txt 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,37 @@ +cmake_minimum_required(VERSION 3.7) +project(kcalendarcore) + +# Find the library +find_package(PkgConfig REQUIRED) +find_package(Qt5Gui REQUIRED) +find_package(Qt5 COMPONENTS + Core + DBus +REQUIRED) + +#set(LibIcal_MIN_VERSION "3.0") +#find_package(ical ${LibIcal_MIN_VERSION}) + +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_INCLUDE_CURRENT_DIR ON) +set(CMAKE_AUTOMOC ON) +pkg_check_modules(3rd_lib REQUIRED + libical + ) + +#安全编译参数 +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-protector-strong -D_FORTITY_SOURCE=1 -z noexecstack -pie -fPIC -z lazy") + +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src ${3rd_lib_INCLUDE_DIRS}) +aux_source_directory(src CALENDARCORE_SRCS) + +add_library(${PROJECT_NAME} STATIC ${CALENDARCORE_SRCS}) + +target_link_libraries(${PROJECT_NAME} + Qt5::Core + Qt5::DBus + Qt5::Gui + ${3rd_lib_LIBRARIES} + ${Libical_LIBRARIES} + icalvcal + icalss) diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/alarm.cpp dde-calendar-5.10.0/3rdparty/kcalendarcore/src/alarm.cpp --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/alarm.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/alarm.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,852 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 1998 Preston Brown + SPDX-FileCopyrightText: 2001 Cornelius Schumacher + SPDX-FileCopyrightText: 2003 David Jarvie + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +/** + @file + This file is part of the API for handling calendar data and + defines the Alarm class. + + @brief + Represents an alarm notification. + + @author Cornelius Schumacher \ +*/ +#include "alarm.h" +#include "incidence.h" +#include "utils_p.h" + +#include +#include + +using namespace KCalendarCore; + +/** + Private class that helps to provide binary compatibility between releases. + @internal +*/ +//@cond PRIVATE +class Q_DECL_HIDDEN KCalendarCore::Alarm::Private +{ +public: + Private() + : mParent(nullptr) + , mType(Alarm::Invalid) + , mAlarmSnoozeTime(5) + , mAlarmRepeatCount(0) + , mEndOffset(false) + , mHasTime(false) + , mAlarmEnabled(false) + , mHasLocationRadius(false) + , mLocationRadius(0) + { + } + + Incidence *mParent = nullptr; // the incidence which this alarm belongs to + + Type mType; // type of alarm + QString mDescription; // text to display/email body/procedure arguments + QString mFile; // program to run/optional audio file to play + QString mMailSubject; // subject of email + QStringList mMailAttachFiles; // filenames to attach to email + Person::List mMailAddresses; // who to mail for reminder + + QDateTime mAlarmTime; // time at which to trigger the alarm + Duration mAlarmSnoozeTime; // how long after alarm to snooze before + // triggering again + int mAlarmRepeatCount; // number of times for alarm to repeat + // after the initial time + + Duration mOffset; // time relative to incidence DTSTART + // to trigger the alarm + bool mEndOffset; // if true, mOffset relates to DTEND, not DTSTART + bool mHasTime; // use mAlarmTime, not mOffset + bool mAlarmEnabled; + + bool mHasLocationRadius; + int mLocationRadius; // location radius for the alarm +}; +//@endcond + +Alarm::Alarm(Incidence *parent) + : d(new KCalendarCore::Alarm::Private) +{ + d->mParent = parent; +} + +Alarm::Alarm(const Alarm &other) + : CustomProperties(other) + , d(new KCalendarCore::Alarm::Private(*other.d)) +{ +} + +Alarm::~Alarm() +{ + delete d; +} + +Alarm &Alarm::operator=(const Alarm &a) +{ + if (&a != this) { + d->mParent = a.d->mParent; + d->mType = a.d->mType; + d->mDescription = a.d->mDescription; + d->mFile = a.d->mFile; + d->mMailAttachFiles = a.d->mMailAttachFiles; + d->mMailAddresses = a.d->mMailAddresses; + d->mMailSubject = a.d->mMailSubject; + d->mAlarmSnoozeTime = a.d->mAlarmSnoozeTime; + d->mAlarmRepeatCount = a.d->mAlarmRepeatCount; + d->mAlarmTime = a.d->mAlarmTime; + d->mOffset = a.d->mOffset; + d->mEndOffset = a.d->mEndOffset; + d->mHasTime = a.d->mHasTime; + d->mAlarmEnabled = a.d->mAlarmEnabled; + } + + return *this; +} + +static bool compareMailAddresses(const Person::List &list1, const Person::List &list2) +{ + if (list1.count() == list2.count()) { + for (int i = 0; i < list1.count(); ++i) { + if (list1.at(i) != list2.at(i)) { + return false; + } + } + return true; + } + + return false; +} + +bool Alarm::operator==(const Alarm &rhs) const +{ + if (d->mType != rhs.d->mType // + || d->mAlarmSnoozeTime != rhs.d->mAlarmSnoozeTime // + || d->mAlarmRepeatCount != rhs.d->mAlarmRepeatCount // + || d->mAlarmEnabled != rhs.d->mAlarmEnabled // + || d->mHasTime != rhs.d->mHasTime // + || d->mHasLocationRadius != rhs.d->mHasLocationRadius // + || d->mLocationRadius != rhs.d->mLocationRadius) { + return false; + } + + if (d->mHasTime) { + if (d->mAlarmTime != rhs.d->mAlarmTime) { + return false; + } + } else { + if (d->mOffset != rhs.d->mOffset || d->mEndOffset != rhs.d->mEndOffset) { + return false; + } + } + + switch (d->mType) { + case Display: + return d->mDescription == rhs.d->mDescription; + + case Email: + return d->mDescription == rhs.d->mDescription // + && d->mMailAttachFiles == rhs.d->mMailAttachFiles // + && compareMailAddresses(d->mMailAddresses, rhs.d->mMailAddresses) // + && d->mMailSubject == rhs.d->mMailSubject; + + case Procedure: + return d->mFile == rhs.d->mFile && d->mDescription == rhs.d->mDescription; + + case Audio: + return d->mFile == rhs.d->mFile; + + case Invalid: + break; + } + return false; +} + +bool Alarm::operator!=(const Alarm &a) const +{ + return !operator==(a); +} + +void Alarm::setType(Alarm::Type type) +{ + if (type == d->mType) { + return; + } + + if (d->mParent) { + d->mParent->update(); + } + switch (type) { + case Display: + d->mDescription.clear(); + break; + case Procedure: + d->mFile.clear(); + d->mDescription.clear(); + break; + case Audio: + d->mFile.clear(); + break; + case Email: + d->mMailSubject.clear(); + d->mDescription.clear(); + d->mMailAddresses.clear(); + d->mMailAttachFiles.clear(); + break; + case Invalid: + break; + default: + if (d->mParent) { + d->mParent->updated(); // not really + } + return; + } + d->mType = type; + if (d->mParent) { + d->mParent->updated(); + } +} + +Alarm::Type Alarm::type() const +{ + return d->mType; +} + +void Alarm::setAudioAlarm(const QString &audioFile) +{ + if (d->mParent) { + d->mParent->update(); + } + d->mType = Audio; + d->mFile = audioFile; + if (d->mParent) { + d->mParent->updated(); + } +} + +void Alarm::setAudioFile(const QString &audioFile) +{ + if (d->mType == Audio) { + if (d->mParent) { + d->mParent->update(); + } + d->mFile = audioFile; + if (d->mParent) { + d->mParent->updated(); + } + } +} + +QString Alarm::audioFile() const +{ + return (d->mType == Audio) ? d->mFile : QString(); +} + +void Alarm::setProcedureAlarm(const QString &programFile, const QString &arguments) +{ + if (d->mParent) { + d->mParent->update(); + } + d->mType = Procedure; + d->mFile = programFile; + d->mDescription = arguments; + if (d->mParent) { + d->mParent->updated(); + } +} + +void Alarm::setProgramFile(const QString &programFile) +{ + if (d->mType == Procedure) { + if (d->mParent) { + d->mParent->update(); + } + d->mFile = programFile; + if (d->mParent) { + d->mParent->updated(); + } + } +} + +QString Alarm::programFile() const +{ + return (d->mType == Procedure) ? d->mFile : QString(); +} + +void Alarm::setProgramArguments(const QString &arguments) +{ + if (d->mType == Procedure) { + if (d->mParent) { + d->mParent->update(); + } + d->mDescription = arguments; + if (d->mParent) { + d->mParent->updated(); + } + } +} + +QString Alarm::programArguments() const +{ + return (d->mType == Procedure) ? d->mDescription : QString(); +} + +void Alarm::setEmailAlarm(const QString &subject, const QString &text, const Person::List &addressees, const QStringList &attachments) +{ + if (d->mParent) { + d->mParent->update(); + } + d->mType = Email; + d->mMailSubject = subject; + d->mDescription = text; + d->mMailAddresses = addressees; + d->mMailAttachFiles = attachments; + if (d->mParent) { + d->mParent->updated(); + } +} + +void Alarm::setMailAddress(const Person &mailAddress) +{ + if (d->mType == Email) { + if (d->mParent) { + d->mParent->update(); + } + d->mMailAddresses.clear(); + d->mMailAddresses.append(mailAddress); + if (d->mParent) { + d->mParent->updated(); + } + } +} + +void Alarm::setMailAddresses(const Person::List &mailAddresses) +{ + if (d->mType == Email) { + if (d->mParent) { + d->mParent->update(); + } + d->mMailAddresses += mailAddresses; + if (d->mParent) { + d->mParent->updated(); + } + } +} + +void Alarm::addMailAddress(const Person &mailAddress) +{ + if (d->mType == Email) { + if (d->mParent) { + d->mParent->update(); + } + d->mMailAddresses.append(mailAddress); + if (d->mParent) { + d->mParent->updated(); + } + } +} + +Person::List Alarm::mailAddresses() const +{ + return (d->mType == Email) ? d->mMailAddresses : Person::List(); +} + +void Alarm::setMailSubject(const QString &mailAlarmSubject) +{ + if (d->mType == Email) { + if (d->mParent) { + d->mParent->update(); + } + d->mMailSubject = mailAlarmSubject; + if (d->mParent) { + d->mParent->updated(); + } + } +} + +QString Alarm::mailSubject() const +{ + return (d->mType == Email) ? d->mMailSubject : QString(); +} + +void Alarm::setMailAttachment(const QString &mailAttachFile) +{ + if (d->mType == Email) { + if (d->mParent) { + d->mParent->update(); + } + d->mMailAttachFiles.clear(); + d->mMailAttachFiles += mailAttachFile; + if (d->mParent) { + d->mParent->updated(); + } + } +} + +void Alarm::setMailAttachments(const QStringList &mailAttachFiles) +{ + if (d->mType == Email) { + if (d->mParent) { + d->mParent->update(); + } + d->mMailAttachFiles = mailAttachFiles; + if (d->mParent) { + d->mParent->updated(); + } + } +} + +void Alarm::addMailAttachment(const QString &mailAttachFile) +{ + if (d->mType == Email) { + if (d->mParent) { + d->mParent->update(); + } + d->mMailAttachFiles += mailAttachFile; + if (d->mParent) { + d->mParent->updated(); + } + } +} + +QStringList Alarm::mailAttachments() const +{ + return (d->mType == Email) ? d->mMailAttachFiles : QStringList(); +} + +void Alarm::setMailText(const QString &text) +{ + if (d->mType == Email) { + if (d->mParent) { + d->mParent->update(); + } + d->mDescription = text; + if (d->mParent) { + d->mParent->updated(); + } + } +} + +QString Alarm::mailText() const +{ + return (d->mType == Email) ? d->mDescription : QString(); +} + +void Alarm::setDisplayAlarm(const QString &text) +{ + if (d->mParent) { + d->mParent->update(); + } + d->mType = Display; + if (!text.isNull()) { + d->mDescription = text; + } + if (d->mParent) { + d->mParent->updated(); + } +} + +void Alarm::setText(const QString &text) +{ + if (d->mType == Display) { + if (d->mParent) { + d->mParent->update(); + } + d->mDescription = text; + if (d->mParent) { + d->mParent->updated(); + } + } +} + +QString Alarm::text() const +{ + return (d->mType == Display) ? d->mDescription : QString(); +} + +void Alarm::setTime(const QDateTime &alarmTime) +{ + if (d->mParent) { + d->mParent->update(); + } + d->mAlarmTime = alarmTime; + d->mHasTime = true; + + if (d->mParent) { + d->mParent->updated(); + } +} + +QDateTime Alarm::time() const +{ + if (hasTime()) { + return d->mAlarmTime; + } else if (d->mParent) { + if (d->mEndOffset) { + QDateTime dt = d->mParent->dateTime(Incidence::RoleAlarmEndOffset); + return d->mOffset.end(dt); + } else { + QDateTime dt = d->mParent->dateTime(Incidence::RoleAlarmStartOffset); + return d->mOffset.end(dt); + } + } else { + return QDateTime(); + } +} + +QDateTime Alarm::nextTime(const QDateTime &preTime, bool ignoreRepetitions) const +{ + if (d->mParent && d->mParent->recurs()) { + QDateTime dtEnd = d->mParent->dateTime(Incidence::RoleAlarmEndOffset); + + QDateTime dtStart = d->mParent->dtStart(); + // Find the incidence's earliest alarm + // Alarm time is defined by an offset from the event start or end time. + QDateTime alarmStart = d->mOffset.end(d->mEndOffset ? dtEnd : dtStart); + // Find the offset from the event start time, which is also used as the + // offset from the recurrence time. + Duration alarmOffset(dtStart, alarmStart); + /* + qDebug() << "dtStart " << dtStart; + qDebug() << "dtEnd " << dtEnd; + qDebug() << "alarmStart " << alarmStart; + qDebug() << "alarmOffset " << alarmOffset.value(); + qDebug() << "preTime " << preTime; + */ + if (alarmStart > preTime) { + // No need to go further. + return alarmStart; + } + if (d->mAlarmRepeatCount && !ignoreRepetitions) { + // The alarm has repetitions, so check whether repetitions of previous + // recurrences happen after given time. + QDateTime prevRecurrence = d->mParent->recurrence()->getPreviousDateTime(preTime); + if (prevRecurrence.isValid()) { + QDateTime prevLastRepeat = alarmOffset.end(duration().end(prevRecurrence)); + // qDebug() << "prevRecurrence" << prevRecurrence; + // qDebug() << "prevLastRepeat" << prevLastRepeat; + if (prevLastRepeat > preTime) { + // Yes they did, return alarm offset to previous recurrence. + QDateTime prevAlarm = alarmOffset.end(prevRecurrence); + // qDebug() << "prevAlarm " << prevAlarm; + return prevAlarm; + } + } + } + // Check the next recurrence now. + QDateTime nextRecurrence = d->mParent->recurrence()->getNextDateTime(preTime); + if (nextRecurrence.isValid()) { + QDateTime nextAlarm = alarmOffset.end(nextRecurrence); + /* + qDebug() << "nextRecurrence" << nextRecurrence; + qDebug() << "nextAlarm " << nextAlarm; + */ + if (nextAlarm > preTime) { + // It's first alarm takes place after given time. + return nextAlarm; + } + } + } else { + // Not recurring. + QDateTime alarmTime = time(); + if (alarmTime > preTime) { + return alarmTime; + } + } + return QDateTime(); +} + +bool Alarm::hasTime() const +{ + return d->mHasTime; +} + +void Alarm::shiftTimes(const QTimeZone &oldZone, const QTimeZone &newZone) +{ + if (d->mParent) { + d->mParent->update(); + } + d->mAlarmTime = d->mAlarmTime.toTimeZone(oldZone); + d->mAlarmTime.setTimeZone(newZone); + if (d->mParent) { + d->mParent->updated(); + } +} + +void Alarm::setSnoozeTime(const Duration &alarmSnoozeTime) +{ + if (alarmSnoozeTime.value() > 0) { + if (d->mParent) { + d->mParent->update(); + } + d->mAlarmSnoozeTime = alarmSnoozeTime; + if (d->mParent) { + d->mParent->updated(); + } + } +} + +Duration Alarm::snoozeTime() const +{ + return d->mAlarmSnoozeTime; +} + +void Alarm::setRepeatCount(int alarmRepeatCount) +{ + if (d->mParent) { + d->mParent->update(); + } + d->mAlarmRepeatCount = alarmRepeatCount; + if (d->mParent) { + d->mParent->updated(); + } +} + +int Alarm::repeatCount() const +{ + return d->mAlarmRepeatCount; +} + +Duration Alarm::duration() const +{ + return Duration(d->mAlarmSnoozeTime.value() * d->mAlarmRepeatCount, d->mAlarmSnoozeTime.type()); +} + +QDateTime Alarm::nextRepetition(const QDateTime &preTime) const +{ + QDateTime at = nextTime(preTime); + if (at > preTime) { + return at; + } + if (!d->mAlarmRepeatCount) { + // there isn't an occurrence after the specified time + return QDateTime(); + } + qint64 repetition; + int interval = d->mAlarmSnoozeTime.value(); + bool daily = d->mAlarmSnoozeTime.isDaily(); + if (daily) { + qint64 daysTo = at.daysTo(preTime); + if (preTime.time() <= at.time()) { + --daysTo; + } + repetition = daysTo / interval + 1; + } else { + repetition = at.secsTo(preTime) / interval + 1; + } + if (repetition > d->mAlarmRepeatCount) { + // all repetitions have finished before the specified time + return QDateTime(); + } + return daily ? at.addDays(int(repetition * interval)) : at.addSecs(repetition * interval); +} + +QDateTime Alarm::previousRepetition(const QDateTime &afterTime) const +{ + QDateTime at = time(); + if (at >= afterTime) { + // alarm's first/only time is at/after the specified time + return QDateTime(); + } + if (!d->mAlarmRepeatCount) { + return at; + } + qint64 repetition; + int interval = d->mAlarmSnoozeTime.value(); + bool daily = d->mAlarmSnoozeTime.isDaily(); + if (daily) { + qint64 daysTo = at.daysTo(afterTime); + if (afterTime.time() <= at.time()) { + --daysTo; + } + repetition = daysTo / interval; + } else { + repetition = (at.secsTo(afterTime) - 1) / interval; + } + if (repetition > d->mAlarmRepeatCount) { + repetition = d->mAlarmRepeatCount; + } + return daily ? at.addDays(int(repetition * interval)) : at.addSecs(repetition * interval); +} + +QDateTime Alarm::endTime() const +{ + if (!d->mAlarmRepeatCount) { + return time(); + } + if (d->mAlarmSnoozeTime.isDaily()) { + return time().addDays(d->mAlarmRepeatCount * d->mAlarmSnoozeTime.asDays()); + } else { + return time().addSecs(d->mAlarmRepeatCount * d->mAlarmSnoozeTime.asSeconds()); + } +} + +void Alarm::toggleAlarm() +{ + if (d->mParent) { + d->mParent->update(); + } + d->mAlarmEnabled = !d->mAlarmEnabled; + if (d->mParent) { + d->mParent->updated(); + } +} + +void Alarm::setEnabled(bool enable) +{ + if (d->mParent) { + d->mParent->update(); + } + d->mAlarmEnabled = enable; + if (d->mParent) { + d->mParent->updated(); + } +} + +bool Alarm::enabled() const +{ + return d->mAlarmEnabled; +} + +void Alarm::setStartOffset(const Duration &offset) +{ + if (d->mParent) { + d->mParent->update(); + } + d->mOffset = offset; + d->mEndOffset = false; + d->mHasTime = false; + if (d->mParent) { + d->mParent->updated(); + } +} + +Duration Alarm::startOffset() const +{ + return (d->mHasTime || d->mEndOffset) ? Duration(0) : d->mOffset; +} + +bool Alarm::hasStartOffset() const +{ + return !d->mHasTime && !d->mEndOffset; +} + +bool Alarm::hasEndOffset() const +{ + return !d->mHasTime && d->mEndOffset; +} + +void Alarm::setEndOffset(const Duration &offset) +{ + if (d->mParent) { + d->mParent->update(); + } + d->mOffset = offset; + d->mEndOffset = true; + d->mHasTime = false; + if (d->mParent) { + d->mParent->updated(); + } +} + +Duration Alarm::endOffset() const +{ + return (d->mHasTime || !d->mEndOffset) ? Duration(0) : d->mOffset; +} + +void Alarm::setParent(Incidence *parent) +{ + d->mParent = parent; +} + +QString Alarm::parentUid() const +{ + return d->mParent ? d->mParent->uid() : QString(); +} + +void Alarm::customPropertyUpdated() +{ + if (d->mParent) { + d->mParent->update(); + d->mParent->updated(); + } +} + +void Alarm::setHasLocationRadius(bool hasLocationRadius) +{ + if (d->mParent) { + d->mParent->update(); + } + d->mHasLocationRadius = hasLocationRadius; + if (hasLocationRadius) { + setNonKDECustomProperty("X-LOCATION-RADIUS", QString::number(d->mLocationRadius)); + } else { + removeNonKDECustomProperty("X-LOCATION-RADIUS"); + } + if (d->mParent) { + d->mParent->updated(); + } +} + +bool Alarm::hasLocationRadius() const +{ + return d->mHasLocationRadius; +} + +void Alarm::setLocationRadius(int locationRadius) +{ + if (d->mParent) { + d->mParent->update(); + } + d->mLocationRadius = locationRadius; + if (d->mParent) { + d->mParent->updated(); + } +} + +int Alarm::locationRadius() const +{ + return d->mLocationRadius; +} + +QDataStream &KCalendarCore::operator<<(QDataStream &out, const KCalendarCore::Alarm::Ptr &a) +{ + if (a) { + out << ((quint32)a->d->mType) << a->d->mAlarmSnoozeTime << a->d->mAlarmRepeatCount << a->d->mEndOffset << a->d->mHasTime << a->d->mAlarmEnabled + << a->d->mHasLocationRadius << a->d->mLocationRadius << a->d->mOffset; + + serializeQDateTimeAsKDateTime(out, a->d->mAlarmTime); + + out << a->d->mFile << a->d->mMailSubject << a->d->mDescription << a->d->mMailAttachFiles << a->d->mMailAddresses; + } + return out; +} + +QDataStream &KCalendarCore::operator>>(QDataStream &in, const KCalendarCore::Alarm::Ptr &a) +{ + if (a) { + quint32 type; + in >> type; + a->d->mType = static_cast(type); + in >> a->d->mAlarmSnoozeTime >> a->d->mAlarmRepeatCount >> a->d->mEndOffset >> a->d->mHasTime >> a->d->mAlarmEnabled >> a->d->mHasLocationRadius + >> a->d->mLocationRadius >> a->d->mOffset; + deserializeKDateTimeAsQDateTime(in, a->d->mAlarmTime); + in >> a->d->mFile >> a->d->mMailSubject >> a->d->mDescription >> a->d->mMailAttachFiles >> a->d->mMailAddresses; + } + return in; +} + +void Alarm::virtual_hook(int id, void *data) +{ + Q_UNUSED(id); + Q_UNUSED(data); + Q_ASSERT(false); +} diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/alarm.h dde-calendar-5.10.0/3rdparty/kcalendarcore/src/alarm.h --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/alarm.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/alarm.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,685 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 2001-2003 Cornelius Schumacher + SPDX-FileCopyrightText: 2003 David Jarvie + SPDX-FileCopyrightText: 2010 Klarälvdalens Datakonsult AB, a KDAB Group company + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +/** + @file + This file is part of the API for handling calendar data and + defines the Alarm class. + + @author Cornelius Schumacher \ +*/ + +#ifndef KCALCORE_ALARM_H +#define KCALCORE_ALARM_H + +#include "customproperties.h" +#include "duration.h" +#include "person.h" + +#include +#include +#include +#include +#include +#include +#include + +class QTimeZone; + +namespace KCalendarCore { +class Incidence; + +/** + @brief + Represents an alarm notification. + + Alarms are user notifications that occur at specified times. + Notifications can be on-screen pop-up dialogs, email messages, + the playing of audio files, or the running of another program. + + Alarms always belong to a parent Incidence. +*/ +class Q_CORE_EXPORT Alarm : public CustomProperties +{ +public: + /** + The different types of alarms. + */ + enum Type { + Invalid, /**< Invalid, or no alarm */ + Display, /**< Display a dialog box */ + Procedure, /**< Call a script */ + Email, /**< Send email */ + Audio, /**< Play an audio file */ + }; + + /** + A shared pointer to an Alarm object. + */ + typedef QSharedPointer Ptr; + + /** + List of alarms. + */ + typedef QVector List; + + /** + Constructs an alarm belonging to the @p parent Incidence. + + @param parent is the Incidence this alarm will belong to. + */ + // Can't find a way to use a shared pointer here. + // 在这里找不到使用共享指针的方法。 + // Inside incidence.cpp, it does alarm->setParent( this ) + explicit Alarm(Incidence *parent); + + /** + Copy constructor. + @param other is the alarm to copy. + */ + Alarm(const Alarm &other); + + /** + Destroys the alarm. + */ + ~Alarm() override; + + /** + Copy operator. + */ + Alarm &operator=(const Alarm &); + + /** + Compares two alarms for equality. + @param a is the comparison alarm. + */ + bool operator==(const Alarm &a) const; + + /** + Compares two alarms for inequality. + + @param a is the comparison alarm. + */ + bool operator!=(const Alarm &a) const; + + /** + Sets the @p parent Incidence of the alarm. + + @param parent is alarm parent Incidence to set. + + @see parentUid() + */ + // Is there a way to use QSharedPointer here? + // although it's safe, Incidence's dtor calls setParent( 0 ) + // se we don't dereference a deleted pointer here. + // Also, I renamed "Incidence *parent()" to "QString parentUid()" + // So we don't return raw pointers + void setParent(Incidence *parent); + + /** + Returns the parent's incidence UID of the alarm. + + @see setParent() + */ + // We don't have a share pointer to return, so return the UID. + Q_REQUIRED_RESULT QString parentUid() const; + + /** + Sets the #Type for this alarm to @p type. + If the specified type is different from the current type of the alarm, + then the alarm's type-specific properties are re-initialized. + + @param type is the alarm #Type to set. + + @see type() + */ + void setType(Type type); + + /** + Returns the #Type of the alarm. + + @see setType() + */ + Q_REQUIRED_RESULT Type type() const; + + /** + Sets the #Display type for this alarm. + If @p text is specified non-empty, then it is used as the description + text to display when the alarm is triggered. + + @param text is the description to display when the alarm is triggered. + + @see setText(), text() + */ + void setDisplayAlarm(const QString &text = QString()); + + /** + Sets the description @p text to be displayed when the alarm is triggered. + Ignored if the alarm is not a display alarm. + + @param text is the description to display when the alarm is triggered. + + @see setDisplayAlarm(), text() + */ + void setText(const QString &text); + + /** + Returns the display text string for a #Display alarm type. + Returns an empty string if the alarm is not a #Display type. + + @see setDisplayAlarm(), setText() + */ + Q_REQUIRED_RESULT QString text() const; + + /** + Sets the #Audio type for this alarm and the name of the audio file + to play when the alarm is triggered. + + @param audioFile is the name of the audio file to play when the alarm + is triggered. + + @see setAudioFile(), audioFile() + */ + void setAudioAlarm(const QString &audioFile = QString()); + + /** + Sets the name of the audio file to play when the audio alarm is triggered. + Ignored if the alarm is not an #Audio type. + + @param audioFile is the name of the audio file to play when the alarm + is triggered. + + @see setAudioAlarm(), audioFile() + */ + void setAudioFile(const QString &audioFile); + + /** + Returns the audio file name for an #Audio alarm type. + Returns an empty string if the alarm is not an #Audio type. + + @see setAudioAlarm(), setAudioFile() + */ + Q_REQUIRED_RESULT QString audioFile() const; + + /** + Sets the #Procedure type for this alarm and the program (with arguments) + to execute when the alarm is triggered. + + @param programFile is the name of the program file to execute when + the alarm is triggered. + @param arguments is a string of arguments to supply to @p programFile. + + @see setProgramFile(), programFile(), + setProgramArguments(), programArguments() + */ + void setProcedureAlarm(const QString &programFile, const QString &arguments = QString()); + + /** + Sets the program file to execute when the alarm is triggered. + Ignored if the alarm is not a #Procedure type. + + @param programFile is the name of the program file to execute when + the alarm is triggered. + + @see setProcedureAlarm(), programFile(), + setProgramArguments(), programArguments() + */ + void setProgramFile(const QString &programFile); + + /** + Returns the program file name for a #Procedure alarm type. + Returns an empty string if the alarm is not a #Procedure type. + + @see setProcedureAlarm(), setProgramFile(), + setProgramArguments(), programArguments() + */ + Q_REQUIRED_RESULT QString programFile() const; + + /** + Sets the program arguments string when the alarm is triggered. + Ignored if the alarm is not a #Procedure type. + + @param arguments is a string of arguments to supply to the program. + + @see setProcedureAlarm(), setProgramFile(), programFile(), + programArguments() + */ + void setProgramArguments(const QString &arguments); + + /** + Returns the program arguments string for a #Procedure alarm type. + Returns an empty string if the alarm is not a #Procedure type. + + @see setProcedureAlarm(), setProgramFile(), programFile(), + setProgramArguments() + */ + Q_REQUIRED_RESULT QString programArguments() const; + + /** + Sets the #Email type for this alarm and the email @p subject, @p text, + @p addresses, and @p attachments that make up an email message to be + sent when the alarm is triggered. + + @param subject is the email subject. + @param text is a string containing the body of the email message. + @param addressees is Person list of email addresses. + @param attachments is a a QStringList of optional file names + of email attachments. + + @see setMailSubject(), setMailText(), setMailAddresses(), + setMailAttachments() + */ + void setEmailAlarm(const QString &subject, const QString &text, const Person::List &addressees, const QStringList &attachments = QStringList()); + + /** + Sets the email address of an #Email type alarm. + Ignored if the alarm is not an #Email type. + + @param mailAlarmAddress is a Person to receive a mail message when + an #Email type alarm is triggered. + + @see setMailSubject(), setMailText(), setMailAddresses(), + setMailAttachment(), setMailAttachments(), mailAddresses() + */ + void setMailAddress(const Person &mailAlarmAddress); + + /** + Sets a list of email addresses of an #Email type alarm. + Ignored if the alarm is not an #Email type. + + @param mailAlarmAddresses is a Person list to receive a mail message + when an #Email type alarm is triggered. + + @see setMailSubject(), setMailText(), setMailAddress(), + setMailAttachments(), setMailAttachment(), mailAddresses() + */ + void setMailAddresses(const Person::List &mailAlarmAddresses); + + /** + Adds an address to the list of email addresses to send mail to when the + alarm is triggered. + Ignored if the alarm is not an #Email type. + + @param mailAlarmAddress is a Person to add to the list of addresses to + receive a mail message when an #Email type alarm is triggered. + + @see setMailAddress(), setMailAddresses(), mailAddresses() + */ + void addMailAddress(const Person &mailAlarmAddress); + + /** + Returns the list of addresses for an #Email alarm type. + Returns an empty list if the alarm is not an #Email type. + + @see addMailAddress(), setMailAddress(), setMailAddresses() + */ + Q_REQUIRED_RESULT Person::List mailAddresses() const; + + /** + Sets the subject line of a mail message for an #Email alarm type. + Ignored if the alarm is not an #Email type. + + @param mailAlarmSubject is a string to be used as a subject line + of an email message to send when the #Email type alarm is triggered. + + @see setMailText(), setMailAddress(), setMailAddresses(), + setMailAttachment(), setMailAttachments(), mailSubject() + */ + void setMailSubject(const QString &mailAlarmSubject); + + /** + Returns the subject line string for an #Email alarm type. + Returns an empty string if the alarm is not an #Email type. + + @see setMailSubject() + */ + Q_REQUIRED_RESULT QString mailSubject() const; + + /** + Sets the filename to attach to a mail message for an #Email alarm type. + Ignored if the alarm is not an #Email type. + + @param mailAttachFile is a string containing a filename to be attached + to an email message to send when the #Email type alarm is triggered. + + @see setMailSubject(), setMailText(), setMailAddress(), + setMailAddresses(), setMailAttachments(), mailAttachments() + */ + void setMailAttachment(const QString &mailAttachFile); + + /** + Sets a list of filenames to attach to a mail message for an #Email + alarm type. Ignored if the alarm is not an #Email type. + + @param mailAttachFiles is a QString list of filenames to attach to + a mail message when an #Email type alarm is triggered. + + @see setMailSubject(), setMailText(), setMailAttachment(), + setMailAddress(), setMailAddresses() + */ + void setMailAttachments(const QStringList &mailAttachFiles); + + /** + Adds a filename to the list of files to attach to a mail message for + an #Email alarm type. Ignored if the alarm is not an #Email type. + + @param mailAttachFile is a string containing a filename to be attached + to an email message to send when the #Email type alarm is triggered. + + @see setMailAttachment(), setMailAttachments(), mailAttachments() + */ + void addMailAttachment(const QString &mailAttachFile); + + /** + Returns the list of attachment filenames for an #Email alarm type. + Returns an empty list if the alarm is not an #Email type. + + @see addMailAttachment(), setMailAttachment(), setMailAttachments() + */ + Q_REQUIRED_RESULT QStringList mailAttachments() const; + + /** + Sets the body text for an #Email alarm type. + Ignored if the alarm is not an #Email type. + + @param text is a string containing the body text of a mail message + when an #Email type alarm is triggered. + + @see setMailSubject(), setMailAddress(), setMailAddresses(), + setMailAttachment(), setMailAttachments() + */ + void setMailText(const QString &text); + + /** + Returns the body text for an #Email alarm type. + Returns an empty string if the alarm is not an #Email type. + + @see setMailText() + */ + Q_REQUIRED_RESULT QString mailText() const; + + /** + Sets the trigger time of the alarm. + + @param alarmTime is the QDateTime alarm trigger. + + @see time() + */ + void setTime(const QDateTime &alarmTime); + + /** + Returns the alarm trigger date/time. + + @see setTime() + */ + Q_REQUIRED_RESULT QDateTime time() const; + + /** + Returns the next alarm trigger date/time after given date/time. + Takes recurrent incidences into account. + 返回给定日期/时间后的下一个报警触发日期/时间。 + 将反复发生的事件考虑在内。 + @param preTime date/time from where to start + @param ignoreRepetitions don't take repetitions into account + @see nextRepetition() + */ + Q_REQUIRED_RESULT QDateTime nextTime(const QDateTime &preTime, bool ignoreRepetitions = false) const; + + /** + Returns the date/time when the last repetition of the alarm goes off. + If the alarm does not repeat this is equivalent to calling time(). + 返回上次重复报警的日期/时间。 + 如果警报没有重复,这相当于调用时间()。 + + @see setTime() + */ + Q_REQUIRED_RESULT QDateTime endTime() const; + + /** + Returns true if the alarm has a trigger date/time. + */ + Q_REQUIRED_RESULT bool hasTime() const; + + /** + Sets the alarm offset relative to the start of the parent Incidence. + + @param offset is a Duration to be used as a time relative to the + start of the parent Incidence to be used as the alarm trigger. + + @see setEndOffset(), startOffset(), endOffset() + */ + void setStartOffset(const Duration &offset); + + /** + Returns offset of alarm in time relative to the start of the parent + Incidence. If the alarm's time is not defined in terms of an offset + relative to the start of the event, returns zero. + + @see setStartOffset(), hasStartOffset() + */ + Q_REQUIRED_RESULT Duration startOffset() const; + + /** + Returns whether the alarm is defined in terms of an offset relative + to the start of the parent Incidence. + + @see startOffset(), setStartOffset() + */ + bool hasStartOffset() const; + + /** + Sets the alarm offset relative to the end of the parent Incidence. + + @param offset is a Duration to be used as a time relative to the + end of the parent Incidence to be used as the alarm trigger. + + @see setStartOffset(), startOffset(), endOffset() + */ + void setEndOffset(const Duration &offset); + + /** + Returns offset of alarm in time relative to the end of the event. + If the alarm's time is not defined in terms of an offset relative + to the end of the event, returns zero. + + @see setEndOffset(), hasEndOffset() + */ + Q_REQUIRED_RESULT Duration endOffset() const; + + /** + Returns whether the alarm is defined in terms of an offset relative + to the end of the event. + + @see endOffset(), setEndOffset() + */ + bool hasEndOffset() const; + + /** + Shift the times of the alarm so that they appear at the same clock + time as before but in a new time zone. The shift is done from a viewing + time zone rather than from the actual alarm time zone. + + For example, shifting an alarm whose start time is 09:00 America/New York, + using an old viewing time zone (@p oldZone) of Europe/London, to a new + time zone (@p newZone) of Europe/Paris, will result in the time being + shifted from 14:00 (which is the London time of the alarm start) to + 14:00 Paris time. + + @param oldZone the time zone which provides the clock times + @param newZone the new time zone + */ + void shiftTimes(const QTimeZone &oldZone, const QTimeZone &newZone); + + /** + Sets the snooze time interval for the alarm. + + @param alarmSnoozeTime the time between snoozes. + + @see snoozeTime() + */ + void setSnoozeTime(const Duration &alarmSnoozeTime); + + /** + Returns the snooze time interval. + + @see setSnoozeTime() + */ + Q_REQUIRED_RESULT Duration snoozeTime() const; + + /** + Sets how many times an alarm is to repeat itself after its initial + occurrence (w/snoozes). + + @param alarmRepeatCount is the number of times an alarm may repeat, + excluding the initial occurrence. + + @see repeatCount() + */ + void setRepeatCount(int alarmRepeatCount); + + /** + Returns how many times an alarm may repeats after its initial occurrence. + 返回警报在初始发生后可能重复的次数。 + + @see setRepeatCount() + */ + Q_REQUIRED_RESULT int repeatCount() const; + + /** + Returns the date/time of the alarm's initial occurrence or its next + repetition after a given time. + + @param preTime the date/time after which to find the next repetition. + + @return the date/time of the next repetition, or an invalid date/time + if the specified time is at or after the alarm's last repetition. + + @see previousRepetition() + */ + Q_REQUIRED_RESULT QDateTime nextRepetition(const QDateTime &preTime) const; + + /** + Returns the date/time of the alarm's latest repetition or, if none, + its initial occurrence before a given time. + + @param afterTime is the date/time before which to find the latest + repetition. + + @return the date and time of the latest repetition, or an invalid + date/time if the specified time is at or before the alarm's initial + occurrence. + + @see nextRepetition() + */ + Q_REQUIRED_RESULT QDateTime previousRepetition(const QDateTime &afterTime) const; + + /** + Returns the interval between the alarm's initial occurrence and + its final repetition. + */ + Q_REQUIRED_RESULT Duration duration() const; + + /** + Toggles the alarm status, i.e, an enable alarm becomes disabled + and a disabled alarm becomes enabled. + + @see enabled(), setEnabled() + */ + void toggleAlarm(); + + /** + Sets the enabled status of the alarm. + @param enable if true, then enable the alarm; else disable the alarm. + + @see enabled(), toggleAlarm() + */ + void setEnabled(bool enable); + + /** + Returns the alarm enabled status: true (enabled) or false (disabled). + + @see setEnabled(), toggleAlarm() + */ + Q_REQUIRED_RESULT bool enabled() const; + + /** + Set if the location radius for the alarm has been defined. + @param hasLocationRadius if true, then this alarm has a location radius. + + @see setLocationRadius() + */ + void setHasLocationRadius(bool hasLocationRadius); + + /** + Returns true if alarm has location radius defined. + + @see setLocationRadius() + */ + Q_REQUIRED_RESULT bool hasLocationRadius() const; + + /** + Set location radius for the alarm. This means that alarm will be + triggered when user approaches the location. Given value will be + stored into custom properties as X-LOCATION-RADIUS. + + @param locationRadius radius in meters + @see locationRadius() + */ + void setLocationRadius(int locationRadius); + + /** + Returns the location radius in meters. + + @see setLocationRadius() + */ + Q_REQUIRED_RESULT int locationRadius() const; + +protected: + /** + @copydoc + CustomProperties::customPropertyUpdated() + */ + void customPropertyUpdated() override; + + /** + @copydoc + IncidenceBase::virtual_hook() + */ + virtual void virtual_hook(int id, void *data); + +private: + //@cond PRIVATE + class Private; + Private *const d; + //@endcond + friend Q_CORE_EXPORT QDataStream &operator<<(QDataStream &s, const KCalendarCore::Alarm::Ptr &); + friend Q_CORE_EXPORT QDataStream &operator>>(QDataStream &s, const KCalendarCore::Alarm::Ptr &); +}; +/** + * Alarm serializer. + * + * @since 4.12 + */ +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &out, const KCalendarCore::Alarm::Ptr &); + +/** + * Alarm deserializer. + * + * @since 4.12 + */ +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &in, const KCalendarCore::Alarm::Ptr &); + +} // namespace KCalendarCore + +//@cond PRIVATE +Q_DECLARE_TYPEINFO(KCalendarCore::Alarm::Ptr, Q_MOVABLE_TYPE); +Q_DECLARE_METATYPE(KCalendarCore::Alarm::Ptr) +//@endcond + +#endif diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/attachment.cpp dde-calendar-5.10.0/3rdparty/kcalendarcore/src/attachment.cpp --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/attachment.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/attachment.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,220 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 2002 Michael Brade + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +/** + @file + This file is part of the API for handling calendar data and + defines the Attachment class. + + @brief + Represents information related to an attachment for a Calendar Incidence. + + @author Michael Brade \ +*/ + +#include "attachment.h" +#include + +using namespace KCalendarCore; + +/** + Private class that helps to provide binary compatibility between releases. + @internal +*/ +//@cond PRIVATE +class Q_DECL_HIDDEN KCalendarCore::Attachment::Private : public QSharedData +{ +public: + Private() = default; + Private(const QString &mime, bool binary) + : mMimeType(mime) + , mBinary(binary) + { + } + Private(const Private &other) = default; + + ~Private() + { + } + + mutable uint mSize = 0; + mutable QByteArray mDecodedDataCache; + QString mMimeType; + QString mUri; + QByteArray mEncodedData; + QString mLabel; + bool mBinary = false; + bool mLocal = false; + bool mShowInline = false; +}; +//@endcond + +Attachment::Attachment() + : d(new Attachment::Private) +{ +} + +Attachment::Attachment(const Attachment &attachment) = default; + +Attachment::Attachment(const QString &uri, const QString &mime) + : d(new Attachment::Private(mime, false)) +{ + d->mUri = uri; +} + +Attachment::Attachment(const QByteArray &base64, const QString &mime) + : d(new Attachment::Private(mime, true)) +{ + d->mEncodedData = base64; +} + +Attachment::~Attachment() = default; + +bool Attachment::isEmpty() const +{ + return d->mMimeType.isEmpty() && d->mUri.isEmpty() && d->mEncodedData.isEmpty(); +} + +bool Attachment::isUri() const +{ + return !d->mBinary; +} + +QString Attachment::uri() const +{ + if (!d->mBinary) { + return d->mUri; + } else { + return QString(); + } +} + +void Attachment::setUri(const QString &uri) +{ + d->mUri = uri; + d->mBinary = false; +} + +bool Attachment::isBinary() const +{ + return d->mBinary; +} + +QByteArray Attachment::data() const +{ + if (d->mBinary) { + return d->mEncodedData; + } else { + return QByteArray(); + } +} + +QByteArray Attachment::decodedData() const +{ + if (d->mDecodedDataCache.isNull()) { + d->mDecodedDataCache = QByteArray::fromBase64(d->mEncodedData); + } + + return d->mDecodedDataCache; +} + +void Attachment::setDecodedData(const QByteArray &data) +{ + setData(data.toBase64()); + d->mDecodedDataCache = data; + d->mSize = d->mDecodedDataCache.size(); +} + +void Attachment::setData(const QByteArray &base64) +{ + d->mEncodedData = base64; + d->mBinary = true; + d->mDecodedDataCache = QByteArray(); + d->mSize = 0; +} + +uint Attachment::size() const +{ + if (isUri()) { + return 0; + } + if (!d->mSize) { + d->mSize = decodedData().size(); + } + + return d->mSize; +} + +QString Attachment::mimeType() const +{ + return d->mMimeType; +} + +void Attachment::setMimeType(const QString &mime) +{ + d->mMimeType = mime; +} + +bool Attachment::showInline() const +{ + return d->mShowInline; +} + +void Attachment::setShowInline(bool showinline) +{ + d->mShowInline = showinline; +} + +QString Attachment::label() const +{ + return d->mLabel; +} + +void Attachment::setLabel(const QString &label) +{ + d->mLabel = label; +} + +bool Attachment::isLocal() const +{ + return d->mLocal; +} + +void Attachment::setLocal(bool local) +{ + d->mLocal = local; +} + +Attachment &Attachment::operator=(const Attachment &other) = default; + +bool Attachment::operator==(const Attachment &a2) const +{ + return uri() == a2.uri() // + && d->mLabel == a2.label() // + && d->mLocal == a2.isLocal() // + && d->mBinary == a2.isBinary() // + && d->mShowInline == a2.showInline() // + && size() == a2.size() // + && decodedData() == a2.decodedData(); +} + +bool Attachment::operator!=(const Attachment &a2) const +{ + return !(*this == a2); +} + +QDataStream &KCalendarCore::operator<<(QDataStream &out, const KCalendarCore::Attachment &a) +{ + out << a.d->mSize << a.d->mMimeType << a.d->mUri << a.d->mEncodedData << a.d->mLabel << a.d->mBinary << a.d->mLocal << a.d->mShowInline; + return out; +} + +QDataStream &KCalendarCore::operator>>(QDataStream &in, KCalendarCore::Attachment &a) +{ + in >> a.d->mSize >> a.d->mMimeType >> a.d->mUri >> a.d->mEncodedData >> a.d->mLabel >> a.d->mBinary >> a.d->mLocal >> a.d->mShowInline; + return in; +} diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/attachment.h dde-calendar-5.10.0/3rdparty/kcalendarcore/src/attachment.h --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/attachment.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/attachment.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,289 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 2002 Michael Brade + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +/** + @file + This file is part of the API for handling calendar data and + defines the Attachment class. + + @author Michael Brade \ +*/ + +#ifndef KCALCORE_ATTACHMENT_H +#define KCALCORE_ATTACHMENT_H + +#include +#include +#include +#include + +namespace KCalendarCore { +/** + @brief + Represents information related to an attachment for a Calendar Incidence. + 表示与日历事件的附件相关的信息。 + + This is not an email message attachment. + + Calendar Incidence attachments consist of: + - A + Uniform Resource Identifier (URI) + or a + base64 encoded + binary blob. + - A + Multipurpose Internet Mail Extensions (MIME) type. + + This class is used to associate files (local or remote) or other resources + with a Calendar Incidence. +*/ +class Q_CORE_EXPORT Attachment +{ + Q_GADGET + Q_PROPERTY(bool isEmpty READ isEmpty) + Q_PROPERTY(QString uri READ uri WRITE setUri) + Q_PROPERTY(bool isUri READ isUri) + Q_PROPERTY(bool isBinary READ isBinary) + Q_PROPERTY(int size READ size) + Q_PROPERTY(QString mimeType READ mimeType WRITE setMimeType) + Q_PROPERTY(bool showInline READ showInline WRITE setShowInline) + Q_PROPERTY(QString label READ label WRITE setLabel) + Q_PROPERTY(bool isLocal READ isLocal WRITE setLocal) + +public: + /** + List of attachments. + */ + typedef QVector List; + + /** + Constructs an empty attachment. + */ + explicit Attachment(); + + /** + Constructs an attachment consisting of a @p uri and a @p mime type. + + @param uri is the @acronym URI referred to by this attachment. + @param mime is the (optional) @acronym MIME type of the @p uri + */ + explicit Attachment(const QString &uri, const QString &mime = QString()); + + /** + Constructs an attachment consisting of a binary blob of data + and a @p mime type. + + @param base64 is the binary data in base64 format for the attachment. + @param mime is the (optional) @acronym MIME type of the attachment + */ + explicit Attachment(const QByteArray &base64, const QString &mime = QString()); + + /** + Constructs an attachment by copying another attachment. + + @param attachment is the attachment to be copied. + */ + Attachment(const Attachment &attachment); + + /** + Destroys the attachment. + */ + ~Attachment(); + + /** + Returns whether this is an empty or default constructed object. + */ + bool isEmpty() const; + + /** + Sets the @acronym URI for this attachment to @p uri. + + @param uri is the @acronym URI to use for the attachment. + + @see uri(), isUri() + */ + void setUri(const QString &uri); + + /** + Returns the @acronym URI of the attachment. + + @see setUri(), isUri() + */ + Q_REQUIRED_RESULT QString uri() const; + + /** + Returns true if the attachment has a @acronym URI; false otherwise. + + @see uri(), setUri(I), isBinary() + */ + Q_REQUIRED_RESULT bool isUri() const; + + /** + Returns true if the attachment has a binary blob; false otherwise. + + @see isUri() + */ + Q_REQUIRED_RESULT bool isBinary() const; + + /** + Sets the base64 encoded binary blob data of the attachment. + + @param base64 contains the base64 encoded binary data. + + @see data(), decodedData() + */ + void setData(const QByteArray &base64); + + /** + Returns a pointer to a QByteArray containing the base64 encoded + binary data of the attachment. + + @see setData(), setDecodedData() + */ + Q_REQUIRED_RESULT QByteArray data() const; + + /** + Sets the decoded attachment data. + + @param data is the decoded base64 binary data. + + @see decodedData(), data() + */ + void setDecodedData(const QByteArray &data); + + /** + Returns a QByteArray containing the decoded base64 binary data of the + attachment. + + @see setDecodedData(), setData() + */ + Q_REQUIRED_RESULT QByteArray decodedData() const; + + /** + Returns the size of the attachment, in bytes. + If the attachment is binary (i.e, there is no @acronym URI associated + with the attachment) then a value of 0 is returned. + */ + uint size() const; + + /** + Sets the @acronym MIME-type of the attachment to @p mime. + + @param mime is the string to use for the attachment @acronym MIME-type. + + @see mimeType() + */ + void setMimeType(const QString &mime); + + /** + Returns the @acronym MIME-type of the attachment. + + @see setMimeType() + */ + Q_REQUIRED_RESULT QString mimeType() const; + + /** + Sets the attachment "show in-line" option, which is derived from + the Calendar Incidence @b X-CONTENT-DISPOSITION parameter. + + @param showinline is the flag to set (true) or unset (false) + for the attachment "show in-line" option. + + @see showInline() + */ + void setShowInline(bool showinline); + + /** + Returns the attachment "show in-line" flag. + + @see setShowInline() + */ + Q_REQUIRED_RESULT bool showInline() const; + + /** + Sets the attachment label to @p label, which is derived from + the Calendar Incidence @b X-LABEL parameter. + + @param label is the string to use for the attachment label. + + @see label() + */ + void setLabel(const QString &label); + + /** + Returns the attachment label string. + */ + Q_REQUIRED_RESULT QString label() const; + + /** + Sets the attachment "local" option, which is derived from the + Calendar Incidence @b X-KONTACT-TYPE parameter. + + @param local is the flag to set (true) or unset (false) for the + attachment "local" option. + + @see local() + */ + void setLocal(bool local); + + /** + Returns the attachment "local" flag. + */ + Q_REQUIRED_RESULT bool isLocal() const; + + /** + Assignment operator. + @param attachment is the attachment to assign. + */ + Attachment &operator=(const Attachment &attachment); + + /** + Compare this with @p attachment for equality. + @param attachment is the attachment to compare. + @return true if the attachments are equal; false otherwise. + */ + bool operator==(const Attachment &attachment) const; + + /** + Compare this with @p attachment for inequality. + @param attachment is the attachment to compare. + @return true if the attachments are /not/ equal; false otherwise. + */ + bool operator!=(const Attachment &attachment) const; + +private: + //@cond PRIVATE + class Private; + QSharedDataPointer d; + //@endcond + + friend Q_CORE_EXPORT QDataStream &operator<<(QDataStream &s, const KCalendarCore::Attachment &); + friend Q_CORE_EXPORT QDataStream &operator>>(QDataStream &s, KCalendarCore::Attachment &); +}; + +/** + * Attachment serializer. + * + * @since 4.12 + */ +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &out, const KCalendarCore::Attachment &); + +/** + * Attachment deserializer. + * + * @since 4.12 + */ +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &in, KCalendarCore::Attachment &); + +} // namespace KCalendarCore + +//@cond PRIVATE +Q_DECLARE_TYPEINFO(KCalendarCore::Attachment, Q_MOVABLE_TYPE); +Q_DECLARE_METATYPE(KCalendarCore::Attachment) +//@endcond + +#endif diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/attendee.cpp dde-calendar-5.10.0/3rdparty/kcalendarcore/src/attendee.cpp --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/attendee.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/attendee.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,336 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 2001 Cornelius Schumacher + SPDX-FileCopyrightText: 2010 Casey Link + SPDX-FileCopyrightText: 2009-2010 Klaralvdalens Datakonsult AB, a KDAB Group company + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +/** + @file + This file is part of the API for handling calendar data and + defines the Attendee class. + + @brief + Represents information related to an attendee of an Calendar Incidence. + + @author Cornelius Schumacher \ +*/ + +#include "attendee.h" +#include "person.h" +#include "person_p.h" + +#include + +using namespace KCalendarCore; + +/** + Private class that helps to provide binary compatibility between releases. + @internal +*/ +//@cond PRIVATE +class Q_DECL_HIDDEN KCalendarCore::Attendee::Private : public QSharedData +{ +public: + void setCuType(CuType cuType); + void setCuType(const QString &cuType); + CuType cuType() const; + QString cuTypeStr() const; + + bool mRSVP = false; + Role mRole; + PartStat mStatus; + mutable QString mUid; + QString mDelegate; + QString mDelegator; + CustomProperties mCustomProperties; + QString mName; + QString mEmail; + +private: + QString sCuType; + CuType mCuType; +}; +//@endcond + +void KCalendarCore::Attendee::Private::setCuType(Attendee::CuType cuType) +{ + mCuType = cuType; + sCuType.clear(); +} + +void KCalendarCore::Attendee::Private::setCuType(const QString &cuType) +{ + const QString upper = cuType.toUpper(); + if (upper == QLatin1String("INDIVIDUAL")) { + setCuType(Attendee::Individual); + } else if (upper == QLatin1String("GROUP")) { + setCuType(Attendee::Group); + } else if (upper == QLatin1String("RESOURCE")) { + setCuType(Attendee::Resource); + } else if (upper == QLatin1String("ROOM")) { + setCuType(Attendee::Room); + } else { + setCuType(Attendee::Unknown); + if (upper.startsWith(QLatin1String("X-")) || upper.startsWith(QLatin1String("IANA-"))) { + sCuType = upper; + } + } +} + +Attendee::CuType KCalendarCore::Attendee::Private::cuType() const +{ + return mCuType; +} + +QString KCalendarCore::Attendee::Private::cuTypeStr() const +{ + switch (mCuType) { + case Attendee::Individual: + return QStringLiteral("INDIVIDUAL"); + case Attendee::Group: + return QStringLiteral("GROUP"); + case Attendee::Resource: + return QStringLiteral("RESOURCE"); + case Attendee::Room: + return QStringLiteral("ROOM"); + case Attendee::Unknown: + if (sCuType.isEmpty()) { + return QStringLiteral("UNKNOWN"); + } else { + return sCuType; + } + } + return QStringLiteral("UNKNOWN"); +} + +Attendee::Attendee() + : d(new Attendee::Private) +{ +} + +Attendee::Attendee(const QString &name, const QString &email, bool rsvp, Attendee::PartStat status, Attendee::Role role, const QString &uid) + : d(new Attendee::Private) +{ + setName(name); + setEmail(email); + d->mRSVP = rsvp; + d->mStatus = status; + d->mRole = role; + d->mUid = uid; + d->setCuType(Attendee::Individual); +} + +Attendee::Attendee(const Attendee &attendee) + : d(attendee.d) +{ +} + +Attendee::~Attendee() = default; + +bool Attendee::isNull() const +{ + // isNull rather than isEmpty, as user code is actually creating empty but non-null attendees... + return d->mName.isNull() && d->mEmail.isNull(); +} + +bool KCalendarCore::Attendee::operator==(const Attendee &attendee) const +{ + return d->mUid == attendee.d->mUid && d->mRSVP == attendee.d->mRSVP && d->mRole == attendee.d->mRole && d->mStatus == attendee.d->mStatus + && d->mDelegate == attendee.d->mDelegate && d->mDelegator == attendee.d->mDelegator && d->cuTypeStr() == attendee.d->cuTypeStr() + && d->mName == attendee.d->mName && d->mEmail == attendee.d->mEmail; +} + +bool KCalendarCore::Attendee::operator!=(const Attendee &attendee) const +{ + return !operator==(attendee); +} + +Attendee &KCalendarCore::Attendee::operator=(const Attendee &attendee) +{ + // check for self assignment + if (&attendee == this) { + return *this; + } + + d = attendee.d; + return *this; +} + +QString Attendee::name() const +{ + return d->mName; +} + +void Attendee::setName(const QString &name) +{ + if (name.startsWith(QLatin1String("mailto:"), Qt::CaseInsensitive)) { + d->mName = name.mid(7); + } else { + d->mName = name; + } +} + +QString Attendee::fullName() const +{ + return fullNameHelper(d->mName, d->mEmail); +} + +QString Attendee::email() const +{ + return d->mEmail; +} + +void Attendee::setEmail(const QString &email) +{ + if (email.startsWith(QLatin1String("mailto:"), Qt::CaseInsensitive)) { + d->mEmail = email.mid(7); + } else { + d->mEmail = email; + } +} + +void Attendee::setRSVP(bool r) +{ + d->mRSVP = r; +} + +bool Attendee::RSVP() const +{ + return d->mRSVP; +} + +void Attendee::setStatus(Attendee::PartStat status) +{ + d->mStatus = status; +} + +Attendee::PartStat Attendee::status() const +{ + return d->mStatus; +} + +void Attendee::setCuType(Attendee::CuType cuType) +{ + d->setCuType(cuType); +} + +void Attendee::setCuType(const QString &cuType) +{ + d->setCuType(cuType); +} + +Attendee::CuType Attendee::cuType() const +{ + return d->cuType(); +} + +QString Attendee::cuTypeStr() const +{ + return d->cuTypeStr(); +} + +void Attendee::setRole(Attendee::Role role) +{ + d->mRole = role; +} + +Attendee::Role Attendee::role() const +{ + return d->mRole; +} + +void Attendee::setUid(const QString &uid) +{ + d->mUid = uid; +} + +QString Attendee::uid() const +{ + /* If Uid is empty, just use the pointer to Attendee (encoded to + * string) as Uid. Only thing that matters is that the Uid is unique + * insofar IncidenceBase is concerned, and this does that (albeit + * not very nicely). If these are ever saved to disk, should use + * (considerably more expensive) CalFormat::createUniqueId(). As Uid + * is not part of Attendee in iCal std, it's fairly safe bet that + * these will never hit disc though so faster generation speed is + * more important than actually being forever unique.*/ + if (d->mUid.isEmpty()) { + d->mUid = QString::number((qlonglong)d.constData()); + } + + return d->mUid; +} + +void Attendee::setDelegate(const QString &delegate) +{ + d->mDelegate = delegate; +} + +QString Attendee::delegate() const +{ + return d->mDelegate; +} + +void Attendee::setDelegator(const QString &delegator) +{ + d->mDelegator = delegator; +} + +QString Attendee::delegator() const +{ + return d->mDelegator; +} + +void Attendee::setCustomProperty(const QByteArray &xname, const QString &xvalue) +{ + d->mCustomProperties.setNonKDECustomProperty(xname, xvalue); +} + +CustomProperties &Attendee::customProperties() +{ + return d->mCustomProperties; +} + +const CustomProperties &Attendee::customProperties() const +{ + return d->mCustomProperties; +} + +QDataStream &KCalendarCore::operator<<(QDataStream &stream, const KCalendarCore::Attendee &attendee) +{ + KCalendarCore::Person p(attendee.name(), attendee.email()); + stream << p; + return stream << attendee.d->mRSVP << int(attendee.d->mRole) << int(attendee.d->mStatus) << attendee.d->mUid << attendee.d->mDelegate + << attendee.d->mDelegator << attendee.d->cuTypeStr() << attendee.d->mCustomProperties; +} + +QDataStream &KCalendarCore::operator>>(QDataStream &stream, KCalendarCore::Attendee &attendee) +{ + bool RSVP; + Attendee::Role role; + Attendee::PartStat status; + QString uid; + QString delegate; + QString delegator; + QString cuType; + CustomProperties customProperties; + uint role_int; + uint status_int; + + KCalendarCore::Person person; + stream >> person; + stream >> RSVP >> role_int >> status_int >> uid >> delegate >> delegator >> cuType >> customProperties; + + role = Attendee::Role(role_int); + status = Attendee::PartStat(status_int); + + attendee = Attendee(person.name(), person.email(), RSVP, status, role, uid); + attendee.setDelegate(delegate); + attendee.setDelegator(delegator); + attendee.setCuType(cuType); + attendee.d->mCustomProperties = customProperties; + return stream; +} diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/attendee.h dde-calendar-5.10.0/3rdparty/kcalendarcore/src/attendee.h --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/attendee.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/attendee.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,369 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 2001-2003 Cornelius Schumacher + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +/** + @file + This file is part of the API for handling calendar data and + defines the Attendee class. + + @author Cornelius Schumacher \ +*/ + +#ifndef KCALCORE_ATTENDEE_H +#define KCALCORE_ATTENDEE_H + +#include +#include + +#include "customproperties.h" + +namespace KCalendarCore { +/** + @brief + Represents information related to an attendee of an Calendar Incidence, + typically a meeting or task (to-do). + + Attendees are people with a name and (optional) email address who are + invited to participate in some way in a meeting or task. This class + also tracks that status of the invitation: accepted; tentatively accepted; + declined; delegated to another person; in-progress; completed. + + Attendees may optionally be asked to @acronym RSVP ("Respond Please") to + the invitation. + + Note that each attendee be can optionally associated with a @acronym UID + (unique identifier) derived from a Calendar Incidence, Email Message, + or any other thing you want. +*/ +class Q_CORE_EXPORT Attendee +{ + Q_GADGET + Q_PROPERTY(bool isNull READ isNull) + Q_PROPERTY(QString name READ name WRITE setName) + Q_PROPERTY(QString fullName READ fullName) + Q_PROPERTY(QString email READ email WRITE setEmail) + Q_PROPERTY(Role role READ role WRITE setRole) + Q_PROPERTY(QString uid READ uid WRITE setUid) + Q_PROPERTY(PartStat status READ status WRITE setStatus) + Q_PROPERTY(CuType cuType READ cuType WRITE setCuType) + Q_PROPERTY(bool rsvp READ RSVP WRITE setRSVP) + Q_PROPERTY(QString delegate READ delegate WRITE setDelegate) + Q_PROPERTY(QString delegator READ delegator WRITE setDelegator) + +public: + /** + The different types of participant status. + The meaning is specific to the incidence type in context. + */ + enum PartStat { + NeedsAction, /**< Event, to-do or journal needs action (default) */ + Accepted, /**< Event, to-do or journal accepted */ + Declined, /**< Event, to-do or journal declined */ + Tentative, /**< Event or to-do tentatively accepted */ + Delegated, /**< Event or to-do delegated */ + Completed, /**< To-do completed */ + InProcess, /**< To-do in process of being completed */ + None, + }; + Q_ENUM(PartStat) + + /** + The different types of participation roles. + */ + enum Role { + ReqParticipant, /**< Participation is required (default) */ + OptParticipant, /**< Participation is optional */ + NonParticipant, /**< Non-Participant; copied for information purposes */ + Chair, /**< Chairperson */ + }; + Q_ENUM(Role) + + /** + * The different types of a participant. + * + * @since 4.14 + */ + enum CuType { + Individual, /**< An individual (default) */ + Group, /**< A group of individuals */ + Resource, /**< A physical resource */ + Room, /**< A room resource */ + Unknown, /**< Otherwise not known */ + /** + * Parameters that have to set via the QString variant of @setCuType() and @cuType() + * x-name ; Experimental cuType + * iana-token ; Other IANA-registered + */ + }; + Q_ENUM(CuType) + + /** + List of attendees. + */ + typedef QVector List; + + /** Create a null Attendee. */ + Attendee(); + + /** + Constructs an attendee consisting of a person name (@p name) and + email address (@p email); invitation status and #Role; + an optional @acronym RSVP flag and @acronym UID. + + @param name is person name of the attendee. + @param email is person email address of the attendee. + @param rsvp if true, the attendee is requested to reply to invitations. + @param status is the #PartStat status of the attendee. + @param role is the #Role of the attendee. + @param uid is the @acronym UID of the attendee. + */ + Attendee(const QString &name, const QString &email, bool rsvp = false, PartStat status = None, Role role = ReqParticipant, const QString &uid = QString()); + + /** + Constructs an attendee by copying another attendee. + + @param attendee is the attendee to be copied. + */ + Attendee(const Attendee &attendee); + + /** + Destroys the attendee. + */ + ~Attendee(); + + /** + * Returns @c true if this is a default-constructed Attendee instance. + */ + bool isNull() const; + + /** + Returns the name of the attendee. + */ + Q_REQUIRED_RESULT QString name() const; + /** + Sets the name of the attendee to @p name. + */ + void setName(const QString &name); + + /** + Returns the full name and email address of this attendee + @return A QString containing the person's full name in the form + "FirstName LastName \". + */ + Q_REQUIRED_RESULT QString fullName() const; + + /** + Returns the email address for this attendee. + */ + Q_REQUIRED_RESULT QString email() const; + /** + Sets the email address for this attendee to @p email. + */ + void setEmail(const QString &email); + + /** + Sets the Role of the attendee to @p role. + + @param role is the Role to use for the attendee. + + @see role() + */ + void setRole(Role role); + + /** + Returns the Role of the attendee. + + @see setRole() + */ + Q_REQUIRED_RESULT Role role() const; + + /** + Sets the @acronym UID of the attendee to @p uid. + + @param uid is the @acronym UID to use for the attendee. + + @see uid() + */ + void setUid(const QString &uid); + + /** + Returns the @acronym UID of the attendee. + + @see setUid() + */ + Q_REQUIRED_RESULT QString uid() const; + + /** + Sets the #PartStat of the attendee to @p status. + + @param status is the #PartStat to use for the attendee. + + @see status() + */ + void setStatus(PartStat status); + + /** + Returns the #PartStat of the attendee. + + @see setStatus() + */ + Q_REQUIRED_RESULT PartStat status() const; + + /** + Sets the #CuType of the attendee to @p cuType. + + @param cuType is the #CuType to use for the attendee. + + @see cuType() + + @since 4.14 + */ + void setCuType(CuType cuType); + + /** + Sets the #CuType of the attendee to @p cuType. + + @param cuType is the #CuType to use for the attendee. + + @see cuType() + + @since 4.14 + */ + void setCuType(const QString &cuType); + + /** + Returns the #CuType of the attendee. + + @see setCuType() + + @since 4.14 + */ + Q_REQUIRED_RESULT CuType cuType() const; + + /** + Returns the #CuType of the attendee. + + @see setCuType() + + @since 4.14 + */ + Q_REQUIRED_RESULT QString cuTypeStr() const; + + /** + Sets the @acronym RSVP flag of the attendee to @p rsvp. + + @param rsvp if set (true), the attendee is requested to reply to + invitations. + + @see RSVP() + */ + void setRSVP(bool rsvp); + + /** + Returns the attendee @acronym RSVP flag. + + @see setRSVP() + */ + Q_REQUIRED_RESULT bool RSVP() const; + + /** + Compares this with @p attendee for equality. + + @param attendee the attendee to compare. + */ + bool operator==(const Attendee &attendee) const; + + /** + Compares this with @p attendee for inequality. + + @param attendee the attendee to compare. + */ + bool operator!=(const Attendee &attendee) const; + + /** + Sets the delegate. + @param delegate is a string containing a MAILTO URI of those delegated + to attend the meeting. + @see delegate(), setDelegator(). + */ + void setDelegate(const QString &delegate); + + /** + Returns the delegate. + @see setDelegate(). + */ + Q_REQUIRED_RESULT QString delegate() const; + + /** + Sets the delegator. + @param delegator is a string containing a MAILTO URI of those who + have delegated their meeting attendance. + @see delegator(), setDelegate(). + */ + void setDelegator(const QString &delegator); + + /** + Returns the delegator. + @see setDelegator(). + */ + Q_REQUIRED_RESULT QString delegator() const; + + /** + Adds a custom property. If the property already exists it will be overwritten. + @param xname is the name of the property. + @param xvalue is its value. + */ + void setCustomProperty(const QByteArray &xname, const QString &xvalue); + + /** + Returns a reference to the CustomProperties object + */ + Q_REQUIRED_RESULT CustomProperties &customProperties(); + + /** + Returns a const reference to the CustomProperties object + */ + const CustomProperties &customProperties() const; + + /** + Sets this attendee equal to @p attendee. + + @param attendee is the attendee to copy. + */ + Attendee &operator=(const Attendee &attendee); + +private: + //@cond PRIVATE + class Private; + QSharedDataPointer d; + //@endcond + + friend Q_CORE_EXPORT QDataStream &operator<<(QDataStream &s, const KCalendarCore::Attendee &attendee); + friend Q_CORE_EXPORT QDataStream &operator>>(QDataStream &s, KCalendarCore::Attendee &attendee); +}; + +/** + Serializes an Attendee object into a data stream. + @param stream is a QDataStream. + @param attendee is a pointer to a Attendee object to be serialized. +*/ +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &stream, const KCalendarCore::Attendee &attendee); + +/** + Initializes an Attendee object from a data stream. + @param stream is a QDataStream. + @param attendee is a pointer to a Attendee object to be initialized. +*/ +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &stream, KCalendarCore::Attendee &attendee); +} // namespace KCalendarCore + +//@cond PRIVATE +Q_DECLARE_TYPEINFO(KCalendarCore::Attendee, Q_MOVABLE_TYPE); +Q_DECLARE_METATYPE(KCalendarCore::Attendee) +//@endcond + +#endif diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/calendar.cpp dde-calendar-5.10.0/3rdparty/kcalendarcore/src/calendar.cpp --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/calendar.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/calendar.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,1406 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 1998 Preston Brown + SPDX-FileCopyrightText: 2000-2004 Cornelius Schumacher + SPDX-FileCopyrightText: 2003-2004 Reinhold Kainhofer + SPDX-FileCopyrightText: 2006 David Jarvie + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +/** + @file + This file is part of the API for handling calendar data and + defines the Calendar class. + + @brief + Represents the main calendar class. + + @author Preston Brown \ + @author Cornelius Schumacher \ + @author Reinhold Kainhofer \ + @author David Jarvie \ +*/ +#include "calendar.h" +#include "calendar_p.h" +#include "calfilter.h" +#include "icaltimezones_p.h" +#include "sorting.h" +#include "visitor.h" + +//extern "C" { +//#include +//} + +#include + +#include // for std::remove() + +using namespace KCalendarCore; + +/** + Make a QHash::value that returns a QVector. +*/ +template +QVector values(const QMultiHash &c) +{ + QVector v; + v.reserve(c.size()); + for (typename QMultiHash::const_iterator it = c.begin(), end = c.end(); it != end; ++it) { + v.push_back(it.value()); + } + return v; +} + +template +QVector values(const QMultiHash &c, const K &x) +{ + QVector v; + typename QMultiHash::const_iterator it = c.find(x); + while (it != c.end() && it.key() == x) { + v.push_back(it.value()); + ++it; + } + return v; +} + +/** + Template for a class that implements a visitor for adding an Incidence + to a resource supporting addEvent(), addTodo() and addJournal() calls. +*/ +template +class AddVisitor : public Visitor +{ +public: + AddVisitor(T *r) + : mResource(r) + { + } + + bool visit(const Event::Ptr &e) override + { + return mResource->addEvent(e); + } + bool visit(const Todo::Ptr &t) override + { + return mResource->addTodo(t); + } + bool visit(const Journal::Ptr &j) override + { + return mResource->addJournal(j); + } + bool visit(const FreeBusy::Ptr &) override + { + return false; + } + +private: + T *mResource; +}; + +/** + Template for a class that implements a visitor for deleting an Incidence + from a resource supporting deleteEvent(), deleteTodo() and deleteJournal() + calls. +*/ +template +class DeleteVisitor : public Visitor +{ +public: + DeleteVisitor(T *r) + : mResource(r) + { + } + + bool visit(const Event::Ptr &e) override + { + mResource->deleteEvent(e); + return true; + } + bool visit(const Todo::Ptr &t) override + { + mResource->deleteTodo(t); + return true; + } + bool visit(const Journal::Ptr &j) override + { + mResource->deleteJournal(j); + return true; + } + bool visit(const FreeBusy::Ptr &) override + { + return false; + } + +private: + T *mResource; +}; +//@endcond + +Calendar::Calendar(const QTimeZone &timeZone) + : d(new KCalendarCore::Calendar::Private) +{ + if (timeZone.isValid()) { + d->mTimeZone = timeZone; + } else { + d->mTimeZone = QTimeZone::systemTimeZone(); + } +} + +Calendar::Calendar(const QByteArray &timeZoneId) + : d(new KCalendarCore::Calendar::Private) +{ + setTimeZoneId(timeZoneId); +} + +Calendar::~Calendar() +{ + delete d; +} + +Person Calendar::owner() const +{ + return d->mOwner; +} + +void Calendar::setOwner(const Person &owner) +{ + if (owner != d->mOwner) { + d->mOwner = owner; + setModified(true); + Q_EMIT ownerChanged(); + } +} + +void Calendar::setTimeZone(const QTimeZone &timeZone) +{ + if (timeZone.isValid()) { + d->mTimeZone = timeZone; + } else { + d->mTimeZone = QTimeZone::systemTimeZone(); + } + + doSetTimeZone(d->mTimeZone); +} + +QTimeZone Calendar::timeZone() const +{ + return d->mTimeZone; +} + +void Calendar::setTimeZoneId(const QByteArray &timeZoneId) +{ + d->mTimeZone = d->timeZoneIdSpec(timeZoneId); + + doSetTimeZone(d->mTimeZone); // NOLINT false clang-analyzer-optin.cplusplus.VirtualCall +} + +//@cond PRIVATE +QTimeZone Calendar::Private::timeZoneIdSpec(const QByteArray &timeZoneId) +{ + if (timeZoneId == QByteArrayLiteral("UTC")) { + return QTimeZone::utc(); + } + auto tz = QTimeZone(timeZoneId); + if (tz.isValid()) { + return tz; + } + return QTimeZone::systemTimeZone(); +} +//@endcond + +QByteArray Calendar::timeZoneId() const +{ + return d->mTimeZone.id(); +} + +void Calendar::shiftTimes(const QTimeZone &oldZone, const QTimeZone &newZone) +{ + setTimeZone(newZone); + + int i, end; + Event::List ev = events(); + for (i = 0, end = ev.count(); i < end; ++i) { + ev[i]->shiftTimes(oldZone, newZone); + } + + Todo::List to = todos(); + for (i = 0, end = to.count(); i < end; ++i) { + to[i]->shiftTimes(oldZone, newZone); + } + + Journal::List jo = journals(); + for (i = 0, end = jo.count(); i < end; ++i) { + jo[i]->shiftTimes(oldZone, newZone); + } +} + +void Calendar::setFilter(CalFilter *filter) +{ + if (filter) { + d->mFilter = filter; + } else { + d->mFilter = d->mDefaultFilter; + } + Q_EMIT filterChanged(); +} + +CalFilter *Calendar::filter() const +{ + return d->mFilter; +} + +QStringList Calendar::categories() const +{ + Incidence::List rawInc(rawIncidences()); + QStringList cats, thisCats; + // @TODO: For now just iterate over all incidences. In the future, + // the list of categories should be built when reading the file. + for (Incidence::List::ConstIterator i = rawInc.constBegin(); i != rawInc.constEnd(); ++i) { + thisCats = (*i)->categories(); + for (QStringList::ConstIterator si = thisCats.constBegin(); si != thisCats.constEnd(); ++si) { + if (!cats.contains(*si)) { + cats.append(*si); + } + } + } + return cats; +} + +Incidence::List Calendar::incidences(const QDate &date) const +{ + return mergeIncidenceList(events(date), todos(date), journals(date)); +} + +Incidence::List Calendar::incidences() const +{ + return mergeIncidenceList(events(), todos(), journals()); +} + +Incidence::List Calendar::rawIncidences() const +{ + return mergeIncidenceList(rawEvents(), rawTodos(), rawJournals()); +} + +Incidence::List Calendar::instances(const Incidence::Ptr &incidence) const +{ + if (incidence) { + Event::List elist; + Todo::List tlist; + Journal::List jlist; + + if (incidence->type() == Incidence::TypeEvent) { + elist = eventInstances(incidence); + } else if (incidence->type() == Incidence::TypeTodo) { + tlist = todoInstances(incidence); + } else if (incidence->type() == Incidence::TypeJournal) { + jlist = journalInstances(incidence); + } + return mergeIncidenceList(elist, tlist, jlist); + } else { + return Incidence::List(); + } +} + +Incidence::List Calendar::duplicates(const Incidence::Ptr &incidence) +{ + if (incidence) { + Incidence::List list; + Incidence::List vals = values(d->mNotebookIncidences); + Incidence::List::const_iterator it; + for (it = vals.constBegin(); it != vals.constEnd(); ++it) { + if (((incidence->dtStart() == (*it)->dtStart()) || (!incidence->dtStart().isValid() && !(*it)->dtStart().isValid())) + && (incidence->summary() == (*it)->summary())) { + list.append(*it); + } + } + return list; + } else { + return Incidence::List(); + } +} + +bool Calendar::addNotebook(const QString ¬ebook, bool isVisible) +{ + if (d->mNotebooks.contains(notebook)) { + return false; + } else { + d->mNotebooks.insert(notebook, isVisible); + return true; + } +} + +bool Calendar::updateNotebook(const QString ¬ebook, bool isVisible) +{ + if (!d->mNotebooks.contains(notebook)) { + return false; + } else { + d->mNotebooks.insert(notebook, isVisible); + const QList incidences = d->mNotebookIncidences.values(notebook); + for (Incidence::Ptr incidence : incidences) { + QHash::Iterator it = d->mIncidenceVisibility.find(incidence); + if (it != d->mIncidenceVisibility.end()) + *it = isVisible; + } + return true; + } +} + +bool Calendar::deleteNotebook(const QString ¬ebook) +{ + if (!d->mNotebooks.contains(notebook)) { + return false; + } else { + return d->mNotebooks.remove(notebook); + } +} + +bool Calendar::setDefaultNotebook(const QString ¬ebook) +{ + if (!d->mNotebooks.contains(notebook)) { + return false; + } else { + d->mDefaultNotebook = notebook; + return true; + } +} + +QString Calendar::defaultNotebook() const +{ + return d->mDefaultNotebook; +} + +bool Calendar::hasValidNotebook(const QString ¬ebook) const +{ + return d->mNotebooks.contains(notebook); +} + +bool Calendar::isVisible(const Incidence::Ptr &incidence) const +{ + if (d->mIncidenceVisibility.contains(incidence)) { + return d->mIncidenceVisibility[incidence]; + } + const QString nuid = notebook(incidence); + bool rv; + if (d->mNotebooks.contains(nuid)) { + rv = d->mNotebooks.value(nuid); + } else { + // NOTE returns true also for nonexisting notebooks for compatibility + rv = true; + } + d->mIncidenceVisibility[incidence] = rv; + return rv; +} + +bool Calendar::isVisible(const QString ¬ebook) const +{ + QHash::ConstIterator it = d->mNotebooks.constFind(notebook); + return (it != d->mNotebooks.constEnd()) ? *it : true; +} + +void Calendar::clearNotebookAssociations() +{ + d->mNotebookIncidences.clear(); + d->mUidToNotebook.clear(); + d->mIncidenceVisibility.clear(); +} + +bool Calendar::setNotebook(const Incidence::Ptr &inc, const QString ¬ebook) +{ + if (!inc) { + return false; + } + + if (!notebook.isEmpty() && !incidence(inc->uid(), inc->recurrenceId())) { + qWarning() << "cannot set notebook until incidence has been added"; + return false; + } + + if (d->mUidToNotebook.contains(inc->uid())) { + QString old = d->mUidToNotebook.value(inc->uid()); + if (!old.isEmpty() && notebook != old) { + if (inc->hasRecurrenceId()) { + qWarning() << "cannot set notebook for child incidences"; + return false; + } + // Move all possible children also. + Incidence::List list = instances(inc); + Incidence::List::Iterator it; + for (it = list.begin(); it != list.end(); ++it) { + d->mNotebookIncidences.remove(old, *it); + d->mNotebookIncidences.insert(notebook, *it); + } + notifyIncidenceChanged(inc); // for removing from old notebook + // don not remove from mUidToNotebook to keep deleted incidences + d->mNotebookIncidences.remove(old, inc); + } + } + if (!notebook.isEmpty()) { + d->mUidToNotebook.insert(inc->uid(), notebook); + d->mNotebookIncidences.insert(notebook, inc); + qWarning() << "setting notebook" << notebook << "for" << inc->uid(); + notifyIncidenceChanged(inc); // for inserting into new notebook + } + + return true; +} + +QString Calendar::notebook(const Incidence::Ptr &incidence) const +{ + if (incidence) { + return d->mUidToNotebook.value(incidence->uid()); + } else { + return QString(); + } +} + +QString Calendar::notebook(const QString &uid) const +{ + return d->mUidToNotebook.value(uid); +} + +QStringList Calendar::notebooks() const +{ + return d->mNotebookIncidences.uniqueKeys(); +} + +Incidence::List Calendar::incidences(const QString ¬ebook) const +{ + if (notebook.isEmpty()) { + return values(d->mNotebookIncidences); + } else { + return values(d->mNotebookIncidences, notebook); + } +} + +/** static */ +Event::List Calendar::sortEvents(const Event::List &eventList, EventSortField sortField, SortDirection sortDirection) +{ + if (eventList.isEmpty()) { + return Event::List(); + } + + Event::List eventListSorted; + + // Notice we alphabetically presort Summaries first. + // We do this so comparison "ties" stay in a nice order. + eventListSorted = eventList; + switch (sortField) { + case EventSortUnsorted: + break; + + case EventSortStartDate: + if (sortDirection == SortDirectionAscending) { + std::sort(eventListSorted.begin(), eventListSorted.end(), Events::startDateLessThan); + } else { + std::sort(eventListSorted.begin(), eventListSorted.end(), Events::startDateMoreThan); + } + break; + + case EventSortEndDate: + if (sortDirection == SortDirectionAscending) { + std::sort(eventListSorted.begin(), eventListSorted.end(), Events::endDateLessThan); + } else { + std::sort(eventListSorted.begin(), eventListSorted.end(), Events::endDateMoreThan); + } + break; + + case EventSortSummary: + if (sortDirection == SortDirectionAscending) { + std::sort(eventListSorted.begin(), eventListSorted.end(), Events::summaryLessThan); + } else { + std::sort(eventListSorted.begin(), eventListSorted.end(), Events::summaryMoreThan); + } + break; + } + + return eventListSorted; +} + +Event::List Calendar::events(const QDate &date, const QTimeZone &timeZone, EventSortField sortField, SortDirection sortDirection) const +{ + Event::List el = rawEventsForDate(date, timeZone, sortField, sortDirection); + d->mFilter->apply(&el); + return el; +} + +Event::List Calendar::events(const QDateTime &dt) const +{ + Event::List el = rawEventsForDate(dt); + d->mFilter->apply(&el); + return el; +} + +Event::List Calendar::events(const QDate &start, const QDate &end, const QTimeZone &timeZone, bool inclusive) const +{ + Event::List el = rawEvents(start, end, timeZone, inclusive); + d->mFilter->apply(&el); + return el; +} + +Event::List Calendar::events(EventSortField sortField, SortDirection sortDirection) const +{ + Event::List el = rawEvents(sortField, sortDirection); + d->mFilter->apply(&el); + return el; +} + +bool Calendar::addIncidence(const Incidence::Ptr &incidence) +{ + if (!incidence) { + return false; + } + + AddVisitor v(this); + return incidence->accept(v, incidence); +} + +bool Calendar::deleteIncidence(const Incidence::Ptr &incidence) +{ + if (!incidence) { + return false; + } + + if (beginChange(incidence)) { + DeleteVisitor v(this); + const bool result = incidence->accept(v, incidence); + endChange(incidence); + return result; + } else { + return false; + } +} + +Incidence::Ptr Calendar::createException(const Incidence::Ptr &incidence, const QDateTime &recurrenceId, bool thisAndFuture) +{ + Q_ASSERT(recurrenceId.isValid()); + if (!incidence || !incidence->recurs() || !recurrenceId.isValid()) { + return Incidence::Ptr(); + } + + Incidence::Ptr newInc(incidence->clone()); + newInc->setCreated(QDateTime::currentDateTimeUtc()); + newInc->setRevision(0); + // Recurring exceptions are not support for now + newInc->clearRecurrence(); + + newInc->setRecurrenceId(recurrenceId); + newInc->setThisAndFuture(thisAndFuture); + newInc->setDtStart(recurrenceId); + + // Calculate and set the new end of the incidence + QDateTime end = incidence->dateTime(IncidenceBase::RoleEnd); + + if (end.isValid()) { + if (incidence->allDay()) { + qint64 offset = incidence->dtStart().daysTo(recurrenceId); + end = end.addDays(offset); + } else { + qint64 offset = incidence->dtStart().secsTo(recurrenceId); + end = end.addSecs(offset); + } + newInc->setDateTime(end, IncidenceBase::RoleEnd); + } + return newInc; +} + +Incidence::Ptr Calendar::incidence(const QString &uid, const QDateTime &recurrenceId) const +{ + Incidence::Ptr i = event(uid, recurrenceId); + if (i) { + return i; + } + + i = todo(uid, recurrenceId); + if (i) { + return i; + } + + i = journal(uid, recurrenceId); + return i; +} + +Incidence::Ptr Calendar::deleted(const QString &uid, const QDateTime &recurrenceId) const +{ + Incidence::Ptr i = deletedEvent(uid, recurrenceId); + if (i) { + return i; + } + + i = deletedTodo(uid, recurrenceId); + if (i) { + return i; + } + + i = deletedJournal(uid, recurrenceId); + return i; +} + +Incidence::List Calendar::incidencesFromSchedulingID(const QString &sid) const +{ + Incidence::List result; + const Incidence::List incidences = rawIncidences(); + Incidence::List::const_iterator it = incidences.begin(); + for (; it != incidences.end(); ++it) { + if ((*it)->schedulingID() == sid) { + result.append(*it); + } + } + return result; +} + +Incidence::Ptr Calendar::incidenceFromSchedulingID(const QString &uid) const +{ + const Incidence::List incidences = rawIncidences(); + Incidence::List::const_iterator it = incidences.begin(); + for (; it != incidences.end(); ++it) { + if ((*it)->schedulingID() == uid) { + // Touchdown, and the crowd goes wild + return *it; + } + } + // Not found + return Incidence::Ptr(); +} + +/** static */ +Todo::List Calendar::sortTodos(const Todo::List &todoList, TodoSortField sortField, SortDirection sortDirection) +{ + if (todoList.isEmpty()) { + return Todo::List(); + } + + Todo::List todoListSorted; + + // Notice we alphabetically presort Summaries first. + // We do this so comparison "ties" stay in a nice order. + + // Note that To-dos may not have Start DateTimes nor due DateTimes. + + todoListSorted = todoList; + switch (sortField) { + case TodoSortUnsorted: + break; + + case TodoSortStartDate: + if (sortDirection == SortDirectionAscending) { + std::sort(todoListSorted.begin(), todoListSorted.end(), Todos::startDateLessThan); + } else { + std::sort(todoListSorted.begin(), todoListSorted.end(), Todos::startDateMoreThan); + } + break; + + case TodoSortDueDate: + if (sortDirection == SortDirectionAscending) { + std::sort(todoListSorted.begin(), todoListSorted.end(), Todos::dueDateLessThan); + } else { + std::sort(todoListSorted.begin(), todoListSorted.end(), Todos::dueDateMoreThan); + } + break; + + case TodoSortPriority: + if (sortDirection == SortDirectionAscending) { + std::sort(todoListSorted.begin(), todoListSorted.end(), Todos::priorityLessThan); + } else { + std::sort(todoListSorted.begin(), todoListSorted.end(), Todos::priorityMoreThan); + } + break; + + case TodoSortPercentComplete: + if (sortDirection == SortDirectionAscending) { + std::sort(todoListSorted.begin(), todoListSorted.end(), Todos::percentLessThan); + } else { + std::sort(todoListSorted.begin(), todoListSorted.end(), Todos::percentMoreThan); + } + break; + + case TodoSortSummary: + if (sortDirection == SortDirectionAscending) { + std::sort(todoListSorted.begin(), todoListSorted.end(), Todos::summaryLessThan); + } else { + std::sort(todoListSorted.begin(), todoListSorted.end(), Todos::summaryMoreThan); + } + break; + + case TodoSortCreated: + if (sortDirection == SortDirectionAscending) { + std::sort(todoListSorted.begin(), todoListSorted.end(), Todos::createdLessThan); + } else { + std::sort(todoListSorted.begin(), todoListSorted.end(), Todos::createdMoreThan); + } + break; + + case TodoSortCategories: + if (sortDirection == SortDirectionAscending) { + std::sort(todoListSorted.begin(), todoListSorted.end(), Incidences::categoriesLessThan); + } else { + std::sort(todoListSorted.begin(), todoListSorted.end(), Incidences::categoriesMoreThan); + } + break; + } + + return todoListSorted; +} + +Todo::List Calendar::todos(TodoSortField sortField, SortDirection sortDirection) const +{ + Todo::List tl = rawTodos(sortField, sortDirection); + d->mFilter->apply(&tl); + return tl; +} + +Todo::List Calendar::todos(const QDate &date) const +{ + Todo::List el = rawTodosForDate(date); + d->mFilter->apply(&el); + return el; +} + +Todo::List Calendar::todos(const QDate &start, const QDate &end, const QTimeZone &timeZone, bool inclusive) const +{ + Todo::List tl = rawTodos(start, end, timeZone, inclusive); + d->mFilter->apply(&tl); + return tl; +} + +/** static */ +Journal::List Calendar::sortJournals(const Journal::List &journalList, JournalSortField sortField, SortDirection sortDirection) +{ + if (journalList.isEmpty()) { + return Journal::List(); + } + + Journal::List journalListSorted = journalList; + + switch (sortField) { + case JournalSortUnsorted: + break; + + case JournalSortDate: + if (sortDirection == SortDirectionAscending) { + std::sort(journalListSorted.begin(), journalListSorted.end(), Journals::dateLessThan); + } else { + std::sort(journalListSorted.begin(), journalListSorted.end(), Journals::dateMoreThan); + } + break; + + case JournalSortSummary: + if (sortDirection == SortDirectionAscending) { + std::sort(journalListSorted.begin(), journalListSorted.end(), Journals::summaryLessThan); + } else { + std::sort(journalListSorted.begin(), journalListSorted.end(), Journals::summaryMoreThan); + } + break; + } + + return journalListSorted; +} + +Journal::List Calendar::journals(JournalSortField sortField, SortDirection sortDirection) const +{ + Journal::List jl = rawJournals(sortField, sortDirection); + d->mFilter->apply(&jl); + return jl; +} + +Journal::List Calendar::journals(const QDate &date) const +{ + Journal::List el = rawJournalsForDate(date); + d->mFilter->apply(&el); + return el; +} + +// When this is called, the to-dos have already been added to the calendar. +// This method is only about linking related to-dos. +void Calendar::setupRelations(const Incidence::Ptr &forincidence) +{ + if (!forincidence) { + return; + } + + const QString uid = forincidence->uid(); + + // First, go over the list of orphans and see if this is their parent + Incidence::List l = values(d->mOrphans, uid); + d->mOrphans.remove(uid); + if (!l.isEmpty()) { + Incidence::List &relations = d->mIncidenceRelations[uid]; + relations.reserve(relations.count() + l.count()); + for (int i = 0, end = l.count(); i < end; ++i) { + relations.append(l[i]); + d->mOrphanUids.remove(l[i]->uid()); + } + } + + // Now see about this incidences parent + if (forincidence->relatedTo().isEmpty() && !forincidence->relatedTo().isEmpty()) { + // Incidence has a uid it is related to but is not registered to it yet. + // Try to find it + Incidence::Ptr parent = incidence(forincidence->relatedTo()); + if (parent) { + // Found it + + // look for hierarchy loops + if (isAncestorOf(forincidence, parent)) { + forincidence->setRelatedTo(QString()); + qWarning() << "hierarchy loop between " << forincidence->uid() << " and " << parent->uid(); + } else { + d->mIncidenceRelations[parent->uid()].append(forincidence); + } + } else { + // Not found, put this in the mOrphans list + // Note that the mOrphans dict might contain multiple entries with the + // same key! which are multiple children that wait for the parent + // incidence to be inserted. + d->mOrphans.insert(forincidence->relatedTo(), forincidence); + d->mOrphanUids.insert(forincidence->uid(), forincidence); + } + } +} + +// If a to-do with sub-to-dos is deleted, move it's sub-to-dos to the orphan list +void Calendar::removeRelations(const Incidence::Ptr &incidence) +{ + if (!incidence) { + qWarning() << "Warning: incidence is 0"; + return; + } + + const QString uid = incidence->uid(); + + for (const Incidence::Ptr &i : qAsConst(d->mIncidenceRelations[uid])) { + if (!d->mOrphanUids.contains(i->uid())) { + d->mOrphans.insert(uid, i); + d->mOrphanUids.insert(i->uid(), i); + i->setRelatedTo(uid); + } + } + + const QString parentUid = incidence->relatedTo(); + + // If this incidence is related to something else, tell that about it + if (!parentUid.isEmpty()) { + Incidence::List &relations = d->mIncidenceRelations[parentUid]; + relations.erase(std::remove(relations.begin(), relations.end(), incidence), relations.end()); + } + + // Remove this one from the orphans list + if (d->mOrphanUids.remove(uid)) { + // This incidence is located in the orphans list - it should be removed + // Since the mOrphans dict might contain the same key (with different + // child incidence pointers!) multiple times, take care that we remove + // the correct one. So we need to remove all items with the given + // parent UID, and re-add those that are not for this item. Also, there + // might be other entries with different UID that point to this + // incidence (this might happen when the relatedTo of the item is + // changed before its parent is inserted. This might happen with + // groupware servers....). Remove them, too + QStringList relatedToUids; + + // First, create a list of all keys in the mOrphans list which point + // to the removed item + relatedToUids << incidence->relatedTo(); + for (QMultiHash::Iterator it = d->mOrphans.begin(); it != d->mOrphans.end(); ++it) { + if (it.value()->uid() == uid) { + relatedToUids << it.key(); + } + } + + // now go through all uids that have one entry that point to the incidence + for (QStringList::const_iterator uidit = relatedToUids.constBegin(); uidit != relatedToUids.constEnd(); ++uidit) { + Incidence::List tempList; + // Remove all to get access to the remaining entries + const Incidence::List l = values(d->mOrphans, *uidit); + d->mOrphans.remove(*uidit); + for (const Incidence::Ptr &i : l) { + if (i != incidence) { + tempList.append(i); + } + } + // Re-add those that point to a different orphan incidence + for (Incidence::List::Iterator incit = tempList.begin(); incit != tempList.end(); ++incit) { + d->mOrphans.insert(*uidit, *incit); + } + } + } + + // Make sure the deleted incidence doesn't relate to a non-deleted incidence, + // since that would cause trouble in MemoryCalendar::close(), as the deleted + // incidences are destroyed after the non-deleted incidences. The destructor + // of the deleted incidences would then try to access the already destroyed + // non-deleted incidence, which would segfault. + // + // So in short: Make sure dead incidences don't point to alive incidences + // via the relation. + // + // This crash is tested in MemoryCalendarTest::testRelationsCrash(). + // incidence->setRelatedTo( Incidence::Ptr() ); +} + +bool Calendar::isAncestorOf(const Incidence::Ptr &ancestor, const Incidence::Ptr &incidence) const +{ + if (!incidence || incidence->relatedTo().isEmpty()) { + return false; + } else if (incidence->relatedTo() == ancestor->uid()) { + return true; + } else { + return isAncestorOf(ancestor, this->incidence(incidence->relatedTo())); + } +} + +Incidence::List Calendar::relations(const QString &uid) const +{ + return d->mIncidenceRelations[uid]; +} + +Calendar::CalendarObserver::~CalendarObserver() +{ +} + +void Calendar::CalendarObserver::calendarModified(bool modified, Calendar *calendar) +{ + Q_UNUSED(modified); + Q_UNUSED(calendar); +} + +void Calendar::CalendarObserver::calendarIncidenceAdded(const Incidence::Ptr &incidence) +{ + Q_UNUSED(incidence); +} + +void Calendar::CalendarObserver::calendarIncidenceChanged(const Incidence::Ptr &incidence) +{ + Q_UNUSED(incidence); +} + +void Calendar::CalendarObserver::calendarIncidenceAboutToBeDeleted(const Incidence::Ptr &incidence) +{ + Q_UNUSED(incidence); +} + +void Calendar::CalendarObserver::calendarIncidenceDeleted(const Incidence::Ptr &incidence, const Calendar *calendar) +{ + Q_UNUSED(incidence); + Q_UNUSED(calendar); +} + +void Calendar::CalendarObserver::calendarIncidenceAdditionCanceled(const Incidence::Ptr &incidence) +{ + Q_UNUSED(incidence); +} + +void Calendar::registerObserver(CalendarObserver *observer) +{ + if (!observer) { + return; + } + + if (!d->mObservers.contains(observer)) { + d->mObservers.append(observer); + } else { + d->mNewObserver = true; + } +} + +void Calendar::unregisterObserver(CalendarObserver *observer) +{ + if (!observer) { + return; + } else { + d->mObservers.removeAll(observer); + } +} + +bool Calendar::isSaving() const +{ + return false; +} + +void Calendar::setModified(bool modified) +{ + if (modified != d->mModified || d->mNewObserver) { + d->mNewObserver = false; + for (CalendarObserver *observer : qAsConst(d->mObservers)) { + observer->calendarModified(modified, this); + } + d->mModified = modified; + } +} + +bool Calendar::isModified() const +{ + return d->mModified; +} + +bool Calendar::save() +{ + return true; +} + +bool Calendar::reload() +{ + return true; +} + +void Calendar::incidenceUpdated(const QString &uid, const QDateTime &recurrenceId) +{ + Incidence::Ptr inc = incidence(uid, recurrenceId); + + if (!inc) { + return; + } + + inc->setLastModified(QDateTime::currentDateTimeUtc()); + // we should probably update the revision number here, + // or internally in the Event itself when certain things change. + // need to verify with ical documentation. + + notifyIncidenceChanged(inc); + + setModified(true); +} + +void Calendar::doSetTimeZone(const QTimeZone &timeZone) +{ + Q_UNUSED(timeZone); +} + +void Calendar::notifyIncidenceAdded(const Incidence::Ptr &incidence) +{ + if (!incidence) { + return; + } + + if (!d->mObserversEnabled) { + return; + } + + for (CalendarObserver *observer : qAsConst(d->mObservers)) { + observer->calendarIncidenceAdded(incidence); + } + + for (auto role : {IncidenceBase::RoleStartTimeZone, IncidenceBase::RoleEndTimeZone}) { + const auto dt = incidence->dateTime(role); + if (dt.isValid() && dt.timeZone() != QTimeZone::utc()) { + if (!d->mTimeZones.contains(dt.timeZone())) { + d->mTimeZones.push_back(dt.timeZone()); + } + } + } +} + +void Calendar::notifyIncidenceChanged(const Incidence::Ptr &incidence) +{ + if (!incidence) { + return; + } + + if (!d->mObserversEnabled) { + return; + } + + for (CalendarObserver *observer : qAsConst(d->mObservers)) { + observer->calendarIncidenceChanged(incidence); + } +} + +void Calendar::notifyIncidenceAboutToBeDeleted(const Incidence::Ptr &incidence) +{ + if (!incidence) { + return; + } + + if (!d->mObserversEnabled) { + return; + } + + for (CalendarObserver *observer : qAsConst(d->mObservers)) { + observer->calendarIncidenceAboutToBeDeleted(incidence); + } +} + +void Calendar::notifyIncidenceDeleted(const Incidence::Ptr &incidence) +{ + if (!incidence) { + return; + } + + if (!d->mObserversEnabled) { + return; + } + + for (CalendarObserver *observer : qAsConst(d->mObservers)) { + observer->calendarIncidenceDeleted(incidence, this); + } +} + +void Calendar::notifyIncidenceAdditionCanceled(const Incidence::Ptr &incidence) +{ + if (!incidence) { + return; + } + + if (!d->mObserversEnabled) { + return; + } + + for (CalendarObserver *observer : qAsConst(d->mObservers)) { + observer->calendarIncidenceAdditionCanceled(incidence); + } +} + +void Calendar::customPropertyUpdated() +{ + setModified(true); +} + +void Calendar::setProductId(const QString &id) +{ + d->mProductId = id; +} + +QString Calendar::productId() const +{ + return d->mProductId; +} + +/** static */ +Incidence::List Calendar::mergeIncidenceList(const Event::List &events, const Todo::List &todos, const Journal::List &journals) +{ + Incidence::List incidences; + incidences.reserve(events.count() + todos.count() + journals.count()); + + int i, end; + for (i = 0, end = events.count(); i < end; ++i) { + incidences.append(events[i]); + } + + for (i = 0, end = todos.count(); i < end; ++i) { + incidences.append(todos[i]); + } + + for (i = 0, end = journals.count(); i < end; ++i) { + incidences.append(journals[i]); + } + + return incidences; +} + +bool Calendar::beginChange(const Incidence::Ptr &incidence) +{ + Q_UNUSED(incidence); + return true; +} + +bool Calendar::endChange(const Incidence::Ptr &incidence) +{ + Q_UNUSED(incidence); + return true; +} + +void Calendar::setObserversEnabled(bool enabled) +{ + d->mObserversEnabled = enabled; +} + +void Calendar::appendAlarms(Alarm::List &alarms, const Incidence::Ptr &incidence, const QDateTime &from, const QDateTime &to) const +{ + QDateTime preTime = from.addSecs(-1); + + Alarm::List alarmlist = incidence->alarms(); + for (int i = 0, iend = alarmlist.count(); i < iend; ++i) { + if (alarmlist[i]->enabled()) { + QDateTime dt = alarmlist[i]->nextRepetition(preTime); + if (dt.isValid() && dt <= to) { + qWarning() << incidence->summary() << "':" << dt.toString(); + alarms.append(alarmlist[i]); + } + } + } +} + +void Calendar::appendRecurringAlarms(Alarm::List &alarms, const Incidence::Ptr &incidence, const QDateTime &from, const QDateTime &to) const +{ + QDateTime dt; + bool endOffsetValid = false; + Duration endOffset(0); + Duration period(from, to); + + Alarm::List alarmlist = incidence->alarms(); + for (int i = 0, iend = alarmlist.count(); i < iend; ++i) { + Alarm::Ptr a = alarmlist[i]; + if (a->enabled()) { + if (a->hasTime()) { + // The alarm time is defined as an absolute date/time + dt = a->nextRepetition(from.addSecs(-1)); + if (!dt.isValid() || dt > to) { + continue; + } + } else { + // Alarm time is defined by an offset from the event start or end time. + // Find the offset from the event start time, which is also used as the + // offset from the recurrence time. + Duration offset(0); + if (a->hasStartOffset()) { + offset = a->startOffset(); + } else if (a->hasEndOffset()) { + offset = a->endOffset(); + if (!endOffsetValid) { + endOffset = Duration(incidence->dtStart(), incidence->dateTime(Incidence::RoleAlarmEndOffset)); + endOffsetValid = true; + } + } + + // Find the incidence's earliest alarm + QDateTime alarmStart = offset.end(a->hasEndOffset() ? incidence->dateTime(Incidence::RoleAlarmEndOffset) : incidence->dtStart()); + if (alarmStart > to) { + continue; + } + QDateTime baseStart = incidence->dtStart(); + if (from > alarmStart) { + alarmStart = from; // don't look earlier than the earliest alarm + baseStart = (-offset).end((-endOffset).end(alarmStart)); + } + + // Adjust the 'alarmStart' date/time and find the next recurrence at or after it. + // Treat the two offsets separately in case one is daily and the other not. + dt = incidence->recurrence()->getNextDateTime(baseStart.addSecs(-1)); + if (!dt.isValid() || (dt = endOffset.end(offset.end(dt))) > to) { // adjust 'dt' to get the alarm time + // The next recurrence is too late. + if (!a->repeatCount()) { + continue; + } + + // The alarm has repetitions, so check whether repetitions of previous + // recurrences fall within the time period. + bool found = false; + Duration alarmDuration = a->duration(); + for (QDateTime base = baseStart; (dt = incidence->recurrence()->getPreviousDateTime(base)).isValid(); base = dt) { + if (a->duration().end(dt) < base) { + break; // this recurrence's last repetition is too early, so give up + } + + // The last repetition of this recurrence is at or after 'alarmStart' time. + // Check if a repetition occurs between 'alarmStart' and 'to'. + int snooze = a->snoozeTime().value(); // in seconds or days + if (a->snoozeTime().isDaily()) { + Duration toFromDuration(dt, base); + int toFrom = toFromDuration.asDays(); + if (a->snoozeTime().end(from) <= to || (toFromDuration.isDaily() && toFrom % snooze == 0) + || (toFrom / snooze + 1) * snooze <= toFrom + period.asDays()) { + found = true; +#ifndef NDEBUG + // for debug output + dt = offset.end(dt).addDays(((toFrom - 1) / snooze + 1) * snooze); +#endif + break; + } + } else { + int toFrom = dt.secsTo(base); + if (period.asSeconds() >= snooze || toFrom % snooze == 0 || (toFrom / snooze + 1) * snooze <= toFrom + period.asSeconds()) { + found = true; +#ifndef NDEBUG + // for debug output + dt = offset.end(dt).addSecs(((toFrom - 1) / snooze + 1) * snooze); +#endif + break; + } + } + } + if (!found) { + continue; + } + } + } + qWarning() << incidence->summary() << "':" << dt.toString(); + alarms.append(a); + } + } +} + +void Calendar::startBatchAdding() +{ + d->batchAddingInProgress = true; +} + +void Calendar::endBatchAdding() +{ + d->batchAddingInProgress = false; +} + +bool Calendar::batchAdding() const +{ + return d->batchAddingInProgress; +} + +void Calendar::setDeletionTracking(bool enable) +{ + d->mDeletionTracking = enable; +} + +bool Calendar::deletionTracking() const +{ + return d->mDeletionTracking; +} + +Alarm::List Calendar::alarmsTo(const QDateTime &to) const +{ + return alarms(QDateTime(QDate(1900, 1, 1), QTime(0, 0, 0)), to); +} + +void Calendar::virtual_hook(int id, void *data) +{ + Q_UNUSED(id); + Q_UNUSED(data); + Q_ASSERT(false); +} + +QString Calendar::id() const +{ + return d->mId; +} + +void Calendar::setId(const QString &id) +{ + if (d->mId != id) { + d->mId = id; + Q_EMIT idChanged(); + } +} + +QString Calendar::name() const +{ + return d->mName; +} + +void Calendar::setName(const QString &name) +{ + if (d->mName != name) { + d->mName = name; + Q_EMIT nameChanged(); + } +} + +QIcon Calendar::icon() const +{ + return d->mIcon; +} + +void Calendar::setIcon(const QIcon &icon) +{ + d->mIcon = icon; + Q_EMIT iconChanged(); +} + +AccessMode Calendar::accessMode() const +{ + return d->mAccessMode; +} + +void Calendar::setAccessMode(const AccessMode mode) +{ + if (d->mAccessMode != mode) { + d->mAccessMode = mode; + Q_EMIT accessModeChanged(); + } +} diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/calendar.h dde-calendar-5.10.0/3rdparty/kcalendarcore/src/calendar.h --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/calendar.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/calendar.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,1482 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 1998 Preston Brown + SPDX-FileCopyrightText 2001, 2003, 2004 Cornelius Schumacher + SPDX-FileCopyrightText: 2003-2004 Reinhold Kainhofer + SPDX-FileCopyrightText: 2006 David Jarvie + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +/** + @file + This file is part of the API for handling calendar data and + defines the Calendar class. + + @author Preston Brown \ + @author Cornelius Schumacher \ + @author Reinhold Kainhofer \ + @author David Jarvie \ + */ + +/* + +TODO: KDE5: + +This API needs serious cleaning up: +- Most (all) methods aren't async ( deleteIncidence(), addIncidence(), load(), save(), ... ) + so it's not very easy to make a derived class that loads from akonadi. + +- It has too many methods. Why do we need fooEvent()/fooJournal()/fooTodo() when fooIncidence() + should be enough. + +*/ + +#ifndef KCALCORE_CALENDAR_H +#define KCALCORE_CALENDAR_H + +#include "customproperties.h" +#include "event.h" +#include "incidence.h" +#include "journal.h" +#include "todo.h" + +#include +#include +#include +#include + +/** Namespace for all KCalendarCore types. */ +namespace KCalendarCore { +class CalFilter; +class Person; +class ICalFormat; + +/** + Calendar Incidence sort directions. +*/ +enum SortDirection { + SortDirectionAscending, /**< Sort in ascending order (first to last) */ + SortDirectionDescending, /**< Sort in descending order (last to first) */ +}; + +/** + Calendar Event sort keys. +*/ +enum EventSortField { + EventSortUnsorted, /**< Do not sort Events */ + EventSortStartDate, /**< Sort Events chronologically, by start date */ + EventSortEndDate, /**< Sort Events chronologically, by end date */ + EventSortSummary, /**< Sort Events alphabetically, by summary */ +}; + +/** + Calendar Todo sort keys. +*/ +enum TodoSortField { + TodoSortUnsorted, /**< Do not sort Todos */ + TodoSortStartDate, /**< Sort Todos chronologically, by start date */ + TodoSortDueDate, /**< Sort Todos chronologically, by due date */ + TodoSortPriority, /**< Sort Todos by priority */ + TodoSortPercentComplete, /**< Sort Todos by percentage completed */ + TodoSortSummary, /**< Sort Todos alphabetically, by summary */ + TodoSortCreated, /**< Sort Todos chronologically, by creation date */ + TodoSortCategories, /**< Sort Todos by categories (tags) @since 5.83 */ +}; + +/** + Calendar Journal sort keys. +*/ +enum JournalSortField { + JournalSortUnsorted, /**< Do not sort Journals */ + JournalSortDate, /**< Sort Journals chronologically by date */ + JournalSortSummary, /**< Sort Journals alphabetically, by summary */ +}; + +/** + The calendar's access mode, i.e. whether it can be written to or is read only. + @since 5.85 +*/ +enum AccessMode { + ReadOnly, + ReadWrite, +}; + +/** + @brief + Represents the main calendar class. + + A calendar contains information like incidences (events, to-dos, journals), + alarms, time zones, and other useful information. + + This is an abstract base class defining the interface to a calendar. + It is implemented by subclasses like MemoryCalendar, which use different + methods to store and access the data. + + Ownership of Incidences: + + Incidence ownership is handled by the following policy: as soon as an + incidence (or any other subclass of IncidenceBase) is added to the + Calendar by an add...() method it is owned by the Calendar object. + The Calendar takes care of deleting the incidence using the delete...() + methods. All Incidences returned by the query functions are returned + as pointers so that changes to the returned Incidences are immediately + visible in the Calendar. Do Not attempt to 'delete' any Incidence + object you get from Calendar -- use the delete...() methods. +*/ +class Q_CORE_EXPORT Calendar : public QObject + , public CustomProperties + , public IncidenceBase::IncidenceObserver +{ + Q_OBJECT + Q_PROPERTY(QString productId READ productId WRITE setProductId) // clazy:exclude=qproperty-without-notify + Q_PROPERTY(KCalendarCore::Person owner READ owner WRITE setOwner NOTIFY ownerChanged) + Q_PROPERTY(QString id READ id WRITE setId NOTIFY idChanged) + Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + Q_PROPERTY(QIcon icon READ icon WRITE setIcon NOTIFY iconChanged) + Q_PROPERTY(AccessMode accessMode READ accessMode WRITE setAccessMode NOTIFY accessModeChanged) + +public: + /** + A shared pointer to a Calendar + */ + typedef QSharedPointer Ptr; + + /** + Constructs a calendar with a specified time zone @p timeZone. + The time zone is used as the default for creating or + modifying incidences in the Calendar. The time zone does + not alter existing incidences. + + @param timeZone time specification + */ + explicit Calendar(const QTimeZone &timeZone); + + /** + Construct Calendar object using a time zone ID. + The time zone ID is used as the default for creating or modifying + incidences in the Calendar. The time zone does not alter existing + incidences. + + @param timeZoneId is a string containing a time zone ID, which is + assumed to be valid. If no time zone is found, the viewing time + specification is set to local time zone. + @e Example: "Europe/Berlin" + */ + explicit Calendar(const QByteArray &timeZoneId); + + /** + Destroys the calendar. + */ + ~Calendar() override; + + /** + Sets the calendar Product ID to @p id. + + @param id is a string containing the Product ID. + + @see productId() const + */ + void setProductId(const QString &id); + + /** + Returns the calendar's Product ID. + + @see setProductId() + */ + Q_REQUIRED_RESULT QString productId() const; + + /** + Sets the owner of the calendar to @p owner. + + @param owner is a Person object. Must be a non-null pointer. + + @see owner() + */ + void setOwner(const Person &owner); + + /** + Returns the owner of the calendar. + + @return the owner Person object. + + @see setOwner() + */ + Q_REQUIRED_RESULT Person owner() const; + + /** + Sets the default time specification zone used for creating + or modifying incidences in the Calendar. + + @param timeZone The time zone + */ + void setTimeZone(const QTimeZone &timeZone); + + /** + Get the time zone used for creating or + modifying incidences in the Calendar. + + @return time specification + */ + Q_REQUIRED_RESULT QTimeZone timeZone() const; + + /** + Sets the time zone ID used for creating or modifying incidences in the + Calendar. This method has no effect on existing incidences. + + @param timeZoneId is a string containing a time zone ID, which is + assumed to be valid. The time zone ID is used to set the time zone + for viewing Incidence date/times. If no time zone is found, the + viewing time specification is set to local time zone. + @e Example: "Europe/Berlin" + @see setTimeZone() + */ + void setTimeZoneId(const QByteArray &timeZoneId); + + /** + Returns the time zone ID used for creating or modifying incidences in + the calendar. + + @return the string containing the time zone ID, or empty string if the + creation/modification time specification is not a time zone. + */ + Q_REQUIRED_RESULT QByteArray timeZoneId() const; + + /** + Shifts the times of all incidences so that they appear at the same clock + time as before but in a new time zone. The shift is done from a viewing + time zone rather than from the actual incidence time zone. + + For example, shifting an incidence whose start time is 09:00 America/New York, + using an old viewing time zone (@p oldSpec) of Europe/London, to a new time + zone (@p newSpec) of Europe/Paris, will result in the time being shifted + from 14:00 (which is the London time of the incidence start) to 14:00 Paris + time. + + @param oldZone the time zone which provides the clock times + @param newZone the new time zone + */ + void shiftTimes(const QTimeZone &oldZone, const QTimeZone &newZone); + + /** + Sets if the calendar has been modified. + + @param modified is true if the calendar has been modified since open + or last save. + + @see isModified() + */ + void setModified(bool modified); + + /** + Determine the calendar's modification status. + 确定日历的修改状态。 + @return true if the calendar has been modified since open or last save. + + @see setModified() + */ + Q_REQUIRED_RESULT bool isModified() const; + + /** + * A unique identifier for this calendar. + * @since 5.85 + * @see setId() + */ + QString id() const; + + /** + * set a unique identifier for this calendar. + * 设置此日历的唯一标识符。 + * @since 5.85 + * @see id() + */ + void setId(const QString &id); + + /** + * The user-visible name for this calendar. + * 此日历的用户可见名称。 + * @since 5.85 + * @see setName() + */ + QString name() const; + + /** + * Set the user-visible name for this calendar. + * @since 5.85 + * @see name() + */ + void setName(const QString &name); + + /** + * This calendar's icon. + * @since 5.85 + * @see setIconName() + */ + QIcon icon() const; + + /** + * Set this calendar's icon. + * @since 5.85 + * @see icon() + */ + void setIcon(const QIcon &icon); + + /** + * This calendar's AccessMode, i.e. whether it is writable or read-only. + * 此日历的访问模式,即它是可写的还是只读的。 + * Defaults to ReadWrite. + * @since 5.85 + * @see setAccessMode() + */ + AccessMode accessMode() const; + + /** + * Set this calendar's AccessMode, i.e. whether it is writable or read-only. + * 设置此日历的访问模式,即它是可写的还是只读的。 + * @since 5.85 + * @see accessMode() + */ + void setAccessMode(const AccessMode mode); + + /** + Clears out the current calendar, freeing all used memory etc. + 清除当前日历,释放所有已用内存等。 + */ + virtual void close() = 0; + + /** + Syncs changes in memory to persistent storage. + 将内存中的更改同步到永久性存储。 + @return true if the save was successful; false otherwise. + Base implementation returns true. + */ + virtual bool save(); + + /** + Loads the calendar contents from storage. This requires that the + calendar has been previously loaded (initialized). + + @return true if the reload was successful; otherwise false. + Base implementation returns true. + */ + virtual bool reload(); + + /** + Determine if the calendar is currently being saved. + + @return true if the calendar is currently being saved; false otherwise. + */ + virtual bool isSaving() const; + + /** + Returns a list of all categories used by Incidences in this Calendar. + + @return a QStringList containing all the categories. + */ + Q_REQUIRED_RESULT QStringList categories() const; + + // Incidence Specific Methods // + + /** + Call this to tell the calendar that you're adding a batch of incidences. + So it doesn't, for example, ask the destination for each incidence. + + @see endBatchAdding() + */ + virtual void startBatchAdding(); + + /** + Tells the Calendar that you stopped adding a batch of incidences. + + @see startBatchAdding() + */ + virtual void endBatchAdding(); + + /** + @return true if batch adding is in progress + */ + Q_REQUIRED_RESULT bool batchAdding() const; + + /** + Inserts an Incidence into the calendar. + 将事件插入日历。 + + @param incidence is a pointer to the Incidence to insert. + + @return true if the Incidence was successfully inserted; false otherwise. + + @see deleteIncidence() + */ + virtual bool addIncidence(const Incidence::Ptr &incidence); + + /** + Removes an Incidence from the calendar. + + @param incidence is a pointer to the Incidence to remove. + + @return true if the Incidence was successfully removed; false otherwise. + + @see addIncidence() + */ + virtual bool deleteIncidence(const Incidence::Ptr &incidence); + + /** + Returns a filtered list of all Incidences for this Calendar. + 返回此日历的所有事件的筛选列表。 + + @return the list of all filtered Incidences. + */ + virtual Incidence::List incidences() const; + + /** + Returns a filtered list of all Incidences which occur on the given date. + 返回给定日期发生的所有事件的筛选列表。 + + @param date request filtered Incidence list for this QDate only. + + @return the list of filtered Incidences occurring on the specified date. + */ + virtual Incidence::List incidences(const QDate &date) const; + + /** + Returns an unfiltered list of all Incidences for this Calendar. + 返回此日历的所有事件的未筛选列表。 + + @return the list of all unfiltered Incidences. + */ + virtual Incidence::List rawIncidences() const; + + /** + Returns an unfiltered list of all exceptions of this recurring incidence. + 所有未筛选异常的重复发生率列表。 + + @param incidence incidence to check + + @return the list of all unfiltered exceptions. + */ + virtual Incidence::List instances(const Incidence::Ptr &incidence) const; + + // Notebook Specific Methods // + + /** + Clears notebook associations from hash-tables for incidences. + Called when in-memory content of the calendar is cleared. + */ + virtual void clearNotebookAssociations(); + + /** + Associate notebook for an incidence. + + @param incidence incidence + @param notebook notebook uid + + @return true if the operation was successful; false otherwise. + */ + virtual bool setNotebook(const Incidence::Ptr &incidence, const QString ¬ebook); + + /** + Get incidence's notebook. + + @param incidence incidence + + @return notebook uid + */ + virtual QString notebook(const Incidence::Ptr &incidence) const; + + /** + Get incidence's notebook. + + @param uid is a unique identifier string + + @return notebook uid + */ + virtual QString notebook(const QString &uid) const; + + /** + List all uids of notebooks currently in the memory. + + @return list of uids of notebooks + */ + virtual QStringList notebooks() const; + + /** + Check if calendar knows about the given notebook. + This means that it will be saved by one of the attached storages. + + @param notebook notebook uid + @return true if calendar has valid notebook + */ + Q_REQUIRED_RESULT bool hasValidNotebook(const QString ¬ebook) const; + + /** + Add notebook information into calendar. + Is usually called by storages only. + + @param notebook notebook uid + @param isVisible notebook visibility + @return true if operation succeeded + @see isVisible() + */ + Q_REQUIRED_RESULT bool addNotebook(const QString ¬ebook, bool isVisible); + + /** + Update notebook information in calendar. + Is usually called by storages only. + + @param notebook notebook uid + @param isVisible notebook visibility + @return true if operation succeeded + @see isVisible() + */ + Q_REQUIRED_RESULT bool updateNotebook(const QString ¬ebook, bool isVisible); + + /** + Delete notebook information from calendar. + Is usually called by storages only. + + @param notebook notebook uid + @return true if operation succeeded + @see isVisible() + */ + Q_REQUIRED_RESULT bool deleteNotebook(const QString ¬ebook); + + /** + set DefaultNotebook information to calendar. + + @param notebook notebook uid + @return true if operation was successful; false otherwise. + */ + Q_REQUIRED_RESULT bool setDefaultNotebook(const QString ¬ebook); + + /** + Get uid of default notebook. + + @return notebook uid + */ + Q_REQUIRED_RESULT QString defaultNotebook() const; + + /** + Check if incidence is visible. + @param incidence is a pointer to the Incidence to check for visibility. + @return true if incidence is visible, false otherwise + */ + Q_REQUIRED_RESULT bool isVisible(const Incidence::Ptr &incidence) const; + + /** + Check if notebook is visible. + @param notebook notebook uid. + @return true if notebook is visible, false otherwise + */ + Q_REQUIRED_RESULT bool isVisible(const QString ¬ebook) const; + + /** + List all notebook incidences in the memory. + + @param notebook is the notebook uid. + @return a list of incidences for the notebook. + */ + virtual Incidence::List incidences(const QString ¬ebook) const; + + /** + List all possible duplicate incidences. + + @param incidence is the incidence to check. + @return a list of duplicate incidences. + */ + virtual Incidence::List duplicates(const Incidence::Ptr &incidence); + + /** + Returns the Incidence associated with the given unique identifier. + + @param uid is a unique identifier string. + @param recurrenceId is possible recurrenceid of incidence, default is null + + @return a pointer to the Incidence. + A null pointer is returned if no such Incidence exists. + */ + Incidence::Ptr incidence(const QString &uid, const QDateTime &recurrenceId = {}) const; + + /** + Returns the deleted Incidence associated with the given unique identifier. + + @param uid is a unique identifier string. + @param recurrenceId is possible recurrenceid of incidence, default is null + + @return a pointer to the Incidence. + A null pointer is returned if no such Incidence exists. + */ + Incidence::Ptr deleted(const QString &uid, const QDateTime &recurrenceId = {}) const; + + /** + Delete all incidences that are instances of recurring incidence @p incidence. + + @param incidence is a pointer to a deleted Incidence + @return true if delete was successful; false otherwise + */ + virtual bool deleteIncidenceInstances(const Incidence::Ptr &incidence) = 0; + + /** + Returns the Incidence associated with the given scheduling identifier. + + @param sid is a unique scheduling identifier string. + + @return a pointer to the Incidence. + A null pointer is returned if no such Incidence exists. + */ + virtual Incidence::Ptr incidenceFromSchedulingID(const QString &sid) const; + + /** + Searches all events and todos for an incidence with this + scheduling identifier. Returns a list of matching results. + + @param sid is a unique scheduling identifier string. + */ + virtual Incidence::List incidencesFromSchedulingID(const QString &sid) const; + + /** + Create a merged list of Events, Todos, and Journals. + 创建事件、待办事项和日志的合并列表。 + + @param events is an Event list to merge. + @param todos is a Todo list to merge. + @param journals is a Journal list to merge. + + @return a list of merged Incidences. + */ + static Incidence::List mergeIncidenceList(const Event::List &events, const Todo::List &todos, const Journal::List &journals); + + /** + Flag that a change to a Calendar Incidence is starting. + @param incidence is a pointer to the Incidence that will be changing. + */ + virtual bool beginChange(const Incidence::Ptr &incidence); + + /** + Flag that a change to a Calendar Incidence has completed. + @param incidence is a pointer to the Incidence that was changed. + */ + virtual bool endChange(const Incidence::Ptr &incidence); + + /** + Creates an exception for an occurrence from a recurring Incidence. + + The returned exception is not automatically inserted into the calendar. + + @param incidence is a pointer to a recurring Incidence. + @param recurrenceId specifies the specific occurrence for which the + exception applies. + @param thisAndFuture specifies if the exception applies only this specific + occcurrence or also to all future occurrences. + + @return a pointer to a new exception incidence with @param recurrenceId set. + @since 4.11 + */ + static Incidence::Ptr createException(const Incidence::Ptr &incidence, const QDateTime &recurrenceId, bool thisAndFuture = false); + + // Event Specific Methods // + + /** + Inserts an Event into the calendar. + + @param event is a pointer to the Event to insert. + + @return true if the Event was successfully inserted; false otherwise. + + @see deleteEvent() + */ + virtual bool addEvent(const Event::Ptr &event) = 0; + + /** + Removes an Event from the calendar. + + @param event is a pointer to the Event to remove. + + @return true if the Event was successfully remove; false otherwise. + + @see addEvent() + */ + virtual bool deleteEvent(const Event::Ptr &event) = 0; + + /** + Delete all events that are instances of recurring event @p event. + + @param event is a pointer to a deleted Event + @return true if delete was successful; false otherwise + */ + virtual bool deleteEventInstances(const Event::Ptr &event) = 0; + + /** + Sort a list of Events. + + @param eventList is a pointer to a list of Events. + @param sortField specifies the EventSortField. + @param sortDirection specifies the SortDirection. + + @return a list of Events sorted as specified. + */ + static Event::List sortEvents(const Event::List &eventList, EventSortField sortField, SortDirection sortDirection); + /** + Returns a sorted, filtered list of all Events for this Calendar. + + @param sortField specifies the EventSortField. + @param sortDirection specifies the SortDirection. + + @return the list of all filtered Events sorted as specified. + */ + virtual Event::List events(EventSortField sortField = EventSortUnsorted, SortDirection sortDirection = SortDirectionAscending) const; + + /** + Returns a filtered list of all Events which occur on the given timestamp. + + @param dt request filtered Event list for this QDateTime only. + + @return the list of filtered Events occurring on the specified timestamp. + */ + Q_REQUIRED_RESULT Event::List events(const QDateTime &dt) const; + + /** + Returns a filtered list of all Events occurring within a date range. + + @param start is the starting date. + @param end is the ending date. + @param timeZone time zone to interpret @p start and @p end, + or the calendar's default time zone if none is specified + @param inclusive if true only Events which are completely included + within the date range are returned. + + @return the list of filtered Events occurring within the specified + date range. + */ + Q_REQUIRED_RESULT Event::List events(const QDate &start, const QDate &end, const QTimeZone &timeZone = {}, bool inclusive = false) const; + + /** + Returns a sorted, filtered list of all Events which occur on the given + date. The Events are sorted according to @a sortField and + @a sortDirection. + + @param date request filtered Event list for this QDate only. + @param timeZone time zone to interpret @p start and @p end, + or the calendar's default time zone if none is specified + @param sortField specifies the EventSortField. + @param sortDirection specifies the SortDirection. + + @return the list of sorted, filtered Events occurring on @a date. + */ + Q_REQUIRED_RESULT Event::List events(const QDate &date, + const QTimeZone &timeZone = {}, + EventSortField sortField = EventSortUnsorted, + SortDirection sortDirection = SortDirectionAscending) const; + + /** + Returns a sorted, unfiltered list of all Events for this Calendar. + + @param sortField specifies the EventSortField. + @param sortDirection specifies the SortDirection. + + @return the list of all unfiltered Events sorted as specified. + */ + virtual Event::List rawEvents(EventSortField sortField = EventSortUnsorted, SortDirection sortDirection = SortDirectionAscending) const = 0; + + /** + Returns an unfiltered list of all Events which occur on the given + timestamp. + + @param dt request unfiltered Event list for this QDateTime only. + + @return the list of unfiltered Events occurring on the specified + timestamp. + */ + virtual Event::List rawEventsForDate(const QDateTime &dt) const = 0; + + /** + Returns an unfiltered list of all Events occurring within a date range. + + @param start is the starting date + @param end is the ending date + @param timeZone time zone to interpret @p start and @p end, + or the calendar's default time zone if none is specified + @param inclusive if true only Events which are completely included + within the date range are returned. + + @return the list of unfiltered Events occurring within the specified + date range. + */ + virtual Event::List rawEvents(const QDate &start, const QDate &end, const QTimeZone &timeZone = {}, bool inclusive = false) const = 0; + + /** + Returns a sorted, unfiltered list of all Events which occur on the given + date. The Events are sorted according to @a sortField and + @a sortDirection. + + @param date request unfiltered Event list for this QDate only + @param timeZone time zone to interpret @p date, + or the calendar's default time zone if none is specified + @param sortField specifies the EventSortField + @param sortDirection specifies the SortDirection + + @return the list of sorted, unfiltered Events occurring on @p date + */ + virtual Event::List rawEventsForDate(const QDate &date, + const QTimeZone &timeZone = {}, + EventSortField sortField = EventSortUnsorted, + SortDirection sortDirection = SortDirectionAscending) const = 0; + + /** + Returns the Event associated with the given unique identifier. + + @param uid is a unique identifier string. + @param recurrenceId is possible recurrenceId of event, default is null + + @return a pointer to the Event. + A null pointer is returned if no such Event exists. + */ + virtual Event::Ptr event(const QString &uid, const QDateTime &recurrenceId = {}) const = 0; + + /** + Returns the deleted Event associated with the given unique identifier. + + @param uid is a unique identifier string. + @param recurrenceId is possible recurrenceId of event, default is null + + @return a pointer to the deleted Event. + A null pointer is returned if no such deleted Event exists, or if deletion tracking + is disabled. + + @see deletionTracking() + */ + virtual Event::Ptr deletedEvent(const QString &uid, const QDateTime &recurrenceId = {}) const = 0; + + /** + Returns a sorted, unfiltered list of all deleted Events for this Calendar. + + @param sortField specifies the EventSortField. + @param sortDirection specifies the SortDirection. + + @return the list of all unfiltered deleted Events sorted as specified. An empty list + is returned if deletion tracking is disabled. + + @see deletionTracking() + */ + virtual Event::List deletedEvents(EventSortField sortField = EventSortUnsorted, SortDirection sortDirection = SortDirectionAscending) const = 0; + + /** + Returns a sorted, unfiltered list of all possible instances for this recurring Event. + + @param event event to check for. Caller guarantees it's of type Event. + @param sortField specifies the EventSortField. + @param sortDirection specifies the SortDirection. + + @return the list of all unfiltered event instances sorted as specified. + */ + virtual Event::List + eventInstances(const Incidence::Ptr &event, EventSortField sortField = EventSortUnsorted, SortDirection sortDirection = SortDirectionAscending) const = 0; + + // Todo Specific Methods // + + /** + Inserts a Todo into the calendar. + + @param todo is a pointer to the Todo to insert. + + @return true if the Todo was successfully inserted; false otherwise. + + @see deleteTodo() + */ + virtual bool addTodo(const Todo::Ptr &todo) = 0; + + /** + Removes a Todo from the calendar. + + @param todo is a pointer to the Todo to remove. + + @return true if the Todo was successfully removed; false otherwise. + + @see addTodo() + */ + virtual bool deleteTodo(const Todo::Ptr &todo) = 0; + + /** + Delete all to-dos that are instances of recurring to-do @p todo. + @param todo is a pointer to a deleted Todo + @return true if delete was successful; false otherwise + */ + virtual bool deleteTodoInstances(const Todo::Ptr &todo) = 0; + + /** + Sort a list of Todos. + + @param todoList is a pointer to a list of Todos. + @param sortField specifies the TodoSortField. + @param sortDirection specifies the SortDirection. + + @return a list of Todos sorted as specified. + */ + static Todo::List sortTodos(const Todo::List &todoList, TodoSortField sortField, SortDirection sortDirection); + + /** + Returns a sorted, filtered list of all Todos for this Calendar. + + @param sortField specifies the TodoSortField. + @param sortDirection specifies the SortDirection. + + @return the list of all filtered Todos sorted as specified. + */ + virtual Todo::List todos(TodoSortField sortField = TodoSortUnsorted, SortDirection sortDirection = SortDirectionAscending) const; + + /** + Returns a filtered list of all Todos which are due on the specified date. + + @param date request filtered Todos due on this QDate. + + @return the list of filtered Todos due on the specified date. + */ + virtual Todo::List todos(const QDate &date) const; + + /** + Returns a filtered list of all Todos occurring within a date range. + + @param start is the starting date + @param end is the ending date + @param timeZone time zone to interpret @p start and @p end, + or the calendar's default time zone if none is specified + @param inclusive if true only Todos which are completely included + within the date range are returned. + + @return the list of filtered Todos occurring within the specified + date range. + */ + virtual Todo::List todos(const QDate &start, const QDate &end, const QTimeZone &timeZone = {}, bool inclusive = false) const; + + /** + Returns a sorted, unfiltered list of all Todos for this Calendar. + + @param sortField specifies the TodoSortField. + @param sortDirection specifies the SortDirection. + + @return the list of all unfiltered Todos sorted as specified. + */ + virtual Todo::List rawTodos(TodoSortField sortField = TodoSortUnsorted, SortDirection sortDirection = SortDirectionAscending) const = 0; + + /** + Returns an unfiltered list of all Todos which due on the specified date. + + @param date request unfiltered Todos due on this QDate. + + @return the list of unfiltered Todos due on the specified date. + */ + virtual Todo::List rawTodosForDate(const QDate &date) const = 0; + + /** + Returns an unfiltered list of all Todos occurring within a date range. + + @param start is the starting date + @param end is the ending date + @param timeZone time zone to interpret @p start and @p end, + or the calendar's default time zone if none is specified + @param inclusive if true only Todos which are completely included + within the date range are returned. + + @return the list of unfiltered Todos occurring within the specified + date range. + */ + virtual Todo::List rawTodos(const QDate &start, const QDate &end, const QTimeZone &timeZone = {}, bool inclusive = false) const = 0; + + /** + Returns the Todo associated with the given unique identifier. + + @param uid is a unique identifier string. + @param recurrenceId is possible recurrenceId of todo, default is null + + @return a pointer to the Todo. + A null pointer is returned if no such Todo exists. + */ + virtual Todo::Ptr todo(const QString &uid, const QDateTime &recurrenceId = {}) const = 0; + + /** + Returns the deleted Todo associated with the given unique identifier. + + @param uid is a unique identifier string. + @param recurrenceId is possible recurrenceId of todo, default is null + + @return a pointer to the deleted Todo. + A null pointer is returned if no such deleted Todo exists or if deletion tracking + is disabled. + + @see deletionTracking() + */ + virtual Todo::Ptr deletedTodo(const QString &uid, const QDateTime &recurrenceId = {}) const = 0; + + /** + Returns a sorted, unfiltered list of all deleted Todos for this Calendar. + + @param sortField specifies the TodoSortField. + @param sortDirection specifies the SortDirection. + + @return the list of all unfiltered deleted Todos sorted as specified. An empty list + is returned if deletion tracking is disabled. + + @see deletionTracking() + */ + virtual Todo::List deletedTodos(TodoSortField sortField = TodoSortUnsorted, SortDirection sortDirection = SortDirectionAscending) const = 0; + + /** + Returns a sorted, unfiltered list of all possible instances for this recurring Todo. + + @param todo todo to check for. Caller guarantees it's of type Todo. + @param sortField specifies the TodoSortField. + @param sortDirection specifies the SortDirection. + + @return the list of all unfiltered todo instances sorted as specified. + */ + virtual Todo::List + todoInstances(const Incidence::Ptr &todo, TodoSortField sortField = TodoSortUnsorted, SortDirection sortDirection = SortDirectionAscending) const = 0; + + // Journal Specific Methods // + + /** + Inserts a Journal into the calendar. + + @param journal is a pointer to the Journal to insert. + + @return true if the Journal was successfully inserted; false otherwise. + + @see deleteJournal() + */ + virtual bool addJournal(const Journal::Ptr &journal) = 0; + + /** + Removes a Journal from the calendar. + + @param journal is a pointer to the Journal to remove. + + @return true if the Journal was successfully removed; false otherwise. + + @see addJournal() + */ + virtual bool deleteJournal(const Journal::Ptr &journal) = 0; + + /** + Delete all journals that are instances of recurring journal @p journal. + + @param journal is a pointer to a deleted Journal + @return true if delete was successful; false otherwise + */ + virtual bool deleteJournalInstances(const Journal::Ptr &journal) = 0; + + /** + Sort a list of Journals. + + @param journalList is a pointer to a list of Journals. + @param sortField specifies the JournalSortField. + @param sortDirection specifies the SortDirection. + + @return a list of Journals sorted as specified. + */ + static Journal::List sortJournals(const Journal::List &journalList, JournalSortField sortField, SortDirection sortDirection); + /** + Returns a sorted, filtered list of all Journals for this Calendar. + + @param sortField specifies the JournalSortField. + @param sortDirection specifies the SortDirection. + + @return the list of all filtered Journals sorted as specified. + */ + virtual Journal::List journals(JournalSortField sortField = JournalSortUnsorted, SortDirection sortDirection = SortDirectionAscending) const; + + /** + Returns a filtered list of all Journals for on the specified date. + + @param date request filtered Journals for this QDate only. + + @return the list of filtered Journals for the specified date. + */ + virtual Journal::List journals(const QDate &date) const; + + /** + Returns a sorted, unfiltered list of all Journals for this Calendar. + + @param sortField specifies the JournalSortField. + @param sortDirection specifies the SortDirection. + + @return the list of all unfiltered Journals sorted as specified. + */ + virtual Journal::List rawJournals(JournalSortField sortField = JournalSortUnsorted, SortDirection sortDirection = SortDirectionAscending) const = 0; + + /** + Returns an unfiltered list of all Journals for on the specified date. + + @param date request unfiltered Journals for this QDate only. + + @return the list of unfiltered Journals for the specified date. + */ + virtual Journal::List rawJournalsForDate(const QDate &date) const = 0; + + /** + Returns the Journal associated with the given unique identifier. + + @param uid is a unique identifier string. + @param recurrenceId is possible recurrenceId of journal, default is null + + @return a pointer to the Journal. + A null pointer is returned if no such Journal exists. + */ + virtual Journal::Ptr journal(const QString &uid, const QDateTime &recurrenceId = {}) const = 0; + + /** + Returns the deleted Journal associated with the given unique identifier. + + @param uid is a unique identifier string. + @param recurrenceId is possible recurrenceId of journal, default is null + + @return a pointer to the deleted Journal. + A null pointer is returned if no such deleted Journal exists or if deletion tracking + is disabled. + + @see deletionTracking() + */ + virtual Journal::Ptr deletedJournal(const QString &uid, const QDateTime &recurrenceId = {}) const = 0; + + /** + Returns a sorted, unfiltered list of all deleted Journals for this Calendar. + + @param sortField specifies the JournalSortField. + @param sortDirection specifies the SortDirection. + + @return the list of all unfiltered deleted Journals sorted as specified. An empty list + is returned if deletion tracking is disabled. + + @see deletionTracking() + */ + virtual Journal::List deletedJournals(JournalSortField sortField = JournalSortUnsorted, SortDirection sortDirection = SortDirectionAscending) const = 0; + + /** + Returns a sorted, unfiltered list of all instances for this recurring Journal. + + @param journal journal to check for. Caller guarantees it's of type Journal. + @param sortField specifies the JournalSortField. + @param sortDirection specifies the SortDirection. + + @return the list of all unfiltered journal instances sorted as specified. + */ + virtual Journal::List journalInstances(const Incidence::Ptr &journal, + JournalSortField sortField = JournalSortUnsorted, + SortDirection sortDirection = SortDirectionAscending) const = 0; + + // Relations Specific Methods // + + /** + Setup Relations for an Incidence. + @param incidence is a pointer to the Incidence to have a Relation setup. + */ + virtual void setupRelations(const Incidence::Ptr &incidence); + + /** + Removes all Relations from an Incidence. + + @param incidence is a pointer to the Incidence to have a Relation removed. + */ + virtual void removeRelations(const Incidence::Ptr &incidence); + + /** + Checks if @p ancestor is an ancestor of @p incidence + + @param ancestor is the incidence we are testing to be an ancestor. + @param incidence is the incidence we are testing to be descended from @p ancestor. + */ + bool isAncestorOf(const Incidence::Ptr &ancestor, const Incidence::Ptr &incidence) const; + + /** + Returns a list of incidences that have a relation of RELTYPE parent + to incidence @p uid. + + @param uid The parent identifier whose children we want to obtain. + */ + Incidence::List relations(const QString &uid) const; + + // Filter Specific Methods // + + /** + Sets the calendar filter. + + @param filter a pointer to a CalFilter object which will be + used to filter Calendar Incidences. The Calendar takes + ownership of @p filter. + + @see filter() + */ + void setFilter(CalFilter *filter); + + /** + Returns the calendar filter. + + @return a pointer to the calendar CalFilter. + A null pointer is returned if no such CalFilter exists. + + @see setFilter() + */ + CalFilter *filter() const; + + // Alarm Specific Methods // + + /** + Returns a list of Alarms within a time range for this Calendar. + + @param from is the starting timestamp. + @param to is the ending timestamp. + @param excludeBlockedAlarms if true, alarms belonging to blocked collections aren't returned. + + @return the list of Alarms for the for the specified time range. + */ + virtual Alarm::List alarms(const QDateTime &from, const QDateTime &to, bool excludeBlockedAlarms = false) const = 0; + + /** + Return a list of Alarms that occur before the specified timestamp. + + @param to is the ending timestamp. + @return the list of Alarms occurring before the specified QDateTime. + @since 5.77 + */ + Q_REQUIRED_RESULT Alarm::List alarmsTo(const QDateTime &to) const; + + // Observer Specific Methods // + + /** + @class CalendarObserver + + The CalendarObserver class. + */ + class Q_CORE_EXPORT CalendarObserver // krazy:exclude=dpointer + { + public: + /** + Destructor. + */ + virtual ~CalendarObserver(); + + /** + Notify the Observer that a Calendar has been modified. + + @param modified set if the calendar has been modified. + @param calendar is a pointer to the Calendar object that + is being observed. + */ + virtual void calendarModified(bool modified, Calendar *calendar); + + /** + Notify the Observer that an Incidence has been inserted. + @param incidence is a pointer to the Incidence that was inserted. + */ + virtual void calendarIncidenceAdded(const Incidence::Ptr &incidence); + + /** + Notify the Observer that an Incidence has been modified. + @param incidence is a pointer to the Incidence that was modified. + */ + virtual void calendarIncidenceChanged(const Incidence::Ptr &incidence); + + /** + Notify the Observer that an Incidence will be removed. + @param incidence is a pointer to the Incidence that will be removed. + */ + virtual void calendarIncidenceAboutToBeDeleted(const Incidence::Ptr &incidence); + + /** + Notify the Observer that an Incidence has been removed. + @param incidence is a pointer to the Incidence that was removed. + @param calendar is a pointer to the calendar where the incidence was part of, + because the incidence was deleted, there is now way to determine the calendar + @since 4.83.0 + */ + virtual void calendarIncidenceDeleted(const Incidence::Ptr &incidence, const Calendar *calendar); + + /** + Notify the Observer that an addition of Incidence has been canceled. + @param incidence is a pointer to the Incidence that was removed. + */ + virtual void calendarIncidenceAdditionCanceled(const Incidence::Ptr &incidence); + }; + + /** + Registers an Observer for this Calendar. + + @param observer is a pointer to an Observer object that will be + watching this Calendar. + + @see unregisterObserver() + */ + void registerObserver(CalendarObserver *observer); + + /** + Unregisters an Observer for this Calendar. + + @param observer is a pointer to an Observer object that has been + watching this Calendar. + + @see registerObserver() + */ + void unregisterObserver(CalendarObserver *observer); + + using QObject::event; // prevent warning about hidden virtual method + +protected: + /** + The Observer interface. So far not implemented. + @param uid is the UID for the Incidence that has been updated. + @param recurrenceId is possible recurrenceid of incidence. + */ + void incidenceUpdated(const QString &uid, const QDateTime &recurrenceId) override; + + /** + Let Calendar subclasses set the time specification. + @param timeZone is the time specification (time zone, etc.) for + viewing Incidence dates.\n + */ + virtual void doSetTimeZone(const QTimeZone &timeZone); + + /** + Let Calendar subclasses notify that they inserted an Incidence. + @param incidence is a pointer to the Incidence object that was inserted. + */ + void notifyIncidenceAdded(const Incidence::Ptr &incidence); + + /** + Let Calendar subclasses notify that they modified an Incidence. + @param incidence is a pointer to the Incidence object that was modified. + */ + void notifyIncidenceChanged(const Incidence::Ptr &incidence); + + /** + Let Calendar subclasses notify that they will remove an Incidence. + @param incidence is a pointer to the Incidence object that will be removed. + */ + void notifyIncidenceAboutToBeDeleted(const Incidence::Ptr &incidence); + + /** + Let Calendar subclasses notify that they removed an Incidence. + @param incidence is a pointer to the Incidence object that has been removed. + */ + void notifyIncidenceDeleted(const Incidence::Ptr &incidence); + + /** + Let Calendar subclasses notify that they canceled addition of an Incidence. + @param incidence is a pointer to the Incidence object that addition as canceled. + */ + void notifyIncidenceAdditionCanceled(const Incidence::Ptr &incidence); + + /** + @copydoc + CustomProperties::customPropertyUpdated() + */ + void customPropertyUpdated() override; + + /** + Let Calendar subclasses notify that they enabled an Observer. + + @param enabled if true tells the calendar that a subclass has + enabled an Observer. + */ + void setObserversEnabled(bool enabled); + + /** + Appends alarms of incidence in interval to list of alarms. + + @param alarms is a List of Alarms to be appended onto. + @param incidence is a pointer to an Incidence containing the Alarm + to be appended. + @param from is the lower range of the next Alarm repetition. + @param to is the upper range of the next Alarm repetition. + */ + void appendAlarms(Alarm::List &alarms, const Incidence::Ptr &incidence, const QDateTime &from, const QDateTime &to) const; + + /** + Appends alarms of recurring events in interval to list of alarms. + + @param alarms is a List of Alarms to be appended onto. + @param incidence is a pointer to an Incidence containing the Alarm + to be appended. + @param from is the lower range of the next Alarm repetition. + @param to is the upper range of the next Alarm repetition. + */ + void appendRecurringAlarms(Alarm::List &alarms, const Incidence::Ptr &incidence, const QDateTime &from, const QDateTime &to) const; + + /** + Enables or disabled deletion tracking. + Default is true. + @see deletedEvent() + @see deletedTodo() + @see deletedJournal() + @since 4.11 + */ + void setDeletionTracking(bool enable); + + /** + Returns if deletion tracking is enabled. + Default is true. + @since 4.11 + */ + bool deletionTracking() const; + + /** + @copydoc + IncidenceBase::virtual_hook() + */ + virtual void virtual_hook(int id, void *data); + +Q_SIGNALS: + /** + Emitted when setFilter() is called. + @since 4.11 + */ + void filterChanged(); + + /** + * Emitted when the id changes. + * @since 5.85 + * @see id() + */ + void idChanged(); + + /** + * Emitted when the name changes. + * @since 5.85 + * @see name() + */ + void nameChanged(); + + /** + * Emitted when the icon name changes. + * @since 5.85 + * @see icon() + */ + void iconChanged(); + + /** + * Emitted when the AccessMode changes. + * @since 5.85 + * @see accessMode() + */ + void accessModeChanged(); + + /** + * Emitted when the owner changes. + * @since 5.85 + * @see owner() + */ + void ownerChanged(); + +private: + friend class ICalFormat; + + //@cond PRIVATE + class Private; + Private *const d; + //@endcond + + Q_DISABLE_COPY(Calendar) +}; + +} // namespace KCalendarCore + +Q_DECLARE_METATYPE(KCalendarCore::Calendar::Ptr) + +#endif diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/calendar_p.h dde-calendar-5.10.0/3rdparty/kcalendarcore/src/calendar_p.h --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/calendar_p.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/calendar_p.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,85 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 1998 Preston Brown + SPDX-FileCopyrightText: 2000-2004 Cornelius Schumacher + SPDX-FileCopyrightText: 2003-2004 Reinhold Kainhofer + SPDX-FileCopyrightText: 2006 David Jarvie + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ + +#ifndef KCALCORE_CALENDAR_P_H +#define KCALCORE_CALENDAR_P_H + +#include "calendar.h" +#include "calfilter.h" + +namespace KCalendarCore { +/** + Private class that helps to provide binary compatibility between releases. + @internal +*/ +//@cond PRIVATE +class Q_DECL_HIDDEN Calendar::Private +{ +public: + Private() + : mModified(false) + , mNewObserver(false) + , mObserversEnabled(true) + , mDefaultFilter(new CalFilter) + , batchAddingInProgress(false) + , mDeletionTracking(true) + { + // Setup default filter, which does nothing + mFilter = mDefaultFilter; + mFilter->setEnabled(false); + + mOwner.setName(QStringLiteral("Unknown Name")); + mOwner.setEmail(QStringLiteral("unknown@nowhere")); + } + + ~Private() + { + if (mFilter != mDefaultFilter) { + delete mFilter; + } + delete mDefaultFilter; + } + QTimeZone timeZoneIdSpec(const QByteArray &timeZoneId); + + QString mProductId; + Person mOwner; + QTimeZone mTimeZone; + QVector mTimeZones; + bool mModified = false; + bool mNewObserver = false; + bool mObserversEnabled = false; + QList mObservers; + + CalFilter *mDefaultFilter = nullptr; + CalFilter *mFilter = nullptr; + + // These lists are used to put together related To-dos + QMultiHash mOrphans; + QMultiHash mOrphanUids; + + // Lists for associating incidences to notebooks + QMultiHash mNotebookIncidences; + QHash mUidToNotebook; + QHash mNotebooks; // name to visibility + QHash mIncidenceVisibility; // incidence -> visibility + QString mDefaultNotebook; // uid of default notebook + QMap mIncidenceRelations; + bool batchAddingInProgress = false; + bool mDeletionTracking = false; + QString mId; + QString mName; + QIcon mIcon; + AccessMode mAccessMode = ReadWrite; +}; + +} // namespace KCalendarCore + +#endif diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/calendarplugin.cpp dde-calendar-5.10.0/3rdparty/kcalendarcore/src/calendarplugin.cpp --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/calendarplugin.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/calendarplugin.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,16 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 2020 Nicolas Fella + SPDX-License-Identifier: LGPL-2.0-or-later +*/ + +#include "calendarplugin.h" + +using namespace KCalendarCore; + +CalendarPlugin::CalendarPlugin(QObject *parent, const QVariantList &args) + : QObject(parent) +{ + Q_UNUSED(args) +} diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/calendarplugin.h dde-calendar-5.10.0/3rdparty/kcalendarcore/src/calendarplugin.h --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/calendarplugin.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/calendarplugin.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,47 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 2020 Nicolas Fella + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +#pragma once + +#include "calendar.h" + +#include + +namespace KCalendarCore { +/** + @brief + A plugin that provides calendar data. + + It allows calendar applications to consume data provided by multiple + sources, e.g. local ical files or remote calendars. + + @since 5.85 + +*/ +class Q_CORE_EXPORT CalendarPlugin : public QObject +{ + Q_OBJECT +public: + CalendarPlugin(QObject *parent, const QVariantList &args); + + /** + * The set of calendars defined by this plugin. + * + * @return QVector of calendars. + */ + virtual QVector calendars() const = 0; + +Q_SIGNALS: + /** + * Emitted when the set of calendars changed. + */ + void calendarsChanged(); + +private: + void *d; +}; + +} // namespace KCalendarCore diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/calfilter.cpp dde-calendar-5.10.0/3rdparty/kcalendarcore/src/calfilter.cpp --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/calfilter.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/calfilter.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,245 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 2001 Cornelius Schumacher + SPDX-FileCopyrightText: 2003-2004 Reinhold Kainhofer + SPDX-FileCopyrightText: 2004 Bram Schoenmakers + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +/** + @file + This file is part of the API for handling calendar data and + defines the CalFilter class. + + @brief + Provides a filter for calendars. + + @author Cornelius Schumacher \ + @author Reinhold Kainhofer \ + @author Bram Schoenmakers \ +*/ + +#include "calfilter.h" + +using namespace KCalendarCore; + +/** + Private class that helps to provide binary compatibility between releases. + @internal +*/ +//@cond PRIVATE +class Q_DECL_HIDDEN KCalendarCore::CalFilter::Private +{ +public: + Private() + { + } + QString mName; // filter name + QStringList mCategoryList; + QStringList mEmailList; + int mCriteria = 0; + int mCompletedTimeSpan = 0; + bool mEnabled = true; +}; +//@endcond + +CalFilter::CalFilter() + : d(new KCalendarCore::CalFilter::Private) +{ +} + +CalFilter::CalFilter(const QString &name) + : d(new KCalendarCore::CalFilter::Private) +{ + d->mName = name; +} + +CalFilter::~CalFilter() +{ + delete d; +} + +bool KCalendarCore::CalFilter::operator==(const CalFilter &filter) const +{ + return d->mName == filter.d->mName && d->mCriteria == filter.d->mCriteria && d->mCategoryList == filter.d->mCategoryList + && d->mEmailList == filter.d->mEmailList && d->mCompletedTimeSpan == filter.d->mCompletedTimeSpan; +} + +void CalFilter::apply(Event::List *eventList) const +{ + if (!d->mEnabled) { + return; + } + + Event::List::Iterator it = eventList->begin(); + while (it != eventList->end()) { + if (!filterIncidence(*it)) { + it = eventList->erase(it); + } else { + ++it; + } + } +} + +// TODO: avoid duplicating apply() code +void CalFilter::apply(Todo::List *todoList) const +{ + if (!d->mEnabled) { + return; + } + + Todo::List::Iterator it = todoList->begin(); + while (it != todoList->end()) { + if (!filterIncidence(*it)) { + it = todoList->erase(it); + } else { + ++it; + } + } +} + +void CalFilter::apply(Journal::List *journalList) const +{ + if (!d->mEnabled) { + return; + } + + Journal::List::Iterator it = journalList->begin(); + while (it != journalList->end()) { + if (!filterIncidence(*it)) { + it = journalList->erase(it); + } else { + ++it; + } + } +} + +bool CalFilter::filterIncidence(const Incidence::Ptr &incidence) const +{ + if (!d->mEnabled) { + return true; + } + + Todo::Ptr todo = incidence.dynamicCast(); + if (todo) { + if ((d->mCriteria & HideCompletedTodos) && todo->isCompleted()) { + // Check if completion date is suffently long ago: + if (todo->completed().addDays(d->mCompletedTimeSpan) < QDateTime::currentDateTimeUtc()) { + return false; + } + } + + if ((d->mCriteria & HideInactiveTodos) && ((todo->hasStartDate() && QDateTime::currentDateTimeUtc() < todo->dtStart()) || todo->isCompleted())) { + return false; + } + + if (d->mCriteria & HideNoMatchingAttendeeTodos) { + bool iAmOneOfTheAttendees = false; + const Attendee::List &attendees = todo->attendees(); + if (!todo->attendees().isEmpty()) { + Attendee::List::ConstIterator it; + for (it = attendees.begin(); it != attendees.end(); ++it) { + if (d->mEmailList.contains((*it).email())) { + iAmOneOfTheAttendees = true; + break; + } + } + } else { + // no attendees, must be me only + iAmOneOfTheAttendees = true; + } + if (!iAmOneOfTheAttendees) { + return false; + } + } + } + + if (d->mCriteria & HideRecurring) { + if (incidence->recurs() || incidence->hasRecurrenceId()) { + return false; + } + } + + if (d->mCriteria & ShowCategories) { + for (QStringList::ConstIterator it = d->mCategoryList.constBegin(); it != d->mCategoryList.constEnd(); ++it) { + QStringList incidenceCategories = incidence->categories(); + for (QStringList::ConstIterator it2 = incidenceCategories.constBegin(); it2 != incidenceCategories.constEnd(); ++it2) { + if ((*it) == (*it2)) { + return true; + } + } + } + return false; + } else { + for (QStringList::ConstIterator it = d->mCategoryList.constBegin(); it != d->mCategoryList.constEnd(); ++it) { + QStringList incidenceCategories = incidence->categories(); + for (QStringList::ConstIterator it2 = incidenceCategories.constBegin(); it2 != incidenceCategories.constEnd(); ++it2) { + if ((*it) == (*it2)) { + return false; + } + } + } + return true; + } +} + +void CalFilter::setName(const QString &name) +{ + d->mName = name; +} + +QString CalFilter::name() const +{ + return d->mName; +} + +void CalFilter::setEnabled(bool enabled) +{ + d->mEnabled = enabled; +} + +bool CalFilter::isEnabled() const +{ + return d->mEnabled; +} + +void CalFilter::setCriteria(int criteria) +{ + d->mCriteria = criteria; +} + +int CalFilter::criteria() const +{ + return d->mCriteria; +} + +void CalFilter::setCategoryList(const QStringList &categoryList) +{ + d->mCategoryList = categoryList; +} + +QStringList CalFilter::categoryList() const +{ + return d->mCategoryList; +} + +void CalFilter::setEmailList(const QStringList &emailList) +{ + d->mEmailList = emailList; +} + +QStringList CalFilter::emailList() const +{ + return d->mEmailList; +} + +void CalFilter::setCompletedTimeSpan(int timespan) +{ + d->mCompletedTimeSpan = timespan; +} + +int CalFilter::completedTimeSpan() const +{ + return d->mCompletedTimeSpan; +} diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/calfilter.h dde-calendar-5.10.0/3rdparty/kcalendarcore/src/calfilter.h --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/calfilter.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/calfilter.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,212 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 2001, 2003, 2004 Cornelius Schumacher + SPDX-FileCopyrightText: 2003-2004 Reinhold Kainhofer + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +/** + @file + This file is part of the API for handling calendar data and + defines the CalFilter class. + + @author Cornelius Schumacher \ + @author Reinhold Kainhofer \ +*/ + +#ifndef KCALCORE_CALFILTER_H +#define KCALCORE_CALFILTER_H + +#include "event.h" +#include "journal.h" +#include "todo.h" + +namespace KCalendarCore { +/** + @brief + Provides a filter for calendars. + 提供日历的筛选器。 + + This class provides a means for filtering calendar incidences by + a list of email addresses, a list of categories, or other #Criteria. + + The following #Criteria are available: + - remove recurring Incidences + - keep Incidences with a matching category (see setCategoryList()) + - remove completed To-dos (see setCompletedTimeSpan()) + - remove inactive To-dos + - remove To-dos without a matching attendee (see setEmailList()) +*/ +class Q_CORE_EXPORT CalFilter +{ +public: + /** + Filtering Criteria. + */ + enum Criteria { + HideRecurring = 1, /**< Remove incidences that recur */ + HideCompletedTodos = 2, /**< Remove completed to-dos */ + ShowCategories = 4, /**< Show incidences with at least one matching category */ + HideInactiveTodos = 8, /**< Remove to-dos that haven't started yet */ + HideNoMatchingAttendeeTodos = 16, /**< Remove to-dos without a matching attendee */ + }; + + /** + Constructs an empty filter -- a filter without a name or criteria. + */ + CalFilter(); + + /** + Constructs a filter with @p name. + + @param name is the name of this filter. + */ + explicit CalFilter(const QString &name); + + /** + Destroys this filter. + */ + ~CalFilter(); + + /** + Sets the filter name. + + @param name is the name of this filter. + @see name(). + */ + void setName(const QString &name); + + /** + Returns the filter name. + @see setName(). + */ + Q_REQUIRED_RESULT QString name() const; + + /** + Sets the criteria which must be fulfilled for an Incidence to pass + the filter. + + @param criteria is a combination of #Criteria. + @see criteria(). + */ + void setCriteria(int criteria); + + /** + Returns the inclusive filter criteria. + @see setCriteria(). + */ + Q_REQUIRED_RESULT int criteria() const; + + /** + Applies the filter to a list of Events. All events not matching the + filter criteria are removed from the list. + + @param eventList is a list of Events to filter. + */ + void apply(Event::List *eventList) const; + + /** + Applies the filter to a list of To-dos. All to-dos not matching the + filter criteria are removed from the list. + + @param todoList is a list of To-dos to filter. + */ + void apply(Todo::List *todoList) const; + + /** + Applies the filter to a list of Journals. All journals not matching the + filter criteria are removed from the list. + + @param journalList is a list of Journals to filter. + */ + void apply(Journal::List *journalList) const; + + /** + Applies the filter criteria to the specified Incidence. + + @param incidence is the Incidence to filter. + @return true if the Incidence passes the criteria; false otherwise. + */ + Q_REQUIRED_RESULT bool filterIncidence(const Incidence::Ptr &incidence) const; + + /** + Enables or disables the filter. + + @param enabled is true if the filter is to be enabled; false otherwise. + @see isEnabled(). + */ + void setEnabled(bool enabled); + + /** + Returns whether the filter is enabled or not. + @see setEnabled(). + */ + Q_REQUIRED_RESULT bool isEnabled() const; + + /** + Sets the list of categories to be considered when filtering incidences + according to the #ShowCategories criteria. + + @param categoryList is a QStringList of categories. + @see categoryList(). + */ + void setCategoryList(const QStringList &categoryList); + + /** + Returns the category list for this filter. + @see setCategoryList(). + */ + Q_REQUIRED_RESULT QStringList categoryList() const; + + /** + Sets the list of email addresses to be considered when filtering + incidences according to the #HideNoMatchingAttendeeTodos criteria. + + @param emailList is a QStringList of email addresses. + @see emailList(). + */ + void setEmailList(const QStringList &emailList); + + /** + Returns the email list for this filter. + @see setEmailList(). + */ + Q_REQUIRED_RESULT QStringList emailList() const; + + /** + Sets the number of days for the #HideCompletedTodos criteria. + If a to-do has been completed within the recent @p timespan days, + then that to-do will be removed during filtering. If a time span is + not specified in the filter, then all completed to-dos will be removed + if the #HideCompletedTodos criteria is set. + + @param timespan is an integer representing a time span in days. + @see completedTimeSpan(). + */ + void setCompletedTimeSpan(int timespan); + + /** + Returns the completed time span for this filter. + @see setCompletedTimeSpan() + */ + Q_REQUIRED_RESULT int completedTimeSpan() const; + + /** + Compares this with @p filter for equality. + + @param filter the CalFilter to compare. + */ + bool operator==(const CalFilter &filter) const; + +private: + //@cond PRIVATE + Q_DISABLE_COPY(CalFilter) + class Private; + Private *const d; + //@endcond +}; + +} // namespace KCalendarCore + +#endif diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/calformat.cpp dde-calendar-5.10.0/3rdparty/kcalendarcore/src/calformat.cpp --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/calformat.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/calformat.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,115 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 2001 Cornelius Schumacher + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +/** + @file + This file is part of the API for handling calendar data and + defines the CalFormat base class. + + @brief + Base class providing an interface to various calendar formats. + + @author Cornelius Schumacher \ +*/ + +#include "calformat.h" +#include "exceptions.h" + +#include + +using namespace KCalendarCore; + +/** + Private class that helps to provide binary compatibility between releases. + @internal +*/ +//@cond PRIVATE +class Q_DECL_HIDDEN KCalendarCore::CalFormat::Private +{ +public: + Private() + { + } + ~Private() + { + delete mException; + } + static QString mApplication; // Name of application, for creating unique ID strings + static QString mProductId; // PRODID string to write to calendar files + QString mLoadedProductId; // PRODID string loaded from calendar file 从日历文件加载的PRODID字符串 + Exception *mException = nullptr; +}; + +QString CalFormat::Private::mApplication = QStringLiteral("libkcal"); +QString CalFormat::Private::mProductId = QStringLiteral("-//K Desktop Environment//NONSGML libkcal 4.3//EN"); +//@endcond + +CalFormat::CalFormat() + : d(new KCalendarCore::CalFormat::Private) +{ +} + +CalFormat::~CalFormat() +{ + clearException(); + delete d; +} + +void CalFormat::clearException() +{ + delete d->mException; + d->mException = nullptr; +} + +void CalFormat::setException(Exception *exception) +{ + delete d->mException; + d->mException = exception; +} + +Exception *CalFormat::exception() const +{ + return d->mException; +} + +void CalFormat::setApplication(const QString &application, const QString &productID) +{ + Private::mApplication = application; + Private::mProductId = productID; +} + +const QString &CalFormat::application() +{ + return Private::mApplication; +} + +const QString &CalFormat::productId() +{ + return Private::mProductId; +} + +QString CalFormat::loadedProductId() +{ + return d->mLoadedProductId; +} + +void CalFormat::setLoadedProductId(const QString &id) +{ + d->mLoadedProductId = id; +} + +QString CalFormat::createUniqueId() +{ + return QUuid::createUuid().toString().mid(1, 36); +} + +void CalFormat::virtual_hook(int id, void *data) +{ + Q_UNUSED(id); + Q_UNUSED(data); + Q_ASSERT(false); +} diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/calformat.h dde-calendar-5.10.0/3rdparty/kcalendarcore/src/calformat.h --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/calformat.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/calformat.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,181 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 2001-2003 Cornelius Schumacher + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +/** + @file + This file is part of the API for handling calendar data and + defines the CalFormat abstract base class. + + @author Cornelius Schumacher \ +*/ + +#ifndef KCALCORE_CALFORMAT_H +#define KCALCORE_CALFORMAT_H + +#include "calendar.h" + +#include + +namespace KCalendarCore { +class Exception; + +/** + @brief + An abstract base class that provides an interface to various calendar formats. + + This is the base class for calendar formats. It provides an interface for the + generation/interpretation of a textual representation of a calendar. +*/ +class Q_CORE_EXPORT CalFormat +{ +public: + /** + Constructs a new Calendar Format object. + */ + CalFormat(); + + /** + Destructor. + */ + virtual ~CalFormat(); + + /** + Loads a calendar on disk into the calendar associated with this format. + 将磁盘上的日历加载到与此格式关联的日历中。 + + @param calendar is the Calendar to be loaded. + @param fileName is the name of the disk file containing the Calendar data. + + @return true if successful; false otherwise. + */ + virtual bool load(const Calendar::Ptr &calendar, const QString &fileName) = 0; + + /** + Writes the calendar to disk. + + @param calendar is the Calendar containing the data to be saved. + @param fileName is the name of the file to write the calendar data. + + @return true if successful; false otherwise. + */ + virtual bool save(const Calendar::Ptr &calendar, const QString &fileName) = 0; + + /** + Loads a calendar from a string + + @param calendar is the Calendar to be loaded. + @param string is the QString containing the Calendar data. + @param deleted use deleted incidences + @param notebook notebook uid + + @return true if successful; false otherwise. + @see fromRawString(), toString(). + */ + virtual bool fromString(const Calendar::Ptr &calendar, const QString &string, bool deleted = false, const QString ¬ebook = QString()) = 0; + + /** + Parses a utf8 encoded string, returning the first iCal component + encountered in that string. This is an overload used for efficient + reading to avoid utf8 conversions, which are expensive when reading + from disk. + + @param calendar is the Calendar to be loaded. + @param string is the QByteArray containing the Calendar data. + @param deleted use deleted incidences + @param notebook notebook uid + + @return true if successful; false otherwise. + @see fromString(), toString(). + */ + virtual bool fromRawString(const Calendar::Ptr &calendar, const QByteArray &string, bool deleted = false, const QString ¬ebook = QString()) = 0; + + /** + Returns the calendar as a string. + @param calendar is the Calendar containing the data to be saved. + @param notebook uid use only incidences with given notebook + @param deleted use deleted incidences + + @return a QString containing the Calendar data if successful; + an empty string otherwise. + @see fromString(), fromRawString(). + */ + virtual QString toString(const Calendar::Ptr &calendar, const QString ¬ebook = QString(), bool deleted = false) = 0; + + /** + Clears the exception status. + */ + void clearException(); + + /** + Returns an exception, if there is any, containing information about the + last error that occurred. + */ + Exception *exception() const; + + /** + Sets the application name for use in unique IDs and error messages, + and product ID for incidence PRODID property + + @param application is a string containing the application name. + @param productID is a string containing the product identifier. + */ + static void setApplication(const QString &application, const QString &productID); + + /** + Returns the application name used in unique IDs and error messages. + */ + static const QString &application(); // krazy:exclude=constref + + /** + Returns the our library's PRODID string to write into calendar files. + */ + static const QString &productId(); // krazy:exclude=constref + + /** + Returns the PRODID string loaded from calendar file. + @see setLoadedProductId() + */ + QString loadedProductId(); + + /** + Creates a unique id string. + */ + static QString createUniqueId(); + + /** + Sets an exception that is to be used by the functions of this class + to report errors. + + @param error is a pointer to an Exception which contains the exception. + */ + void setException(Exception *error); + +protected: + /** + Sets the PRODID string loaded from calendar file. + @param id is a pruduct Id string to set for the calendar file. + @see loadedProductId() + */ + void setLoadedProductId(const QString &id); + + /** + @copydoc + IncidenceBase::virtual_hook() + */ + virtual void virtual_hook(int id, void *data); + +private: + //@cond PRIVATE + Q_DISABLE_COPY(CalFormat) + class Private; + Private *const d; + //@endcond +}; + +} // namespace KCalendarCore + +#endif diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/calstorage.cpp dde-calendar-5.10.0/3rdparty/kcalendarcore/src/calstorage.cpp --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/calstorage.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/calstorage.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,52 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 2002, 2003 Cornelius Schumacher + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +/** + @file + This file is part of the API for handling calendar data and + defines the CalStorage abstract base class. + + @brief + An abstract base class that provides a calendar storage interface. + + @author Cornelius Schumacher \ +*/ + +#include "calstorage.h" + +using namespace KCalendarCore; + +/** + Private class that helps to provide binary compatibility between releases. + @internal +*/ +//@cond PRIVATE +class Q_DECL_HIDDEN KCalendarCore::CalStorage::Private +{ +public: + Private(const Calendar::Ptr &cal) + : mCalendar(cal) + { + } + Calendar::Ptr mCalendar; +}; +//@endcond + +CalStorage::CalStorage(const Calendar::Ptr &calendar) + : d(new KCalendarCore::CalStorage::Private(calendar)) +{ +} + +CalStorage::~CalStorage() +{ + delete d; +} + +Calendar::Ptr CalStorage::calendar() const +{ + return d->mCalendar; +} diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/calstorage.h dde-calendar-5.10.0/3rdparty/kcalendarcore/src/calstorage.h --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/calstorage.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/calstorage.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,87 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 2002, 2003 Cornelius Schumacher + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +/** + @file + This file is part of the API for handling calendar data and + defines the CalStorage abstract base class. + + @author Cornelius Schumacher \ +*/ + +#ifndef KCALCORE_CALSTORAGE_H +#define KCALCORE_CALSTORAGE_H + +#include "calendar.h" + +#include + +namespace KCalendarCore { +/** + @brief + An abstract base class that provides a calendar storage interface. + + This is the base class for calendar storage. It provides an interface for the + loading and saving of calendars. +*/ +class Q_CORE_EXPORT CalStorage : public QObject +{ + Q_OBJECT + +public: + /** + Constructs a new storage object for a calendar. + @param calendar is a pointer to a valid Calendar object. + */ + explicit CalStorage(const Calendar::Ptr &calendar); + + /** + Destuctor. + */ + ~CalStorage() override; + + /** + Returns the calendar for this storage object. + @return A pointer to the calendar whose storage is being managed. + */ + Calendar::Ptr calendar() const; + + /** + Opens the calendar for storage. + @return true if the open was successful; false otherwise. + */ + virtual bool open() = 0; + + /** + Loads the calendar into memory. + @return true if the load was successful; false otherwise. + */ + virtual bool load() = 0; + + /** + Saves the calendar. + @return true if the save was successful; false otherwise. + */ + virtual bool save() = 0; + + /** + Closes the calendar storage. + @return true if the close was successful; false otherwise. + */ + virtual bool close() = 0; + +private: + //@cond PRIVATE + Q_DISABLE_COPY(CalStorage) + class Private; + Private *const d; + //@endcond +}; + +} // namespace KCalendarCore + +#endif diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/compat.cpp dde-calendar-5.10.0/3rdparty/kcalendarcore/src/compat.cpp --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/compat.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/compat.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,396 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 2002 Cornelius Schumacher + SPDX-FileCopyrightText: 2003-2004 Reinhold Kainhofer + SPDX-FileCopyrightText: 2012 Christian Mollekopf + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +/** + @file + This file is part of the API for handling calendar data and defines + classes for managing compatibility between different calendar formats. + + @brief + Classes that provide compatibility to older or "broken" calendar formats. + + @author Cornelius Schumacher \ + @author Reinhold Kainhofer \ +*/ + +#include "compat_p.h" +#include "incidence.h" + +#include +#include +#include +#include + +using namespace KCalendarCore; + +Compat *CompatFactory::createCompat(const QString &productId, const QString &implementationVersion) +{ + Compat *compat = nullptr; + + int korg = productId.indexOf(QLatin1String("KOrganizer")); + int outl9 = productId.indexOf(QLatin1String("Outlook 9.0")); + + if (korg >= 0) { + int versionStart = productId.indexOf(QLatin1Char(' '), korg); + if (versionStart >= 0) { + int versionStop = productId.indexOf(QRegularExpression(QStringLiteral("[ /]")), versionStart + 1); + if (versionStop >= 0) { + QString version = productId.mid(versionStart + 1, versionStop - versionStart - 1); + + int versionNum = version.section(QLatin1Char('.'), 0, 0).toInt() * 10000 + version.section(QLatin1Char('.'), 1, 1).toInt() * 100 + + version.section(QLatin1Char('.'), 2, 2).toInt(); + int releaseStop = productId.indexOf(QLatin1Char('/'), versionStop); + QString release; + if (releaseStop > versionStop) { + release = productId.mid(versionStop + 1, releaseStop - versionStop - 1); + } + if (versionNum < 30100) { + compat = new CompatPre31; + } else if (versionNum < 30200) { + compat = new CompatPre32; + } else if (versionNum == 30200 && release == QLatin1String("pre")) { + qDebug() << "Generating compat for KOrganizer 3.2 pre"; + compat = new Compat32PrereleaseVersions; + } else if (versionNum < 30400) { + compat = new CompatPre34; + } else if (versionNum < 30500) { + compat = new CompatPre35; + } + } + } + } else if (outl9 >= 0) { + qDebug() << "Generating compat for Outlook < 2000 (Outlook 9.0)"; + compat = new CompatOutlook9; + } + if (!compat) { + compat = new Compat; + } + // Older implementations lacked the implementation version, + // so apply this fix if it is a file from kontact and the version is missing. + if (implementationVersion.isEmpty() + && (productId.contains(QLatin1String("libkcal")) || productId.contains(QLatin1String("KOrganizer")) || productId.contains(QLatin1String("KAlarm")))) { + compat = new CompatPre410(compat); + } + + return compat; +} + +Compat::Compat() + : d(nullptr) +{ +} + +Compat::~Compat() +{ +} + +void Compat::fixEmptySummary(const Incidence::Ptr &incidence) +{ + // some stupid vCal exporters ignore the standard and use Description + // instead of Summary for the default field. Correct for this: Copy the + // first line of the description to the summary (if summary is just one + // line, move it) + if (incidence->summary().isEmpty() && !(incidence->description().isEmpty())) { + QString oldDescription = incidence->description().trimmed(); + QString newSummary(oldDescription); + newSummary.remove(QRegularExpression(QStringLiteral("\n.*"))); + incidence->setSummary(newSummary); + if (oldDescription == newSummary) { + incidence->setDescription(QLatin1String("")); + } + } +} + +void Compat::fixAlarms(const Incidence::Ptr &incidence) +{ + Q_UNUSED(incidence); +} + +void Compat::fixFloatingEnd(QDate &date) +{ + Q_UNUSED(date); +} + +void Compat::fixRecurrence(const Incidence::Ptr &incidence) +{ + Q_UNUSED(incidence); + // Prevent use of compatibility mode during subsequent changes by the application + // incidence->recurrence()->setCompatVersion(); +} + +int Compat::fixPriority(int priority) +{ + return priority; +} + +bool Compat::useTimeZoneShift() const +{ + return true; +} + +void Compat::setCreatedToDtStamp(const Incidence::Ptr &incidence, const QDateTime &dtstamp) +{ + Q_UNUSED(incidence); + Q_UNUSED(dtstamp); +} + +class Q_DECL_HIDDEN CompatDecorator::Private +{ +public: + Compat *compat; +}; + +CompatDecorator::CompatDecorator(Compat *compat) + : d(new CompatDecorator::Private) +{ + d->compat = compat; +} + +CompatDecorator::~CompatDecorator() +{ + delete d->compat; + delete d; +} + +void CompatDecorator::fixEmptySummary(const Incidence::Ptr &incidence) +{ + d->compat->fixEmptySummary(incidence); +} + +void CompatDecorator::fixAlarms(const Incidence::Ptr &incidence) +{ + d->compat->fixAlarms(incidence); +} + +void CompatDecorator::fixFloatingEnd(QDate &date) +{ + d->compat->fixFloatingEnd(date); +} + +void CompatDecorator::fixRecurrence(const Incidence::Ptr &incidence) +{ + d->compat->fixRecurrence(incidence); +} + +int CompatDecorator::fixPriority(int priority) +{ + return d->compat->fixPriority(priority); +} + +bool CompatDecorator::useTimeZoneShift() const +{ + return d->compat->useTimeZoneShift(); +} + +void CompatDecorator::setCreatedToDtStamp(const Incidence::Ptr &incidence, const QDateTime &dtstamp) +{ + d->compat->setCreatedToDtStamp(incidence, dtstamp); +} + +CompatPre35::CompatPre35() + : d(nullptr) +{ +} + +CompatPre35::~CompatPre35() +{ +} + +void CompatPre35::fixRecurrence(const Incidence::Ptr &incidence) +{ + Recurrence *recurrence = incidence->recurrence(); + if (recurrence) { + QDateTime start(incidence->dtStart()); + // kde < 3.5 only had one rrule, so no need to loop over all RRULEs. + RecurrenceRule *r = recurrence->defaultRRule(); + if (r && !r->dateMatchesRules(start)) { + recurrence->addExDateTime(start); + } + } + + // Call base class method now that everything else is done + Compat::fixRecurrence(incidence); +} + +CompatPre34::CompatPre34() + : d(nullptr) +{ +} + +CompatPre34::~CompatPre34() +{ +} + +int CompatPre34::fixPriority(int priority) +{ + if (0 < priority && priority < 6) { + // adjust 1->1, 2->3, 3->5, 4->7, 5->9 + return 2 * priority - 1; + } else { + return priority; + } +} + +CompatPre32::CompatPre32() + : d(nullptr) +{ +} + +CompatPre32::~CompatPre32() +{ +} + +void CompatPre32::fixRecurrence(const Incidence::Ptr &incidence) +{ + Recurrence *recurrence = incidence->recurrence(); + if (recurrence->recurs() && recurrence->duration() > 0) { + recurrence->setDuration(recurrence->duration() + incidence->recurrence()->exDates().count()); + } + // Call base class method now that everything else is done + CompatPre35::fixRecurrence(incidence); +} + +CompatPre31::CompatPre31() + : d(nullptr) +{ +} + +CompatPre31::~CompatPre31() +{ +} + +void CompatPre31::fixFloatingEnd(QDate &endDate) +{ + endDate = endDate.addDays(1); +} + +void CompatPre31::fixRecurrence(const Incidence::Ptr &incidence) +{ + CompatPre32::fixRecurrence(incidence); + + Recurrence *recur = incidence->recurrence(); + RecurrenceRule *r = nullptr; + if (recur) { + r = recur->defaultRRule(); + } + if (recur && r) { + int duration = r->duration(); + if (duration > 0) { + // Backwards compatibility for KDE < 3.1. + // rDuration was set to the number of time periods to recur, + // with week start always on a Monday. + // Convert this to the number of occurrences. + r->setDuration(-1); + QDate end(r->startDt().date()); + bool doNothing = false; + // # of periods: + int tmp = (duration - 1) * r->frequency(); + switch (r->recurrenceType()) { + case RecurrenceRule::rWeekly: { + end = end.addDays(tmp * 7 + 7 - end.dayOfWeek()); + break; + } + case RecurrenceRule::rMonthly: { + int month = end.month() - 1 + tmp; + end.setDate(end.year() + month / 12, month % 12 + 1, 31); + break; + } + case RecurrenceRule::rYearly: { + end.setDate(end.year() + tmp, 12, 31); + break; + } + default: + doNothing = true; + break; + } + if (!doNothing) { + duration = r->durationTo(QDateTime(end, QTime(0, 0, 0), incidence->dtStart().timeZone())); + r->setDuration(duration); + } + } + + /* addYearlyNum */ + // Dates were stored as day numbers, with a fiddle to take account of + // leap years. Convert the day number to a month. + QList days = r->byYearDays(); + if (!days.isEmpty()) { + QList months = r->byMonths(); + for (int i = 0; i < months.size(); ++i) { + int newmonth = QDate(r->startDt().date().year(), 1, 1).addDays(months.at(i) - 1).month(); + if (!months.contains(newmonth)) { + months.append(newmonth); + } + } + + r->setByMonths(months); + days.clear(); + r->setByYearDays(days); + } + } +} + +CompatOutlook9::CompatOutlook9() + : d(nullptr) +{ +} + +CompatOutlook9::~CompatOutlook9() +{ +} + +void CompatOutlook9::fixAlarms(const Incidence::Ptr &incidence) +{ + if (!incidence) { + return; + } + Alarm::List alarms = incidence->alarms(); + Alarm::List::Iterator end(alarms.end()); + for (Alarm::List::Iterator it = alarms.begin(); it != end; ++it) { + Alarm::Ptr al = *it; + if (al && al->hasStartOffset()) { + Duration offsetDuration = al->startOffset(); + int offs = offsetDuration.asSeconds(); + if (offs > 0) { + offsetDuration = Duration(-offs); + } + al->setStartOffset(offsetDuration); + } + } +} + +Compat32PrereleaseVersions::Compat32PrereleaseVersions() + : d(nullptr) +{ +} + +Compat32PrereleaseVersions::~Compat32PrereleaseVersions() +{ +} + +bool Compat32PrereleaseVersions::useTimeZoneShift() const +{ + return false; +} + +CompatPre410::CompatPre410(Compat *decoratedCompat) + : CompatDecorator(decoratedCompat) + , d(nullptr) +{ +} + +CompatPre410::~CompatPre410() +{ +} + +void CompatPre410::setCreatedToDtStamp(const Incidence::Ptr &incidence, const QDateTime &dtstamp) +{ + if (dtstamp.isValid()) { + incidence->setCreated(dtstamp); + } +} diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/compat_p.h dde-calendar-5.10.0/3rdparty/kcalendarcore/src/compat_p.h --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/compat_p.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/compat_p.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,377 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 2002 Cornelius Schumacher + SPDX-FileCopyrightText: 2003-2004 Reinhold Kainhofer + SPDX-FileCopyrightText: 2012 Christian Mollekopf + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +/** + @file + This file is part of the API for handling calendar data and defines + classes for managing compatibility between different calendar formats. + + @author Cornelius Schumacher \ + @author Reinhold Kainhofer \ +*/ + +#ifndef KCALCORE_COMPAT_P_H +#define KCALCORE_COMPAT_P_H + +#include "incidence.h" + +#include // for Q_DISABLE_COPY() + +class QDate; +class QString; + +namespace KCalendarCore { +class Compat; + +/** + @brief + Factory for creating the right Compat object. + + @internal +*/ +class CompatFactory +{ +public: + /** + Creates the appropriate Compat class as determined by the Product ID. + + @param productId is a string containing a valid Product ID from + a supported calendar format. + @return A pointer to a Compat object which is owned by the caller. + */ + static Compat *createCompat(const QString &productId, const QString &implementationVersion); +}; + +/** + @brief + This class provides compatibility to older or broken calendar files. + + @internal +*/ +class Compat +{ +public: + /** + Constructor. + */ + Compat(); + + /** + Destructor. + */ + virtual ~Compat(); + + /** + Fixes the recurrence rule for an incidence. + @param incidence is a pointer to an Incidence object that may + need its recurrence rule fixed. + */ + virtual void fixRecurrence(const Incidence::Ptr &incidence); + + /** + Fixes an empty summary for an incidence. + @param incidence is a pointer to an Incidence object that may need + its summary fixed. + */ + virtual void fixEmptySummary(const Incidence::Ptr &incidence); + + /** + Fixes the alarms list an incidence. + @param incidence is a pointer to an Incidence object that may need + its alarms fixed. + */ + virtual void fixAlarms(const Incidence::Ptr &incidence); + + /** + Fixes the end date for floating events. + @param date is the end date to fix. + */ + virtual void fixFloatingEnd(QDate &date); + + /** + Fixes the priority. + @param priority is the priority value to fix. + @return an integer representing a valid priority value. + */ + virtual int fixPriority(int priority); + + /** + Returns true if a timezone shift should be used; false otherwise. + */ + virtual bool useTimeZoneShift() const; + + /** + Sets the created and dtstamp. + */ + virtual void setCreatedToDtStamp(const Incidence::Ptr &incidence, const QDateTime &dtstamp); + +private: + //@cond PRIVATE + Q_DISABLE_COPY(Compat) + class Private; + Private *const d; + //@endcond +}; + +/** + @brief + Decorator so multiple compatibility classes can be stacked. +*/ +class CompatDecorator : public Compat +{ +public: + explicit CompatDecorator(Compat *decoratedCompat); + ~CompatDecorator() override; + + /** + @copydoc + Compat::fixRecurrence() + */ + void fixRecurrence(const Incidence::Ptr &incidence) override; + + /** + @copydoc + Compat::fixEmptySummary() + */ + void fixEmptySummary(const Incidence::Ptr &incidence) override; + + /** + @copydoc + Compat::fixAlarms() + */ + void fixAlarms(const Incidence::Ptr &incidence) override; + + /** + @copydoc + Compat::fixFloatingEnd() + */ + void fixFloatingEnd(QDate &date) override; + + /** + @copydoc + Compat::fixPriority() + */ + int fixPriority(int priority) override; + + /** + @copydoc + Compat::useTimeZoneShift() + */ + bool useTimeZoneShift() const override; + + /** + @copydoc + Compat::setCreatedToDtStamp() + */ + void setCreatedToDtStamp(const Incidence::Ptr &incidence, const QDateTime &dtstamp) override; + +private: + //@cond PRIVATE + Q_DISABLE_COPY(CompatDecorator) + class Private; + Private *const d; + //@endcond +}; + +/** + @brief + Compatibility class for KOrganizer pre-3.5 calendar files. + + Before kde 3.5, the start date was not automatically a recurring date. + So, if the start date doesn't match the recurrence rule, we need to add + an ex-date for the date start. If a duration was given, the DTSTART was + only counted if it matched, so by accident this was already the correct + behavior, so we don't need to adjust the duration. +*/ +class CompatPre35 : public Compat +{ +public: + CompatPre35(); + ~CompatPre35() override; + + /** + @copydoc + Compat::fixRecurrence() + */ + void fixRecurrence(const Incidence::Ptr &incidence) override; + +private: + //@cond PRIVATE + class Private; + Private *const d; + //@endcond +}; + +/** + @brief + Compatibility class for KOrganizer pre-3.4 calendar files. +*/ +class CompatPre34 : public CompatPre35 +{ +public: + CompatPre34(); + ~CompatPre34() override; + + /** + @copydoc + Compat::fixPriority() + */ + int fixPriority(int priority) override; + +private: + //@cond PRIVATE + class Private; + Private *const d; + //@endcond +}; + +/** + @brief + Compatibility class for KOrganizer pre-3.2 calendar files. + + The recurrence has a specified number of repetitions. + Pre-3.2, this was extended by the number of exception dates. + This is also rfc 2445-compliant. The duration of an RRULE also counts + events that are later excluded via EXDATE or EXRULE. +*/ +class CompatPre32 : public CompatPre34 +{ +public: + CompatPre32(); + ~CompatPre32() override; + + /** + @copydoc + Compat::fixRecurrence() + */ + void fixRecurrence(const Incidence::Ptr &incidence) override; + +private: + //@cond PRIVATE + + class Private; + Private *const d; + //@endcond +}; + +/** + @brief + Compatibility class for KOrganizer pre-3.1 calendar files. + + Before kde 3.1, floating events (events without a date) had 0:00 of their + last day as the end date. E.g. 28.5.2005 0:00 until 28.5.2005 0:00 for an + event that lasted the whole day on May 28, 2005. According to RFC 2445, the + end date for such an event needs to be 29.5.2005 0:00. + + Update: We misunderstood rfc 2445 in this regard. For all-day events, the + DTEND is the last day of the event. See a mail from the Author or rfc 2445: + http://www.imc.org/ietf-calendar/archive1/msg03648.html + However, as all other applications also got this wrong, we'll just leave it + as it is and use the wrong interpretation (was also discussed on ietf-calsify) +*/ +class CompatPre31 : public CompatPre32 +{ +public: + CompatPre31(); + ~CompatPre31(); + + /** + @copydoc + Compat::fixFloatingEnd() + */ + void fixFloatingEnd(QDate &date) override; + + /** + @copydoc + Compat::fixRecurrence() + */ + void fixRecurrence(const Incidence::Ptr &incidence) override; + +private: + //@cond PRIVATE + class Private; + Private *const d; + //@endcond +}; + +/** + @brief + Compatibility class for KOrganizer prerelease 3.2 calendar files. +*/ +class Compat32PrereleaseVersions : public Compat +{ +public: + Compat32PrereleaseVersions(); + ~Compat32PrereleaseVersions() override; + + /** + @copydoc + Compat::useTimeZoneShift() + */ + bool useTimeZoneShift() const override; + +private: + //@cond PRIVATE + class Private; + Private *const d; + //@endcond +}; + +/** + @brief + Compatibility class for Outlook 9 calendar files. + + In Outlook 9, alarms have the wrong sign. I.e. RFC 2445 says that negative + values for the trigger are before the event's start. Outlook/exchange, + however used positive values. +*/ +class CompatOutlook9 : public Compat +{ +public: + CompatOutlook9(); + ~CompatOutlook9() override; + + /** + @copydoc + Compat::fixAlarms() + */ + void fixAlarms(const Incidence::Ptr &incidence) override; + +private: + //@cond PRIVATE + class Private; + Private *const d; + //@endcond +}; + +/** + @brief + Compatibility class for Kontact < 4.10 calendar files. +*/ +class CompatPre410 : public CompatDecorator +{ +public: + explicit CompatPre410(Compat *decoratedCompat); + ~CompatPre410() override; + /** + @copydoc + Compat::setCreatedToDtStamp() + */ + void setCreatedToDtStamp(const Incidence::Ptr &incidence, const QDateTime &dtstamp) override; + +private: + //@cond PRIVATE + class Private; + Private *const d; + //@endcond +}; + +} // namespace KCalendarCore + +#endif diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/conference.cpp dde-calendar-5.10.0/3rdparty/kcalendarcore/src/conference.cpp --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/conference.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/conference.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,144 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 2020 Daniel Vrátil + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ + +#include "conference.h" + +#include + +using namespace KCalendarCore; + +/** + Private class that helps to provide binary compatibility between releases. + @internal +*/ +//@cond PRIVATE +class Q_DECL_HIDDEN KCalendarCore::Conference::Private : public QSharedData +{ +public: + QString label; + QString language; + QStringList features; + QUrl uri; + CustomProperties customProperties; +}; +//@endcond + +Conference::Conference() + : d(new Conference::Private) +{ +} + +Conference::Conference(const QUrl &uri, const QString &label, const QStringList &features, const QString &language) + : d(new Conference::Private) +{ + setUri(uri); + setLabel(label); + setFeatures(features); + setLanguage(language); +} + +Conference::Conference(const Conference &) = default; + +Conference::~Conference() = default; + +bool Conference::isNull() const +{ + // isNull rather than isEmpty, as user code is actually creating empty but non-null conferences... + return !d->uri.isValid() && d->label.isNull(); +} + +bool KCalendarCore::Conference::operator==(const Conference &other) const +{ + return std::tie(d->label, d->language, d->features, d->uri) == std::tie(other.d->label, other.d->language, other.d->features, other.d->uri); +} + +bool KCalendarCore::Conference::operator!=(const Conference &other) const +{ + return !operator==(other); +} + +Conference &KCalendarCore::Conference::operator=(const Conference &) = default; + +QUrl Conference::uri() const +{ + return d->uri; +} + +void Conference::setUri(const QUrl &uri) +{ + d->uri = uri; +} + +QString Conference::label() const +{ + return d->label; +} + +void Conference::setLabel(const QString &label) +{ + d->label = label; +} + +QStringList Conference::features() const +{ + return d->features; +} + +void Conference::addFeature(const QString &feature) +{ + d->features.push_back(feature); +} + +void Conference::removeFeature(const QString &feature) +{ + d->features.removeAll(feature); +} + +void Conference::setFeatures(const QStringList &features) +{ + d->features = features; +} + +QString Conference::language() const +{ + return d->language; +} + +void Conference::setLanguage(const QString &language) +{ + d->language = language; +} + +void Conference::setCustomProperty(const QByteArray &xname, const QString &xvalue) +{ + d->customProperties.setNonKDECustomProperty(xname, xvalue); +} + +CustomProperties &Conference::customProperties() +{ + return d->customProperties; +} + +const CustomProperties &Conference::customProperties() const +{ + return d->customProperties; +} + +QDataStream &KCalendarCore::operator<<(QDataStream &stream, const KCalendarCore::Conference &conference) +{ + return stream << conference.d->uri << conference.d->label << conference.d->features << conference.d->language << conference.d->customProperties; +} + +QDataStream &KCalendarCore::operator>>(QDataStream &stream, KCalendarCore::Conference &conference) +{ + Conference conf; + stream >> conf.d->uri >> conf.d->label >> conf.d->features >> conf.d->language >> conf.d->customProperties; + conference = conf; + + return stream; +} diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/conference.h dde-calendar-5.10.0/3rdparty/kcalendarcore/src/conference.h --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/conference.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/conference.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,199 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 2020 Daniel Vrátil + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ + +#ifndef KCALCORE_CONFERENCE_H +#define KCALCORE_CONFERENCE_H + +#include +#include +#include + +#include "customproperties.h" + +namespace KCalendarCore { +/** + @brief + Represents information related to a conference information of an Calendar + Incidence, typically a meeting or task (to-do). + 表示与会议相关的信息日历事件的信息,通常是会议或任务(待办事项)。 + + Conference contains information needed to join a remote conference system + (e.g. phone call, audio/video meeting etc.) + + @since 5.77 +*/ +class Q_CORE_EXPORT Conference +{ + Q_GADGET + Q_PROPERTY(bool isNull READ isNull) + Q_PROPERTY(QStringList features READ features WRITE setFeatures) + Q_PROPERTY(QString label READ label WRITE setLabel) + Q_PROPERTY(QUrl uri READ uri WRITE setUri) + Q_PROPERTY(QString language READ language WRITE setLanguage) + +public: + using List = QVector; + + /** Create a null Conference. */ + explicit Conference(); + + /** + Constructs a conference consisting of a @p uri, description of + the URI (@p label), list of features of the conference (@p features) + and @p language. + + @param uri Uri to join the conference. + @param label Label of the URI. + @param features Features of this particular conference method. + @param language Language of the information present in other fields. + */ + Conference(const QUrl &uri, const QString &label, const QStringList &features = {}, const QString &language = {}); + + /** + Constructs a conference by copying another conference. + + @param conference is the conference to be copied. + */ + Conference(const Conference &conference); + + /** + Destroys the conference. + */ + ~Conference(); + + /** + Compares this with @p conference for equality. + + @param conference the conference to compare. + */ + bool operator==(const Conference &conference) const; + + /** + Compares this with @p conference for inequality. + + @param conference the conference to compare. + */ + bool operator!=(const Conference &other) const; + + /** + * Returns @c true if this is a default-constructed Conference instance. + */ + Q_REQUIRED_RESULT bool isNull() const; + + /** + * Returns URI to join the conference, with access code included. + */ + Q_REQUIRED_RESULT QUrl uri() const; + + /** + * Sets the URI to @uri. + */ + void setUri(const QUrl &uri); + + /** + * Returns label with additional details regarding further use of the URI. + */ + Q_REQUIRED_RESULT QString label() const; + + /** + * Sets the URI label to @p label. + */ + void setLabel(const QString &label); + + /** + * Returns the list of features of the conferencing system at given URI. + * + * This can be e.g. CHAT, AUDIO, VIDEO, PHONE, etc. + */ + Q_REQUIRED_RESULT QStringList features() const; + + /** + * Adds @p feature to the list of features. + * + * @param feature Feature to add. + */ + void addFeature(const QString &feature); + + /** + * Removes @p feature from the list of features. + * + * @param feature Feature to remove. + */ + void removeFeature(const QString &feature); + + /** + * Sets the list of features to @p features. + */ + void setFeatures(const QStringList &features); + + /** + * Returns the language of the text present in other properties of this object. + */ + Q_REQUIRED_RESULT QString language() const; + + /** + * Sets the language to @p language. + */ + void setLanguage(const QString &language); + + /** + Sets this conference equal to @p conference. + + @param conference is the conference to copy. + */ + Conference &operator=(const Conference &conference); + + /** + Adds a custom property. If the property already exists it will be overwritten. + @param xname is the name of the property. + @param xvalue is its value. + */ + void setCustomProperty(const QByteArray &xname, const QString &xvalue); + + /** + Returns a reference to the CustomProperties object + */ + Q_REQUIRED_RESULT CustomProperties &customProperties(); + + /** + Returns a const reference to the CustomProperties object + */ + const CustomProperties &customProperties() const; + +private: + //@cond PRIVATE + class Private; + QSharedDataPointer d; + //@endcond + + friend Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const KCalendarCore::Conference &); + friend Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, KCalendarCore::Conference &); +}; + +/** + Serializes a Conference object into a data stream. + @param stream is a QDataStream. + @param conference is a reference to a Conference object to be serialized. +*/ +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &stream, const KCalendarCore::Conference &conference); + +/** + Initializes a Conference object from a data stream. + @param stream is a QDataStream. + @param conference is a reference to a Conference object to be initialized. +*/ +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &stream, KCalendarCore::Conference &conference); + +} // namespace KCalendarCore + +//@cond PRIVATE +Q_DECLARE_TYPEINFO(KCalendarCore::Conference, Q_MOVABLE_TYPE); +Q_DECLARE_METATYPE(KCalendarCore::Conference) +//@endcond + +#endif diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/customproperties.cpp dde-calendar-5.10.0/3rdparty/kcalendarcore/src/customproperties.cpp --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/customproperties.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/customproperties.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,247 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 2002, 2006, 2010 David Jarvie + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +/** + @file + This file is part of the API for handling calendar data and + defines the CustomProperties class. + + @brief + A class to manage custom calendar properties. + + @author David Jarvie \ +*/ + +#include "customproperties.h" + +#include +#include + +using namespace KCalendarCore; + +//@cond PRIVATE +static bool checkName(const QByteArray &name); + +class Q_DECL_HIDDEN CustomProperties::Private +{ +public: + bool operator==(const Private &other) const; + QMap mProperties; // custom calendar properties + QMap mPropertyParameters; + + // Volatile properties are not written back to the serialized format and are not compared in operator== + // They are only used for runtime purposes and are not part of the payload. + QMap mVolatileProperties; + + bool isVolatileProperty(const QString &name) const + { + return name.startsWith(QLatin1String("X-KDE-VOLATILE")); + } +}; + +bool CustomProperties::Private::operator==(const CustomProperties::Private &other) const +{ + if (mProperties.count() != other.mProperties.count()) { + // qDebug() << "Property count is different:" << mProperties << other.mProperties; + return false; + } + for (QMap::ConstIterator it = mProperties.begin(); it != mProperties.end(); ++it) { + QMap::ConstIterator itOther = other.mProperties.find(it.key()); + if (itOther == other.mProperties.end() || itOther.value() != it.value()) { + return false; + } + } + for (QMap::ConstIterator it = mPropertyParameters.begin(); it != mPropertyParameters.end(); ++it) { + QMap::ConstIterator itOther = other.mPropertyParameters.find(it.key()); + if (itOther == other.mPropertyParameters.end() || itOther.value() != it.value()) { + return false; + } + } + return true; +} +//@endcond + +CustomProperties::CustomProperties() + : d(new Private) +{ +} + +CustomProperties::CustomProperties(const CustomProperties &cp) + : d(new Private(*cp.d)) +{ +} + +CustomProperties &CustomProperties::operator=(const CustomProperties &other) +{ + // check for self assignment + if (&other == this) { + return *this; + } + + *d = *other.d; + return *this; +} + +CustomProperties::~CustomProperties() +{ + delete d; +} + +bool CustomProperties::operator==(const CustomProperties &other) const +{ + return *d == *other.d; +} + +void CustomProperties::setCustomProperty(const QByteArray &app, const QByteArray &key, const QString &value) +{ + if (value.isNull() || key.isEmpty() || app.isEmpty()) { + return; + } + QByteArray property = "X-KDE-" + app + '-' + key; + if (!checkName(property)) { + return; + } + customPropertyUpdate(); + + if (d->isVolatileProperty(QLatin1String(property))) { + d->mVolatileProperties[property] = value; + } else { + d->mProperties[property] = value; + } + + customPropertyUpdated(); +} + +void CustomProperties::removeCustomProperty(const QByteArray &app, const QByteArray &key) +{ + removeNonKDECustomProperty(QByteArray("X-KDE-" + app + '-' + key)); +} + +QString CustomProperties::customProperty(const QByteArray &app, const QByteArray &key) const +{ + return nonKDECustomProperty(QByteArray("X-KDE-" + app + '-' + key)); +} + +QByteArray CustomProperties::customPropertyName(const QByteArray &app, const QByteArray &key) +{ + QByteArray property("X-KDE-" + app + '-' + key); + if (!checkName(property)) { + return QByteArray(); + } + return property; +} + +void CustomProperties::setNonKDECustomProperty(const QByteArray &name, const QString &value, const QString ¶meters) +{ + if (value.isNull() || !checkName(name)) { + return; + } + customPropertyUpdate(); + if (d->isVolatileProperty(QLatin1String(name))) { + d->mVolatileProperties[name] = value; + } else { + d->mProperties[name] = value; + d->mPropertyParameters[name] = parameters; + } + customPropertyUpdated(); +} +void CustomProperties::removeNonKDECustomProperty(const QByteArray &name) +{ + if (d->mProperties.contains(name)) { + customPropertyUpdate(); + d->mProperties.remove(name); + d->mPropertyParameters.remove(name); + customPropertyUpdated(); + } else if (d->mVolatileProperties.contains(name)) { + customPropertyUpdate(); + d->mVolatileProperties.remove(name); + customPropertyUpdated(); + } +} + +QString CustomProperties::nonKDECustomProperty(const QByteArray &name) const +{ + return d->isVolatileProperty(QLatin1String(name)) ? d->mVolatileProperties.value(name) : d->mProperties.value(name); +} + +QString CustomProperties::nonKDECustomPropertyParameters(const QByteArray &name) const +{ + return d->mPropertyParameters.value(name); +} + +void CustomProperties::setCustomProperties(const QMap &properties) +{ + bool changed = false; + for (QMap::ConstIterator it = properties.begin(); it != properties.end(); ++it) { + // Validate the property name and convert any null string to empty string + if (checkName(it.key())) { + if (d->isVolatileProperty(QLatin1String(it.key()))) { + d->mVolatileProperties[it.key()] = it.value().isNull() ? QLatin1String("") : it.value(); + } else { + d->mProperties[it.key()] = it.value().isNull() ? QLatin1String("") : it.value(); + } + if (!changed) { + customPropertyUpdate(); + } + changed = true; + } + } + if (changed) { + customPropertyUpdated(); + } +} + +QMap CustomProperties::customProperties() const +{ + QMap result = d->mProperties; + for (auto it = d->mVolatileProperties.begin(), end = d->mVolatileProperties.end(); it != end; ++it) { + result.insert(it.key(), it.value()); + } + return result; +} + +void CustomProperties::customPropertyUpdate() +{ +} + +void CustomProperties::customPropertyUpdated() +{ +} + +//@cond PRIVATE +bool checkName(const QByteArray &name) +{ + // Check that the property name starts with 'X-' and contains + //检查属性名称是否以“X-”开头,并包含 + // only the permitted characters + //只有允许的字符 + const char *n = name.constData(); + int len = name.length(); + if (len < 2 || n[0] != 'X' || n[1] != '-') { + return false; + } + for (int i = 2; i < len; ++i) { + char ch = n[i]; + if ((ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z') || (ch >= '0' && ch <= '9') || ch == '-') { + continue; + } + return false; // invalid character found + } + return true; +} +//@endcond + +QDataStream &KCalendarCore::operator<<(QDataStream &stream, const KCalendarCore::CustomProperties &properties) +{ + return stream << properties.d->mProperties << properties.d->mPropertyParameters; +} + +QDataStream &KCalendarCore::operator>>(QDataStream &stream, KCalendarCore::CustomProperties &properties) +{ + properties.d->mVolatileProperties.clear(); + return stream >> properties.d->mProperties >> properties.d->mPropertyParameters; +} diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/customproperties.h dde-calendar-5.10.0/3rdparty/kcalendarcore/src/customproperties.h --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/customproperties.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/customproperties.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,206 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 2002, 2006, 2010 David Jarvie + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +/** + @file + This file is part of the API for handling calendar data and + defines the CustomProperties class. + + @author David Jarvie \ +*/ + +#ifndef KCALCORE_CUSTOMPROPERTIES_H +#define KCALCORE_CUSTOMPROPERTIES_H + +#include +#include + +namespace KCalendarCore { +/** + @brief + A class to manage custom calendar properties. + 用于管理自定义日历属性的类。 + + This class represents custom calendar properties. + It is used as a base class for classes which represent calendar components. + A custom property name written by the kcalcore library has the form X-KDE-APP-KEY + where APP represents the application name, and KEY distinguishes individual + properties for the application. + In keeping with RFC2445, property names must be composed only of the + characters A-Z, a-z, 0-9 and '-'. +*/ +class Q_CORE_EXPORT CustomProperties +{ + friend Q_CORE_EXPORT QDataStream &operator<<(QDataStream &s, const KCalendarCore::CustomProperties &properties); + friend Q_CORE_EXPORT QDataStream &operator>>(QDataStream &s, KCalendarCore::CustomProperties &properties); + +public: + /** + Constructs an empty custom properties instance. + */ + CustomProperties(); + + /** + Copy constructor. + @param other is the one to copy. + */ + CustomProperties(const CustomProperties &other); + + /** + Destructor. + */ + virtual ~CustomProperties(); + + /** + Compare this with @p properties for equality. + @param properties is the one to compare. + @warning The comparison is not polymorphic. + */ + bool operator==(const CustomProperties &properties) const; + + /** + Create or modify a custom calendar property. + + @param app Application name as it appears in the custom property name. 在自定义属性名称中显示的应用程序名称。 + @param key Property identifier specific to the application. 特定于应用程序的属性标识符。 + @param value The property's value. A call with a value of QString() + will be ignored. + @see removeCustomProperty(). + */ + void setCustomProperty(const QByteArray &app, const QByteArray &key, const QString &value); + + /** + Delete a custom calendar property. + + @param app Application name as it appears in the custom property name. + @param key Property identifier specific to the application. + @see setCustomProperty(). + */ + void removeCustomProperty(const QByteArray &app, const QByteArray &key); + + /** + Return the value of a custom calendar property. + + @param app Application name as it appears in the custom property name. + @param key Property identifier specific to the application. + @return Property value, or QString() if (and only if) the property + does not exist. + */ + Q_REQUIRED_RESULT QString customProperty(const QByteArray &app, const QByteArray &key) const; + + /** + Validate and return the full name of a custom calendar property. + + @param app Application name as it appears in the custom property name. + @param key Property identifier specific to the application. + @return Full property name, or empty string if it would contain invalid + characters + */ + Q_REQUIRED_RESULT static QByteArray customPropertyName(const QByteArray &app, const QByteArray &key); + + /** + Create or modify a non-KDE or non-standard custom calendar property. + 创建或修改非KDE或非标准自定义日历属性。 + + @param name Full property name + @param value The property's value. A call with a value of QString() + will be ignored. + @param parameters The formatted list of parameters for the + property. They should be formatted as RFC specifies, that is, + KEY=VALUE;KEY2=VALUE2. We're mostly concerned about passing them + through as-is albeit they can be of course parsed if need be. + @see removeNonKDECustomProperty(). + */ + void setNonKDECustomProperty(const QByteArray &name, const QString &value, const QString ¶meters = QString()); + + /** + Delete a non-KDE or non-standard custom calendar property. + + @param name Full property name + @see setNonKDECustomProperty(). + */ + void removeNonKDECustomProperty(const QByteArray &name); + + /** + Return the value of a non-KDE or non-standard custom calendar property. + 返回非KDE或非标准自定义日历属性的值。 + + @param name Full property name + @return Property value, or QString() if (and only if) the property + does not exist. + */ + Q_REQUIRED_RESULT QString nonKDECustomProperty(const QByteArray &name) const; + + /** + Return the parameters of a non-KDE or non-standard custom + calendar property. + + @param name Full property name + @return The parameters for the given property. Empty string is + returned if none are set. + */ + Q_REQUIRED_RESULT QString nonKDECustomPropertyParameters(const QByteArray &name) const; + + /** + Initialise the alarm's custom calendar properties to the specified + key/value pairs. + 将报警的自定义日历属性初始化为指定的键/值对。 + @param properties is a QMap of property key/value pairs. + @see customProperties(). + */ + void setCustomProperties(const QMap &properties); + + /** + Returns all custom calendar property key/value pairs. + @see setCustomProperties(). + */ + Q_REQUIRED_RESULT QMap customProperties() const; + + /** + Assignment operator. + @warning The assignment is not polymorphic. + @param other is the CustomProperty to assign. + */ + CustomProperties &operator=(const CustomProperties &other); + +protected: + /** + Called before a custom property will be changed. + 在更改自定义属性之前调用。 + The default implementation does nothing: override in derived classes + to perform change processing. + 默认实现不做任何事情:重写派生类以执行更改处理。 + */ + virtual void customPropertyUpdate(); + + /** + Called when a custom property has been changed. + The default implementation does nothing: override in derived classes + to perform change processing. + */ + virtual void customPropertyUpdated(); + +private: + //@cond PRIVATE + class Private; + Private *const d; + //@endcond +}; + +/** + Serializes the @p properties object into the @p stream. +*/ +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &stream, const KCalendarCore::CustomProperties &properties); + +/** + Initializes the @p properties object from the @p stream. +*/ +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &stream, KCalendarCore::CustomProperties &properties); + +} // namespace KCalendarCore + +#endif diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/duration.cpp dde-calendar-5.10.0/3rdparty/kcalendarcore/src/duration.cpp --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/duration.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/duration.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,216 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 2001 Cornelius Schumacher + SPDX-FileCopyrightText: 2007 David Jarvie + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +/** + @file + This file is part of the API for handling calendar data and + defines the Duration class. + + @brief + Represents a span of time measured in seconds. + + @author Cornelius Schumacher \ + @author David Jarvie \ +*/ +#include "duration.h" + +#include +#include + +using namespace KCalendarCore; + +/** + Private class that helps to provide binary compatibility between releases. + @internal +*/ +//@cond PRIVATE +class Q_DECL_HIDDEN KCalendarCore::Duration::Private +{ +public: + int seconds() const + { + return mDaily ? mDuration * 86400 : mDuration; + } + int mDuration; // number of seconds or days in the duration + bool mDaily = false; // specified in terms of days rather than seconds +}; +//@endcond + +Duration::Duration() + : d(new KCalendarCore::Duration::Private()) +{ +} + +Duration::Duration(const QDateTime &start, const QDateTime &end) + : d(new KCalendarCore::Duration::Private()) +{ + if (start.time() == end.time() && start.timeZone() == end.timeZone()) { + d->mDuration = start.daysTo(end); + d->mDaily = true; + } else { + d->mDuration = start.secsTo(end); + d->mDaily = false; + } +} + +Duration::Duration(const QDateTime &start, const QDateTime &end, Type type) + : d(new KCalendarCore::Duration::Private()) +{ + if (type == Days) { + QDateTime endSt(end.toTimeZone(start.timeZone())); + d->mDuration = start.daysTo(endSt); + if (d->mDuration) { + // Round down to whole number of days if necessary + if (start < endSt) { + if (endSt.time() < start.time()) { + --d->mDuration; + } + } else { + if (endSt.time() > start.time()) { + ++d->mDuration; + } + } + } + d->mDaily = true; + } else { + d->mDuration = start.secsTo(end); + d->mDaily = false; + } +} + +Duration::Duration(int duration, Type type) + : d(new KCalendarCore::Duration::Private()) +{ + d->mDuration = duration; + d->mDaily = (type == Days); +} + +Duration::Duration(const Duration &duration) + : d(new KCalendarCore::Duration::Private(*duration.d)) +{ +} + +Duration::~Duration() +{ + delete d; +} + +Duration &Duration::operator=(const Duration &duration) +{ + // check for self assignment + if (&duration == this) { + return *this; + } + + *d = *duration.d; + return *this; +} + +Duration::operator bool() const +{ + return d->mDuration; +} + +bool Duration::operator<(const Duration &other) const +{ + if (d->mDaily == other.d->mDaily) { + // guard against integer overflow for two daily durations + return d->mDuration < other.d->mDuration; + } + return d->seconds() < other.d->seconds(); +} + +bool Duration::operator==(const Duration &other) const +{ + // Note: daily and non-daily durations are always unequal, since a day's + // duration may differ from 24 hours if it happens to span a daylight saving + // time change. + return d->mDuration == other.d->mDuration && d->mDaily == other.d->mDaily; +} + +Duration &Duration::operator+=(const Duration &other) +{ + if (d->mDaily == other.d->mDaily) { + d->mDuration += other.d->mDuration; + } else if (d->mDaily) { + d->mDuration = d->mDuration * 86400 + other.d->mDuration; + d->mDaily = false; + } else { + d->mDuration += other.d->mDuration + 86400; + } + return *this; +} + +Duration Duration::operator-() const +{ + return Duration(-d->mDuration, (d->mDaily ? Days : Seconds)); +} + +Duration &Duration::operator-=(const Duration &duration) +{ + return operator+=(-duration); +} + +Duration &Duration::operator*=(int value) +{ + d->mDuration *= value; + return *this; +} + +Duration &Duration::operator/=(int value) +{ + d->mDuration /= value; + return *this; +} + +QDateTime Duration::end(const QDateTime &start) const +{ + return d->mDaily ? start.addDays(d->mDuration) : start.addSecs(d->mDuration); +} + +Duration::Type Duration::type() const +{ + return d->mDaily ? Days : Seconds; +} + +bool Duration::isDaily() const +{ + return d->mDaily; +} + +int Duration::asSeconds() const +{ + return d->seconds(); +} + +int Duration::asDays() const +{ + return d->mDaily ? d->mDuration : d->mDuration / 86400; +} + +int Duration::value() const +{ + return d->mDuration; +} + +bool Duration::isNull() const +{ + return d->mDuration == 0; +} + +QDataStream &KCalendarCore::operator<<(QDataStream &out, const KCalendarCore::Duration &duration) +{ + out << duration.d->mDuration << duration.d->mDaily; + return out; +} + +QDataStream &KCalendarCore::operator>>(QDataStream &in, KCalendarCore::Duration &duration) +{ + in >> duration.d->mDuration >> duration.d->mDaily; + return in; +} diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/duration.h dde-calendar-5.10.0/3rdparty/kcalendarcore/src/duration.h --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/duration.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/duration.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,342 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 2001-2003 Cornelius Schumacher + SPDX-FileCopyrightText: 2007 David Jarvie + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +/** + @file + This file is part of the API for handling calendar data and + defines the Duration class. + + @author Cornelius Schumacher \ + @author David Jarvie \ +*/ + +#ifndef KCALCORE_DURATION_H +#define KCALCORE_DURATION_H + +#include +#include +#include + +class QDateTime; + +namespace KCalendarCore { +/** + @brief + Represents a span of time measured in seconds or days. + 表示以秒或天为单位的时间跨度。 + + A duration is a span of time measured in seconds or days. Construction can + be done by specifying a stop and end time, or simply by specifying the number + of seconds or days. + + Much of the time, it does not matter whether a duration is specified in + seconds or in days. But it does make a difference when a duration is used to + define a time period encompassing a daylight saving time change. +*/ +class Q_CORE_EXPORT Duration +{ +public: + /** + The unit of time used to define the duration. + */ + enum Type { + Seconds, + /**< duration is a number of seconds */ //秒 + Days, + /**< duration is a number of days */ //天 + }; + + /** + Constructs a duration of 0 seconds. + */ + Duration(); + + /** + Constructs a duration from @p start to @p end. + + If the time of day in @p start and @p end is equal, and their time + specifications (i.e. time zone etc.) are the same, the duration will be + set in terms of days. Otherwise, the duration will be set in terms of + seconds. + + @param start is the time the duration begins. + @param end is the time the duration ends. + */ + Duration(const QDateTime &start, const QDateTime &end); + + /** + Constructs a duration from @p start to @p end. + + If @p type is Days, and the time of day in @p start's time zone differs + between @p start and @p end, the duration will be rounded down to the + nearest whole number of days. + + @param start is the time the duration begins. + @param end is the time the duration ends. + @param type the unit of time to use (seconds or days) + */ + Duration(const QDateTime &start, const QDateTime &end, Type type); + + /** + Constructs a duration with a number of seconds or days. + + @param duration the number of seconds or days in the duration + @param type the unit of time to use (seconds or days) + */ + // Keep the following implicit since instances are often used in integer evaluations. + Duration(int duration, Type type = Seconds); // krazy:exclude=explicit + + /** + Constructs a duration by copying another duration object. + + @param duration is the duration to copy. + */ + Duration(const Duration &duration); + + /** + Destroys a duration. + */ + ~Duration(); + + /** + Sets this duration equal to @p duration. + + @param duration is the duration to copy. + */ + Duration &operator=(const Duration &duration); + + /** + Returns true if this duration is non-zero. + */ + operator bool() const; + + /** + Returns true if this duration is zero. + */ + bool operator!() const + { + return !operator bool(); + } + + /** + Returns true if this duration is smaller than the @p other. + @param other is the other duration to compare. + */ + bool operator<(const Duration &other) const; + + /** + Returns true if this duration is smaller than or equal to the @p other. + @param other is the other duration to compare. + */ + bool operator<=(const Duration &other) const + { + return !other.operator<(*this); + } + + /** + Returns true if this duration is greater than the @p other. + @param other is the other duration to compare. + */ + bool operator>(const Duration &other) const + { + return other.operator<(*this); + } + + /** + Returns true if this duration is greater than or equal to the @p other. + @param other is the other duration to compare. + */ + bool operator>=(const Duration &other) const + { + return !operator<(other); + } + + /** + Returns true if this duration is equal to the @p other. + Daily and non-daily durations are always considered unequal, since a + day's duration may differ from 24 hours if it happens to span a daylight + saving time change. + @param other the other duration to compare + */ + bool operator==(const Duration &other) const; + + /** + Returns true if this duration is not equal to the @p other. + Daily and non-daily durations are always considered unequal, since a + day's duration may differ from 24 hours if it happens to span a daylight + saving time change. + @param other is the other duration to compare. + */ + bool operator!=(const Duration &other) const + { + return !operator==(other); + } + + /** + Adds another duration to this one. + If one is in terms of days and the other in terms of seconds, + the result is in terms of seconds. + @param other the other duration to add + */ + Duration &operator+=(const Duration &other); + + /** + Adds two durations. + If one is in terms of days and the other in terms of seconds, + the result is in terms of seconds. + + @param other the other duration to add + @return combined duration + */ + Duration operator+(const Duration &other) const + { + return Duration(*this) += other; + } + + /** + Returns the negative of this duration. + */ + Duration operator-() const; + + /** + Subtracts another duration from this one. + If one is in terms of days and the other in terms of seconds, + the result is in terms of seconds. + + @param other the other duration to subtract + */ + Duration &operator-=(const Duration &other); + + /** + Returns the difference between another duration and this. + If one is in terms of days and the other in terms of seconds, + the result is in terms of seconds. + + @param other the other duration to subtract + @return difference in durations + */ + Duration operator-(const Duration &other) const + { + return Duration(*this) += other; + } + + /** + Multiplies this duration by a value. + @param value value to multiply by + */ + Duration &operator*=(int value); + + /** + Multiplies a duration by a value. + + @param value value to multiply by + @return resultant duration + */ + Duration operator*(int value) const + { + return Duration(*this) *= value; + } + + /** + Divides this duration by a value. + @param value value to divide by + */ + Duration &operator/=(int value); + + /** + Divides a duration by a value. + + @param value value to divide by + @return resultant duration + */ + Duration operator/(int value) const + { + return Duration(*this) /= value; + } + + /** + Computes a duration end time by adding the number of seconds or + days in the duration to the specified @p start time. + + @param start is the start time. + @return end time. + */ + Q_REQUIRED_RESULT QDateTime end(const QDateTime &start) const; + + /** + Returns the time units (seconds or days) used to specify the duration. + */ + Q_REQUIRED_RESULT Type type() const; + + /** + Returns whether the duration is specified in terms of days rather + than seconds. + */ + Q_REQUIRED_RESULT bool isDaily() const; + + /** + Returns the length of the duration in seconds. + */ + Q_REQUIRED_RESULT int asSeconds() const; + + /** + Returns the length of the duration in days. If the duration is + not an exact number of days, it is rounded down to return the + number of whole days. + */ + Q_REQUIRED_RESULT int asDays() const; + + /** + Returns the length of the duration in seconds or days. + + @return if isDaily(), duration in days, else duration in seconds + */ + Q_REQUIRED_RESULT int value() const; + + /** + Returns true if the duration is 0 seconds. + */ + Q_REQUIRED_RESULT bool isNull() const; + +private: + //@cond PRIVATE + class Private; + Private *const d; + //@endcond + + friend Q_CORE_EXPORT QDataStream &operator<<(QDataStream &s, const KCalendarCore::Duration &); + friend Q_CORE_EXPORT QDataStream &operator>>(QDataStream &s, KCalendarCore::Duration &); +}; + +/** + * Duration serializer. + * + * @since 4.12 + */ +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &out, const KCalendarCore::Duration &); + +/** + * Duration deserializer. + * + * @since 4.12 + */ +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &in, KCalendarCore::Duration &); + +inline uint qHash(const Duration &duration, uint seed = 0) +{ + QtPrivate::QHashCombine hash; + seed = hash(seed, duration.isDaily()); + seed = hash(seed, duration.asSeconds()); + return seed; +} + +} // namespace KCalendarCore + +Q_DECLARE_METATYPE(KCalendarCore::Duration) + +#endif diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/event.cpp dde-calendar-5.10.0/3rdparty/kcalendarcore/src/event.cpp --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/event.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/event.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,343 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 2001 Cornelius Schumacher + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +/** + @file + This file is part of the API for handling calendar data and + defines the Event class. + + @brief + This class provides an Event in the sense of RFC2445. + + @author Cornelius Schumacher \ +*/ + +#include "event.h" +#include "utils_p.h" +#include "visitor.h" + +#include +#include + +using namespace KCalendarCore; + +/** + Private class that helps to provide binary compatibility between releases. + @internal +*/ +//@cond PRIVATE +class Q_DECL_HIDDEN KCalendarCore::Event::Private +{ +public: + QDateTime mDtEnd; + Transparency mTransparency = Opaque; + bool mMultiDayValid = false; + bool mMultiDay = false; + bool mIsLunnar = false; //是否为农历 +}; +//@endcond + +Event::Event() + : d(new KCalendarCore::Event::Private) +{ +} + +Event::Event(const Event &other) + : Incidence(other) + , d(new KCalendarCore::Event::Private(*other.d)) +{ +} + +Event::Event(const Incidence &other) + : Incidence(other) + , d(new KCalendarCore::Event::Private) +{ +} + +Event::~Event() +{ + delete d; +} + +Event *Event::clone() const +{ + return new Event(*this); +} + +IncidenceBase &Event::assign(const IncidenceBase &other) +{ + if (&other != this) { + Incidence::assign(other); + const Event *e = static_cast(&other); + *d = *(e->d); + } + return *this; +} + +bool Event::equals(const IncidenceBase &event) const +{ + if (!Incidence::equals(event)) { + return false; + } else { + // If they weren't the same type IncidenceBase::equals would had returned false already + const Event *e = static_cast(&event); + return ((dtEnd() == e->dtEnd()) || (!dtEnd().isValid() && !e->dtEnd().isValid())) && transparency() == e->transparency(); + } +} + +Incidence::IncidenceType Event::type() const +{ + return TypeEvent; +} + +QByteArray Event::typeStr() const +{ + return QByteArrayLiteral("Event"); +} + +void Event::setDtStart(const QDateTime &dt) +{ + d->mMultiDayValid = false; + Incidence::setDtStart(dt); +} + +void Event::setDtEnd(const QDateTime &dtEnd) +{ + if (mReadOnly) { + return; + } + + if (d->mDtEnd != dtEnd || hasDuration() == dtEnd.isValid()) { + update(); + d->mDtEnd = dtEnd; + d->mMultiDayValid = false; + setHasDuration(!dtEnd.isValid()); + setFieldDirty(FieldDtEnd); + updated(); + } +} + +QDateTime Event::dtEnd() const +{ + if (d->mDtEnd.isValid()) { + return d->mDtEnd; + } + + if (hasDuration()) { + if (allDay()) { + // For all day events, dtEnd is always inclusive + QDateTime end = duration().end(dtStart().addDays(-1)); + return end >= dtStart() ? end : dtStart(); + } else { + return duration().end(dtStart()); + } + } + + // It is valid for a VEVENT to be without a DTEND. See RFC2445, Sect4.6.1. + // Be careful to use Event::dateEnd() as appropriate due to this possibility. + return dtStart(); +} + +QDate Event::dateEnd() const +{ + QDateTime end = dtEnd().toTimeZone(dtStart().timeZone()); + if (allDay()) { + return end.date(); + } else { + return end.addSecs(-1).date(); + } +} + +bool Event::hasEndDate() const +{ + return d->mDtEnd.isValid(); +} + +bool Event::isMultiDay(const QTimeZone &zone) const +{ + // First off, if spec's not valid, we can check for cache + if (!zone.isValid() && d->mMultiDayValid) { + return d->mMultiDay; + } + + // Not in cache -> do it the hard way + QDateTime start, end; + + if (!zone.isValid()) { + start = dtStart(); + end = dtEnd(); + } else { + start = dtStart().toTimeZone(zone); + end = dtEnd().toTimeZone(zone); + } + + bool multi = (start < end && start.date() != end.date()); + + // End date is non inclusive + // If we have an incidence that duration is one day and ends with a start of a new day + // than it is not a multiday event + if (multi && end.time() == QTime(0, 0, 0)) { + multi = start.daysTo(end) > 1; + } + + // Update the cache + // Also update Cache if spec is invalid + d->mMultiDayValid = true; + d->mMultiDay = multi; + return multi; +} + +void Event::shiftTimes(const QTimeZone &oldZone, const QTimeZone &newZone) +{ + Incidence::shiftTimes(oldZone, newZone); + if (d->mDtEnd.isValid()) { + d->mDtEnd = d->mDtEnd.toTimeZone(oldZone); + d->mDtEnd.setTimeZone(newZone); + } +} + +void Event::setTransparency(Event::Transparency transparency) +{ + if (mReadOnly) { + return; + } + update(); + d->mTransparency = transparency; + setFieldDirty(FieldTransparency); + updated(); +} + +Event::Transparency Event::transparency() const +{ + return d->mTransparency; +} + +void Event::setDuration(const Duration &duration) +{ + setDtEnd(QDateTime()); + Incidence::setDuration(duration); +} + +void Event::setAllDay(bool allday) +{ + if (allday != allDay() && !mReadOnly) { + setFieldDirty(FieldDtEnd); + Incidence::setAllDay(allday); + } +} + +void Event::setLunnar(bool lunnar) +{ + if (d->mIsLunnar == lunnar) + return; + update(); + d->mIsLunnar = lunnar; + updated(); +} + +bool Event::lunnar() const +{ + return d->mIsLunnar; +} + +bool Event::accept(Visitor &v, const IncidenceBase::Ptr &incidence) +{ + return v.visit(incidence.staticCast()); +} + +QDateTime Event::dateTime(DateTimeRole role) const +{ + switch (role) { + case RoleRecurrenceStart: + case RoleAlarmStartOffset: + case RoleStartTimeZone: + case RoleSort: + return dtStart(); + case RoleCalendarHashing: + return !recurs() && !isMultiDay() ? dtStart() : QDateTime(); + case RoleAlarmEndOffset: + case RoleEndTimeZone: + case RoleEndRecurrenceBase: + case RoleEnd: + case RoleDisplayEnd: + return dtEnd(); + case RoleDisplayStart: + return dtStart(); + case RoleAlarm: + if (alarms().isEmpty()) { + return QDateTime(); + } else { + Alarm::Ptr alarm = alarms().at(0); + return alarm->hasStartOffset() ? dtStart() : dtEnd(); + } + default: + return QDateTime(); + } +} + +void Event::setDateTime(const QDateTime &dateTime, DateTimeRole role) +{ + switch (role) { + case RoleDnD: { + const qint64 duration = dtStart().secsTo(dtEnd()); + + setDtStart(dateTime); + setDtEnd(dateTime.addSecs(duration <= 0 ? 3600 : duration)); + break; + } + case RoleEnd: + setDtEnd(dateTime); + break; + default: + qDebug() << "Unhandled role" << role; + } +} + +void Event::virtual_hook(VirtualHook id, void *data) +{ + Q_UNUSED(id); + Q_UNUSED(data); +} + +QLatin1String KCalendarCore::Event::mimeType() const +{ + return Event::eventMimeType(); +} + +QLatin1String Event::eventMimeType() +{ + return QLatin1String("application/x-vnd.akonadi.calendar.event"); +} + +QLatin1String Event::iconName(const QDateTime &) const +{ + return QLatin1String("view-calendar-day"); +} + +void Event::serialize(QDataStream &out) const +{ + Incidence::serialize(out); + serializeQDateTimeAsKDateTime(out, d->mDtEnd); + out << hasEndDate() << static_cast(d->mTransparency) << d->mMultiDayValid << d->mMultiDay; +} + +void Event::deserialize(QDataStream &in) +{ + Incidence::deserialize(in); + bool hasEndDateDummy = true; + deserializeKDateTimeAsQDateTime(in, d->mDtEnd); + in >> hasEndDateDummy; + quint32 transp; + in >> transp; + d->mTransparency = static_cast(transp); + in >> d->mMultiDayValid >> d->mMultiDay; +} + +bool Event::supportsGroupwareCommunication() const +{ + return true; +} diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/event.h dde-calendar-5.10.0/3rdparty/kcalendarcore/src/event.h --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/event.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/event.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,279 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 2001-2003 Cornelius Schumacher + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +/** + @file + This file is part of the API for handling calendar data and + defines the Event class. + + @author Cornelius Schumacher \ +*/ +#ifndef KCALCORE_EVENT_H +#define KCALCORE_EVENT_H + +#include "incidence.h" + +#include + +namespace KCalendarCore { +/** + @brief + This class provides an Event in the sense of RFC2445. + 此类提供RFC2445意义上的事件。 +*/ +class Q_CORE_EXPORT Event : public Incidence +{ + Q_GADGET + Q_PROPERTY(QDateTime dtEnd READ dtEnd WRITE setDtEnd) + Q_PROPERTY(KCalendarCore::Event::Transparency transparency READ transparency WRITE setTransparency) +public: + /** + The different Event transparency types. + */ + enum Transparency { + Opaque, /**< Event appears in free/busy time */ + Transparent, /**< Event does @b not appear in free/busy time */ + }; + Q_ENUM(Transparency) + + /** + A shared pointer to an Event object. + */ + typedef QSharedPointer Ptr; + + /** + List of events. + */ + typedef QVector List; + + ///@cond PRIVATE + // needed for Akonadi polymorphic payload support + typedef Incidence SuperClass; + ///@endcond + + /** + Constructs an event. + */ + Event(); + + /** + Copy constructor. + @param other is the event to copy. + */ + Event(const Event &other); + + /** + Costructs an event out of an incidence + This constructs allows to make it easy to create an event from a todo. + @param other is the incidence to copy. + @since 4.14 + */ + Event(const Incidence &other); // krazy:exclude=explicit (copy ctor) + + /** + Destroys the event. + */ + ~Event() override; + + /** + @copydoc + IncidenceBase::type() + */ + Q_REQUIRED_RESULT IncidenceType type() const override; + + /** + @copydoc + IncidenceBase::typeStr() + */ + Q_REQUIRED_RESULT QByteArray typeStr() const override; + + /** + Returns an exact copy of this Event. The caller owns the returned object. + */ + Event *clone() const override; + + /** + Sets the incidence starting date/time. + 设置事件开始日期/时间。 + + @param dt is the starting date/time. + @see IncidenceBase::dtStart(). + */ + void setDtStart(const QDateTime &dt) override; + + /** + Sets the event end date and time. + Important note for all day events: the end date is inclusive, + the event will still occur during dtEnd(). When serializing to iCalendar + DTEND will be dtEnd()+1, because the RFC states that DTEND is exclusive. + @param dtEnd is a QDateTime specifying when the event ends. + @see dtEnd(), dateEnd(). + */ + void setDtEnd(const QDateTime &dtEnd); + + /** + Returns the event end date and time. + Important note for all day events: the returned end date is inclusive, + the event will still occur during dtEnd(). When serializing to iCalendar + DTEND will be dtEnd()+1, because the RFC states that DTEND is exclusive. + @see setDtEnd(). + */ + virtual QDateTime dtEnd() const; + + /** + Returns the date when the event ends. This might be different from + dtEnd().date, since the end date/time is non-inclusive. So timed events + ending at 0:00 have their end date on the day before. + 返回事件结束的日期。这可能与dtEnd()的日期不同,因为结束日期/时间不包括在内。因此,在0:00结束的定时事件的结束日期为前一天 + */ + Q_REQUIRED_RESULT QDate dateEnd() const; + + /** + Returns whether the event has an end date/time. + */ + Q_REQUIRED_RESULT bool hasEndDate() const; + + /** + Returns true if the event spans multiple days, otherwise return false. + 如果事件跨越多天,则返回true,否则返回false。 + + For recurring events, it returns true if the first occurrence spans multiple days, + otherwise returns false. Other occurrences might have a different span due to day light + savings changes. + + 对于重复发生的事件,如果第一次发生跨越多天,则返回true,否则返回false。由于日光节约的变化,其他事件可能会有不同的跨度 + + @param zone If set, looks if the event is multiday for the given zone. + If not set, looks if event this multiday for its zone. + */ + Q_REQUIRED_RESULT bool isMultiDay(const QTimeZone &zone = {}) const; + + /** + @copydoc + IncidenceBase::shiftTimes() + */ + void shiftTimes(const QTimeZone &oldZone, const QTimeZone &newZone) override; + + /** + Sets the event's time transparency level. + 设置事件的时间透明度级别。 + @param transparency is the event Transparency level. + */ + void setTransparency(Transparency transparency); + + /** + Returns the event's time transparency level. + */ + Q_REQUIRED_RESULT Transparency transparency() const; + + /** + Sets the duration of this event. + 设置此事件的持续时间。 + @param duration is the event Duration. + */ + void setDuration(const Duration &duration) override; + + /** + @copydoc + IncidenceBase::setAllDay(). + */ + void setAllDay(bool allDay) override; + + //设置是否为农历日程 + void setLunnar(bool lunnar); + bool lunnar() const; + + /** + @copydoc + IncidenceBase::dateTime() + */ + Q_REQUIRED_RESULT QDateTime dateTime(DateTimeRole role) const override; + + /** + @copydoc + IncidenceBase::setDateTime() + */ + void setDateTime(const QDateTime &dateTime, DateTimeRole role) override; + + /** + @copydoc + IncidenceBase::mimeType() + */ + Q_REQUIRED_RESULT QLatin1String mimeType() const override; + + /** + @copydoc + Incidence::iconName() + */ + Q_REQUIRED_RESULT QLatin1String iconName(const QDateTime &recurrenceId = {}) const override; + + /** + @copydoc + Incidence::supportsGroupwareCommunication() + 支持群件通信 + */ + Q_REQUIRED_RESULT bool supportsGroupwareCommunication() const override; + + /** + Returns the Akonadi specific sub MIME type of a KCalendarCore::Event. + */ + Q_REQUIRED_RESULT static QLatin1String eventMimeType(); + +protected: + /** + Compares two events for equality. + 比较两个事件是否相等。 + @param event is the event to compare. + */ + bool equals(const IncidenceBase &event) const override; + + /** + @copydoc + IncidenceBase::assign() + */ + IncidenceBase &assign(const IncidenceBase &other) override; + + /** + @copydoc + IncidenceBase::virtual_hook() + */ + void virtual_hook(VirtualHook id, void *data) override; + +private: + /** + @copydoc + IncidenceBase::accept() + */ + bool accept(Visitor &v, const IncidenceBase::Ptr &incidence) override; + + /** + Disabled, otherwise could be dangerous if you subclass Event. + Use IncidenceBase::operator= which is safe because it calls + virtual function assign(). + @param other is another Event object to assign to this one. + */ + Event &operator=(const Event &other); + + // For polymorfic serialization + void serialize(QDataStream &out) const override; + void deserialize(QDataStream &in) override; + + //@cond PRIVATE + class Private; + Private *const d; + //@endcond +}; + +} // namespace KCalendarCore + +//@cond PRIVATE +Q_DECLARE_TYPEINFO(KCalendarCore::Event::Ptr, Q_MOVABLE_TYPE); +Q_DECLARE_METATYPE(KCalendarCore::Event::Ptr) +Q_DECLARE_METATYPE(KCalendarCore::Event *) +//@endcond + +#endif diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/exceptions.cpp dde-calendar-5.10.0/3rdparty/kcalendarcore/src/exceptions.cpp --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/exceptions.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/exceptions.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,62 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 2001 Cornelius Schumacher + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +/** + @file + This file is part of the API for handling calendar data and + defines the Exception class. + + We don't use actual C++ exceptions right now. These classes are currently + returned by an error function; but we can build upon them, if/when we start + to use C++ exceptions. + + @brief + Exception base class. + + @author Cornelius Schumacher \ +*/ + +#include "exceptions.h" +#include "calformat.h" + +using namespace KCalendarCore; + +namespace KCalendarCore { +class ExceptionPrivate +{ +public: + /** + The current exception code. + */ + Exception::ErrorCode mCode; + + /** Arguments to pass to i18n(). */ + QStringList mArguments; +}; + +} // namespace KCalendarCore + +Exception::Exception(const ErrorCode code, const QStringList &arguments) + : d(new ExceptionPrivate) +{ + d->mCode = code; + d->mArguments = arguments; +} + +Exception::~Exception() +{ +} + +Exception::ErrorCode Exception::code() const +{ + return d->mCode; +} + +QStringList Exception::arguments() const +{ + return d->mArguments; +} diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/exceptions.h dde-calendar-5.10.0/3rdparty/kcalendarcore/src/exceptions.h --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/exceptions.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/exceptions.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,100 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 2001-2003 Cornelius Schumacher + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +/** + @file + This file is part of the API for handling calendar data and + defines the Exception class. + + We don't use actual C++ exceptions right now. These classes are currently + returned by an error function; but we can build upon them, if/when we start + to use C++ exceptions. + + @brief + Exception base class. + + @author Cornelius Schumacher \ +*/ + +#ifndef KCALCORE_EXCEPTIONS_H +#define KCALCORE_EXCEPTIONS_H + +#include +#include + +#include + +namespace KCalendarCore { +class ExceptionPrivate; + +/** + Exception base class, currently used as a fancy kind of error code + and not as an C++ exception. +*/ +class Q_CORE_EXPORT Exception +{ +public: + /** + The different types of error codes + */ + enum ErrorCode { + LoadError, /**< Load error */ + SaveError, /**< Save error */ + ParseErrorIcal, /**< Parse error in libical */ + ParseErrorKcal, /**< Parse error in libkcal */ + NoCalendar, /**< No calendar component found */ + CalVersion1, /**< vCalendar v1.0 detected */ + CalVersion2, /**< iCalendar v2.0 detected */ + CalVersionUnknown, /**< Unknown calendar format detected */ + Restriction, /**< Restriction violation */ + UserCancel, /**< User canceled the operation */ + NoWritableFound, /**< No writable resource is available */ + SaveErrorOpenFile, + SaveErrorSaveFile, + LibICalError, + VersionPropertyMissing, + ExpectedCalVersion2, + ExpectedCalVersion2Unknown, + ParseErrorNotIncidence, + ParseErrorEmptyMessage, + ParseErrorUnableToParse, + ParseErrorMethodProperty, + }; + + /** + Construct an exception. + @param code is the error code. + @param arguments is a list of arguments that can be passed + to an i18n engine to help build a descriptive message for the user, a common + argument is for example the filename where the error occurred. + */ + explicit Exception(const ErrorCode code, const QStringList &arguments = QStringList()); + + /** + Destructor. + */ + virtual ~Exception(); + + /** + Returns the error code. + @return The ErrorCode for this exception. + */ + Q_REQUIRED_RESULT virtual ErrorCode code() const; + + /** + Returns the arguments. + @return A QStringList with the argument list for this exception. + */ + Q_REQUIRED_RESULT virtual QStringList arguments() const; + +private: + std::unique_ptr d; +}; + +} // namespace KCalendarCore + +#endif diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/filestorage.cpp dde-calendar-5.10.0/3rdparty/kcalendarcore/src/filestorage.cpp --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/filestorage.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/filestorage.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,172 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 2002 Cornelius Schumacher + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +/** + @file + This file is part of the API for handling calendar data and + defines the FileStorage class. + + @brief + This class provides a calendar storage as a local file. + + @author Cornelius Schumacher \ +*/ +#include "filestorage.h" +#include "exceptions.h" +#include "icalformat.h" +#include "memorycalendar.h" +#include "vcalformat.h" + +#include + +using namespace KCalendarCore; + +/* + Private class that helps to provide binary compatibility between releases. +*/ +//@cond PRIVATE +class Q_DECL_HIDDEN KCalendarCore::FileStorage::Private +{ +public: + Private(const QString &fileName, CalFormat *format) + : mFileName(fileName) + , mSaveFormat(format) + { + } + ~Private() + { + delete mSaveFormat; + } + + QString mFileName; + CalFormat *mSaveFormat = nullptr; +}; +//@endcond + +FileStorage::FileStorage(const Calendar::Ptr &cal, const QString &fileName, CalFormat *format) + : CalStorage(cal) + , d(new Private(fileName, format)) +{ +} + +FileStorage::~FileStorage() +{ + delete d; +} + +void FileStorage::setFileName(const QString &fileName) +{ + d->mFileName = fileName; +} + +QString FileStorage::fileName() const +{ + return d->mFileName; +} + +void FileStorage::setSaveFormat(CalFormat *format) +{ + delete d->mSaveFormat; + d->mSaveFormat = format; +} + +CalFormat *FileStorage::saveFormat() const +{ + return d->mSaveFormat; +} + +bool FileStorage::open() +{ + return true; +} + +bool FileStorage::load() +{ + if (d->mFileName.isEmpty()) { + qWarning() << "Empty filename while trying to load"; + return false; + } + + // Always try to load with iCalendar. It will detect, if it is actually a + // vCalendar file. + bool success; + QString productId; + // First try the supplied format. Otherwise fall through to iCalendar, then + // to vCalendar + success = saveFormat() && saveFormat()->load(calendar(), d->mFileName); + if (success) { + productId = saveFormat()->loadedProductId(); + } else { + ICalFormat iCal; + + success = iCal.load(calendar(), d->mFileName); + + if (success) { + productId = iCal.loadedProductId(); + } else { + if (iCal.exception()) { + if ((iCal.exception()->code() == Exception::ParseErrorIcal) || (iCal.exception()->code() == Exception::CalVersion1)) { + // Possible vCalendar or invalid iCalendar encountered + qDebug() << d->mFileName << " is an invalid iCalendar or possibly a vCalendar."; + qDebug() << "Try to load it as a vCalendar"; + VCalFormat vCal; + success = vCal.load(calendar(), d->mFileName); + productId = vCal.loadedProductId(); + if (!success) { + if (vCal.exception()) { + qWarning() << d->mFileName << " is not a valid vCalendar file." + << " exception code " << vCal.exception()->code(); + } + return false; + } + } else { + return false; + } + } else { + qWarning() << "There should be an exception set."; + return false; + } + } + } + + calendar()->setProductId(productId); + calendar()->setModified(false); + + return true; +} + +bool FileStorage::save() +{ + if (d->mFileName.isEmpty()) { + return false; + } + + CalFormat *format = d->mSaveFormat ? d->mSaveFormat : new ICalFormat; + + bool success = format->save(calendar(), d->mFileName); + + if (success) { + calendar()->setModified(false); + } else { + if (!format->exception()) { + qDebug() << "Error. There should be an exception set."; + } else { + qDebug() << int(format->exception()->code()); + } + } + + if (!d->mSaveFormat) { + delete format; + } + + return success; +} + +bool FileStorage::close() +{ + return true; +} diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/filestorage.h dde-calendar-5.10.0/3rdparty/kcalendarcore/src/filestorage.h --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/filestorage.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/filestorage.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,118 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 2002, 2003 Cornelius Schumacher + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +/** + @file + This file is part of the API for handling calendar data and + defines the FileStorage class. + + @author Cornelius Schumacher \ +*/ + +#ifndef KCALCORE_FILESTORAGE_H +#define KCALCORE_FILESTORAGE_H + +#include "calstorage.h" + +namespace KCalendarCore { +class CalFormat; +class Calendar; + +/** + @brief + This class provides a calendar storage as a local file. + 此类将日历存储作为本地文件提供。 +*/ +class Q_CORE_EXPORT FileStorage : public CalStorage +{ + Q_OBJECT +public: + /** + A shared pointer to a FileStorage. + */ + typedef QSharedPointer Ptr; + + /** + Constructs a new FileStorage object for Calendar @p calendar with format + @p format, and storage to file @p fileName. + + @param calendar is a pointer to a valid Calendar object. + @param fileName is the name of the disk file containing the calendar data. + @param format is a pointer to a valid CalFormat object that specifies + the calendar format to be used. FileStorage takes ownership; i.e., the + memory for @p format is deleted by this destructor. If no format is + specified, then iCalendar format is assumed. + */ + explicit FileStorage(const Calendar::Ptr &calendar, const QString &fileName = QString(), KCalendarCore::CalFormat *format = nullptr); + + /** + Destructor. + */ + ~FileStorage() override; + + /** + Sets the name of the file that contains the calendar data. + + @param fileName is the name of the disk file containing the calendar data. + @see fileName(). + */ + void setFileName(const QString &fileName); + + /** + Returns the calendar file name. + @return A QString with the name of the calendar file for this storge. + @see setFileName(). + */ + Q_REQUIRED_RESULT QString fileName() const; + + /** + Sets the CalFormat object to use for this storage. + + @param format is a pointer to a valid CalFormat object that specifies + the calendar format to be used. FileStorage takes ownership. + @see saveFormat(). + */ + void setSaveFormat(KCalendarCore::CalFormat *format); + + /** + Returns the CalFormat object used by this storage. + @return A pointer to the CalFormat object used by this storage. + @see setSaveFormat(). + */ + CalFormat *saveFormat() const; + + /** + @copydoc CalStorage::open() + */ + Q_REQUIRED_RESULT bool open() override; + + /** + @copydoc CalStorage::load() + */ + Q_REQUIRED_RESULT bool load() override; + + /** + @copydoc CalStorage::save() + */ + Q_REQUIRED_RESULT bool save() override; + + /** + @copydoc CalStorage::close() + */ + Q_REQUIRED_RESULT bool close() override; + +private: + //@cond PRIVATE + Q_DISABLE_COPY(FileStorage) + class Private; + Private *const d; + //@endcond +}; + +} // namespace KCalendarCore + +#endif diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/freebusycache.cpp dde-calendar-5.10.0/3rdparty/kcalendarcore/src/freebusycache.cpp --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/freebusycache.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/freebusycache.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,29 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 2004 Cornelius Schumacher + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +/** + @file + This file is part of the API for handling calendar data and + defines the FreeBusyCache abstract base class. + + @author Cornelius Schumacher \ +*/ + +#include "freebusycache.h" + +using namespace KCalendarCore; + +FreeBusyCache::~FreeBusyCache() +{ +} + +void FreeBusyCache::virtual_hook(int id, void *data) +{ + Q_UNUSED(id); + Q_UNUSED(data); + Q_ASSERT(false); +} diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/freebusycache.h dde-calendar-5.10.0/3rdparty/kcalendarcore/src/freebusycache.h --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/freebusycache.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/freebusycache.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,67 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 2004 Cornelius Schumacher + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +/** + @file + This file is part of the API for handling calendar data and + defines the FreeBusyCache abstract base class. + + @author Cornelius Schumacher \ +*/ + +#ifndef KCALCORE_FREEBUSYCACHE_H +#define KCALCORE_FREEBUSYCACHE_H + +#include "freebusy.h" + +class QString; + +namespace KCalendarCore { +class Person; + +/** + @brief + An abstract base class to allow different implementations of storing + free busy information, e.g. local storage or storage on a Kolab server. +*/ +class Q_CORE_EXPORT FreeBusyCache +{ +public: + /** + Destructor. + */ + virtual ~FreeBusyCache(); + + /** + Save freebusy information belonging to an email. + + @param freebusy is a pointer to a valid FreeBusy instance. + @param person is a valid Person instance. + @return true if the save was successful; false otherwise. + */ + virtual bool saveFreeBusy(const FreeBusy::Ptr &freebusy, const Person &person) = 0; + + /** + Load freebusy information belonging to an email. + + @param email is a QString containing a email string in the + "FirstName LastName " format. + @return A pointer to the FreeBusy object loaded for the specified email; returns 0 if + there was some problem attempting to load the FreeBusy information. + */ + virtual FreeBusy::Ptr loadFreeBusy(const QString &email) = 0; + +protected: + /** + @copydoc IncidenceBase::virtual_hook() + */ + virtual void virtual_hook(int id, void *data); +}; + +} // namespace KCalendarCore + +#endif diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/freebusy.cpp dde-calendar-5.10.0/3rdparty/kcalendarcore/src/freebusy.cpp --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/freebusy.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/freebusy.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,414 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 2001 Cornelius Schumacher + SPDX-FileCopyrightText: 2004 Reinhold Kainhofer + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +/** + @file + This file is part of the API for handling calendar data and + defines the FreeBusy class. + + @brief + Provides information about the free/busy time of a calendar user. + + @author Cornelius Schumacher \ + @author Reinhold Kainhofer \ +*/ +#include "freebusy.h" +#include "utils_p.h" +#include "visitor.h" + +#include "icalformat.h" + +#include +#include + +using namespace KCalendarCore; + +//@cond PRIVATE +class Q_DECL_HIDDEN KCalendarCore::FreeBusy::Private +{ +private: + FreeBusy *q; + +public: + Private(FreeBusy *qq) + : q(qq) + { + } + + Private(const KCalendarCore::FreeBusy::Private &other, FreeBusy *qq) + : q(qq) + { + init(other); + } + + Private(const FreeBusyPeriod::List &busyPeriods, FreeBusy *qq) + : q(qq) + , mBusyPeriods(busyPeriods) + { + } + + void init(const KCalendarCore::FreeBusy::Private &other); + void init(const Event::List &events, const QDateTime &start, const QDateTime &end); + + QDateTime mDtEnd; // end datetime + FreeBusyPeriod::List mBusyPeriods; // list of periods + + // This is used for creating a freebusy object for the current user + bool addLocalPeriod(FreeBusy *fb, const QDateTime &start, const QDateTime &end); +}; + +void KCalendarCore::FreeBusy::Private::init(const KCalendarCore::FreeBusy::Private &other) +{ + mDtEnd = other.mDtEnd; + mBusyPeriods = other.mBusyPeriods; +} +//@endcond + +FreeBusy::FreeBusy() + : d(new KCalendarCore::FreeBusy::Private(this)) +{ +} + +FreeBusy::FreeBusy(const FreeBusy &other) + : IncidenceBase(other) + , d(new KCalendarCore::FreeBusy::Private(*other.d, this)) +{ +} + +FreeBusy::FreeBusy(const QDateTime &start, const QDateTime &end) + : d(new KCalendarCore::FreeBusy::Private(this)) +{ + setDtStart(start); // NOLINT false clang-analyzer-optin.cplusplus.VirtualCall + setDtEnd(end); // NOLINT false clang-analyzer-optin.cplusplus.VirtualCall +} + +FreeBusy::FreeBusy(const Event::List &events, const QDateTime &start, const QDateTime &end) + : d(new KCalendarCore::FreeBusy::Private(this)) +{ + setDtStart(start); // NOLINT false clang-analyzer-optin.cplusplus.VirtualCall + setDtEnd(end); // NOLINT false clang-analyzer-optin.cplusplus.VirtualCall + + d->init(events, start, end); +} + +//@cond PRIVATE +void FreeBusy::Private::init(const Event::List &eventList, const QDateTime &start, const QDateTime &end) +{ + const qint64 duration = start.daysTo(end); + QDate day; + QDateTime tmpStart; + QDateTime tmpEnd; + + // Loops through every event in the calendar + Event::List::ConstIterator it; + for (it = eventList.constBegin(); it != eventList.constEnd(); ++it) { + Event::Ptr event = *it; + + // If this event is transparent it shouldn't be in the freebusy list. + if (event->transparency() == Event::Transparent) { + continue; + } + + // The code below can not handle all-day events. Fixing this resulted + // in a lot of duplicated code. Instead, make a copy of the event and + // set the period to the full day(s). This trick works for recurring, + // multiday, and single day all-day events. + Event::Ptr allDayEvent; + if (event->allDay()) { + // addDay event. Do the hack + qDebug() << "All-day event"; + allDayEvent = Event::Ptr(new Event(*event)); + + // Set the start and end times to be on midnight + QDateTime st = allDayEvent->dtStart(); + st.setTime(QTime(0, 0)); + QDateTime nd = allDayEvent->dtEnd(); + nd.setTime(QTime(23, 59, 59, 999)); + allDayEvent->setAllDay(false); + allDayEvent->setDtStart(st); + allDayEvent->setDtEnd(nd); + + qDebug() << "Use:" << st.toString() << "to" << nd.toString(); + // Finally, use this event for the setting below + event = allDayEvent; + } + + // This whole for loop is for recurring events, it loops through + // each of the days of the freebusy request + + for (qint64 i = 0; i <= duration; ++i) { + day = start.addDays(i).date(); + tmpStart.setDate(day); + tmpEnd.setDate(day); + + if (event->recurs()) { + if (event->isMultiDay()) { + // FIXME: This doesn't work for sub-daily recurrences or recurrences with + // a different time than the original event. + const qint64 extraDays = event->dtStart().daysTo(event->dtEnd()); + for (qint64 x = 0; x <= extraDays; ++x) { + if (event->recursOn(day.addDays(-x), start.timeZone())) { + tmpStart.setDate(day.addDays(-x)); + tmpStart.setTime(event->dtStart().time()); + tmpEnd = event->duration().end(tmpStart); + + addLocalPeriod(q, tmpStart, tmpEnd); + break; + } + } + } else { + if (event->recursOn(day, start.timeZone())) { + tmpStart.setTime(event->dtStart().time()); + tmpEnd.setTime(event->dtEnd().time()); + + addLocalPeriod(q, tmpStart, tmpEnd); + } + } + } + } + + // Non-recurring events + addLocalPeriod(q, event->dtStart(), event->dtEnd()); + } + + q->sortList(); +} +//@endcond + +FreeBusy::FreeBusy(const Period::List &busyPeriods) + : d(new KCalendarCore::FreeBusy::Private(this)) +{ + addPeriods(busyPeriods); +} + +FreeBusy::FreeBusy(const FreeBusyPeriod::List &busyPeriods) + : d(new KCalendarCore::FreeBusy::Private(busyPeriods, this)) +{ +} + +FreeBusy::~FreeBusy() +{ + delete d; +} + +IncidenceBase::IncidenceType FreeBusy::type() const +{ + return TypeFreeBusy; +} + +QByteArray FreeBusy::typeStr() const +{ + return QByteArrayLiteral("FreeBusy"); +} + +void FreeBusy::setDtStart(const QDateTime &start) +{ + IncidenceBase::setDtStart(start.toUTC()); + updated(); +} + +void FreeBusy::setDtEnd(const QDateTime &end) +{ + d->mDtEnd = end; +} + +QDateTime FreeBusy::dtEnd() const +{ + return d->mDtEnd; +} + +Period::List FreeBusy::busyPeriods() const +{ + Period::List res; + + res.reserve(d->mBusyPeriods.count()); + for (const FreeBusyPeriod &p : qAsConst(d->mBusyPeriods)) { + res << p; + } + + return res; +} + +FreeBusyPeriod::List FreeBusy::fullBusyPeriods() const +{ + return d->mBusyPeriods; +} + +void FreeBusy::sortList() +{ + std::sort(d->mBusyPeriods.begin(), d->mBusyPeriods.end()); +} + +void FreeBusy::addPeriods(const Period::List &list) +{ + d->mBusyPeriods.reserve(d->mBusyPeriods.count() + list.count()); + for (const Period &p : qAsConst(list)) { + d->mBusyPeriods << FreeBusyPeriod(p); + } + sortList(); +} + +void FreeBusy::addPeriods(const FreeBusyPeriod::List &list) +{ + d->mBusyPeriods += list; + sortList(); +} + +void FreeBusy::addPeriod(const QDateTime &start, const QDateTime &end) +{ + d->mBusyPeriods.append(FreeBusyPeriod(start, end)); + sortList(); +} + +void FreeBusy::addPeriod(const QDateTime &start, const Duration &duration) +{ + d->mBusyPeriods.append(FreeBusyPeriod(start, duration)); + sortList(); +} + +void FreeBusy::merge(const FreeBusy::Ptr &freeBusy) +{ + if (freeBusy->dtStart() < dtStart()) { + setDtStart(freeBusy->dtStart()); + } + + if (freeBusy->dtEnd() > dtEnd()) { + setDtEnd(freeBusy->dtEnd()); + } + + Period::List periods = freeBusy->busyPeriods(); + Period::List::ConstIterator it; + d->mBusyPeriods.reserve(d->mBusyPeriods.count() + periods.count()); + for (it = periods.constBegin(); it != periods.constEnd(); ++it) { + d->mBusyPeriods.append(FreeBusyPeriod((*it).start(), (*it).end())); + } + sortList(); +} + +void FreeBusy::shiftTimes(const QTimeZone &oldZone, const QTimeZone &newZone) +{ + if (oldZone.isValid() && newZone.isValid() && oldZone != newZone) { + IncidenceBase::shiftTimes(oldZone, newZone); + d->mDtEnd = d->mDtEnd.toTimeZone(oldZone); + d->mDtEnd.setTimeZone(newZone); + for (FreeBusyPeriod p : qAsConst(d->mBusyPeriods)) { + p.shiftTimes(oldZone, newZone); + } + } +} + +IncidenceBase &FreeBusy::assign(const IncidenceBase &other) +{ + if (&other != this) { + IncidenceBase::assign(other); + const FreeBusy *f = static_cast(&other); + d->init(*(f->d)); + } + return *this; +} + +bool FreeBusy::equals(const IncidenceBase &freeBusy) const +{ + if (!IncidenceBase::equals(freeBusy)) { + return false; + } else { + // If they weren't the same type IncidenceBase::equals would had returned false already + const FreeBusy *fb = static_cast(&freeBusy); + return dtEnd() == fb->dtEnd() && d->mBusyPeriods == fb->d->mBusyPeriods; + } +} + +bool FreeBusy::accept(Visitor &v, const IncidenceBase::Ptr &incidence) +{ + return v.visit(incidence.staticCast()); +} + +QDateTime FreeBusy::dateTime(DateTimeRole role) const +{ + Q_UNUSED(role); + // No roles affecting freeBusy yet + return QDateTime(); +} + +void FreeBusy::setDateTime(const QDateTime &dateTime, DateTimeRole role) +{ + Q_UNUSED(dateTime); + Q_UNUSED(role); +} + +void FreeBusy::virtual_hook(VirtualHook id, void *data) +{ + Q_UNUSED(id); + Q_UNUSED(data); + Q_ASSERT(false); +} + +//@cond PRIVATE +bool FreeBusy::Private::addLocalPeriod(FreeBusy *fb, const QDateTime &eventStart, const QDateTime &eventEnd) +{ + QDateTime tmpStart; + QDateTime tmpEnd; + + // Check to see if the start *or* end of the event is + // between the start and end of the freebusy dates. + QDateTime start = fb->dtStart(); + if (!(((start.secsTo(eventStart) >= 0) && (eventStart.secsTo(mDtEnd) >= 0)) || ((start.secsTo(eventEnd) >= 0) && (eventEnd.secsTo(mDtEnd) >= 0)))) { + return false; + } + + if (eventStart.secsTo(start) >= 0) { + tmpStart = start; + } else { + tmpStart = eventStart; + } + + if (eventEnd.secsTo(mDtEnd) <= 0) { + tmpEnd = mDtEnd; + } else { + tmpEnd = eventEnd; + } + + FreeBusyPeriod p(tmpStart, tmpEnd); + mBusyPeriods.append(p); + + return true; +} +//@endcond + +QLatin1String FreeBusy::mimeType() const +{ + return FreeBusy::freeBusyMimeType(); +} + +QLatin1String KCalendarCore::FreeBusy::freeBusyMimeType() +{ + return QLatin1String("application/x-vnd.akonadi.calendar.freebusy"); +} + +QDataStream &KCalendarCore::operator<<(QDataStream &stream, const KCalendarCore::FreeBusy::Ptr &freebusy) +{ + KCalendarCore::ICalFormat format; + QString data = format.createScheduleMessage(freebusy, iTIPPublish); + return stream << data; +} + +QDataStream &KCalendarCore::operator>>(QDataStream &stream, KCalendarCore::FreeBusy::Ptr &freebusy) +{ + QString freeBusyVCal; + stream >> freeBusyVCal; + + KCalendarCore::ICalFormat format; + freebusy = format.parseFreeBusy(freeBusyVCal); + + if (!freebusy) { + qDebug() << "Error parsing free/busy"; + qDebug() << freeBusyVCal; + } + + return stream; +} diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/freebusy.h dde-calendar-5.10.0/3rdparty/kcalendarcore/src/freebusy.h --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/freebusy.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/freebusy.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,277 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 2001-2003 Cornelius Schumacher + SPDX-FileCopyrightText: 2004 Reinhold Kainhofer + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +/** + @file + This file is part of the API for handling calendar data and + defines the FreeBusy class. + + @author Cornelius Schumacher \ + @author Reinhold Kainhofer \ +*/ + +#ifndef KCALCORE_FREEBUSY_H +#define KCALCORE_FREEBUSY_H + +#include "event.h" +#include "freebusyperiod.h" +#include "incidencebase.h" +#include "period.h" + +#include + +namespace KCalendarCore { +class FreeBusy; + +/** + @brief + Provides information about the free/busy time of a calendar. + + A free/busy is a collection of Periods. + + @see Period. +*/ +class Q_CORE_EXPORT FreeBusy : public IncidenceBase +{ + friend Q_CORE_EXPORT QDataStream &operator<<(QDataStream &s, const KCalendarCore::FreeBusy::Ptr &freebusy); + friend Q_CORE_EXPORT QDataStream &operator>>(QDataStream &s, KCalendarCore::FreeBusy::Ptr &freebusy); + +public: + /** + A shared pointer to a FreeBusy object. + */ + typedef QSharedPointer Ptr; + + /** + List of FreeBusy objects. + */ + typedef QVector List; + + /** + Constructs an free/busy without any periods. + */ + FreeBusy(); + + /** + Copy constructor. + @param other is the free/busy to copy. + */ + FreeBusy(const FreeBusy &other); + + /** + Constructs a free/busy from a list of periods. + @param busyPeriods is a list of periods. + */ + explicit FreeBusy(const Period::List &busyPeriods); + + /** + Constructs a free/busy from a list of periods. + @param busyPeriods is a list of periods. + */ + explicit FreeBusy(const FreeBusyPeriod::List &busyPeriods); + + /** + Constructs a free/busy from a single period. + + @param start is the start date/time of the period. + @param end is the end date/time of the period. + */ + FreeBusy(const QDateTime &start, const QDateTime &end); + + /** + Constructs a freebusy for a specified list of events given a single period. + + @param events list of events. + @param start is the start date/time of the period. + @param end is the end date/time of the period. + */ + FreeBusy(const Event::List &events, const QDateTime &start, const QDateTime &end); + + /** + Destroys a free/busy. + */ + ~FreeBusy() override; + + /** + @copydoc + IncidenceBase::type() + */ + Q_REQUIRED_RESULT IncidenceType type() const override; + + /** + @copydoc + IncidenceBase::typeStr() + */ + Q_REQUIRED_RESULT QByteArray typeStr() const override; + + /** + Sets the start date/time for the free/busy. Note that this date/time + may be later or earlier than all periods within the free/busy. + + @param start is a QDateTime specifying an start datetime. + @see IncidenceBase::dtStart(), setDtEnd(). + */ + void setDtStart(const QDateTime &start) override; + + /** + Sets the end datetime for the free/busy. Note that this datetime + may be later or earlier than all periods within the free/busy. + + @param end is a QDateTime specifying an end datetime. + @see dtEnd(), setDtStart(). + */ + void setDtEnd(const QDateTime &end); + + /** + Returns the end datetime for the free/busy. + FIXME: calling addPeriod() does not change mDtEnd. Is that incorrect? + @see setDtEnd(). + */ + Q_REQUIRED_RESULT virtual QDateTime dtEnd() const; + + /** + @copydoc + IncidenceBase::shiftTimes() + */ + void shiftTimes(const QTimeZone &oldZone, const QTimeZone &newZone) override; + + /** + Returns the list of all periods within the free/busy. + */ + Q_REQUIRED_RESULT Period::List busyPeriods() const; + + /** + Returns the list of all periods within the free/busy. + */ + Q_REQUIRED_RESULT FreeBusyPeriod::List fullBusyPeriods() const; + + /** + Adds a period to the freebusy list and sorts the list. + + @param start is the start datetime of the period. + @param end is the end datetime of the period. + */ + void addPeriod(const QDateTime &start, const QDateTime &end); + + /** + Adds a period to the freebusy list and sorts the list. + + @param start is the start datetime of the period. + @param duration is the Duration of the period. + */ + void addPeriod(const QDateTime &start, const Duration &duration); + + /** + Adds a list of periods to the freebusy object and then sorts that list. + Use this if you are adding many items, instead of the addPeriod method, + to avoid sorting repeatedly. + + @param list is a list of Period objects. + */ + void addPeriods(const Period::List &list); + + /** + Adds a list of periods to the freebusy object and then sorts that list. + Use this if you are adding many items, instead of the addPeriod method, + to avoid sorting repeatedly. + + @param list is a list of FreeBusyPeriod objects. + */ + void addPeriods(const FreeBusyPeriod::List &list); + + /** + Sorts the list of free/busy periods into ascending order. + */ + void sortList(); + + /** + Merges another free/busy into this free/busy. + + @param freebusy is a pointer to a valid FreeBusy object. + */ + void merge(const FreeBusy::Ptr &freebusy); + + /** + @copydoc + IncidenceBase::dateTime() + */ + Q_REQUIRED_RESULT QDateTime dateTime(DateTimeRole role) const override; + + /** + @copydoc + IncidenceBase::setDateTime() + */ + void setDateTime(const QDateTime &dateTime, DateTimeRole role) override; + + /** + @copydoc + IncidenceBase::mimeType() + */ + Q_REQUIRED_RESULT QLatin1String mimeType() const override; + + /** + Returns the Akonadi specific sub MIME type of a KCalendarCore::FreeBusy. + */ + Q_REQUIRED_RESULT static QLatin1String freeBusyMimeType(); + +protected: + /** + Compare this with @p freebusy for equality. + @param freebusy is the FreeBusy to compare. + */ + bool equals(const IncidenceBase &freebusy) const override; + + /** + @copydoc + IncidenceBase::assign() + */ + IncidenceBase &assign(const IncidenceBase &other) override; + + /** + @copydoc + IncidenceBase::virtual_hook() + */ + void virtual_hook(VirtualHook id, void *data) override; + +private: + /** + @copydoc + IncidenceBase::accept() + */ + bool accept(Visitor &v, const IncidenceBase::Ptr &incidence) override; + + /** + Disabled, otherwise could be dangerous if you subclass FreeBusy. + Use IncidenceBase::operator= which is safe because it calls + virtual function assign(). + @param other is another FreeBusy object to assign to this one. + */ + FreeBusy &operator=(const FreeBusy &other); + + //@cond PRIVATE + class Private; + Private *const d; + //@endcond +}; + +/** + Serializes the @p freebusy object into the @p stream. +*/ +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &stream, const KCalendarCore::FreeBusy::Ptr &freebusy); +/** + Initializes the @p freebusy object from the @p stream. +*/ +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &stream, KCalendarCore::FreeBusy::Ptr &freebusy); +} // namespace KCalendarCore + +//@cond PRIVATE +Q_DECLARE_TYPEINFO(KCalendarCore::FreeBusy::Ptr, Q_MOVABLE_TYPE); +Q_DECLARE_METATYPE(KCalendarCore::FreeBusy::Ptr) +//@endcond + +#endif diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/freebusyperiod.cpp dde-calendar-5.10.0/3rdparty/kcalendarcore/src/freebusyperiod.cpp --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/freebusyperiod.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/freebusyperiod.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,137 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 2001 Cornelius Schumacher + SPDX-FileCopyrightText: 2007 David Jarvie + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +/** + @file + This file is part of the API for handling calendar data and + defines the FreeBusyPeriod class. + + @brief + Represents a period of time. + + @author Cornelius Schumacher \ +*/ + +#include "freebusyperiod.h" + +using namespace KCalendarCore; + +//@cond PRIVATE +class Q_DECL_HIDDEN KCalendarCore::FreeBusyPeriod::Private +{ +public: + Private() + : mType(Unknown) + { + } + + QString mSummary; + QString mLocation; + FreeBusyType mType; +}; +//@endcond + +FreeBusyPeriod::FreeBusyPeriod() + : Period() + , d(new KCalendarCore::FreeBusyPeriod::Private()) +{ +} + +FreeBusyPeriod::FreeBusyPeriod(const QDateTime &start, const QDateTime &end) + : Period(start, end) + , d(new KCalendarCore::FreeBusyPeriod::Private()) +{ +} + +FreeBusyPeriod::FreeBusyPeriod(const QDateTime &start, const Duration &duration) + : Period(start, duration) + , d(new KCalendarCore::FreeBusyPeriod::Private()) +{ +} + +FreeBusyPeriod::FreeBusyPeriod(const FreeBusyPeriod &period) + : Period(period) + , d(new KCalendarCore::FreeBusyPeriod::Private(*period.d)) +{ +} + +FreeBusyPeriod::FreeBusyPeriod(const Period &period) + : Period(period) + , d(new KCalendarCore::FreeBusyPeriod::Private()) +{ +} + +FreeBusyPeriod::~FreeBusyPeriod() +{ + delete d; +} + +FreeBusyPeriod &FreeBusyPeriod::operator=(const FreeBusyPeriod &other) +{ + // check for self assignment + if (&other == this) { + return *this; + } + + Period::operator=(other); + *d = *other.d; + return *this; +} + +QString FreeBusyPeriod::summary() const +{ + return d->mSummary; +} + +void FreeBusyPeriod::setSummary(const QString &summary) +{ + d->mSummary = summary; +} + +QString FreeBusyPeriod::location() const +{ + return d->mLocation; +} + +void FreeBusyPeriod::setLocation(const QString &location) +{ + d->mLocation = location; +} + +FreeBusyPeriod::FreeBusyType FreeBusyPeriod::type() const +{ + return d->mType; +} + +void FreeBusyPeriod::setType(FreeBusyPeriod::FreeBusyType type) +{ + d->mType = type; +} + +QDataStream &KCalendarCore::operator<<(QDataStream &stream, const KCalendarCore::FreeBusyPeriod &period) +{ + KCalendarCore::Period periodParent = static_cast(period); + stream << periodParent; + stream << period.summary() << period.location() << static_cast(period.type()); + return stream; +} + +QDataStream &KCalendarCore::operator>>(QDataStream &stream, FreeBusyPeriod &period) +{ + KCalendarCore::Period periodParent; + QString summary, location; + int type; + + stream >> periodParent >> summary >> location >> type; + + period = periodParent; + period.setLocation(location); + period.setSummary(summary); + period.setType(static_cast(type)); + return stream; +} diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/freebusyperiod.h dde-calendar-5.10.0/3rdparty/kcalendarcore/src/freebusyperiod.h --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/freebusyperiod.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/freebusyperiod.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,158 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 2001-2003 Cornelius Schumacher + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +/** + @file + This file is part of the API for handling calendar data and + defines the Period class. + + @brief + Represents a period of time. + + @author Cornelius Schumacher \ +*/ + +#ifndef KCALCORE_FREEBUSYPERIOD_H +#define KCALCORE_FREEBUSYPERIOD_H + +#include "period.h" + +#include + +namespace KCalendarCore { +/** + The period can be defined by either a start time and an end time or + by a start time and a duration. +*/ +class Q_CORE_EXPORT FreeBusyPeriod : public Period +{ +public: + enum FreeBusyType { + Free, + Busy, + BusyUnavailable, + BusyTentative, + Unknown, + }; + + /** + List of periods. + */ + typedef QVector List; + + /** + Constructs a period without a duration. + */ + FreeBusyPeriod(); + + /** + Constructs a period from @p start to @p end. + + @param start the time the period begins. + @param end the time the period ends. + */ + FreeBusyPeriod(const QDateTime &start, const QDateTime &end); + + /** + Constructs a period from @p start and lasting @p duration. + + @param start the time when the period starts. + @param duration how long the period lasts. + */ + FreeBusyPeriod(const QDateTime &start, const Duration &duration); + + /** + Constructs a period by copying another period object + + @param period the period to copy + */ + + FreeBusyPeriod(const FreeBusyPeriod &period); + + /** + Constructs a period by copying another period object + + @param period the period to copy + */ + + FreeBusyPeriod(const Period &period); // krazy:exclude=explicit + + /** + Destroys a period. + */ + ~FreeBusyPeriod(); + + /** + Sets this period equal to the @p other one. + + @param other is the other period to compare. + */ + FreeBusyPeriod &operator=(const FreeBusyPeriod &other); + + /** + Sets the period summary. + @param summary is the period summary string. + @see summary(). + */ + void setSummary(const QString &summary); + + /** + Returns the period summary. + @see setSummary() + */ + Q_REQUIRED_RESULT QString summary() const; + + /** + Sets the period location. + @param location is the period location string. + @see location(). + */ + void setLocation(const QString &location); + + /** + Returns the period location. + @see setLocation() + */ + Q_REQUIRED_RESULT QString location() const; + + /** + Sets the free/busy type. + @param type is the type of free/busy period + @see type(). + @since 5.0 + */ + void setType(FreeBusyType type); + + /** + Returns free/busy type + @see setType(). + @since 5.0 + */ + Q_REQUIRED_RESULT FreeBusyType type() const; + +private: + //@cond PRIVATE + class Private; + Private *const d; + //@endcond + + friend Q_CORE_EXPORT QDataStream &operator<<(QDataStream &stream, const KCalendarCore::FreeBusyPeriod &period); + friend Q_CORE_EXPORT QDataStream &operator>>(QDataStream &stream, KCalendarCore::FreeBusyPeriod &period); +}; + +/** Write @p period to the datastream @p stream, in binary format. */ +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &stream, const KCalendarCore::FreeBusyPeriod &period); + +/** Read a Period object into @p period from @p stream, in binary format. */ +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &stream, KCalendarCore::FreeBusyPeriod &period); +} // namespace KCalendarCore + +//@cond PRIVATE +Q_DECLARE_METATYPE(KCalendarCore::FreeBusyPeriod) +//@endcond + +#endif diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/icalformat.cpp dde-calendar-5.10.0/3rdparty/kcalendarcore/src/icalformat.cpp --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/icalformat.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/icalformat.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,649 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 2001 Cornelius Schumacher + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +/** + @file + This file is part of the API for handling calendar data and + defines the ICalFormat class. + + @brief + iCalendar format implementation: a layer of abstraction for libical. + + @author Cornelius Schumacher \ +*/ +#include "icalformat.h" +#include "calendar_p.h" +#include "icalformat_p.h" +#include "icaltimezones_p.h" +#include "memorycalendar.h" + +#include +#include +#include +#include + +extern "C" { +#include "libical/ical.h" +#include "libical/icalmemory.h" +#include "libical/icalparser.h" +#include "libical/icalrestriction.h" +#include "libical/icalss.h" +} + +using namespace KCalendarCore; + +//@cond PRIVATE +class Q_DECL_HIDDEN KCalendarCore::ICalFormat::Private +{ +public: + Private(ICalFormat *parent) + : mImpl(new ICalFormatImpl(parent)) + , mTimeZone(QTimeZone::utc()) + { + } + ~Private() + { + delete mImpl; + } + ICalFormatImpl *mImpl = nullptr; + QTimeZone mTimeZone; +}; +//@endcond + +ICalFormat::ICalFormat() + : d(new Private(this)) +{ +} + +ICalFormat::~ICalFormat() +{ + icalmemory_free_ring(); + delete d; +} + +bool ICalFormat::load(const Calendar::Ptr &calendar, const QString &fileName) +{ + qDebug() << fileName; + + clearException(); + + QFile file(fileName); + if (!file.open(QIODevice::ReadOnly)) { + qCritical() << "load error: unable to open " << fileName; + setException(new Exception(Exception::LoadError)); + return false; + } + const QByteArray text = file.readAll().trimmed(); + file.close(); + + if (!text.isEmpty()) { + if (!fromRawString(calendar, text, false, fileName)) { + qWarning() << fileName << " is not a valid iCalendar file"; + setException(new Exception(Exception::ParseErrorIcal)); + return false; + } + } + + // Note: we consider empty files to be valid + + return true; +} + +bool ICalFormat::save(const Calendar::Ptr &calendar, const QString &fileName) +{ + qDebug() << fileName; + + clearException(); + + QString text = toString(calendar); + if (text.isEmpty()) { + return false; + } + + // Write backup file + const QString backupFile = fileName + QLatin1Char('~'); + QFile::remove(backupFile); + QFile::copy(fileName, backupFile); + + QSaveFile file(fileName); + if (!file.open(QIODevice::WriteOnly)) { + qCritical() << "file open error: " << file.errorString() << ";filename=" << fileName; + setException(new Exception(Exception::SaveErrorOpenFile, QStringList(fileName))); + + return false; + } + + // Convert to UTF8 and save + QByteArray textUtf8 = text.toUtf8(); + file.write(textUtf8.data(), textUtf8.size()); + // QSaveFile doesn't report a write error when the device is full (see Qt + // bug 75077), so check that the data can actually be written. + if (!file.flush()) { + qDebug() << "file write error (flush failed)"; + setException(new Exception(Exception::SaveErrorSaveFile, QStringList(fileName))); + return false; + } + + if (!file.commit()) { + qDebug() << "file finalize error:" << file.errorString(); + setException(new Exception(Exception::SaveErrorSaveFile, QStringList(fileName))); + + return false; + } + + return true; +} + +bool ICalFormat::fromString(const Calendar::Ptr &cal, const QString &string, bool deleted, const QString ¬ebook) +{ + return fromRawString(cal, string.toUtf8(), deleted, notebook); +} + +Incidence::Ptr ICalFormat::readIncidence(const QByteArray &string) +{ + // Let's defend const correctness until the very gates of hell^Wlibical + icalcomponent *calendar = icalcomponent_new_from_string(const_cast(string.constData())); + if (!calendar) { + qCritical() << "parse error from icalcomponent_new_from_string. string=" << QString::fromLatin1(string); + setException(new Exception(Exception::ParseErrorIcal)); + return Incidence::Ptr(); + } + + ICalTimeZoneCache tzCache; + ICalTimeZoneParser parser(&tzCache); + parser.parse(calendar); + + Incidence::Ptr incidence; + if (icalcomponent_isa(calendar) == ICAL_VCALENDAR_COMPONENT) { + incidence = d->mImpl->readOneIncidence(calendar, &tzCache); + } else if (icalcomponent_isa(calendar) == ICAL_XROOT_COMPONENT) { + icalcomponent *comp = icalcomponent_get_first_component(calendar, ICAL_VCALENDAR_COMPONENT); + if (comp) { + incidence = d->mImpl->readOneIncidence(comp, &tzCache); + } + } + + if (!incidence) { + qDebug() << "No VCALENDAR component found"; + setException(new Exception(Exception::NoCalendar)); + } + + icalcomponent_free(calendar); + icalmemory_free_ring(); + + return incidence; +} + +bool ICalFormat::fromRawString(const Calendar::Ptr &cal, const QByteArray &string, bool deleted, const QString ¬ebook) +{ + Q_UNUSED(notebook); + // Get first VCALENDAR component. + // TODO: Handle more than one VCALENDAR or non-VCALENDAR top components + icalcomponent *calendar; + + // Let's defend const correctness until the very gates of hell^Wlibical + calendar = icalcomponent_new_from_string(const_cast(string.constData())); + if (!calendar) { + qCritical() << "parse error from icalcomponent_new_from_string. string=" << QString::fromLatin1(string); + setException(new Exception(Exception::ParseErrorIcal)); + return false; + } + + bool success = true; + + if (icalcomponent_isa(calendar) == ICAL_XROOT_COMPONENT) { + icalcomponent *comp; + for (comp = icalcomponent_get_first_component(calendar, ICAL_VCALENDAR_COMPONENT); comp; + comp = icalcomponent_get_next_component(calendar, ICAL_VCALENDAR_COMPONENT)) { + // put all objects into their proper places + if (!d->mImpl->populate(cal, comp, deleted)) { + qCritical() << "Could not populate calendar"; + if (!exception()) { + setException(new Exception(Exception::ParseErrorKcal)); + } + success = false; + } else { + setLoadedProductId(d->mImpl->loadedProductId()); + } + } + } else if (icalcomponent_isa(calendar) != ICAL_VCALENDAR_COMPONENT) { + qDebug() << "No VCALENDAR component found"; + setException(new Exception(Exception::NoCalendar)); + success = false; + } else { + // put all objects into their proper places + if (!d->mImpl->populate(cal, calendar, deleted)) { + qDebug() << "Could not populate calendar"; + if (!exception()) { + setException(new Exception(Exception::ParseErrorKcal)); + } + success = false; + } else { + setLoadedProductId(d->mImpl->loadedProductId()); + } + } + + icalcomponent_free(calendar); + icalmemory_free_ring(); + + return success; +} + +Incidence::Ptr ICalFormat::fromString(const QString &string) +{ + MemoryCalendar::Ptr cal(new MemoryCalendar(d->mTimeZone)); + fromString(cal, string); + + const Incidence::List list = cal->incidences(); + return !list.isEmpty() ? list.first() : Incidence::Ptr(); +} + +QString ICalFormat::toString(const Calendar::Ptr &cal, const QString ¬ebook, bool deleted) +{ + icalcomponent *calendar = d->mImpl->createCalendarComponent(cal); + icalcomponent *component; + + QVector tzUsedList; + TimeZoneEarliestDate earliestTz; + + // todos + Todo::List todoList = deleted ? cal->deletedTodos() : cal->rawTodos(); + for (auto it = todoList.cbegin(), end = todoList.cend(); it != end; ++it) { + if (!deleted || !cal->todo((*it)->uid(), (*it)->recurrenceId())) { + // use existing ones, or really deleted ones + if (notebook.isEmpty() || (!cal->notebook(*it).isEmpty() && notebook.endsWith(cal->notebook(*it)))) { + component = d->mImpl->writeTodo(*it, &tzUsedList); + icalcomponent_add_component(calendar, component); + ICalTimeZoneParser::updateTzEarliestDate((*it), &earliestTz); + } + } + } + // events + Event::List events = deleted ? cal->deletedEvents() : cal->rawEvents(); + for (auto it = events.cbegin(), end = events.cend(); it != end; ++it) { + if (!deleted || !cal->event((*it)->uid(), (*it)->recurrenceId())) { + // use existing ones, or really deleted ones + if (notebook.isEmpty() || (!cal->notebook(*it).isEmpty() && notebook.endsWith(cal->notebook(*it)))) { + component = d->mImpl->writeEvent(*it, &tzUsedList); + icalcomponent_add_component(calendar, component); + ICalTimeZoneParser::updateTzEarliestDate((*it), &earliestTz); + } + } + } + + // journals + Journal::List journals = deleted ? cal->deletedJournals() : cal->rawJournals(); + for (auto it = journals.cbegin(), end = journals.cend(); it != end; ++it) { + if (!deleted || !cal->journal((*it)->uid(), (*it)->recurrenceId())) { + // use existing ones, or really deleted ones + if (notebook.isEmpty() || (!cal->notebook(*it).isEmpty() && notebook.endsWith(cal->notebook(*it)))) { + component = d->mImpl->writeJournal(*it, &tzUsedList); + icalcomponent_add_component(calendar, component); + ICalTimeZoneParser::updateTzEarliestDate((*it), &earliestTz); + } + } + } + + // time zones + if (todoList.isEmpty() && events.isEmpty() && journals.isEmpty()) { + // no incidences means no used timezones, use all timezones + // this will export a calendar having only timezone definitions + tzUsedList = cal->d->mTimeZones; + } + for (const auto &qtz : qAsConst(tzUsedList)) { + if (qtz != QTimeZone::utc()) { + icaltimezone *tz = ICalTimeZoneParser::icaltimezoneFromQTimeZone(qtz, earliestTz[qtz]); + if (!tz) { + qCritical() << "bad time zone"; + } else { + component = icalcomponent_new_clone(icaltimezone_get_component(tz)); + icalcomponent_add_component(calendar, component); + icaltimezone_free(tz, 1); + } + } + } + + char *const componentString = icalcomponent_as_ical_string_r(calendar); + const QString &text = QString::fromUtf8(componentString); + free(componentString); + + icalcomponent_free(calendar); + icalmemory_free_ring(); + + if (text.isEmpty()) { + setException(new Exception(Exception::LibICalError)); + } + + return text; +} + +QString ICalFormat::toICalString(const Incidence::Ptr &incidence) +{ + MemoryCalendar::Ptr cal(new MemoryCalendar(d->mTimeZone)); + cal->addIncidence(Incidence::Ptr(incidence->clone())); + return toString(cal.staticCast()); +} + +QString ICalFormat::toString(const Incidence::Ptr &incidence) +{ + return QString::fromUtf8(toRawString(incidence)); +} + +QByteArray ICalFormat::toRawString(const Incidence::Ptr &incidence) +{ + TimeZoneList tzUsedList; + + icalcomponent *component = d->mImpl->writeIncidence(incidence, iTIPRequest, &tzUsedList); + + QByteArray text = icalcomponent_as_ical_string(component); + + TimeZoneEarliestDate earliestTzDt; + ICalTimeZoneParser::updateTzEarliestDate(incidence, &earliestTzDt); + + // time zones + for (const auto &qtz : qAsConst(tzUsedList)) { + if (qtz != QTimeZone::utc()) { + icaltimezone *tz = ICalTimeZoneParser::icaltimezoneFromQTimeZone(qtz, earliestTzDt[qtz]); + if (!tz) { + qCritical() << "bad time zone"; + } else { + icalcomponent *tzcomponent = icaltimezone_get_component(tz); + icalcomponent_add_component(component, component); + text.append(icalcomponent_as_ical_string(tzcomponent)); + icaltimezone_free(tz, 1); + } + } + } + + icalcomponent_free(component); + + return text; +} + +QString ICalFormat::toString(RecurrenceRule *recurrence) +{ + icalproperty *property = icalproperty_new_rrule(d->mImpl->writeRecurrenceRule(recurrence)); + QString text = QString::fromUtf8(icalproperty_as_ical_string(property)); + icalproperty_free(property); + return text; +} + +bool ICalFormat::fromString(RecurrenceRule *recurrence, const QString &rrule) +{ + if (!recurrence) { + return false; + } + bool success = true; + icalerror_clear_errno(); + struct icalrecurrencetype recur = icalrecurrencetype_from_string(rrule.toLatin1().constData()); + if (icalerrno != ICAL_NO_ERROR) { + qDebug() << "Recurrence parsing error:" << icalerror_strerror(icalerrno); + success = false; + } + + if (success) { + d->mImpl->readRecurrence(recur, recurrence); + } + + return success; +} + +QString ICalFormat::createScheduleMessage(const IncidenceBase::Ptr &incidence, iTIPMethod method) +{ + icalcomponent *message = nullptr; + + if (incidence->type() == Incidence::TypeEvent || incidence->type() == Incidence::TypeTodo) { + Incidence::Ptr i = incidence.staticCast(); + + // Recurring events need timezone information to allow proper calculations + // across timezones with different DST. + const bool useUtcTimes = !i->recurs(); + + const bool hasSchedulingId = (i->schedulingID() != i->uid()); + + const bool incidenceNeedChanges = (useUtcTimes || hasSchedulingId); + + if (incidenceNeedChanges) { + // The incidence need changes, so clone it before we continue + i = Incidence::Ptr(i->clone()); + + // Handle conversion to UTC times + if (useUtcTimes) { + i->shiftTimes(QTimeZone::utc(), QTimeZone::utc()); + } + + // Handle scheduling ID being present + if (hasSchedulingId) { + // We have a separation of scheduling ID and UID + i->setSchedulingID(QString(), i->schedulingID()); + } + + // Build the message with the cloned incidence + message = d->mImpl->createScheduleComponent(i, method); + } + } + + if (message == nullptr) { + message = d->mImpl->createScheduleComponent(incidence, method); + } + + QString messageText = QString::fromUtf8(icalcomponent_as_ical_string(message)); + + icalcomponent_free(message); + return messageText; +} + +FreeBusy::Ptr ICalFormat::parseFreeBusy(const QString &str) +{ + clearException(); + + icalcomponent *message = icalparser_parse_string(str.toUtf8().constData()); + + if (!message) { + return FreeBusy::Ptr(); + } + + FreeBusy::Ptr freeBusy; + + icalcomponent *c = nullptr; + for (c = icalcomponent_get_first_component(message, ICAL_VFREEBUSY_COMPONENT); c != nullptr; + c = icalcomponent_get_next_component(message, ICAL_VFREEBUSY_COMPONENT)) { + FreeBusy::Ptr fb = d->mImpl->readFreeBusy(c); + + if (freeBusy) { + freeBusy->merge(fb); + } else { + freeBusy = fb; + } + } + + if (!freeBusy) { + qDebug() << "object is not a freebusy."; + } + + icalcomponent_free(message); + + return freeBusy; +} + +ScheduleMessage::Ptr ICalFormat::parseScheduleMessage(const Calendar::Ptr &cal, const QString &messageText) +{ + setTimeZone(cal->timeZone()); + clearException(); + + if (messageText.isEmpty()) { + setException(new Exception(Exception::ParseErrorEmptyMessage)); + return ScheduleMessage::Ptr(); + } + + icalcomponent *message = icalparser_parse_string(messageText.toUtf8().constData()); + + if (!message) { + setException(new Exception(Exception::ParseErrorUnableToParse)); + + return ScheduleMessage::Ptr(); + } + + icalproperty *m = icalcomponent_get_first_property(message, ICAL_METHOD_PROPERTY); + if (!m) { + setException(new Exception(Exception::ParseErrorMethodProperty)); + + return ScheduleMessage::Ptr(); + } + + // Populate the message's time zone collection with all VTIMEZONE components + ICalTimeZoneCache tzlist; + ICalTimeZoneParser parser(&tzlist); + parser.parse(message); + + IncidenceBase::Ptr incidence; + icalcomponent *c = icalcomponent_get_first_component(message, ICAL_VEVENT_COMPONENT); + if (c) { + incidence = d->mImpl->readEvent(c, &tzlist).staticCast(); + } + + if (!incidence) { + c = icalcomponent_get_first_component(message, ICAL_VTODO_COMPONENT); + if (c) { + incidence = d->mImpl->readTodo(c, &tzlist).staticCast(); + } + } + + if (!incidence) { + c = icalcomponent_get_first_component(message, ICAL_VJOURNAL_COMPONENT); + if (c) { + incidence = d->mImpl->readJournal(c, &tzlist).staticCast(); + } + } + + if (!incidence) { + c = icalcomponent_get_first_component(message, ICAL_VFREEBUSY_COMPONENT); + if (c) { + incidence = d->mImpl->readFreeBusy(c).staticCast(); + } + } + + if (!incidence) { + qDebug() << "object is not a freebusy, event, todo or journal"; + setException(new Exception(Exception::ParseErrorNotIncidence)); + + return ScheduleMessage::Ptr(); + } + + icalproperty_method icalmethod = icalproperty_get_method(m); + iTIPMethod method; + + switch (icalmethod) { + case ICAL_METHOD_PUBLISH: + method = iTIPPublish; + break; + case ICAL_METHOD_REQUEST: + method = iTIPRequest; + break; + case ICAL_METHOD_REFRESH: + method = iTIPRefresh; + break; + case ICAL_METHOD_CANCEL: + method = iTIPCancel; + break; + case ICAL_METHOD_ADD: + method = iTIPAdd; + break; + case ICAL_METHOD_REPLY: + method = iTIPReply; + break; + case ICAL_METHOD_COUNTER: + method = iTIPCounter; + break; + case ICAL_METHOD_DECLINECOUNTER: + method = iTIPDeclineCounter; + break; + default: + method = iTIPNoMethod; + qDebug() << "Unknown method"; + break; + } + + if (!icalrestriction_check(message)) { + qWarning() << "\nkcalcore library reported a problem while parsing:"; + qWarning() << ScheduleMessage::methodName(method) << ":" << d->mImpl->extractErrorProperty(c); + } + + Incidence::Ptr existingIncidence = cal->incidence(incidence->uid()); + + icalcomponent *calendarComponent = nullptr; + if (existingIncidence) { + calendarComponent = d->mImpl->createCalendarComponent(cal); + + // TODO: check, if cast is required, or if it can be done by virtual funcs. + // TODO: Use a visitor for this! + if (existingIncidence->type() == Incidence::TypeTodo) { + Todo::Ptr todo = existingIncidence.staticCast(); + icalcomponent_add_component(calendarComponent, d->mImpl->writeTodo(todo)); + } + if (existingIncidence->type() == Incidence::TypeEvent) { + Event::Ptr event = existingIncidence.staticCast(); + icalcomponent_add_component(calendarComponent, d->mImpl->writeEvent(event)); + } + } else { + icalcomponent_free(message); + return ScheduleMessage::Ptr(new ScheduleMessage(incidence, method, ScheduleMessage::Unknown)); + } + + icalproperty_xlicclass result = icalclassify(message, calendarComponent, static_cast("")); + + ScheduleMessage::Status status; + + switch (result) { + case ICAL_XLICCLASS_PUBLISHNEW: + status = ScheduleMessage::PublishNew; + break; + case ICAL_XLICCLASS_PUBLISHUPDATE: + status = ScheduleMessage::PublishUpdate; + break; + case ICAL_XLICCLASS_OBSOLETE: + status = ScheduleMessage::Obsolete; + break; + case ICAL_XLICCLASS_REQUESTNEW: + status = ScheduleMessage::RequestNew; + break; + case ICAL_XLICCLASS_REQUESTUPDATE: + status = ScheduleMessage::RequestUpdate; + break; + case ICAL_XLICCLASS_UNKNOWN: + default: + status = ScheduleMessage::Unknown; + break; + } + + icalcomponent_free(message); + icalcomponent_free(calendarComponent); + + return ScheduleMessage::Ptr(new ScheduleMessage(incidence, method, status)); +} + +void ICalFormat::setTimeZone(const QTimeZone &timeZone) +{ + d->mTimeZone = timeZone; +} + +QTimeZone ICalFormat::timeZone() const +{ + return d->mTimeZone; +} + +QByteArray ICalFormat::timeZoneId() const +{ + return d->mTimeZone.id(); +} + +void ICalFormat::virtual_hook(int id, void *data) +{ + Q_UNUSED(id); + Q_UNUSED(data); + Q_ASSERT(false); +} diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/icalformat.h dde-calendar-5.10.0/3rdparty/kcalendarcore/src/icalformat.h --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/icalformat.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/icalformat.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,227 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 2001-2003 Cornelius Schumacher + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +/** + @file + This file is part of the API for handling calendar data and + defines the ICalFormat class. + 该文件是用于处理日历数据的API的一部分,并定义了ICalFormat类。 + + @author Cornelius Schumacher \ +*/ +#ifndef KCALCORE_ICALFORMAT_H +#define KCALCORE_ICALFORMAT_H + +#include "calformat.h" +#include "freebusy.h" +#include "incidence.h" +#include "schedulemessage.h" + +namespace KCalendarCore { +class FreeBusy; +class Incidence; +class IncidenceBase; +class RecurrenceRule; + +/** + @brief + iCalendar format implementation. + + This class implements the iCalendar format. It provides methods for + loading/saving/converting iCalendar format data into the internal + representation as Calendar and Incidences. + + @warning When importing/loading to a Calendar, there is only duplicate + check if those Incidences are loaded into the Calendar. If they are not + loaded it will create duplicates. +*/ +class Q_CORE_EXPORT ICalFormat : public CalFormat +{ +public: + /** + Constructor a new iCalendar Format object. + */ + ICalFormat(); + + /** + Destructor. + */ + ~ICalFormat() override; + + /** + @copydoc + CalFormat::load() + */ + bool load(const Calendar::Ptr &calendar, const QString &fileName) override; + + /** + @copydoc + CalFormat::save() + */ + bool save(const Calendar::Ptr &calendar, const QString &fileName) override; + + /** + @copydoc + CalFormat::fromString() + + @note The notebook is ignored and the default one is used + */ + bool fromString(const Calendar::Ptr &calendar, const QString &string, bool deleted = false, const QString ¬ebook = QString()) override; + + /** + Parses a string, returning the first iCal component as an Incidence. + 解析字符串,将第一个iCal组件作为关联返回。 + + @param string is a QString containing the data to be parsed. + + @return non-zero pointer if the parsing was successful; 0 otherwise. + @see fromString(const Calendar::Ptr &, const QString &), fromRawString() + */ + Incidence::Ptr fromString(const QString &string); + + /** + Parses a bytearray, returning the first iCal component as an Incidence, ignoring timezone information. + 解析字节数组,将第一个iCal组件作为关联返回,忽略时区信息。 + This function is significantly faster than fromString by avoiding the overhead of parsing timezone information. + Timezones are instead solely interpreted by using system-timezones. + + @param string is a utf8 QByteArray containing the data to be parsed. + + @return non-zero pointer if the parsing was successful; 0 otherwise. + @see fromString(const QString &), fromRawString() + */ + Incidence::Ptr readIncidence(const QByteArray &string); + + /** + Parses a string and fills a RecurrenceRule object with the information. + 解析字符串并用信息填充RecurrenceRule对象。 + + @param rule is a pointer to a RecurrenceRule object. + @param string is a QString containing the data to be parsed. + @return true if successful; false otherwise. + */ + Q_REQUIRED_RESULT bool fromString(RecurrenceRule *rule, const QString &string); + + /** + @copydoc + CalFormat::fromRawString() + */ + Q_REQUIRED_RESULT bool + fromRawString(const Calendar::Ptr &calendar, const QByteArray &string, bool deleted = false, const QString ¬ebook = QString()) override; + + /** + @copydoc + CalFormat::toString() + */ + Q_REQUIRED_RESULT QString toString(const Calendar::Ptr &calendar, const QString ¬ebook = QString(), bool deleted = false) override; + + /** + Converts an Incidence to a QString. + @param incidence is a pointer to an Incidence object to be converted + into a QString. + + @return the QString will be Null if the conversion was unsuccessful. + */ + Q_REQUIRED_RESULT QString toString(const Incidence::Ptr &incidence); + + /** + Converts an Incidence to a QByteArray. + @param incidence is a pointer to an Incidence object to be converted + into a QByteArray. + + @return the QString will be Null if the conversion was unsuccessful. + @since 4.7 + */ + Q_REQUIRED_RESULT QByteArray toRawString(const Incidence::Ptr &incidence); + + /** + Converts a RecurrenceRule to a QString. + @param rule is a pointer to a RecurrenceRule object to be converted + into a QString. + + @return the QString will be Null if the conversion was unsuccessful. + */ + Q_REQUIRED_RESULT QString toString(RecurrenceRule *rule); + + /** + Converts an Incidence to iCalendar formatted text. + + @param incidence is a pointer to an Incidence object to be converted + into iCal formatted text. + @return the QString will be Null if the conversion was unsuccessful. + */ + Q_REQUIRED_RESULT QString toICalString(const Incidence::Ptr &incidence); + + /** + Creates a scheduling message string for an Incidence. + + @param incidence is a pointer to an IncidenceBase object to be scheduled. + @param method is a Scheduler::Method + + @return a QString containing the message if successful; 0 otherwise. + */ + Q_REQUIRED_RESULT QString createScheduleMessage(const IncidenceBase::Ptr &incidence, iTIPMethod method); + + /** + Parses a Calendar scheduling message string into ScheduleMessage object. + + @param calendar is a pointer to a Calendar object associated with the + scheduling message. + @param string is a QString containing the data to be parsed. + + @return a pointer to a ScheduleMessage object if successful; 0 otherwise. + The calling routine may later free the return memory. + */ + ScheduleMessage::Ptr parseScheduleMessage(const Calendar::Ptr &calendar, const QString &string); + + /** + Converts a QString into a FreeBusy object. + + @param string is a QString containing the data to be parsed. + @return a pointer to a FreeBusy object if successful; 0 otherwise. + + @note Do not attempt to free the FreeBusy memory from the calling routine. + */ + FreeBusy::Ptr parseFreeBusy(const QString &string); + + /** + Sets the iCalendar time zone. + @param timeZone is the time zone to set. + @see timeZone(). + */ + void setTimeZone(const QTimeZone &timeZone); + + /** + Returns the iCalendar time zone. + @see setTimeZone(). + */ + Q_REQUIRED_RESULT QTimeZone timeZone() const; + + /** + Returns the timezone id string used by the iCalendar; an empty string + if the iCalendar does not have a timezone. + */ + Q_REQUIRED_RESULT QByteArray timeZoneId() const; + +protected: + /** + @copydoc + IncidenceBase::virtual_hook() + */ + void virtual_hook(int id, void *data) override; + +private: + //@cond PRIVATE + Q_DISABLE_COPY(ICalFormat) + class Private; + Private *const d; + //@endcond +}; + +} // namespace KCalendarCore + +#endif diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/icalformat_p.cpp dde-calendar-5.10.0/3rdparty/kcalendarcore/src/icalformat_p.cpp --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/icalformat_p.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/icalformat_p.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,3015 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 2001 Cornelius Schumacher + SPDX-FileCopyrightText: 2003-2004 Reinhold Kainhofer + SPDX-FileCopyrightText: 2006 David Jarvie + SPDX-FileCopyrightText: 2012 Christian Mollekopf + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +/** + @file + This file is part of the API for handling calendar data and + defines the internal ICalFormat classes. + + @brief + This class provides the libical dependent functions for ICalFormat. + + @author Cornelius Schumacher \ + @author Reinhold Kainhofer \ + @author David Jarvie \ +*/ + +#include "icalformat_p.h" +#include "compat_p.h" +#include "icalformat.h" +#include "icaltimezones_p.h" +#include "incidencebase.h" +#include "memorycalendar.h" +#include "visitor.h" + +#include +#include +#include + +using namespace KCalendarCore; + +static const char APP_NAME_FOR_XPROPERTIES[] = "KCALCORE"; +static const char ENABLED_ALARM_XPROPERTY[] = "ENABLED"; +static const char IMPLEMENTATION_VERSION_XPROPERTY[] = "X-KDE-ICAL-IMPLEMENTATION-VERSION"; +//EVENT农历日程标识 +static const char VEVENT_LUNNAR_XPROPERTY[] = "X-DDE-ICAL-LUNNAR"; + +/* Static helpers */ +/* +static void _dumpIcaltime( const icaltimetype& t) +{ + qDebug() << "--- Y:" << t.year << "M:" << t.month << "D:" << t.day; + qDebug() << "--- H:" << t.hour << "M:" << t.minute << "S:" << t.second; + qDebug() << "--- isUtc:" << icaltime_is_utc( t ); + qDebug() << "--- zoneId:" << icaltimezone_get_tzid( const_cast( t.zone ) ); +} +*/ + +//@cond PRIVATE +template +void removeAllICal(QVector> &c, const QSharedPointer &x) +{ + if (c.count() < 1) { + return; + } + + int cnt = c.count(x); + if (cnt != 1) { + qCritical() << "There number of relatedTos for this incidence is " << cnt << " (there must be 1 relatedTo only)"; + Q_ASSERT_X(false, "removeAllICal", "Count is not 1."); + return; + } + + c.remove(c.indexOf(x)); +} + +const int gSecondsPerMinute = 60; +const int gSecondsPerHour = gSecondsPerMinute * 60; +const int gSecondsPerDay = gSecondsPerHour * 24; +const int gSecondsPerWeek = gSecondsPerDay * 7; + +class ToComponentVisitor : public Visitor +{ +public: + ToComponentVisitor(ICalFormatImpl *impl, iTIPMethod m, TimeZoneList *tzUsedList = nullptr) + : mImpl(impl) + , mComponent(nullptr) + , mMethod(m) + , mTzUsedList(tzUsedList) + { + } + + ~ToComponentVisitor(); + + bool visit(const Event::Ptr &e) override + { + mComponent = mImpl->writeEvent(e, mTzUsedList); + return true; + } + bool visit(const Todo::Ptr &t) override + { + mComponent = mImpl->writeTodo(t, mTzUsedList); + return true; + } + bool visit(const Journal::Ptr &j) override + { + mComponent = mImpl->writeJournal(j, mTzUsedList); + return true; + } + bool visit(const FreeBusy::Ptr &fb) override + { + mComponent = mImpl->writeFreeBusy(fb, mMethod); + return true; + } + + icalcomponent *component() + { + return mComponent; + } + +private: + ICalFormatImpl *mImpl = nullptr; + icalcomponent *mComponent = nullptr; + iTIPMethod mMethod; + TimeZoneList *mTzUsedList = nullptr; +}; + +ToComponentVisitor::~ToComponentVisitor() +{ +} + +class Q_DECL_HIDDEN ICalFormatImpl::Private +{ +public: + Private(ICalFormatImpl *impl, ICalFormat *parent) + : mImpl(impl) + , mParent(parent) + , mCompat(new Compat) + { + } + ~Private() + { + delete mCompat; + } + void writeIncidenceBase(icalcomponent *parent, const IncidenceBase::Ptr &); + void readIncidenceBase(icalcomponent *parent, const IncidenceBase::Ptr &); + void writeCustomProperties(icalcomponent *parent, CustomProperties *); + void readCustomProperties(icalcomponent *parent, CustomProperties *); + + ICalFormatImpl *mImpl = nullptr; + ICalFormat *mParent = nullptr; + QString mLoadedProductId; // PRODID string loaded from calendar file + Event::List mEventsRelate; // events with relations + Todo::List mTodosRelate; // todos with relations + Compat *mCompat = nullptr; +}; +//@endcond + +inline icaltimetype ICalFormatImpl::writeICalUtcDateTime(const QDateTime &dt, bool dayOnly) +{ + return writeICalDateTime(dt.toUTC(), dayOnly); +} + +ICalFormatImpl::ICalFormatImpl(ICalFormat *parent) + : d(new Private(this, parent)) +{ +} + +ICalFormatImpl::~ICalFormatImpl() +{ + delete d; +} + +QString ICalFormatImpl::loadedProductId() const +{ + return d->mLoadedProductId; +} + +icalcomponent *ICalFormatImpl::writeIncidence(const IncidenceBase::Ptr &incidence, iTIPMethod method, TimeZoneList *tzUsedList) +{ + ToComponentVisitor v(this, method, tzUsedList); + if (incidence->accept(v, incidence)) { + return v.component(); + } else { + return nullptr; + } +} + +icalcomponent *ICalFormatImpl::writeTodo(const Todo::Ptr &todo, TimeZoneList *tzUsedList) +{ + icalcomponent *vtodo = icalcomponent_new(ICAL_VTODO_COMPONENT); + + writeIncidence(vtodo, todo.staticCast(), tzUsedList); + + // due date + icalproperty *prop; + if (todo->hasDueDate()) { + icaltimetype due; + if (todo->allDay()) { + due = writeICalDate(todo->dtDue(true).date()); + prop = icalproperty_new_due(due); + } else { + prop = writeICalDateTimeProperty(ICAL_DUE_PROPERTY, todo->dtDue(true), tzUsedList); + } + icalcomponent_add_property(vtodo, prop); + } + + // start time + if (todo->hasStartDate()) { + icaltimetype start; + if (todo->allDay()) { + start = writeICalDate(todo->dtStart(true).date()); + prop = icalproperty_new_dtstart(start); + } else { + prop = writeICalDateTimeProperty(ICAL_DTSTART_PROPERTY, todo->dtStart(true), tzUsedList); + } + icalcomponent_add_property(vtodo, prop); + } + + // completion date (UTC) + if (todo->isCompleted()) { + if (!todo->hasCompletedDate()) { + // If the todo was created by KOrganizer<2.2 it does not have + // a correct completion date. Set one now. + todo->setCompleted(QDateTime::currentDateTimeUtc()); + } + icaltimetype completed = writeICalUtcDateTime(todo->completed()); + icalcomponent_add_property(vtodo, icalproperty_new_completed(completed)); + } + + icalcomponent_add_property(vtodo, icalproperty_new_percentcomplete(todo->percentComplete())); + + if (todo->isCompleted()) { + if (icalcomponent_count_properties(vtodo, ICAL_STATUS_PROPERTY)) { + icalproperty *p = icalcomponent_get_first_property(vtodo, ICAL_STATUS_PROPERTY); + icalcomponent_remove_property(vtodo, p); + icalproperty_free(p); + } + icalcomponent_add_property(vtodo, icalproperty_new_status(ICAL_STATUS_COMPLETED)); + } + + if (todo->recurs() && todo->dtStart(false).isValid()) { + prop = writeICalDateTimeProperty(ICAL_X_PROPERTY, todo->dtStart(false), tzUsedList); + icalproperty_set_x_name(prop, "X-KDE-LIBKCAL-DTRECURRENCE"); + icalcomponent_add_property(vtodo, prop); + } + + return vtodo; +} + +icalcomponent *ICalFormatImpl::writeEvent(const Event::Ptr &event, TimeZoneList *tzUsedList) +{ + icalcomponent *vevent = icalcomponent_new(ICAL_VEVENT_COMPONENT); + + writeIncidence(vevent, event.staticCast(), tzUsedList); + + // start time + icalproperty *prop = nullptr; + icaltimetype start; + + QDateTime dt = event->dtStart(); + if (dt.isValid()) { + if (event->allDay()) { + start = writeICalDate(event->dtStart().date()); + prop = icalproperty_new_dtstart(start); + } else { + prop = writeICalDateTimeProperty(ICAL_DTSTART_PROPERTY, event->dtStart(), tzUsedList); + } + icalcomponent_add_property(vevent, prop); + } + + if (event->hasEndDate()) { + // End time. + // RFC2445 says that if DTEND is present, it has to be greater than DTSTART. + icaltimetype end; + QDateTime dt = event->dtEnd(); + if (event->allDay()) { + // +1 day because end date is non-inclusive. + end = writeICalDate(dt.date().addDays(1)); + icalcomponent_add_property(vevent, icalproperty_new_dtend(end)); + } else { + if (dt != event->dtStart()) { + icalcomponent_add_property(vevent, writeICalDateTimeProperty(ICAL_DTEND_PROPERTY, dt, tzUsedList)); + } + } + } + +// TODO: resources +#if 0 + // resources + QStringList tmpStrList = anEvent->resources(); + QString tmpStr = tmpStrList.join(";"); + if (!tmpStr.isEmpty()) { + addPropValue(vevent, VCResourcesProp, tmpStr.toUtf8()); + } + +#endif + + // Transparency + switch (event->transparency()) { + case Event::Transparent: + icalcomponent_add_property(vevent, icalproperty_new_transp(ICAL_TRANSP_TRANSPARENT)); + break; + case Event::Opaque: + icalcomponent_add_property(vevent, icalproperty_new_transp(ICAL_TRANSP_OPAQUE)); + break; + } + + //农历 + if (event->lunnar()) { + event->setNonKDECustomProperty(VEVENT_LUNNAR_XPROPERTY, QStringLiteral("TRUE")); + } + + // Custom properties + const QMap custom = event->customProperties(); + for (QMap::ConstIterator c = custom.begin(); c != custom.end(); ++c) { + icalproperty *p = icalproperty_new_x(c.value().toUtf8().constData()); + icalproperty_set_x_name(p, c.key().constData()); + icalcomponent_add_property(vevent, p); + } + + return vevent; +} + +icalcomponent *ICalFormatImpl::writeFreeBusy(const FreeBusy::Ptr &freebusy, iTIPMethod method) +{ + icalcomponent *vfreebusy = icalcomponent_new(ICAL_VFREEBUSY_COMPONENT); + + d->writeIncidenceBase(vfreebusy, freebusy.staticCast()); + + icalcomponent_add_property(vfreebusy, icalproperty_new_dtstart(writeICalUtcDateTime(freebusy->dtStart()))); + + icalcomponent_add_property(vfreebusy, icalproperty_new_dtend(writeICalUtcDateTime(freebusy->dtEnd()))); + + Q_UNUSED(method); + icalcomponent_add_property(vfreebusy, icalproperty_new_uid(freebusy->uid().toUtf8().constData())); + + // Loops through all the periods in the freebusy object + FreeBusyPeriod::List list = freebusy->fullBusyPeriods(); + icalperiodtype period = icalperiodtype_null_period(); + for (int i = 0, count = list.count(); i < count; ++i) { + const FreeBusyPeriod fbPeriod = list[i]; + period.start = writeICalUtcDateTime(fbPeriod.start()); + if (fbPeriod.hasDuration()) { + period.duration = writeICalDuration(fbPeriod.duration()); + } else { + period.end = writeICalUtcDateTime(fbPeriod.end()); + } + + icalproperty *property = icalproperty_new_freebusy(period); + + icalparameter_fbtype fbType; + switch (fbPeriod.type()) { + case FreeBusyPeriod::Free: + fbType = ICAL_FBTYPE_FREE; + break; + case FreeBusyPeriod::Busy: + fbType = ICAL_FBTYPE_BUSY; + break; + case FreeBusyPeriod::BusyTentative: + fbType = ICAL_FBTYPE_BUSYTENTATIVE; + break; + case FreeBusyPeriod::BusyUnavailable: + fbType = ICAL_FBTYPE_BUSYUNAVAILABLE; + break; + case FreeBusyPeriod::Unknown: + fbType = ICAL_FBTYPE_X; + break; + default: + fbType = ICAL_FBTYPE_NONE; + break; + } + icalproperty_set_parameter(property, icalparameter_new_fbtype(fbType)); + + if (!fbPeriod.summary().isEmpty()) { + icalparameter *param = icalparameter_new_x("X-SUMMARY"); + icalparameter_set_xvalue(param, fbPeriod.summary().toUtf8().toBase64().constData()); + icalproperty_set_parameter(property, param); + } + if (!fbPeriod.location().isEmpty()) { + icalparameter *param = icalparameter_new_x("X-LOCATION"); + icalparameter_set_xvalue(param, fbPeriod.location().toUtf8().toBase64().constData()); + icalproperty_set_parameter(property, param); + } + + icalcomponent_add_property(vfreebusy, property); + } + + return vfreebusy; +} + +icalcomponent *ICalFormatImpl::writeJournal(const Journal::Ptr &journal, TimeZoneList *tzUsedList) +{ + icalcomponent *vjournal = icalcomponent_new(ICAL_VJOURNAL_COMPONENT); + + writeIncidence(vjournal, journal.staticCast(), tzUsedList); + + // start time + icalproperty *prop = nullptr; + QDateTime dt = journal->dtStart(); + if (dt.isValid()) { + icaltimetype start; + if (journal->allDay()) { + start = writeICalDate(dt.date()); + prop = icalproperty_new_dtstart(start); + } else { + prop = writeICalDateTimeProperty(ICAL_DTSTART_PROPERTY, dt, tzUsedList); + } + icalcomponent_add_property(vjournal, prop); + } + + return vjournal; +} + +void ICalFormatImpl::writeIncidence(icalcomponent *parent, const Incidence::Ptr &incidence, TimeZoneList *tzUsedList) +{ + if (incidence->schedulingID() != incidence->uid()) { + // We need to store the UID in here. The rawSchedulingID will + // go into the iCal UID component + incidence->setCustomProperty("LIBKCAL", "ID", incidence->uid()); + } else { + incidence->removeCustomProperty("LIBKCAL", "ID"); + } + + d->writeIncidenceBase(parent, incidence.staticCast()); + + // creation date in storage + icalcomponent_add_property(parent, writeICalDateTimeProperty(ICAL_CREATED_PROPERTY, incidence->created())); + + // unique id + // If the scheduling ID is different from the real UID, the real + // one is stored on X-REALID above + if (!incidence->schedulingID().isEmpty()) { + icalcomponent_add_property(parent, icalproperty_new_uid(incidence->schedulingID().toUtf8().constData())); + } + + // revision + if (incidence->revision() > 0) { // 0 is default, so don't write that out + icalcomponent_add_property(parent, icalproperty_new_sequence(incidence->revision())); + } + + // last modification date + if (incidence->lastModified().isValid()) { + icalcomponent_add_property(parent, writeICalDateTimeProperty(ICAL_LASTMODIFIED_PROPERTY, incidence->lastModified())); + } + + // description + if (!incidence->description().isEmpty()) { + icalcomponent_add_property(parent, writeDescription(incidence->description(), incidence->descriptionIsRich())); + } + + // summary + if (!incidence->summary().isEmpty()) { + icalcomponent_add_property(parent, writeSummary(incidence->summary(), incidence->summaryIsRich())); + } + + // location + if (!incidence->location().isEmpty()) { + icalcomponent_add_property(parent, writeLocation(incidence->location(), incidence->locationIsRich())); + } + + // status + icalproperty_status status = ICAL_STATUS_NONE; + switch (incidence->status()) { + case Incidence::StatusTentative: + status = ICAL_STATUS_TENTATIVE; + break; + case Incidence::StatusConfirmed: + status = ICAL_STATUS_CONFIRMED; + break; + case Incidence::StatusCompleted: + status = ICAL_STATUS_COMPLETED; + break; + case Incidence::StatusNeedsAction: + status = ICAL_STATUS_NEEDSACTION; + break; + case Incidence::StatusCanceled: + status = ICAL_STATUS_CANCELLED; + break; + case Incidence::StatusInProcess: + status = ICAL_STATUS_INPROCESS; + break; + case Incidence::StatusDraft: + status = ICAL_STATUS_DRAFT; + break; + case Incidence::StatusFinal: + status = ICAL_STATUS_FINAL; + break; + case Incidence::StatusX: { + icalproperty *p = icalproperty_new_status(ICAL_STATUS_X); + icalvalue_set_x(icalproperty_get_value(p), incidence->customStatus().toUtf8().constData()); + icalcomponent_add_property(parent, p); + break; + } + case Incidence::StatusNone: + default: + break; + } + if (status != ICAL_STATUS_NONE) { + icalcomponent_add_property(parent, icalproperty_new_status(status)); + } + + // secrecy + icalproperty_class secClass; + switch (incidence->secrecy()) { + case Incidence::SecrecyPublic: + secClass = ICAL_CLASS_PUBLIC; + break; + case Incidence::SecrecyConfidential: + secClass = ICAL_CLASS_CONFIDENTIAL; + break; + case Incidence::SecrecyPrivate: + default: + secClass = ICAL_CLASS_PRIVATE; + break; + } + if (secClass != ICAL_CLASS_PUBLIC) { + icalcomponent_add_property(parent, icalproperty_new_class(secClass)); + } + + // color + if (!incidence->color().isEmpty()) { + icalcomponent_add_property(parent, icalproperty_new_color(incidence->color().toUtf8().constData())); + } + + // geo + if (incidence->hasGeo()) { + icalgeotype geo; + geo.lat = incidence->geoLatitude(); + geo.lon = incidence->geoLongitude(); + icalcomponent_add_property(parent, icalproperty_new_geo(geo)); + } + + // priority + if (incidence->priority() > 0) { // 0 is undefined priority + icalcomponent_add_property(parent, icalproperty_new_priority(incidence->priority())); + } + + // categories + QString categories = incidence->categories().join(QLatin1Char(',')); + if (!categories.isEmpty()) { + icalcomponent_add_property(parent, icalproperty_new_categories(categories.toUtf8().constData())); + } + + // related event + if (!incidence->relatedTo().isEmpty()) { + icalcomponent_add_property(parent, icalproperty_new_relatedto(incidence->relatedTo().toUtf8().constData())); + } + + // recurrenceid + if (incidence->hasRecurrenceId()) { + icalproperty *p = writeICalDateTimeProperty(ICAL_RECURRENCEID_PROPERTY, incidence->recurrenceId(), tzUsedList); + if (incidence->thisAndFuture()) { + icalproperty_add_parameter(p, icalparameter_new_range(ICAL_RANGE_THISANDFUTURE)); + } + icalcomponent_add_property(parent, p); + } + + RecurrenceRule::List rrules(incidence->recurrence()->rRules()); + RecurrenceRule::List::ConstIterator rit; + for (rit = rrules.constBegin(); rit != rrules.constEnd(); ++rit) { + icalcomponent_add_property(parent, icalproperty_new_rrule(writeRecurrenceRule((*rit)))); + } + + RecurrenceRule::List exrules(incidence->recurrence()->exRules()); + RecurrenceRule::List::ConstIterator exit; + for (exit = exrules.constBegin(); exit != exrules.constEnd(); ++exit) { + icalcomponent_add_property(parent, icalproperty_new_exrule(writeRecurrenceRule((*exit)))); + } + + DateList dateList = incidence->recurrence()->exDates(); + DateList::ConstIterator exIt; + for (exIt = dateList.constBegin(); exIt != dateList.constEnd(); ++exIt) { + icalcomponent_add_property(parent, icalproperty_new_exdate(writeICalDate(*exIt))); + } + + auto dateTimeList = incidence->recurrence()->exDateTimes(); + for (auto extIt = dateTimeList.constBegin(); extIt != dateTimeList.constEnd(); ++extIt) { + icalcomponent_add_property(parent, writeICalDateTimeProperty(ICAL_EXDATE_PROPERTY, *extIt, tzUsedList)); + } + + dateList = incidence->recurrence()->rDates(); + DateList::ConstIterator rdIt; + for (rdIt = dateList.constBegin(); rdIt != dateList.constEnd(); ++rdIt) { + icalcomponent_add_property(parent, icalproperty_new_rdate(writeICalDatePeriod(*rdIt))); + } + dateTimeList = incidence->recurrence()->rDateTimes(); + for (auto rdtIt = dateTimeList.constBegin(); rdtIt != dateTimeList.constEnd(); ++rdtIt) { + icalcomponent_add_property(parent, writeICalDateTimeProperty(ICAL_RDATE_PROPERTY, *rdtIt, tzUsedList)); + } + + // attachments + Attachment::List attachments = incidence->attachments(); + Attachment::List::ConstIterator atIt; + for (atIt = attachments.constBegin(); atIt != attachments.constEnd(); ++atIt) { + icalcomponent_add_property(parent, writeAttachment(*atIt)); + } + + // alarms + auto alarms = incidence->alarms(); + for (auto it = alarms.cbegin(), end = alarms.cend(); it != end; ++it) { + icalcomponent_add_component(parent, writeAlarm(*it)); + } + + // conferences + const auto conferences = incidence->conferences(); + for (const auto &conf : conferences) { + icalcomponent_add_property(parent, writeConference(conf)); + } + + // duration + if (incidence->hasDuration()) { + icaldurationtype duration; + duration = writeICalDuration(incidence->duration()); + icalcomponent_add_property(parent, icalproperty_new_duration(duration)); + } +} + +//@cond PRIVATE +void ICalFormatImpl::Private::writeIncidenceBase(icalcomponent *parent, const IncidenceBase::Ptr &incidenceBase) +{ + // organizer stuff + if (!incidenceBase->organizer().isEmpty()) { + icalproperty *p = mImpl->writeOrganizer(incidenceBase->organizer()); + if (p) { + icalcomponent_add_property(parent, p); + } + } + + icalcomponent_add_property(parent, icalproperty_new_dtstamp(writeICalUtcDateTime(incidenceBase->lastModified()))); + + // attendees + if (incidenceBase->attendeeCount() > 0) { + auto attendees = incidenceBase->attendees(); + for (auto it = attendees.constBegin(); it != attendees.constEnd(); ++it) { + icalproperty *p = mImpl->writeAttendee(*it); + if (p) { + icalcomponent_add_property(parent, p); + } + } + } + + // contacts + QStringList contacts = incidenceBase->contacts(); + for (QStringList::const_iterator it = contacts.constBegin(); it != contacts.constEnd(); ++it) { + icalcomponent_add_property(parent, icalproperty_new_contact((*it).toUtf8().constData())); + } + + // comments + QStringList comments = incidenceBase->comments(); + for (QStringList::const_iterator it = comments.constBegin(); it != comments.constEnd(); ++it) { + icalcomponent_add_property(parent, icalproperty_new_comment((*it).toUtf8().constData())); + } + + // url + const QUrl url = incidenceBase->url(); + if (url.isValid()) { + icalcomponent_add_property(parent, icalproperty_new_url(url.toString().toUtf8().constData())); + } + + // custom properties + writeCustomProperties(parent, incidenceBase.data()); +} + +void ICalFormatImpl::Private::writeCustomProperties(icalcomponent *parent, CustomProperties *properties) +{ + const QMap custom = properties->customProperties(); + for (QMap::ConstIterator c = custom.begin(); c != custom.end(); ++c) { + if (c.key().startsWith("X-KDE-VOLATILE")) { // krazy:exclude=strings + // We don't write these properties to disk to disk + continue; + } + icalproperty *p = icalproperty_new_x(c.value().toUtf8().constData()); + QString parameters = properties->nonKDECustomPropertyParameters(c.key()); + + // Minimalist parameter handler: extract icalparameter's out of + // the given input text (not really parsing as such) + if (!parameters.isEmpty()) { + const QStringList sl = parameters.split(QLatin1Char(';')); + for (const QString ¶meter : sl) { + icalparameter *param = icalparameter_new_from_string(parameter.toUtf8().constData()); + if (param) { + icalproperty_add_parameter(p, param); + } + } + } + + icalproperty_set_x_name(p, c.key().constData()); + icalcomponent_add_property(parent, p); + } +} +//@endcond + +icalproperty *ICalFormatImpl::writeOrganizer(const Person &organizer) +{ + if (organizer.email().isEmpty()) { + return nullptr; + } + + icalproperty *p = icalproperty_new_organizer(QByteArray(QByteArray("MAILTO:") + organizer.email().toUtf8()).constData()); + + if (!organizer.name().isEmpty()) { + icalproperty_add_parameter(p, + icalparameter_new_cn(organizer.name().toUtf8().constData())); + } + // TODO: Write dir, sent-by and language + + return p; +} + +icalproperty *ICalFormatImpl::writeDescription(const QString &description, bool isRich) +{ + icalproperty *p = icalproperty_new_description(description.toUtf8().constData()); + if (isRich) { + icalproperty_add_parameter(p, icalparameter_new_from_string("X-KDE-TEXTFORMAT=HTML")); + } + return p; +} + +icalproperty *ICalFormatImpl::writeSummary(const QString &summary, bool isRich) +{ + icalproperty *p = icalproperty_new_summary(summary.toUtf8().constData()); + if (isRich) { + icalproperty_add_parameter(p, icalparameter_new_from_string("X-KDE-TEXTFORMAT=HTML")); + } + return p; +} + +icalproperty *ICalFormatImpl::writeLocation(const QString &location, bool isRich) +{ + icalproperty *p = icalproperty_new_location(location.toUtf8().constData()); + if (isRich) { + icalproperty_add_parameter(p, icalparameter_new_from_string("X-KDE-TEXTFORMAT=HTML")); + } + return p; +} + +icalproperty *ICalFormatImpl::writeAttendee(const Attendee &attendee) +{ + if (attendee.email().isEmpty()) { + return nullptr; + } + + icalproperty *p = icalproperty_new_attendee(QByteArray(QByteArray("mailto:") + attendee.email().toUtf8()).constData()); + + if (!attendee.name().isEmpty()) { + icalproperty_add_parameter(p, + icalparameter_new_cn(attendee.name().toUtf8().constData())); + } + + icalproperty_add_parameter(p, icalparameter_new_rsvp(attendee.RSVP() ? ICAL_RSVP_TRUE : ICAL_RSVP_FALSE)); + + icalparameter_partstat status = ICAL_PARTSTAT_NEEDSACTION; + switch (attendee.status()) { + default: + case Attendee::NeedsAction: + status = ICAL_PARTSTAT_NEEDSACTION; + break; + case Attendee::Accepted: + status = ICAL_PARTSTAT_ACCEPTED; + break; + case Attendee::Declined: + status = ICAL_PARTSTAT_DECLINED; + break; + case Attendee::Tentative: + status = ICAL_PARTSTAT_TENTATIVE; + break; + case Attendee::Delegated: + status = ICAL_PARTSTAT_DELEGATED; + break; + case Attendee::Completed: + status = ICAL_PARTSTAT_COMPLETED; + break; + case Attendee::InProcess: + status = ICAL_PARTSTAT_INPROCESS; + break; + } + icalproperty_add_parameter(p, icalparameter_new_partstat(status)); + + icalparameter_role role = ICAL_ROLE_REQPARTICIPANT; + switch (attendee.role()) { + case Attendee::Chair: + role = ICAL_ROLE_CHAIR; + break; + default: + case Attendee::ReqParticipant: + role = ICAL_ROLE_REQPARTICIPANT; + break; + case Attendee::OptParticipant: + role = ICAL_ROLE_OPTPARTICIPANT; + break; + case Attendee::NonParticipant: + role = ICAL_ROLE_NONPARTICIPANT; + break; + } + icalproperty_add_parameter(p, icalparameter_new_role(role)); + + icalparameter_cutype cutype = ICAL_CUTYPE_INDIVIDUAL; + switch (attendee.cuType()) { + case Attendee::Unknown: + cutype = ICAL_CUTYPE_UNKNOWN; + break; + default: + case Attendee::Individual: + cutype = ICAL_CUTYPE_INDIVIDUAL; + break; + case Attendee::Group: + cutype = ICAL_CUTYPE_GROUP; + break; + case Attendee::Resource: + cutype = ICAL_CUTYPE_RESOURCE; + break; + case Attendee::Room: + cutype = ICAL_CUTYPE_ROOM; + break; + } + icalproperty_add_parameter(p, icalparameter_new_cutype(cutype)); + + if (!attendee.uid().isEmpty()) { + icalparameter *icalparameter_uid = icalparameter_new_x(attendee.uid().toUtf8().constData()); + + icalparameter_set_xname(icalparameter_uid, "X-UID"); + icalproperty_add_parameter(p, icalparameter_uid); + } + + if (!attendee.delegate().isEmpty()) { + icalparameter *icalparameter_delegate = icalparameter_new_delegatedto(attendee.delegate().toUtf8().constData()); + icalproperty_add_parameter(p, icalparameter_delegate); + } + + if (!attendee.delegator().isEmpty()) { + icalparameter *icalparameter_delegator = icalparameter_new_delegatedfrom(attendee.delegator().toUtf8().constData()); + icalproperty_add_parameter(p, icalparameter_delegator); + } + + return p; +} + +icalproperty *ICalFormatImpl::writeAttachment(const Attachment &att) +{ + icalattach *attach; + if (att.isUri()) { + attach = icalattach_new_from_url(att.uri().toUtf8().data()); + } else { + attach = icalattach_new_from_data((const char *)att.data().constData(), nullptr, nullptr); + } + icalproperty *p = icalproperty_new_attach(attach); + + icalattach_unref(attach); + + if (!att.mimeType().isEmpty()) { + icalproperty_add_parameter(p, icalparameter_new_fmttype(att.mimeType().toUtf8().data())); + } + + if (att.isBinary()) { + icalproperty_add_parameter(p, icalparameter_new_value(ICAL_VALUE_BINARY)); + icalproperty_add_parameter(p, icalparameter_new_encoding(ICAL_ENCODING_BASE64)); + } + + if (att.showInline()) { + icalparameter *icalparameter_inline = icalparameter_new_x("inline"); + icalparameter_set_xname(icalparameter_inline, "X-CONTENT-DISPOSITION"); + icalproperty_add_parameter(p, icalparameter_inline); + } + + if (!att.label().isEmpty()) { + icalparameter *icalparameter_label = icalparameter_new_x(att.label().toUtf8().constData()); + icalparameter_set_xname(icalparameter_label, "X-LABEL"); + icalproperty_add_parameter(p, icalparameter_label); + } + + if (att.isLocal()) { + icalparameter *icalparameter_local = icalparameter_new_x("local"); + icalparameter_set_xname(icalparameter_local, "X-KONTACT-TYPE"); + icalproperty_add_parameter(p, icalparameter_local); + } + + return p; +} + +icalrecurrencetype ICalFormatImpl::writeRecurrenceRule(RecurrenceRule *recur) +{ + icalrecurrencetype r; + icalrecurrencetype_clear(&r); + + switch (recur->recurrenceType()) { + case RecurrenceRule::rSecondly: + r.freq = ICAL_SECONDLY_RECURRENCE; + break; + case RecurrenceRule::rMinutely: + r.freq = ICAL_MINUTELY_RECURRENCE; + break; + case RecurrenceRule::rHourly: + r.freq = ICAL_HOURLY_RECURRENCE; + break; + case RecurrenceRule::rDaily: + r.freq = ICAL_DAILY_RECURRENCE; + break; + case RecurrenceRule::rWeekly: + r.freq = ICAL_WEEKLY_RECURRENCE; + break; + case RecurrenceRule::rMonthly: + r.freq = ICAL_MONTHLY_RECURRENCE; + break; + case RecurrenceRule::rYearly: + r.freq = ICAL_YEARLY_RECURRENCE; + break; + default: + r.freq = ICAL_NO_RECURRENCE; + qDebug() << "no recurrence"; + break; + } + + int index = 0; + QList bys; + QList::ConstIterator it; + + // Now write out the BY* parts: + bys = recur->bySeconds(); + index = 0; + for (it = bys.constBegin(); it != bys.constEnd(); ++it) { + r.by_second[index++] = *it; + r.by_second[index++] = static_cast(*it); + } + + bys = recur->byMinutes(); + index = 0; + for (it = bys.constBegin(); it != bys.constEnd(); ++it) { + r.by_minute[index++] = *it; + r.by_minute[index++] = static_cast(*it); + } + + bys = recur->byHours(); + index = 0; + for (it = bys.constBegin(); it != bys.constEnd(); ++it) { + r.by_hour[index++] = *it; + r.by_hour[index++] = static_cast(*it); + } + + bys = recur->byMonthDays(); + index = 0; + for (it = bys.constBegin(); it != bys.constEnd(); ++it) { + short dShort = static_cast((*it) * 8); + r.by_month_day[index++] = static_cast(icalrecurrencetype_day_position(dShort)); + } + + bys = recur->byYearDays(); + index = 0; + for (it = bys.constBegin(); it != bys.constEnd(); ++it) { + r.by_year_day[index++] = static_cast(*it); + } + + bys = recur->byWeekNumbers(); + index = 0; + for (it = bys.constBegin(); it != bys.constEnd(); ++it) { + r.by_week_no[index++] = static_cast(*it); + } + + bys = recur->byMonths(); + index = 0; + for (it = bys.constBegin(); it != bys.constEnd(); ++it) { + r.by_month[index++] = static_cast(*it); + } + + bys = recur->bySetPos(); + index = 0; + for (it = bys.constBegin(); it != bys.constEnd(); ++it) { + r.by_set_pos[index++] = static_cast(*it); + } + + const QList &byd = recur->byDays(); + int day; + index = 0; + for (QList::ConstIterator dit = byd.constBegin(); dit != byd.constEnd(); ++dit) { + day = (*dit).day() % 7 + 1; // convert from Monday=1 to Sunday=1 + if ((*dit).pos() < 0) { + day += (-(*dit).pos()) * 8; + day = -day; + } else { + day += (*dit).pos() * 8; + } + r.by_day[index++] = static_cast(day); + } + + r.week_start = static_cast(recur->weekStart() % 7 + 1); + + if (recur->frequency() > 1) { + // Don't write out INTERVAL=1, because that's the default anyway + r.interval = static_cast(recur->frequency()); + } + + if (recur->duration() > 0) { + r.count = recur->duration(); + } else if (recur->duration() == -1) { + r.count = 0; + } else { + if (recur->allDay()) { + r.until = writeICalDate(recur->endDt().date()); + } else { + r.until = writeICalDateTime(recur->endDt()); + } + } + + return r; +} + +icalcomponent *ICalFormatImpl::writeAlarm(const Alarm::Ptr &alarm) +{ + if (alarm->enabled()) { + alarm->setCustomProperty(APP_NAME_FOR_XPROPERTIES, ENABLED_ALARM_XPROPERTY, QStringLiteral("TRUE")); + } else { + alarm->setCustomProperty(APP_NAME_FOR_XPROPERTIES, ENABLED_ALARM_XPROPERTY, QStringLiteral("FALSE")); + } + + icalcomponent *a = icalcomponent_new(ICAL_VALARM_COMPONENT); + + icalproperty_action action; + icalattach *attach = nullptr; + + switch (alarm->type()) { + case Alarm::Procedure: + action = ICAL_ACTION_PROCEDURE; + attach = icalattach_new_from_url(QFile::encodeName(alarm->programFile()).data()); + icalcomponent_add_property(a, icalproperty_new_attach(attach)); + if (!alarm->programArguments().isEmpty()) { + icalcomponent_add_property(a, icalproperty_new_description(alarm->programArguments().toUtf8().constData())); + } + break; + case Alarm::Audio: + action = ICAL_ACTION_AUDIO; + if (!alarm->audioFile().isEmpty()) { + attach = icalattach_new_from_url(QFile::encodeName(alarm->audioFile()).data()); + icalcomponent_add_property(a, icalproperty_new_attach(attach)); + } + break; + case Alarm::Email: { + action = ICAL_ACTION_EMAIL; + const Person::List addresses = alarm->mailAddresses(); + for (Person::List::ConstIterator ad = addresses.constBegin(); ad != addresses.constEnd(); ++ad) { + if (!(*ad).email().isEmpty()) { + icalproperty *p = icalproperty_new_attendee(QByteArray(QByteArray("MAILTO:") + (*ad).email().toUtf8()).constData()); + if (!(*ad).name().isEmpty()) { + icalproperty_add_parameter(p, + icalparameter_new_cn((*ad).name().toUtf8().constData())); + } + icalcomponent_add_property(a, p); + } + } + icalcomponent_add_property(a, icalproperty_new_summary(alarm->mailSubject().toUtf8().constData())); + icalcomponent_add_property(a, icalproperty_new_description(alarm->mailText().toUtf8().constData())); + const QStringList attachments = alarm->mailAttachments(); + if (!attachments.isEmpty()) { + for (QStringList::const_iterator at = attachments.constBegin(), end = attachments.constEnd(); at != end; ++at) { + attach = icalattach_new_from_url(QFile::encodeName(*at).data()); + icalcomponent_add_property(a, icalproperty_new_attach(attach)); + } + } + break; + } + case Alarm::Display: + action = ICAL_ACTION_DISPLAY; + icalcomponent_add_property(a, icalproperty_new_description(alarm->text().toUtf8().constData())); + break; + case Alarm::Invalid: + default: + qDebug() << "Unknown type of alarm"; + action = ICAL_ACTION_NONE; + break; + } + icalcomponent_add_property(a, icalproperty_new_action(action)); + + // Trigger time + icaltriggertype trigger; + if (alarm->hasTime()) { + trigger.time = writeICalUtcDateTime(alarm->time(), false); + trigger.duration = icaldurationtype_null_duration(); + } else { + trigger.time = icaltime_null_time(); + Duration offset; + if (alarm->hasStartOffset()) { + offset = alarm->startOffset(); + } else { + offset = alarm->endOffset(); + } + trigger.duration = writeICalDuration(offset); + } + icalproperty *p = icalproperty_new_trigger(trigger); + if (alarm->hasEndOffset()) { + icalproperty_add_parameter(p, icalparameter_new_related(ICAL_RELATED_END)); + } + icalcomponent_add_property(a, p); + + // Repeat count and duration + if (alarm->repeatCount()) { + icalcomponent_add_property(a, icalproperty_new_repeat(alarm->repeatCount())); + icalcomponent_add_property(a, icalproperty_new_duration(writeICalDuration(alarm->snoozeTime()))); + } + + // Custom properties + const QMap custom = alarm->customProperties(); + for (QMap::ConstIterator c = custom.begin(); c != custom.end(); ++c) { + icalproperty *p = icalproperty_new_x(c.value().toUtf8().constData()); + icalproperty_set_x_name(p, c.key().constData()); + icalcomponent_add_property(a, p); + } + + icalattach_unref(attach); + + return a; +} + +icalproperty *ICalFormatImpl::writeConference(const Conference &conference) +{ + icalproperty *p = icalproperty_new_conference(conference.uri().toString().toUtf8().constData()); + icalproperty_set_parameter_from_string(p, "VALUE", "URI"); + icalproperty_set_parameter_from_string(p, "FEATURE", conference.features().join(QLatin1Char(',')).toUtf8().constData()); + icalproperty_set_parameter_from_string(p, "LABEL", conference.label().toUtf8().constData()); + + return p; +} + +Todo::Ptr ICalFormatImpl::readTodo(icalcomponent *vtodo, const ICalTimeZoneCache *tzlist) +{ + Todo::Ptr todo(new Todo); + + readIncidence(vtodo, todo, tzlist); + + icalproperty *p = icalcomponent_get_first_property(vtodo, ICAL_ANY_PROPERTY); + + while (p) { + icalproperty_kind kind = icalproperty_isa(p); + switch (kind) { + case ICAL_DUE_PROPERTY: { + // due date/time + bool allDay = false; + QDateTime kdt = readICalDateTimeProperty(p, tzlist, false, &allDay); + todo->setDtDue(kdt, true); + todo->setAllDay(allDay); + break; + } + case ICAL_COMPLETED_PROPERTY: // completion date/time + todo->setCompleted(readICalDateTimeProperty(p, tzlist)); + break; + + case ICAL_PERCENTCOMPLETE_PROPERTY: // Percent completed + todo->setPercentComplete(icalproperty_get_percentcomplete(p)); + break; + + case ICAL_RELATEDTO_PROPERTY: // related todo (parent) + todo->setRelatedTo(QString::fromUtf8(icalproperty_get_relatedto(p))); + d->mTodosRelate.append(todo); + break; + + case ICAL_DTSTART_PROPERTY: + // Flag that todo has start date. Value is read in by readIncidence(). + if (!todo->comments().filter(QStringLiteral("NoStartDate")).isEmpty()) { + todo->setDtStart(QDateTime()); + } + break; + case ICAL_X_PROPERTY: { + const char *name = icalproperty_get_x_name(p); + if (QLatin1String(name) == QLatin1String("X-KDE-LIBKCAL-DTRECURRENCE")) { + const QDateTime dateTime = readICalDateTimeProperty(p, tzlist); + if (dateTime.isValid()) { + todo->setDtRecurrence(dateTime); + } else { + qDebug() << "Invalid dateTime"; + } + } + } break; + default: + // TODO: do something about unknown properties? + break; + } + + p = icalcomponent_get_next_property(vtodo, ICAL_ANY_PROPERTY); + } + + if (d->mCompat) { + d->mCompat->fixEmptySummary(todo); + } + + todo->resetDirtyFields(); + return todo; +} + +Event::Ptr ICalFormatImpl::readEvent(icalcomponent *vevent, const ICalTimeZoneCache *tzlist) +{ + Event::Ptr event(new Event); + + readIncidence(vevent, event, tzlist); + + icalproperty *p = icalcomponent_get_first_property(vevent, ICAL_ANY_PROPERTY); + + bool dtEndProcessed = false; + + while (p) { + icalproperty_kind kind = icalproperty_isa(p); + switch (kind) { + case ICAL_DTEND_PROPERTY: { + // end date and time + bool allDay = false; + QDateTime kdt = readICalDateTimeProperty(p, tzlist, false, &allDay); + if (allDay) { + // End date is non-inclusive + QDate endDate = kdt.date().addDays(-1); + if (d->mCompat) { + d->mCompat->fixFloatingEnd(endDate); + } + if (endDate < event->dtStart().date()) { + endDate = event->dtStart().date(); + } + event->setDtEnd(QDateTime(endDate, {}, event->dtStart().timeZone())); + event->setAllDay(true); + } else { + event->setDtEnd(kdt); + event->setAllDay(false); + } + dtEndProcessed = true; + break; + } + case ICAL_RELATEDTO_PROPERTY: // related event (parent) + event->setRelatedTo(QString::fromUtf8(icalproperty_get_relatedto(p))); + d->mEventsRelate.append(event); + break; + + case ICAL_TRANSP_PROPERTY: { // Transparency + icalproperty_transp transparency = icalproperty_get_transp(p); + if (transparency == ICAL_TRANSP_TRANSPARENT) { + event->setTransparency(Event::Transparent); + } else { + event->setTransparency(Event::Opaque); + } + break; + } + default: + // TODO: do something about unknown properties? + break; + } + + p = icalcomponent_get_next_property(vevent, ICAL_ANY_PROPERTY); + } + + // according to rfc2445 the dtend shouldn't be written when it equals + // start date. so assign one equal to start date. + if (!dtEndProcessed && !event->hasDuration()) { + event->setDtEnd(event->dtStart()); + } + + //全天 + QString msade = event->nonKDECustomProperty("X-MICROSOFT-CDO-ALLDAYEVENT"); + if (!msade.isEmpty()) { + bool allDay = (msade == QLatin1String("TRUE")); + event->setAllDay(allDay); + } + + //农历 + QString lunnar = event->nonKDECustomProperty(VEVENT_LUNNAR_XPROPERTY); + if (!lunnar.isEmpty()) { + //TODO:多次转换时会出现多个TRUE,待跟踪 + bool isLunnar = (lunnar.contains(QLatin1String("TRUE"))); + event->setLunnar(isLunnar); + } + + if (d->mCompat) { + d->mCompat->fixEmptySummary(event); + } + + event->resetDirtyFields(); + return event; +} + +FreeBusy::Ptr ICalFormatImpl::readFreeBusy(icalcomponent *vfreebusy) +{ + FreeBusy::Ptr freebusy(new FreeBusy); + + d->readIncidenceBase(vfreebusy, freebusy); + + icalproperty *p = icalcomponent_get_first_property(vfreebusy, ICAL_ANY_PROPERTY); + + FreeBusyPeriod::List periods; + + while (p) { + icalproperty_kind kind = icalproperty_isa(p); + switch (kind) { + case ICAL_DTSTART_PROPERTY: // start date and time (UTC) + freebusy->setDtStart(readICalUtcDateTimeProperty(p, nullptr)); + break; + + case ICAL_DTEND_PROPERTY: // end Date and Time (UTC) + freebusy->setDtEnd(readICalUtcDateTimeProperty(p, nullptr)); + break; + + case ICAL_FREEBUSY_PROPERTY: { // Any FreeBusy Times (UTC) + icalperiodtype icalperiod = icalproperty_get_freebusy(p); + QDateTime period_start = readICalUtcDateTime(p, icalperiod.start); + FreeBusyPeriod period; + if (!icaltime_is_null_time(icalperiod.end)) { + QDateTime period_end = readICalUtcDateTime(p, icalperiod.end); + period = FreeBusyPeriod(period_start, period_end); + } else { + Duration duration(readICalDuration(icalperiod.duration)); + period = FreeBusyPeriod(period_start, duration); + } + + icalparameter *param = icalproperty_get_first_parameter(p, ICAL_FBTYPE_PARAMETER); + if (param) { + icalparameter_fbtype fbType = icalparameter_get_fbtype(param); + switch (fbType) { + case ICAL_FBTYPE_FREE: + period.setType(FreeBusyPeriod::Free); + break; + case ICAL_FBTYPE_BUSY: + period.setType(FreeBusyPeriod::Busy); + break; + case ICAL_FBTYPE_BUSYTENTATIVE: + period.setType(FreeBusyPeriod::BusyTentative); + break; + case ICAL_FBTYPE_BUSYUNAVAILABLE: + period.setType(FreeBusyPeriod::BusyUnavailable); + break; + case ICAL_FBTYPE_X: + period.setType(FreeBusyPeriod::Unknown); + break; + case ICAL_FBTYPE_NONE: + period.setType(FreeBusyPeriod::Free); + break; + } + } + + param = icalproperty_get_first_parameter(p, ICAL_X_PARAMETER); + while (param) { + if (strncmp(icalparameter_get_xname(param), "X-SUMMARY", 9) == 0) { + period.setSummary(QString::fromUtf8(QByteArray::fromBase64(icalparameter_get_xvalue(param)))); + } + if (strncmp(icalparameter_get_xname(param), "X-LOCATION", 10) == 0) { + period.setLocation(QString::fromUtf8(QByteArray::fromBase64(icalparameter_get_xvalue(param)))); + } + param = icalproperty_get_next_parameter(p, ICAL_X_PARAMETER); + } + + periods.append(period); + break; + } + + default: + // TODO: do something about unknown properties? + break; + } + p = icalcomponent_get_next_property(vfreebusy, ICAL_ANY_PROPERTY); + } + freebusy->addPeriods(periods); + + freebusy->resetDirtyFields(); + return freebusy; +} + +Journal::Ptr ICalFormatImpl::readJournal(icalcomponent *vjournal, const ICalTimeZoneCache *tzList) +{ + Journal::Ptr journal(new Journal); + readIncidence(vjournal, journal, tzList); + + journal->resetDirtyFields(); + return journal; +} + +Attendee ICalFormatImpl::readAttendee(icalproperty *attendee) +{ + // the following is a hack to support broken calendars (like WebCalendar 1.0.x) + // that include non-RFC-compliant attendees. Otherwise libical 0.42 asserts. + if (!icalproperty_get_value(attendee)) { + return {}; + } + + icalparameter *p = nullptr; + + QString email = QString::fromUtf8(icalproperty_get_attendee(attendee)); + if (email.startsWith(QLatin1String("mailto:"), Qt::CaseInsensitive)) { + email.remove(0, 7); + } + + // libical may return everything after ATTENDEE tag if the rest is + // not meaningful. Verify the address to filter out these cases. + if (!Person::isValidEmail(email)) { + return {}; + } + + QString name; + QString uid; + p = icalproperty_get_first_parameter(attendee, ICAL_CN_PARAMETER); + if (p) { + name = QString::fromUtf8(icalparameter_get_cn(p)); + } else { + } + + bool rsvp = false; + p = icalproperty_get_first_parameter(attendee, ICAL_RSVP_PARAMETER); + if (p) { + icalparameter_rsvp rsvpParameter = icalparameter_get_rsvp(p); + if (rsvpParameter == ICAL_RSVP_TRUE) { + rsvp = true; + } + } + + Attendee::PartStat status = Attendee::NeedsAction; + p = icalproperty_get_first_parameter(attendee, ICAL_PARTSTAT_PARAMETER); + if (p) { + icalparameter_partstat partStatParameter = icalparameter_get_partstat(p); + switch (partStatParameter) { + default: + case ICAL_PARTSTAT_NEEDSACTION: + status = Attendee::NeedsAction; + break; + case ICAL_PARTSTAT_ACCEPTED: + status = Attendee::Accepted; + break; + case ICAL_PARTSTAT_DECLINED: + status = Attendee::Declined; + break; + case ICAL_PARTSTAT_TENTATIVE: + status = Attendee::Tentative; + break; + case ICAL_PARTSTAT_DELEGATED: + status = Attendee::Delegated; + break; + case ICAL_PARTSTAT_COMPLETED: + status = Attendee::Completed; + break; + case ICAL_PARTSTAT_INPROCESS: + status = Attendee::InProcess; + break; + } + } + + Attendee::Role role = Attendee::ReqParticipant; + p = icalproperty_get_first_parameter(attendee, ICAL_ROLE_PARAMETER); + if (p) { + icalparameter_role roleParameter = icalparameter_get_role(p); + switch (roleParameter) { + case ICAL_ROLE_CHAIR: + role = Attendee::Chair; + break; + default: + case ICAL_ROLE_REQPARTICIPANT: + role = Attendee::ReqParticipant; + break; + case ICAL_ROLE_OPTPARTICIPANT: + role = Attendee::OptParticipant; + break; + case ICAL_ROLE_NONPARTICIPANT: + role = Attendee::NonParticipant; + break; + } + } + + Attendee::CuType cuType = Attendee::Individual; + p = icalproperty_get_first_parameter(attendee, ICAL_CUTYPE_PARAMETER); + if (p) { + icalparameter_cutype cutypeParameter = icalparameter_get_cutype(p); + switch (cutypeParameter) { + case ICAL_CUTYPE_X: + case ICAL_CUTYPE_UNKNOWN: + cuType = Attendee::Unknown; + break; + default: + case ICAL_CUTYPE_NONE: + case ICAL_CUTYPE_INDIVIDUAL: + cuType = Attendee::Individual; + break; + case ICAL_CUTYPE_GROUP: + cuType = Attendee::Group; + break; + case ICAL_CUTYPE_RESOURCE: + cuType = Attendee::Resource; + break; + case ICAL_CUTYPE_ROOM: + cuType = Attendee::Room; + break; + } + } + + p = icalproperty_get_first_parameter(attendee, ICAL_X_PARAMETER); + QMap custom; + while (p) { + QString xname = QString::fromLatin1(icalparameter_get_xname(p)).toUpper(); + QString xvalue = QString::fromUtf8(icalparameter_get_xvalue(p)); + if (xname == QLatin1String("X-UID")) { + uid = xvalue; + } else { + custom[xname.toUtf8()] = xvalue; + } + p = icalproperty_get_next_parameter(attendee, ICAL_X_PARAMETER); + } + + Attendee a(name, email, rsvp, status, role, uid); + a.setCuType(cuType); + a.customProperties().setCustomProperties(custom); + + p = icalproperty_get_first_parameter(attendee, ICAL_DELEGATEDTO_PARAMETER); + if (p) { + a.setDelegate(QLatin1String(icalparameter_get_delegatedto(p))); + } + + p = icalproperty_get_first_parameter(attendee, ICAL_DELEGATEDFROM_PARAMETER); + if (p) { + a.setDelegator(QLatin1String(icalparameter_get_delegatedfrom(p))); + } + + return a; +} + +Person ICalFormatImpl::readOrganizer(icalproperty *organizer) +{ + QString email = QString::fromUtf8(icalproperty_get_organizer(organizer)); + if (email.startsWith(QLatin1String("mailto:"), Qt::CaseInsensitive)) { + email.remove(0, 7); + } + QString cn; + + icalparameter *p = icalproperty_get_first_parameter(organizer, ICAL_CN_PARAMETER); + + if (p) { + cn = QString::fromUtf8(icalparameter_get_cn(p)); + } + Person org(cn, email); + // TODO: Treat sent-by, dir and language here, too + return org; +} + +Attachment ICalFormatImpl::readAttachment(icalproperty *attach) +{ + Attachment attachment; + + QByteArray p; + icalvalue *value = icalproperty_get_value(attach); + + switch (icalvalue_isa(value)) { + case ICAL_ATTACH_VALUE: { + icalattach *a = icalproperty_get_attach(attach); + if (!icalattach_get_is_url(a)) { + p = QByteArray(reinterpret_cast(icalattach_get_data(a))); + if (!p.isEmpty()) { + attachment = Attachment(p); + } + } else { + p = icalattach_get_url(a); + if (!p.isEmpty()) { + attachment = Attachment(QString::fromUtf8(p)); + } + } + break; + } + case ICAL_BINARY_VALUE: { + icalattach *a = icalproperty_get_attach(attach); + p = QByteArray(reinterpret_cast(icalattach_get_data(a))); + if (!p.isEmpty()) { + attachment = Attachment(p); + } + break; + } + case ICAL_URI_VALUE: + p = icalvalue_get_uri(value); + attachment = Attachment(QString::fromUtf8(p)); + break; + default: + break; + } + + if (!attachment.isEmpty()) { + icalparameter *p = icalproperty_get_first_parameter(attach, ICAL_FMTTYPE_PARAMETER); + if (p) { + attachment.setMimeType(QLatin1String(icalparameter_get_fmttype(p))); + } + + p = icalproperty_get_first_parameter(attach, ICAL_X_PARAMETER); + while (p) { + QString xname = QString::fromLatin1(icalparameter_get_xname(p)).toUpper(); + QString xvalue = QString::fromUtf8(icalparameter_get_xvalue(p)); + if (xname == QLatin1String("X-CONTENT-DISPOSITION")) { + attachment.setShowInline(xvalue.toLower() == QLatin1String("inline")); + } else if (xname == QLatin1String("X-LABEL")) { + attachment.setLabel(xvalue); + } else if (xname == QLatin1String("X-KONTACT-TYPE")) { + attachment.setLocal(xvalue.toLower() == QLatin1String("local")); + } + p = icalproperty_get_next_parameter(attach, ICAL_X_PARAMETER); + } + + p = icalproperty_get_first_parameter(attach, ICAL_X_PARAMETER); + while (p) { + if (strncmp(icalparameter_get_xname(p), "X-LABEL", 7) == 0) { + attachment.setLabel(QString::fromUtf8(icalparameter_get_xvalue(p))); + } + p = icalproperty_get_next_parameter(attach, ICAL_X_PARAMETER); + } + } + + return attachment; +} + +void ICalFormatImpl::readIncidence(icalcomponent *parent, const Incidence::Ptr &incidence, const ICalTimeZoneCache *tzlist) +{ + d->readIncidenceBase(parent, incidence); + + icalproperty *p = icalcomponent_get_first_property(parent, ICAL_ANY_PROPERTY); + + const char *text; + int intvalue, inttext; + icaldurationtype icalduration; + QDateTime kdt; + QDateTime dtstamp; + + QStringList categories; + + while (p) { + icalproperty_kind kind = icalproperty_isa(p); + switch (kind) { + case ICAL_CREATED_PROPERTY: + incidence->setCreated(readICalDateTimeProperty(p, tzlist)); + break; + + case ICAL_DTSTAMP_PROPERTY: + dtstamp = readICalDateTimeProperty(p, tzlist); + break; + + case ICAL_SEQUENCE_PROPERTY: // sequence + intvalue = icalproperty_get_sequence(p); + incidence->setRevision(intvalue); + break; + + case ICAL_LASTMODIFIED_PROPERTY: // last modification UTC date/time + incidence->setLastModified(readICalDateTimeProperty(p, tzlist)); + break; + + case ICAL_DTSTART_PROPERTY: { // start date and time + bool allDay = false; + kdt = readICalDateTimeProperty(p, tzlist, false, &allDay); + incidence->setDtStart(kdt); + incidence->setAllDay(allDay); + break; + } + + case ICAL_DURATION_PROPERTY: // start date and time + icalduration = icalproperty_get_duration(p); + incidence->setDuration(readICalDuration(icalduration)); + break; + + case ICAL_DESCRIPTION_PROPERTY: { // description + QString textStr = QString::fromUtf8(icalproperty_get_description(p)); + if (!textStr.isEmpty()) { + QString valStr = QString::fromUtf8(icalproperty_get_parameter_as_string(p, "X-KDE-TEXTFORMAT")); + if (!valStr.compare(QLatin1String("HTML"), Qt::CaseInsensitive)) { + incidence->setDescription(textStr, true); + } else { + incidence->setDescription(textStr, false); + } + } + } break; + + case ICAL_SUMMARY_PROPERTY: { // summary + QString textStr = QString::fromUtf8(icalproperty_get_summary(p)); + if (!textStr.isEmpty()) { + QString valStr = QString::fromUtf8(icalproperty_get_parameter_as_string(p, "X-KDE-TEXTFORMAT")); + if (!valStr.compare(QLatin1String("HTML"), Qt::CaseInsensitive)) { + incidence->setSummary(textStr, true); + } else { + incidence->setSummary(textStr, false); + } + } + } break; + + case ICAL_LOCATION_PROPERTY: { // location + if (!icalproperty_get_value(p)) { + // Fix for #191472. This is a pre-crash guard in case libical was + // compiled in superstrict mode (--enable-icalerrors-are-fatal) + // TODO: pre-crash guard other property getters too. + break; + } + QString textStr = QString::fromUtf8(icalproperty_get_location(p)); + if (!textStr.isEmpty()) { + QString valStr = QString::fromUtf8(icalproperty_get_parameter_as_string(p, "X-KDE-TEXTFORMAT")); + if (!valStr.compare(QLatin1String("HTML"), Qt::CaseInsensitive)) { + incidence->setLocation(textStr, true); + } else { + incidence->setLocation(textStr, false); + } + } + } break; + + case ICAL_STATUS_PROPERTY: { // status + Incidence::Status stat; + switch (icalproperty_get_status(p)) { + case ICAL_STATUS_TENTATIVE: + stat = Incidence::StatusTentative; + break; + case ICAL_STATUS_CONFIRMED: + stat = Incidence::StatusConfirmed; + break; + case ICAL_STATUS_COMPLETED: + stat = Incidence::StatusCompleted; + break; + case ICAL_STATUS_NEEDSACTION: + stat = Incidence::StatusNeedsAction; + break; + case ICAL_STATUS_CANCELLED: + stat = Incidence::StatusCanceled; + break; + case ICAL_STATUS_INPROCESS: + stat = Incidence::StatusInProcess; + break; + case ICAL_STATUS_DRAFT: + stat = Incidence::StatusDraft; + break; + case ICAL_STATUS_FINAL: + stat = Incidence::StatusFinal; + break; + case ICAL_STATUS_X: + incidence->setCustomStatus(QString::fromUtf8(icalvalue_get_x(icalproperty_get_value(p)))); + stat = Incidence::StatusX; + break; + case ICAL_STATUS_NONE: + default: + stat = Incidence::StatusNone; + break; + } + if (stat != Incidence::StatusX) { + incidence->setStatus(stat); + } + break; + } + + case ICAL_GEO_PROPERTY: { // geo + icalgeotype geo = icalproperty_get_geo(p); + incidence->setGeoLatitude(geo.lat); + incidence->setGeoLongitude(geo.lon); + incidence->setHasGeo(true); + break; + } + + case ICAL_PRIORITY_PROPERTY: // priority + intvalue = icalproperty_get_priority(p); + if (d->mCompat) { + intvalue = d->mCompat->fixPriority(intvalue); + } + incidence->setPriority(intvalue); + break; + + case ICAL_CATEGORIES_PROPERTY: { // categories + // We have always supported multiple CATEGORIES properties per component + // even though the RFC seems to indicate only 1 is permitted. + // We can't change that -- in order to retain backwards compatibility. + text = icalproperty_get_categories(p); + const QString val = QString::fromUtf8(text); + const QStringList lstVal = val.split(QLatin1Char(','), QString::SkipEmptyParts); + for (const QString &cat : lstVal) { + // ensure no duplicates + if (!categories.contains(cat)) { + categories.append(cat); + } + } + break; + } + + case ICAL_RECURRENCEID_PROPERTY: // recurrenceId + kdt = readICalDateTimeProperty(p, tzlist); + if (kdt.isValid()) { + incidence->setRecurrenceId(kdt); + const icalparameter *param = icalproperty_get_first_parameter(p, ICAL_RANGE_PARAMETER); + if (param && icalparameter_get_range(param) == ICAL_RANGE_THISANDFUTURE) { + incidence->setThisAndFuture(true); + } else { + // A workaround for a bug in libical (https://github.com/libical/libical/issues/185) + // If a recurrenceId has both tzid and range, both parameters end up in the tzid. + // This results in invalid tzid's like: "Europe/Berlin;RANGE=THISANDFUTURE" + const icalparameter *param = icalproperty_get_first_parameter(p, ICAL_TZID_PARAMETER); + QString tzid = QString::fromLatin1(icalparameter_get_tzid(param)); + const QStringList parts = tzid.toLower().split(QLatin1Char(';')); + for (const QString &part : parts) { + if (part == QLatin1String("range=thisandfuture")) { + incidence->setThisAndFuture(true); + break; + } + } + } + } + break; + + case ICAL_RRULE_PROPERTY: + readRecurrenceRule(p, incidence); + break; + + case ICAL_RDATE_PROPERTY: { + bool allDay = false; + kdt = readICalDateTimeProperty(p, tzlist, false, &allDay); + if (kdt.isValid()) { + if (allDay) { + incidence->recurrence()->addRDate(kdt.date()); + } else { + incidence->recurrence()->addRDateTime(kdt); + } + } else { + // TODO: RDates as period are not yet implemented! + } + break; + } + + case ICAL_EXRULE_PROPERTY: + readExceptionRule(p, incidence); + break; + + case ICAL_EXDATE_PROPERTY: { + bool allDay = false; + kdt = readICalDateTimeProperty(p, tzlist, false, &allDay); + if (allDay) { + incidence->recurrence()->addExDate(kdt.date()); + } else { + incidence->recurrence()->addExDateTime(kdt); + } + break; + } + + case ICAL_CLASS_PROPERTY: + inttext = icalproperty_get_class(p); + if (inttext == ICAL_CLASS_PUBLIC) { + incidence->setSecrecy(Incidence::SecrecyPublic); + } else if (inttext == ICAL_CLASS_CONFIDENTIAL) { + incidence->setSecrecy(Incidence::SecrecyConfidential); + } else { + incidence->setSecrecy(Incidence::SecrecyPrivate); + } + break; + + case ICAL_ATTACH_PROPERTY: // attachments + incidence->addAttachment(readAttachment(p)); + break; + + case ICAL_COLOR_PROPERTY: + incidence->setColor(QString::fromUtf8(icalproperty_get_color(p))); + break; + + default: + // TODO: do something about unknown properties? + break; + } + + p = icalcomponent_get_next_property(parent, ICAL_ANY_PROPERTY); + } + + // Set the scheduling ID + const QString uid = incidence->customProperty("LIBKCAL", "ID"); + if (!uid.isNull()) { + // The UID stored in incidencebase is actually the scheduling ID + // It has to be stored in the iCal UID component for compatibility + // with other iCal applications + incidence->setSchedulingID(incidence->uid(), uid); + } + + // Now that recurrence and exception stuff is completely set up, + // do any backwards compatibility adjustments. + if (incidence->recurs() && d->mCompat) { + d->mCompat->fixRecurrence(incidence); + } + + // add categories + incidence->setCategories(categories); + + // iterate through all alarms + for (icalcomponent *alarm = icalcomponent_get_first_component(parent, ICAL_VALARM_COMPONENT); alarm; + alarm = icalcomponent_get_next_component(parent, ICAL_VALARM_COMPONENT)) { + readAlarm(alarm, incidence); + } + + // iterate through all conferences + Conference::List conferences; + for (auto *conf = icalcomponent_get_first_property(parent, ICAL_CONFERENCE_PROPERTY); conf; + conf = icalcomponent_get_next_property(parent, ICAL_CONFERENCE_PROPERTY)) { + conferences.push_back(readConference(conf)); + } + incidence->setConferences(conferences); + + if (d->mCompat) { + // Fix incorrect alarm settings by other applications (like outloook 9) + d->mCompat->fixAlarms(incidence); + d->mCompat->setCreatedToDtStamp(incidence, dtstamp); + } +} + +//@cond PRIVATE +void ICalFormatImpl::Private::readIncidenceBase(icalcomponent *parent, const IncidenceBase::Ptr &incidenceBase) +{ + icalproperty *p = icalcomponent_get_first_property(parent, ICAL_ANY_PROPERTY); + bool uidProcessed = false; + while (p) { + icalproperty_kind kind = icalproperty_isa(p); + switch (kind) { + case ICAL_UID_PROPERTY: // unique id + uidProcessed = true; + incidenceBase->setUid(QString::fromUtf8(icalproperty_get_uid(p))); + break; + + case ICAL_ORGANIZER_PROPERTY: // organizer + incidenceBase->setOrganizer(mImpl->readOrganizer(p)); + break; + + case ICAL_ATTENDEE_PROPERTY: // attendee + incidenceBase->addAttendee(mImpl->readAttendee(p)); + break; + + case ICAL_COMMENT_PROPERTY: + incidenceBase->addComment(QString::fromUtf8(icalproperty_get_comment(p))); + break; + + case ICAL_CONTACT_PROPERTY: + incidenceBase->addContact(QString::fromUtf8(icalproperty_get_contact(p))); + break; + + case ICAL_URL_PROPERTY: + incidenceBase->setUrl(QUrl(QString::fromUtf8(icalproperty_get_url(p)))); + break; + + default: + break; + } + + p = icalcomponent_get_next_property(parent, ICAL_ANY_PROPERTY); + } + + if (!uidProcessed) { + qWarning() << "The incidence didn't have any UID! Report a bug " + << "to the application that generated this file."; + + // Our in-memory incidence has a random uid generated in Event's ctor. + // Make it empty so it matches what's in the file: + incidenceBase->setUid(QString()); + + // Otherwise, next time we read the file, this function will return + // an event with another random uid and we will have two events in the calendar. + } + + // custom properties + readCustomProperties(parent, incidenceBase.data()); +} + +void ICalFormatImpl::Private::readCustomProperties(icalcomponent *parent, CustomProperties *properties) +{ + QByteArray property; + QString value, parameters; + icalproperty *p = icalcomponent_get_first_property(parent, ICAL_X_PROPERTY); + icalparameter *param = nullptr; + + while (p) { + QString nvalue = QString::fromUtf8(icalproperty_get_x(p)); + if (nvalue.isEmpty()) { + icalvalue *value = icalproperty_get_value(p); + if (icalvalue_isa(value) == ICAL_TEXT_VALUE) { + // Calling icalvalue_get_text( value ) on a datetime value crashes. + nvalue = QString::fromUtf8(icalvalue_get_text(value)); + } else { + p = icalcomponent_get_next_property(parent, ICAL_X_PROPERTY); + continue; + } + } + const char *name = icalproperty_get_x_name(p); + QByteArray nproperty(name); + if (property != nproperty) { + // New property + if (!property.isEmpty()) { + properties->setNonKDECustomProperty(property, value, parameters); + } + property = name; + value = nvalue; + QStringList parametervalues; + for (param = icalproperty_get_first_parameter(p, ICAL_ANY_PARAMETER); param; param = icalproperty_get_next_parameter(p, ICAL_ANY_PARAMETER)) { + // 'c' is owned by ical library => all we need to do is just use it + const char *c = icalparameter_as_ical_string(param); + parametervalues.push_back(QLatin1String(c)); + } + parameters = parametervalues.join(QLatin1Char(';')); + } else { + value = value.append(QLatin1Char(',')).append(nvalue); + } + p = icalcomponent_get_next_property(parent, ICAL_X_PROPERTY); + } + if (!property.isEmpty()) { + properties->setNonKDECustomProperty(property, value, parameters); + } +} +//@endcond + +void ICalFormatImpl::readRecurrenceRule(icalproperty *rrule, const Incidence::Ptr &incidence) +{ + Recurrence *recur = incidence->recurrence(); + + struct icalrecurrencetype r = icalproperty_get_rrule(rrule); + // dumpIcalRecurrence(r); + + RecurrenceRule *recurrule = new RecurrenceRule(/*incidence*/); + recurrule->setStartDt(incidence->dtStart()); + readRecurrence(r, recurrule); + recur->addRRule(recurrule); +} + +void ICalFormatImpl::readExceptionRule(icalproperty *rrule, const Incidence::Ptr &incidence) +{ + struct icalrecurrencetype r = icalproperty_get_exrule(rrule); + // dumpIcalRecurrence(r); + + RecurrenceRule *recurrule = new RecurrenceRule(/*incidence*/); + recurrule->setStartDt(incidence->dtStart()); + readRecurrence(r, recurrule); + + Recurrence *recur = incidence->recurrence(); + recur->addExRule(recurrule); +} + +void ICalFormatImpl::readRecurrence(const struct icalrecurrencetype &r, RecurrenceRule *recur) +{ + // Generate the RRULE string + recur->setRRule(QLatin1String(icalrecurrencetype_as_string(const_cast(&r)))); + // Period + switch (r.freq) { + case ICAL_SECONDLY_RECURRENCE: + recur->setRecurrenceType(RecurrenceRule::rSecondly); + break; + case ICAL_MINUTELY_RECURRENCE: + recur->setRecurrenceType(RecurrenceRule::rMinutely); + break; + case ICAL_HOURLY_RECURRENCE: + recur->setRecurrenceType(RecurrenceRule::rHourly); + break; + case ICAL_DAILY_RECURRENCE: + recur->setRecurrenceType(RecurrenceRule::rDaily); + break; + case ICAL_WEEKLY_RECURRENCE: + recur->setRecurrenceType(RecurrenceRule::rWeekly); + break; + case ICAL_MONTHLY_RECURRENCE: + recur->setRecurrenceType(RecurrenceRule::rMonthly); + break; + case ICAL_YEARLY_RECURRENCE: + recur->setRecurrenceType(RecurrenceRule::rYearly); + break; + case ICAL_NO_RECURRENCE: + default: + recur->setRecurrenceType(RecurrenceRule::rNone); + } + // Frequency + recur->setFrequency(r.interval); + + // Duration & End Date + if (!icaltime_is_null_time(r.until)) { + icaltimetype t = r.until; + //结束时间不切换零时区 + recur->setEndDt(readICalDateTime(nullptr, t, nullptr, false)); + } else { + if (r.count == 0) { + recur->setDuration(-1); + } else { + recur->setDuration(r.count); + } + } + + // Week start setting + short wkst = static_cast((r.week_start + 5) % 7 + 1); + recur->setWeekStart(wkst); + + // And now all BY* + QList lst; + int i; + int index = 0; + +// clang-format off +//@cond PRIVATE +#define readSetByList( rrulecomp, setfunc ) \ + index = 0; \ + lst.clear(); \ + while ( ( i = r.rrulecomp[index++] ) != ICAL_RECURRENCE_ARRAY_MAX ) { \ + lst.append( i ); \ + } \ + if ( !lst.isEmpty() ) { \ + recur->setfunc( lst ); \ + } +//@endcond + // clang-format on + + // BYSECOND, MINUTE and HOUR, MONTHDAY, YEARDAY, WEEKNUMBER, MONTH + // and SETPOS are standard int lists, so we can treat them with the + // same macro + readSetByList(by_second, setBySeconds); + readSetByList(by_minute, setByMinutes); + readSetByList(by_hour, setByHours); + readSetByList(by_month_day, setByMonthDays); + readSetByList(by_year_day, setByYearDays); + readSetByList(by_week_no, setByWeekNumbers); + readSetByList(by_month, setByMonths); + readSetByList(by_set_pos, setBySetPos); +#undef readSetByList + + // BYDAY is a special case, since it's not an int list + QList wdlst; + short day; + index = 0; + while ((day = r.by_day[index++]) != ICAL_RECURRENCE_ARRAY_MAX) { + RecurrenceRule::WDayPos pos; + pos.setDay(static_cast((icalrecurrencetype_day_day_of_week(day) + 5) % 7 + 1)); + pos.setPos(icalrecurrencetype_day_position(day)); + wdlst.append(pos); + } + if (!wdlst.isEmpty()) { + recur->setByDays(wdlst); + } + + // TODO: Store all X- fields of the RRULE inside the recurrence (so they are + // preserved +} + +void ICalFormatImpl::readAlarm(icalcomponent *alarm, const Incidence::Ptr &incidence) +{ + Alarm::Ptr ialarm = incidence->newAlarm(); + ialarm->setRepeatCount(0); + ialarm->setEnabled(true); + + // Determine the alarm's action type + icalproperty *p = icalcomponent_get_first_property(alarm, ICAL_ACTION_PROPERTY); + Alarm::Type type = Alarm::Display; + icalproperty_action action = ICAL_ACTION_DISPLAY; + if (!p) { + qDebug() << "Unknown type of alarm, using default"; + // TODO: do something about unknown alarm type? + } else { + action = icalproperty_get_action(p); + switch (action) { + case ICAL_ACTION_DISPLAY: + type = Alarm::Display; + break; + case ICAL_ACTION_AUDIO: + type = Alarm::Audio; + break; + case ICAL_ACTION_PROCEDURE: + type = Alarm::Procedure; + break; + case ICAL_ACTION_EMAIL: + type = Alarm::Email; + break; + default: + break; + // TODO: do something about invalid alarm type? + } + } + ialarm->setType(type); + + p = icalcomponent_get_first_property(alarm, ICAL_ANY_PROPERTY); + while (p) { + icalproperty_kind kind = icalproperty_isa(p); + + switch (kind) { + case ICAL_TRIGGER_PROPERTY: { + icaltriggertype trigger = icalproperty_get_trigger(p); + if (!icaltime_is_null_time(trigger.time)) { + // set the trigger to a specific time (which is not in rfc2445, btw) + ialarm->setTime(readICalUtcDateTime(p, trigger.time)); + } else { + // set the trigger to an offset from the incidence start or end time. + if (!icaldurationtype_is_bad_duration(trigger.duration)) { + Duration duration(readICalDuration(trigger.duration)); + icalparameter *param = icalproperty_get_first_parameter(p, ICAL_RELATED_PARAMETER); + if (param && icalparameter_get_related(param) == ICAL_RELATED_END) { + ialarm->setEndOffset(duration); + } else { + ialarm->setStartOffset(duration); + } + } else { + // a bad duration was encountered, just set a 0 duration from start + ialarm->setStartOffset(Duration(0)); + } + } + break; + } + case ICAL_DURATION_PROPERTY: { + icaldurationtype duration = icalproperty_get_duration(p); + ialarm->setSnoozeTime(readICalDuration(duration)); + break; + } + case ICAL_REPEAT_PROPERTY: + ialarm->setRepeatCount(icalproperty_get_repeat(p)); + break; + + case ICAL_DESCRIPTION_PROPERTY: { + // Only in DISPLAY and EMAIL and PROCEDURE alarms + QString description = QString::fromUtf8(icalproperty_get_description(p)); + switch (action) { + case ICAL_ACTION_DISPLAY: + ialarm->setText(description); + break; + case ICAL_ACTION_PROCEDURE: + ialarm->setProgramArguments(description); + break; + case ICAL_ACTION_EMAIL: + ialarm->setMailText(description); + break; + default: + break; + } + break; + } + case ICAL_SUMMARY_PROPERTY: + // Only in EMAIL alarm + ialarm->setMailSubject(QString::fromUtf8(icalproperty_get_summary(p))); + break; + + case ICAL_ATTENDEE_PROPERTY: { + // Only in EMAIL alarm + QString email = QString::fromUtf8(icalproperty_get_attendee(p)); + if (email.startsWith(QLatin1String("mailto:"), Qt::CaseInsensitive)) { + email.remove(0, 7); + } + QString name; + icalparameter *param = icalproperty_get_first_parameter(p, ICAL_CN_PARAMETER); + if (param) { + name = QString::fromUtf8(icalparameter_get_cn(param)); + } + ialarm->addMailAddress(Person(name, email)); + break; + } + + case ICAL_ATTACH_PROPERTY: { + // Only in AUDIO and EMAIL and PROCEDURE alarms + Attachment attach = readAttachment(p); + if (!attach.isEmpty() && attach.isUri()) { + switch (action) { + case ICAL_ACTION_AUDIO: + ialarm->setAudioFile(attach.uri()); + break; + case ICAL_ACTION_PROCEDURE: + ialarm->setProgramFile(attach.uri()); + break; + case ICAL_ACTION_EMAIL: + ialarm->addMailAttachment(attach.uri()); + break; + default: + break; + } + } else { + qDebug() << "Alarm attachments currently only support URIs," + << "but no binary data"; + } + break; + } + default: + break; + } + p = icalcomponent_get_next_property(alarm, ICAL_ANY_PROPERTY); + } + + // custom properties + d->readCustomProperties(alarm, ialarm.data()); + + QString locationRadius = ialarm->nonKDECustomProperty("X-LOCATION-RADIUS"); + if (!locationRadius.isEmpty()) { + ialarm->setLocationRadius(locationRadius.toInt()); + ialarm->setHasLocationRadius(true); + } + + if (ialarm->customProperty(APP_NAME_FOR_XPROPERTIES, ENABLED_ALARM_XPROPERTY) == QLatin1String("FALSE")) { + ialarm->setEnabled(false); + } + // TODO: check for consistency of alarm properties +} + +icaldatetimeperiodtype ICalFormatImpl::writeICalDatePeriod(const QDate &date) +{ + icaldatetimeperiodtype t; + t.time = writeICalDate(date); + t.period = icalperiodtype_null_period(); + return t; +} + +Conference ICalFormatImpl::readConference(icalproperty *prop) +{ + Conference conf; + conf.setUri(QUrl(QString::fromUtf8(icalproperty_get_conference(prop)))); + conf.setLabel(QString::fromUtf8(icalproperty_get_parameter_as_string(prop, "LABEL"))); + conf.setFeatures(QString::fromUtf8(icalproperty_get_parameter_as_string(prop, "FEATURE")).split(QLatin1Char(','))); + conf.setLanguage(QString::fromUtf8(icalproperty_get_parameter_as_string(prop, "LANGUAGE"))); + return conf; +} + +icaltimetype ICalFormatImpl::writeICalDate(const QDate &date) +{ + icaltimetype t = icaltime_null_time(); + + t.year = date.year(); + t.month = date.month(); + t.day = date.day(); + + t.hour = 0; + t.minute = 0; + t.second = 0; + + t.is_date = 1; + t.zone = nullptr; + + return t; +} + +icaltimetype ICalFormatImpl::writeICalDateTime(const QDateTime &datetime, bool dateOnly) +{ + icaltimetype t = icaltime_null_time(); + + t.year = datetime.date().year(); + t.month = datetime.date().month(); + t.day = datetime.date().day(); + + t.is_date = dateOnly; + + if (!t.is_date) { + t.hour = datetime.time().hour(); + t.minute = datetime.time().minute(); + t.second = datetime.time().second(); + } + t.zone = nullptr; // zone is NOT set + if (datetime.timeSpec() == Qt::UTC || (datetime.timeSpec() == Qt::TimeZone && datetime.timeZone() == QTimeZone::utc()) || (datetime.timeSpec() == Qt::OffsetFromUTC && datetime.offsetFromUtc() == 0)) { + t = icaltime_convert_to_zone(t, icaltimezone_get_utc_timezone()); + } + return t; +} + +icalproperty *ICalFormatImpl::writeICalDateTimeProperty(const icalproperty_kind type, const QDateTime &dt, TimeZoneList *tzUsedList) +{ + icaltimetype t; + + switch (type) { + case ICAL_DTSTAMP_PROPERTY: + case ICAL_CREATED_PROPERTY: + case ICAL_LASTMODIFIED_PROPERTY: + t = writeICalDateTime(dt.toUTC()); + break; + default: + t = writeICalDateTime(dt); + break; + } + + icalproperty *p; + switch (type) { + case ICAL_DTSTAMP_PROPERTY: + p = icalproperty_new_dtstamp(t); + break; + case ICAL_CREATED_PROPERTY: + p = icalproperty_new_created(t); + break; + case ICAL_LASTMODIFIED_PROPERTY: + p = icalproperty_new_lastmodified(t); + break; + case ICAL_DTSTART_PROPERTY: // start date and time + p = icalproperty_new_dtstart(t); + break; + case ICAL_DTEND_PROPERTY: // end date and time + p = icalproperty_new_dtend(t); + break; + case ICAL_DUE_PROPERTY: + p = icalproperty_new_due(t); + break; + case ICAL_RECURRENCEID_PROPERTY: + p = icalproperty_new_recurrenceid(t); + break; + case ICAL_EXDATE_PROPERTY: + p = icalproperty_new_exdate(t); + break; + case ICAL_X_PROPERTY: { + p = icalproperty_new_x(""); + icaltimetype timeType = writeICalDateTime(dt); + icalvalue *text = icalvalue_new_datetime(timeType); + icalproperty_set_value(p, text); + } break; + default: { + icaldatetimeperiodtype tp; + tp.time = t; + tp.period = icalperiodtype_null_period(); + switch (type) { + case ICAL_RDATE_PROPERTY: + p = icalproperty_new_rdate(tp); + break; + default: + return nullptr; + } + } + } + + QTimeZone qtz; + if (!icaltime_is_utc(t)) { + qtz = dt.timeZone(); + } + + if (qtz.isValid()) { + if (tzUsedList) { + if (!tzUsedList->contains(qtz)) { + tzUsedList->push_back(qtz); + } + } + + icalproperty_add_parameter(p, icalparameter_new_tzid(qtz.id().constData())); + } + return p; +} + +QDateTime ICalFormatImpl::readICalDateTime(icalproperty *p, const icaltimetype &t, const ICalTimeZoneCache *tzCache, bool utc) +{ + // qDebug(); + // _dumpIcaltime( t ); + + QTimeZone timeZone; + if (icaltime_is_utc(t) || t.zone == icaltimezone_get_utc_timezone()) { + timeZone = QTimeZone::utc(); // the time zone is UTC + utc = false; // no need to convert to UTC + } else { + icalparameter *param = p ? icalproperty_get_first_parameter(p, ICAL_TZID_PARAMETER) : nullptr; + QByteArray tzid = param ? QByteArray(icalparameter_get_tzid(param)) : QByteArray(); + + // A workaround for a bug in libical (https://github.com/libical/libical/issues/185) + // If a recurrenceId has both tzid and range, both parameters end up in the tzid. + // This results in invalid tzid's like: "Europe/Berlin;RANGE=THISANDFUTURE" + QStringList parts = QString::fromLatin1(tzid).split(QLatin1Char(';')); + if (parts.count() > 1) { + tzid = parts.first().toLatin1(); + } + + if (tzCache) { + // First try to get the timezone from cache + timeZone = tzCache->tzForTime(QDateTime({t.year, t.month, t.day}, {}), tzid); + } + if (!timeZone.isValid()) { + // Fallback to trying to match against Qt timezone + timeZone = QTimeZone(tzid); + } + if (!timeZone.isValid()) { + // Finally, give up and assume local timezone + timeZone = QTimeZone::systemTimeZone(); + } + } + QDateTime result; + if (t.is_date) { + result = QDateTime(QDate(t.year, t.month, t.day), {}, timeZone); + } else { + result = QDateTime(QDate(t.year, t.month, t.day), QTime(t.hour, t.minute, t.second), timeZone); + } + return utc ? result.toUTC() : result; +} + +QDate ICalFormatImpl::readICalDate(const icaltimetype &t) +{ + return QDate(t.year, t.month, t.day); +} + +QDateTime ICalFormatImpl::readICalDateTimeProperty(icalproperty *p, const ICalTimeZoneCache *tzList, bool utc, bool *allDay) +{ + icaldatetimeperiodtype tp; + icalproperty_kind kind = icalproperty_isa(p); + switch (kind) { + case ICAL_CREATED_PROPERTY: // UTC date/time + tp.time = icalproperty_get_created(p); + utc = true; + break; + case ICAL_DTSTAMP_PROPERTY: // UTC date/time + tp.time = icalproperty_get_dtstamp(p); + utc = true; + break; + case ICAL_LASTMODIFIED_PROPERTY: // last modification UTC date/time + tp.time = icalproperty_get_lastmodified(p); + utc = true; + break; + case ICAL_DTSTART_PROPERTY: // start date and time (UTC for freebusy) + tp.time = icalproperty_get_dtstart(p); + break; + case ICAL_DTEND_PROPERTY: // end date and time (UTC for freebusy) + tp.time = icalproperty_get_dtend(p); + break; + case ICAL_DUE_PROPERTY: // due date/time + tp.time = icalproperty_get_due(p); + break; + case ICAL_COMPLETED_PROPERTY: // UTC completion date/time + tp.time = icalproperty_get_completed(p); + utc = true; + break; + case ICAL_RECURRENCEID_PROPERTY: + tp.time = icalproperty_get_recurrenceid(p); + break; + case ICAL_EXDATE_PROPERTY: + tp.time = icalproperty_get_exdate(p); + break; + case ICAL_X_PROPERTY: { + const char *name = icalproperty_get_x_name(p); + if (QLatin1String(name) == QLatin1String("X-KDE-LIBKCAL-DTRECURRENCE")) { + const char *value = icalvalue_as_ical_string(icalproperty_get_value(p)); + icalvalue *v = icalvalue_new_from_string(ICAL_DATETIME_VALUE, value); + tp.time = icalvalue_get_datetime(v); + icalvalue_free(v); + break; + } + } // end of ICAL_X_PROPERTY + Q_FALLTHROUGH(); + default: + switch (kind) { + case ICAL_RDATE_PROPERTY: + tp = icalproperty_get_rdate(p); + break; + default: + return QDateTime(); + } + if (!icaltime_is_valid_time(tp.time)) { + return QDateTime(); // a time period was found (not implemented yet) + } + break; + } + + if (allDay) { + *allDay = tp.time.is_date; + } + + if (tp.time.is_date) { + return QDateTime(readICalDate(tp.time), QTime()); + } else { + return readICalDateTime(p, tp.time, tzList, utc); + } +} + +icaldurationtype ICalFormatImpl::writeICalDuration(const Duration &duration) +{ + // should be able to use icaldurationtype_from_int(), except we know + // that some older tools do not properly support weeks. So we never + // set a week duration, only days + + icaldurationtype d; + + int value = duration.value(); + d.is_neg = (value < 0) ? 1 : 0; + if (value < 0) { + value = -value; + } + // RFC2445 states that an ical duration value must be + // EITHER weeks OR days/time, not both. + if (duration.isDaily()) { + if (!(value % 7)) { + d.weeks = value / 7; + d.days = 0; + } else { + d.weeks = 0; + d.days = value; + } + d.hours = d.minutes = d.seconds = 0; + } else { + if (!(value % gSecondsPerWeek)) { + d.weeks = value / gSecondsPerWeek; + d.days = d.hours = d.minutes = d.seconds = 0; + } else { + d.weeks = 0; + d.days = value / gSecondsPerDay; + value %= gSecondsPerDay; + d.hours = value / gSecondsPerHour; + value %= gSecondsPerHour; + d.minutes = value / gSecondsPerMinute; + value %= gSecondsPerMinute; + d.seconds = value; + } + } + + return d; +} + +Duration ICalFormatImpl::readICalDuration(const icaldurationtype &d) +{ + int days = d.weeks * 7; + days += d.days; + int seconds = d.hours * gSecondsPerHour; + seconds += d.minutes * gSecondsPerMinute; + seconds += d.seconds; + if (seconds || !days) { // Create second-type duration for 0 delay durations. + seconds += days * gSecondsPerDay; + if (d.is_neg) { + seconds = -seconds; + } + return Duration(seconds, Duration::Seconds); + } else { + if (d.is_neg) { + days = -days; + } + return Duration(days, Duration::Days); + } +} + +icalcomponent *ICalFormatImpl::createCalendarComponent(const Calendar::Ptr &cal) +{ + icalcomponent *calendar; + + // Root component + calendar = icalcomponent_new(ICAL_VCALENDAR_COMPONENT); + + // Product Identifier + icalproperty *p = icalproperty_new_prodid(CalFormat::productId().toUtf8().constData()); + icalcomponent_add_property(calendar, p); + + // iCalendar version (2.0) + p = icalproperty_new_version(const_cast(_ICAL_VERSION)); + icalcomponent_add_property(calendar, p); + + // Implementation Version + p = icalproperty_new_x(_ICAL_IMPLEMENTATION_VERSION); + icalproperty_set_x_name(p, IMPLEMENTATION_VERSION_XPROPERTY); + icalcomponent_add_property(calendar, p); + + // Add time zone + // NOTE: Commented out since relevant timezones are added by the caller. + // Previously we got some timezones listed twice in the ical file. + /* + if ( cal && cal->timeZones() ) { + const ICalTimeZones::ZoneMap zmaps = cal->timeZones()->zones(); + for ( ICalTimeZones::ZoneMap::ConstIterator it=zmaps.constBegin(); + it != zmaps.constEnd(); ++it ) { + icaltimezone *icaltz = (*it).icalTimezone(); + if ( !icaltz ) { + qCritical() << "bad time zone"; + } else { + icalcomponent *tz = icalcomponent_new_clone( icaltimezone_get_component( icaltz ) ); + icalcomponent_add_component( calendar, tz ); + icaltimezone_free( icaltz, 1 ); + } + } + } + */ + // Custom properties + if (cal != nullptr) { + d->writeCustomProperties(calendar, cal.data()); + } + + return calendar; +} + +Incidence::Ptr ICalFormatImpl::readOneIncidence(icalcomponent *calendar, const ICalTimeZoneCache *tzlist) +{ + if (!calendar) { + qWarning() << "Populate called with empty calendar"; + return Incidence::Ptr(); + } + icalcomponent *c = icalcomponent_get_first_component(calendar, ICAL_VEVENT_COMPONENT); + if (c) { + return readEvent(c, tzlist); + } + c = icalcomponent_get_first_component(calendar, ICAL_VTODO_COMPONENT); + if (c) { + return readTodo(c, tzlist); + } + c = icalcomponent_get_first_component(calendar, ICAL_VJOURNAL_COMPONENT); + if (c) { + return readJournal(c, tzlist); + } + qWarning() << "Found no incidence"; + return Incidence::Ptr(); +} + +// take a raw vcalendar (i.e. from a file on disk, clipboard, etc. etc. +// and break it down from its tree-like format into the dictionary format +// that is used internally in the ICalFormatImpl. +//获取原始vcalendar(即,从磁盘上的文件、剪贴板等),并将其从树状格式分解为ICalFormatImpl内部使用的字典格式。 +bool ICalFormatImpl::populate(const Calendar::Ptr &cal, icalcomponent *calendar, bool deleted, const QString ¬ebook) +{ + Q_UNUSED(notebook); + + // qDebug()<<"Populate called"; + + // this function will populate the caldict dictionary and other event + // lists. It turns vevents into Events and then inserts them. + // + + if (!calendar) { + qWarning() << "Populate called with empty calendar"; + return false; + } + + // TODO: check for METHOD + + icalproperty *p = icalcomponent_get_first_property(calendar, ICAL_X_PROPERTY); + QString implementationVersion; + + while (p) { + const char *name = icalproperty_get_x_name(p); + QByteArray nproperty(name); + if (nproperty == QByteArray(IMPLEMENTATION_VERSION_XPROPERTY)) { + QString nvalue = QString::fromUtf8(icalproperty_get_x(p)); + if (nvalue.isEmpty()) { + icalvalue *value = icalproperty_get_value(p); + if (icalvalue_isa(value) == ICAL_TEXT_VALUE) { + nvalue = QString::fromUtf8(icalvalue_get_text(value)); + } + } + implementationVersion = nvalue; + icalcomponent_remove_property(calendar, p); + icalproperty_free(p); + } + p = icalcomponent_get_next_property(calendar, ICAL_X_PROPERTY); + } + + p = icalcomponent_get_first_property(calendar, ICAL_PRODID_PROPERTY); + if (!p) { + qDebug() << "No PRODID property found"; + d->mLoadedProductId.clear(); + } else { + d->mLoadedProductId = QString::fromUtf8(icalproperty_get_prodid(p)); + + delete d->mCompat; + d->mCompat = CompatFactory::createCompat(d->mLoadedProductId, implementationVersion); + } + + p = icalcomponent_get_first_property(calendar, ICAL_VERSION_PROPERTY); + if (!p) { + qDebug() << "No VERSION property found"; + d->mParent->setException(new Exception(Exception::CalVersionUnknown)); + return false; + } else { + const char *version = icalproperty_get_version(p); + if (!version) { + qDebug() << "No VERSION property found"; + d->mParent->setException(new Exception(Exception::VersionPropertyMissing)); + + return false; + } + if (strcmp(version, "1.0") == 0) { + qDebug() << "Expected iCalendar, got vCalendar"; + d->mParent->setException(new Exception(Exception::CalVersion1)); + return false; + } else if (strcmp(version, "2.0") != 0) { + qDebug() << "Expected iCalendar, got unknown format"; + d->mParent->setException(new Exception(Exception::CalVersionUnknown)); + return false; + } + } + + // Populate the calendar's time zone collection with all VTIMEZONE components + ICalTimeZoneCache timeZoneCache; + ICalTimeZoneParser parser(&timeZoneCache); + parser.parse(calendar); + + // custom properties + d->readCustomProperties(calendar, cal.data()); + + // Store all events with a relatedTo property in a list for post-processing + d->mEventsRelate.clear(); + d->mTodosRelate.clear(); + // TODO: make sure that only actually added events go to this lists. + + icalcomponent *c = icalcomponent_get_first_component(calendar, ICAL_VTODO_COMPONENT); + while (c) { + Todo::Ptr todo = readTodo(c, &timeZoneCache); + if (todo) { + // qDebug() << "todo is not zero and deleted is " << deleted; + Todo::Ptr old = cal->todo(todo->uid(), todo->recurrenceId()); + if (old) { + if (old->uid().isEmpty()) { + qWarning() << "Skipping invalid VTODO"; + c = icalcomponent_get_next_component(calendar, ICAL_VTODO_COMPONENT); + continue; + } + // qDebug() << "Found an old todo with uid " << old->uid(); + if (deleted) { + // qDebug() << "Todo " << todo->uid() << " already deleted"; + cal->deleteTodo(old); // move old to deleted + removeAllICal(d->mTodosRelate, old); + } else if (todo->revision() > old->revision()) { + // qDebug() << "Replacing old todo " << old.data() << " with this one " << todo.data(); + cal->deleteTodo(old); // move old to deleted + removeAllICal(d->mTodosRelate, old); + cal->addTodo(todo); // and replace it with this one + } + } else if (deleted) { + // qDebug() << "Todo " << todo->uid() << " already deleted"; + old = cal->deletedTodo(todo->uid(), todo->recurrenceId()); + if (!old) { + cal->addTodo(todo); // add this one + cal->deleteTodo(todo); // and move it to deleted + } + } else { + // qDebug() << "Adding todo " << todo.data() << todo->uid(); + cal->addTodo(todo); // just add this one + } + } + c = icalcomponent_get_next_component(calendar, ICAL_VTODO_COMPONENT); + } + + // Iterate through all events + c = icalcomponent_get_first_component(calendar, ICAL_VEVENT_COMPONENT); + while (c) { + Event::Ptr event = readEvent(c, &timeZoneCache); + if (event) { + // qDebug() << "event is not zero and deleted is " << deleted; + Event::Ptr old = cal->event(event->uid(), event->recurrenceId()); + if (old) { + if (old->uid().isEmpty()) { + qWarning() << "Skipping invalid VEVENT"; + c = icalcomponent_get_next_component(calendar, ICAL_VEVENT_COMPONENT); + continue; + } + // qDebug() << "Found an old event with uid " << old->uid(); + if (deleted) { + // qDebug() << "Event " << event->uid() << " already deleted"; + cal->deleteEvent(old); // move old to deleted + removeAllICal(d->mEventsRelate, old); + } else if (event->revision() > old->revision()) { + // qDebug() << "Replacing old event " << old.data() + // << " with this one " << event.data(); + cal->deleteEvent(old); // move old to deleted + removeAllICal(d->mEventsRelate, old); + cal->addEvent(event); // and replace it with this one + } + } else if (deleted) { + // qDebug() << "Event " << event->uid() << " already deleted"; + old = cal->deletedEvent(event->uid(), event->recurrenceId()); + if (!old) { + cal->addEvent(event); // add this one + cal->deleteEvent(event); // and move it to deleted + } + } else { + // qDebug() << "Adding event " << event.data() << event->uid(); + cal->addEvent(event); // just add this one + } + } + c = icalcomponent_get_next_component(calendar, ICAL_VEVENT_COMPONENT); + } + + // Iterate through all journals + c = icalcomponent_get_first_component(calendar, ICAL_VJOURNAL_COMPONENT); + while (c) { + Journal::Ptr journal = readJournal(c, &timeZoneCache); + if (journal) { + Journal::Ptr old = cal->journal(journal->uid(), journal->recurrenceId()); + if (old) { + if (deleted) { + cal->deleteJournal(old); // move old to deleted + } else if (journal->revision() > old->revision()) { + cal->deleteJournal(old); // move old to deleted + cal->addJournal(journal); // and replace it with this one + } + } else if (deleted) { + old = cal->deletedJournal(journal->uid(), journal->recurrenceId()); + if (!old) { + cal->addJournal(journal); // add this one + cal->deleteJournal(journal); // and move it to deleted + } + } else { + cal->addJournal(journal); // just add this one + } + } + c = icalcomponent_get_next_component(calendar, ICAL_VJOURNAL_COMPONENT); + } + + // TODO: Remove any previous time zones no longer referenced in the calendar + + return true; +} + +QString ICalFormatImpl::extractErrorProperty(icalcomponent *c) +{ + QString errorMessage; + + icalproperty *error = icalcomponent_get_first_property(c, ICAL_XLICERROR_PROPERTY); + while (error) { + errorMessage += QLatin1String(icalproperty_get_xlicerror(error)); + errorMessage += QLatin1Char('\n'); + error = icalcomponent_get_next_property(c, ICAL_XLICERROR_PROPERTY); + } + + return errorMessage; +} + +/* +void ICalFormatImpl::dumpIcalRecurrence( const icalrecurrencetype &r ) +{ + int i; + + qDebug() << " Freq:" << int( r.freq ); + qDebug() << " Until:" << icaltime_as_ical_string( r.until ); + qDebug() << " Count:" << r.count; + if ( r.by_day[0] != ICAL_RECURRENCE_ARRAY_MAX ) { + int index = 0; + QString out = " By Day: "; + while ( ( i = r.by_day[index++] ) != ICAL_RECURRENCE_ARRAY_MAX ) { + out.append( QString::number( i ) + ' ' ); + } + qDebug() << out; + } + if ( r.by_month_day[0] != ICAL_RECURRENCE_ARRAY_MAX ) { + int index = 0; + QString out = " By Month Day: "; + while ( ( i = r.by_month_day[index++] ) != ICAL_RECURRENCE_ARRAY_MAX ) { + out.append( QString::number( i ) + ' ' ); + } + qDebug() << out; + } + if ( r.by_year_day[0] != ICAL_RECURRENCE_ARRAY_MAX ) { + int index = 0; + QString out = " By Year Day: "; + while ( ( i = r.by_year_day[index++] ) != ICAL_RECURRENCE_ARRAY_MAX ) { + out.append( QString::number( i ) + ' ' ); + } + qDebug() << out; + } + if ( r.by_month[0] != ICAL_RECURRENCE_ARRAY_MAX ) { + int index = 0; + QString out = " By Month: "; + while ( ( i = r.by_month[index++] ) != ICAL_RECURRENCE_ARRAY_MAX ) { + out.append( QString::number( i ) + ' ' ); + } + qDebug() << out; + } + if ( r.by_set_pos[0] != ICAL_RECURRENCE_ARRAY_MAX ) { + int index = 0; + QString out = " By Set Pos: "; + while ( ( i = r.by_set_pos[index++] ) != ICAL_RECURRENCE_ARRAY_MAX ) { + qDebug() << "=========" << i; + out.append( QString::number( i ) + ' ' ); + } + qDebug() << out; + } +} +*/ + +icalcomponent *ICalFormatImpl::createScheduleComponent(const IncidenceBase::Ptr &incidence, iTIPMethod method) +{ + icalcomponent *message = createCalendarComponent(); + + // Create VTIMEZONE components for this incidence + TimeZoneList zones; + if (incidence) { + const QDateTime kd1 = incidence->dateTime(IncidenceBase::RoleStartTimeZone); + const QDateTime kd2 = incidence->dateTime(IncidenceBase::RoleEndTimeZone); + + if (kd1.isValid() && kd1.timeZone() != QTimeZone::utc()) { + zones << kd1.timeZone(); + } + + if (kd2.isValid() && kd2.timeZone() != QTimeZone::utc() && kd1.timeZone() != kd2.timeZone()) { + zones << kd2.timeZone(); + } + + TimeZoneEarliestDate earliestTz; + ICalTimeZoneParser::updateTzEarliestDate(incidence, &earliestTz); + + for (const auto &qtz : qAsConst(zones)) { + icaltimezone *icaltz = ICalTimeZoneParser::icaltimezoneFromQTimeZone(qtz, earliestTz[qtz]); + if (!icaltz) { + qCritical() << "bad time zone"; + } else { + icalcomponent *tz = icalcomponent_new_clone(icaltimezone_get_component(icaltz)); + icalcomponent_add_component(message, tz); + icaltimezone_free(icaltz, 1); + } + } + } else { + qDebug() << "No incidence"; + return message; + } + + icalproperty_method icalmethod = ICAL_METHOD_NONE; + + switch (method) { + case iTIPPublish: + icalmethod = ICAL_METHOD_PUBLISH; + break; + case iTIPRequest: + icalmethod = ICAL_METHOD_REQUEST; + break; + case iTIPRefresh: + icalmethod = ICAL_METHOD_REFRESH; + break; + case iTIPCancel: + icalmethod = ICAL_METHOD_CANCEL; + break; + case iTIPAdd: + icalmethod = ICAL_METHOD_ADD; + break; + case iTIPReply: + icalmethod = ICAL_METHOD_REPLY; + break; + case iTIPCounter: + icalmethod = ICAL_METHOD_COUNTER; + break; + case iTIPDeclineCounter: + icalmethod = ICAL_METHOD_DECLINECOUNTER; + break; + default: + qDebug() << "Unknown method"; + return message; + } + + icalcomponent_add_property(message, icalproperty_new_method(icalmethod)); + + icalcomponent *inc = writeIncidence(incidence, method); + + if (method != KCalendarCore::iTIPNoMethod) { + // Not very nice, but since dtstamp changes semantics if used in scheduling, we have to adapt + icalcomponent_set_dtstamp(inc, writeICalUtcDateTime(QDateTime::currentDateTimeUtc())); + } + + /* + * RFC 2446 states in section 3.4.3 ( REPLY to a VTODO ), that + * a REQUEST-STATUS property has to be present. For the other two, event and + * free busy, it can be there, but is optional. Until we do more + * fine grained handling, assume all is well. Note that this is the + * status of the _request_, not the attendee. Just to avoid confusion. + * - till + */ + if (icalmethod == ICAL_METHOD_REPLY) { + struct icalreqstattype rst; + rst.code = ICAL_2_0_SUCCESS_STATUS; + rst.desc = nullptr; + rst.debug = nullptr; + icalcomponent_add_property(inc, icalproperty_new_requeststatus(rst)); + } + icalcomponent_add_component(message, inc); + + return message; +} diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/icalformat_p.h dde-calendar-5.10.0/3rdparty/kcalendarcore/src/icalformat_p.h --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/icalformat_p.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/icalformat_p.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,232 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 2001-2003 Cornelius Schumacher + SPDX-FileCopyrightText: 2003-2004 Reinhold Kainhofer + SPDX-FileCopyrightText: 2006 David Jarvie + SPDX-FileCopyrightText: 2012 Christian Mollekopf + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +/** + @file + This file is part of the API for handling calendar data and + defines the internal ICalFormatImpl class. + + @author Cornelius Schumacher \ + @author Reinhold Kainhofer \ + @author David Jarvie \ +*/ +#ifndef KCALCORE_ICALFORMAT_P_H +#define KCALCORE_ICALFORMAT_P_H + +#include "calendar.h" +#include "event.h" +#include "exceptions.h" +#include "freebusy.h" +#include "journal.h" +#include "person.h" +#include "schedulemessage.h" +#include "todo.h" + +#include + +class QDate; + +namespace KCalendarCore { +class Alarm; +class Attachment; +class Attendee; +class Conference; +class Duration; +class Event; +class FreeBusy; +class ICalFormat; +class ICalTimeZoneCache; +class Incidence; +class Journal; +class Recurrence; +class RecurrenceRule; +class Todo; + +using TimeZoneList = QVector; + +/** + Tell the Libical library that we are using ICal Version 2.0. + @internal +*/ +#define _ICAL_VERSION "2.0" + +/** + Version of this library implementation + @internal +*/ +#define _ICAL_IMPLEMENTATION_VERSION "1.0" + +/** + @brief + This class provides the libical dependent functions for ICalFormat. + + This class implements the iCalendar format. It provides methods for + loading/saving/converting iCalendar format data into the internal + representation as Calendar and Incidences. + + @internal +*/ +class ICalFormatImpl +{ +public: + /** + Construct a new iCal format for calendar object. + @param parent is a pointer to a valid ICalFormat object. + */ + explicit ICalFormatImpl(ICalFormat *parent); + + /** + Destructor. + */ + virtual ~ICalFormatImpl(); + + /** + Updates a calendar with data from a raw iCalendar. Incidences already + existing in @p calendar are not affected except that if a new incidence + with the same UID is found, the existing incidence is replaced. + */ + bool populate(const Calendar::Ptr &calendar, icalcomponent *fs, bool deleted = false, const QString ¬ebook = QString()); + + Incidence::Ptr readOneIncidence(icalcomponent *calendar, const ICalTimeZoneCache *tzlist); + + icalcomponent *writeIncidence(const IncidenceBase::Ptr &incidence, iTIPMethod method = iTIPRequest, TimeZoneList *tzUsedList = nullptr); + + icalcomponent *writeTodo(const Todo::Ptr &todo, TimeZoneList *tzUsedList = nullptr); + + icalcomponent *writeEvent(const Event::Ptr &event, TimeZoneList *tzUsedList = nullptr); + + icalcomponent *writeJournal(const Journal::Ptr &journal, TimeZoneList *tzUsedList = nullptr); + + icalcomponent *writeFreeBusy(const FreeBusy::Ptr &freebusy, iTIPMethod method = iTIPPublish); + + void writeIncidence(icalcomponent *parent, const Incidence::Ptr &incidence, TimeZoneList *tzUsedList = nullptr); + + icalproperty *writeDescription(const QString &description, bool isRich = false); + icalproperty *writeSummary(const QString &summary, bool isRich = false); + icalproperty *writeLocation(const QString &location, bool isRich = false); + icalproperty *writeAttendee(const Attendee &attendee); + icalproperty *writeOrganizer(const Person &organizer); + icalproperty *writeAttachment(const Attachment &attach); + icalproperty *writeRecurrenceRule(Recurrence *); + icalrecurrencetype writeRecurrenceRule(RecurrenceRule *recur); + icalcomponent *writeAlarm(const Alarm::Ptr &alarm); + icalproperty *writeConference(const Conference &conference); + + QString extractErrorProperty(icalcomponent *); + Todo::Ptr readTodo(icalcomponent *vtodo, const ICalTimeZoneCache *tzList); + Event::Ptr readEvent(icalcomponent *vevent, const ICalTimeZoneCache *tzList); + FreeBusy::Ptr readFreeBusy(icalcomponent *vfreebusy); + Journal::Ptr readJournal(icalcomponent *vjournal, const ICalTimeZoneCache *tzList); + Attendee readAttendee(icalproperty *attendee); + Person readOrganizer(icalproperty *organizer); + Attachment readAttachment(icalproperty *attach); + void readIncidence(icalcomponent *parent, const Incidence::Ptr &incidence, const ICalTimeZoneCache *tzList); + void readRecurrenceRule(icalproperty *rrule, const Incidence::Ptr &event); + void readExceptionRule(icalproperty *rrule, const Incidence::Ptr &incidence); + void readRecurrence(const struct icalrecurrencetype &r, RecurrenceRule *recur); + void readAlarm(icalcomponent *alarm, const Incidence::Ptr &incidence); + Conference readConference(icalproperty *conference); + + /** + Returns the PRODID string loaded from calendar file. + */ + QString loadedProductId() const; + + static icaltimetype writeICalDate(const QDate &); + + static QDate readICalDate(const icaltimetype &); + + static icaltimetype writeICalDateTime(const QDateTime &, bool dayOnly = false); + + static icaltimetype writeICalUtcDateTime(const QDateTime &, bool dayOnly = false); + + /** + Creates an ical property from a date/time value. + If a time zone is specified for the value, a TZID parameter is inserted + into the ical property, @p tzlist and @p tzUsedList are updated to include + the time zone. Note that while @p tzlist owns any time zone instances in + its collection, @p tzUsedList does not. + + @param kind kind of property + @param dt date/time value + @param tzlist time zones collection + @param tzUsedList time zones collection, only updated if @p tzlist + is also specified + @return property, or null if error. It is the caller's responsibility + to free the returned property. + */ + static icalproperty *writeICalDateTimeProperty(const icalproperty_kind kind, const QDateTime &dt, TimeZoneList *tzUsedList = nullptr); + + /** + Converts a date/time from ICal format. + + @param p property from which @p t has been obtained + @param t ICal format date/time + @param utc UTC date/time is expected + @return date/time, converted to UTC if @p utc is @c true + */ + static QDateTime readICalDateTime(icalproperty *p, const icaltimetype &t, const ICalTimeZoneCache *tzList, bool utc = false); + + /** + Converts a UTC date/time from ICal format. + If @p t is not a UTC date/time, it is treated as invalid. + + @param p ical parameter to read from + @param t ICal format date/time + @return date/time, or invalid if @p t is not UTC + */ + static QDateTime readICalUtcDateTime(icalproperty *p, icaltimetype &t, const ICalTimeZoneCache *tzList = nullptr) + { + return readICalDateTime(p, t, tzList, true); + } + + /** + Reads a date or date/time value from a property. + + @param p ical parameter to read from + @param utc true to read a UTC value, false to allow time zone + to be specified. + @return date or date/time, or invalid if property doesn't contain + a time value. + */ + static QDateTime readICalDateTimeProperty(icalproperty *p, const ICalTimeZoneCache *tzList, bool utc = false, bool *allDay = nullptr); + + /** + Reads a UTC date/time value from a property. + @param p is a pointer to a valid icalproperty structure. + */ + static QDateTime readICalUtcDateTimeProperty(icalproperty *p, const ICalTimeZoneCache *tzList, bool *allDay = nullptr) + { + return readICalDateTimeProperty(p, tzList, true, allDay); + } + + static icaldurationtype writeICalDuration(const Duration &duration); + + static Duration readICalDuration(const icaldurationtype &d); + + static icaldatetimeperiodtype writeICalDatePeriod(const QDate &date); + + icalcomponent *createCalendarComponent(const Calendar::Ptr &calendar = Calendar::Ptr()); + + icalcomponent *createScheduleComponent(const IncidenceBase::Ptr &incidence, iTIPMethod method); + +protected: + // void dumpIcalRecurrence( const icalrecurrencetype &r ); + +private: + //@cond PRIVATE + class Private; + Private *const d; + //@endcond +}; + +} // namespace KCalendarCore + +#endif diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/icaltimezones.cpp dde-calendar-5.10.0/3rdparty/kcalendarcore/src/icaltimezones.cpp --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/icaltimezones.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/icaltimezones.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,659 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 2005-2007 David Jarvie + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ + +#include "icalformat.h" +#include "icalformat_p.h" +#include "icaltimezones_p.h" +#include "recurrence.h" +#include "recurrencehelper_p.h" +#include "recurrencerule.h" + +#include +#include +#include + +extern "C" { +//#include +#include +} + +using namespace KCalendarCore; + +// Minimum repetition counts for VTIMEZONE RRULEs +static const int minRuleCount = 5; // for any RRULE +static const int minPhaseCount = 8; // for separate STANDARD/DAYLIGHT component + +// Convert an ical time to QDateTime, preserving the UTC indicator +static QDateTime toQDateTime(const icaltimetype &t) +{ + return QDateTime(QDate(t.year, t.month, t.day), + QTime(t.hour, t.minute, t.second), + (icaltime_is_utc(t) ? Qt::UTC : Qt::LocalTime)); +} + +// Maximum date for time zone data. +// It's not sensible to try to predict them very far in advance, because +// they can easily change. Plus, it limits the processing required. +static QDateTime MAX_DATE() +{ + static QDateTime dt; + if (!dt.isValid()) { + dt = QDateTime(QDate::currentDate().addYears(20), QTime(0, 0, 0)); + } + return dt; +} + +static icaltimetype writeLocalICalDateTime(const QDateTime &utc, int offset) +{ + const QDateTime local = utc.addSecs(offset); + icaltimetype t = icaltime_null_time(); + t.year = local.date().year(); + t.month = local.date().month(); + t.day = local.date().day(); + t.hour = local.time().hour(); + t.minute = local.time().minute(); + t.second = local.time().second(); + t.is_date = 0; + t.zone = nullptr; + return t; +} + +namespace KCalendarCore { +void ICalTimeZonePhase::dump() +{ + qDebug() << " ~~~ ICalTimeZonePhase ~~~"; + qDebug() << " Abbreviations:" << abbrevs; + qDebug() << " UTC offset:" << utcOffset; + qDebug() << " Transitions:" << transitions; + qDebug() << " ~~~~~~~~~~~~~~~~~~~~~~~~~"; +} + +void ICalTimeZone::dump() +{ + qDebug() << "~~~ ICalTimeZone ~~~"; + qDebug() << "ID:" << id; + qDebug() << "QZONE:" << qZone.id(); + qDebug() << "STD:"; + standard.dump(); + qDebug() << "DST:"; + daylight.dump(); + qDebug() << "~~~~~~~~~~~~~~~~~~~~"; +} + +ICalTimeZoneCache::ICalTimeZoneCache() +{ +} + +void ICalTimeZoneCache::insert(const QByteArray &id, const ICalTimeZone &tz) +{ + mCache.insert(id, tz); +} + +namespace { +template +typename T::const_iterator greatestSmallerThan(const T &c, const typename T::value_type &v) +{ + auto it = std::lower_bound(c.cbegin(), c.cend(), v); + if (it != c.cbegin()) { + return --it; + } + return c.cend(); +} + +} // namespace + +QTimeZone ICalTimeZoneCache::tzForTime(const QDateTime &dt, const QByteArray &tzid) const +{ + if (QTimeZone::isTimeZoneIdAvailable(tzid)) { + return QTimeZone(tzid); + } + + const ICalTimeZone tz = mCache.value(tzid); + if (!tz.qZone.isValid()) { + return QTimeZone::systemTimeZone(); + } + + // If the matched timezone is one of the UTC offset timezones, we need to make + // sure it's in the correct DTS. + // The lookup in ICalTimeZoneParser will only find TZ in standard time, but + // if the datetim in question fits in the DTS zone, we need to use another UTC + // offset timezone + if (tz.qZone.id().startsWith("UTC")) { // krazy:exclude=strings + // Find the nearest standard and DST transitions that occur BEFORE the "dt" + const auto stdPrev = greatestSmallerThan(tz.standard.transitions, dt); + const auto dstPrev = greatestSmallerThan(tz.daylight.transitions, dt); + if (stdPrev != tz.standard.transitions.cend() && dstPrev != tz.daylight.transitions.cend()) { + if (*dstPrev > *stdPrev) { + // Previous DTS is closer to "dt" than previous standard, which + // means we are in DTS right now + const auto tzids = QTimeZone::availableTimeZoneIds(tz.daylight.utcOffset); + auto dtsTzId = std::find_if(tzids.cbegin(), tzids.cend(), [](const QByteArray &id) { + return id.startsWith("UTC"); // krazy:exclude=strings + }); + if (dtsTzId != tzids.cend()) { + return QTimeZone(*dtsTzId); + } + } + } + } + + return tz.qZone; +} + +ICalTimeZoneParser::ICalTimeZoneParser(ICalTimeZoneCache *cache) + : mCache(cache) +{ +} + +void ICalTimeZoneParser::updateTzEarliestDate(const IncidenceBase::Ptr &incidence, TimeZoneEarliestDate *earliest) +{ + for (auto role : {IncidenceBase::RoleStartTimeZone, IncidenceBase::RoleEndTimeZone}) { + const auto dt = incidence->dateTime(role); + if (dt.isValid()) { + if (dt.timeZone() == QTimeZone::utc()) { + continue; + } + const auto prev = earliest->value(incidence->dtStart().timeZone()); + if (!prev.isValid() || incidence->dtStart() < prev) { + earliest->insert(incidence->dtStart().timeZone(), prev); + } + } + } +} + +icalcomponent *ICalTimeZoneParser::icalcomponentFromQTimeZone(const QTimeZone &tz, const QDateTime &earliest) +{ + // VTIMEZONE RRULE types + enum { + DAY_OF_MONTH = 0x01, + WEEKDAY_OF_MONTH = 0x02, + LAST_WEEKDAY_OF_MONTH = 0x04, + }; + + // Write the time zone data into an iCal component + icalcomponent *tzcomp = icalcomponent_new(ICAL_VTIMEZONE_COMPONENT); + icalcomponent_add_property(tzcomp, icalproperty_new_tzid(tz.id().constData())); + // icalcomponent_add_property(tzcomp, icalproperty_new_location( tz.name().toUtf8() )); + + // Compile an ordered list of transitions so that we can know the phases + // which occur before and after each transition. + QTimeZone::OffsetDataList transits = tz.transitions(QDateTime(), MAX_DATE()); + if (transits.isEmpty()) { + // If there is no way to compile a complete list of transitions + // transitions() can return an empty list + // In that case try get one transition to write a valid VTIMEZONE entry. + if (transits.isEmpty()) { + qDebug() << "No transition information available VTIMEZONE will be invalid."; + } + } + if (earliest.isValid()) { + // Remove all transitions earlier than those we are interested in + for (int i = 0, end = transits.count(); i < end; ++i) { + if (transits.at(i).atUtc >= earliest) { + if (i > 0) { + transits.erase(transits.begin(), transits.begin() + i); + } + break; + } + } + } + int trcount = transits.count(); + QVector transitionsDone(trcount, false); + + // Go through the list of transitions and create an iCal component for each + // distinct combination of phase after and UTC offset before the transition. + icaldatetimeperiodtype dtperiod; + dtperiod.period = icalperiodtype_null_period(); + for (;;) { + int i = 0; + for (; i < trcount && transitionsDone[i]; ++i) { + ; + } + if (i >= trcount) { + break; + } + // Found a phase combination which hasn't yet been processed + const int preOffset = (i > 0) ? transits.at(i - 1).offsetFromUtc : 0; + const auto &transit = transits.at(i); + if (transit.offsetFromUtc == preOffset) { + transitionsDone[i] = true; + while (++i < trcount) { + if (transitionsDone[i] || transits.at(i).offsetFromUtc != transit.offsetFromUtc + || transits.at(i).daylightTimeOffset != transit.daylightTimeOffset || transits.at(i - 1).offsetFromUtc != preOffset) { + continue; + } + transitionsDone[i] = true; + } + continue; + } + const bool isDst = transit.daylightTimeOffset > 0; + icalcomponent *phaseComp = icalcomponent_new(isDst ? ICAL_XDAYLIGHT_COMPONENT : ICAL_XSTANDARD_COMPONENT); + if (!transit.abbreviation.isEmpty()) { + icalcomponent_add_property(phaseComp, icalproperty_new_tzname(static_cast(transit.abbreviation.toUtf8().constData()))); + } + icalcomponent_add_property(phaseComp, icalproperty_new_tzoffsetfrom(preOffset)); + icalcomponent_add_property(phaseComp, icalproperty_new_tzoffsetto(transit.offsetFromUtc)); + // Create a component to hold initial RRULE if any, plus all RDATEs + icalcomponent *phaseComp1 = icalcomponent_new_clone(phaseComp); + icalcomponent_add_property(phaseComp1, icalproperty_new_dtstart(writeLocalICalDateTime(transits.at(i).atUtc, preOffset))); + bool useNewRRULE = false; + + // Compile the list of UTC transition dates/times, and check + // if the list can be reduced to an RRULE instead of multiple RDATEs. + QTime time; + QDate date; + int year = 0, month = 0, daysInMonth = 0, dayOfMonth = 0; // avoid compiler warnings + int dayOfWeek = 0; // Monday = 1 + int nthFromStart = 0; // nth (weekday) of month + int nthFromEnd = 0; // nth last (weekday) of month + int newRule; + int rule = 0; + QList rdates; // dates which (probably) need to be written as RDATEs + QList times; + QDateTime qdt = transits.at(i).atUtc; // set 'qdt' for start of loop + times += qdt; + transitionsDone[i] = true; + do { + if (!rule) { + // Initialise data for detecting a new rule + rule = DAY_OF_MONTH | WEEKDAY_OF_MONTH | LAST_WEEKDAY_OF_MONTH; + time = qdt.time(); + date = qdt.date(); + year = date.year(); + month = date.month(); + daysInMonth = date.daysInMonth(); + dayOfWeek = date.dayOfWeek(); // Monday = 1 + dayOfMonth = date.day(); + nthFromStart = (dayOfMonth - 1) / 7 + 1; // nth (weekday) of month + nthFromEnd = (daysInMonth - dayOfMonth) / 7 + 1; // nth last (weekday) of month + } + if (++i >= trcount) { + newRule = 0; + times += QDateTime(); // append a dummy value since last value in list is ignored + } else { + if (transitionsDone[i] || transits.at(i).offsetFromUtc != transit.offsetFromUtc + || transits.at(i).daylightTimeOffset != transit.daylightTimeOffset || transits.at(i - 1).offsetFromUtc != preOffset) { + continue; + } + transitionsDone[i] = true; + qdt = transits.at(i).atUtc; + if (!qdt.isValid()) { + continue; + } + newRule = rule; + times += qdt; + date = qdt.date(); + if (qdt.time() != time || date.month() != month || date.year() != ++year) { + newRule = 0; + } else { + const int day = date.day(); + if ((newRule & DAY_OF_MONTH) && day != dayOfMonth) { + newRule &= ~DAY_OF_MONTH; + } + if (newRule & (WEEKDAY_OF_MONTH | LAST_WEEKDAY_OF_MONTH)) { + if (date.dayOfWeek() != dayOfWeek) { + newRule &= ~(WEEKDAY_OF_MONTH | LAST_WEEKDAY_OF_MONTH); + } else { + if ((newRule & WEEKDAY_OF_MONTH) && (day - 1) / 7 + 1 != nthFromStart) { + newRule &= ~WEEKDAY_OF_MONTH; + } + if ((newRule & LAST_WEEKDAY_OF_MONTH) && (daysInMonth - day) / 7 + 1 != nthFromEnd) { + newRule &= ~LAST_WEEKDAY_OF_MONTH; + } + } + } + } + } + if (!newRule) { + // The previous rule (if any) no longer applies. + // Write all the times up to but not including the current one. + // First check whether any of the last RDATE values fit this rule. + int yr = times[0].date().year(); + while (!rdates.isEmpty()) { + qdt = rdates.last(); + date = qdt.date(); + if (qdt.time() != time || date.month() != month || date.year() != --yr) { + break; + } + const int day = date.day(); + if (rule & DAY_OF_MONTH) { + if (day != dayOfMonth) { + break; + } + } else { + if (date.dayOfWeek() != dayOfWeek || ((rule & WEEKDAY_OF_MONTH) && (day - 1) / 7 + 1 != nthFromStart) + || ((rule & LAST_WEEKDAY_OF_MONTH) && (daysInMonth - day) / 7 + 1 != nthFromEnd)) { + break; + } + } + times.prepend(qdt); + rdates.pop_back(); + } + if (times.count() > (useNewRRULE ? minPhaseCount : minRuleCount)) { + // There are enough dates to combine into an RRULE + icalrecurrencetype r; + icalrecurrencetype_clear(&r); + r.freq = ICAL_YEARLY_RECURRENCE; + r.by_month[0] = month; + if (rule & DAY_OF_MONTH) { + r.by_month_day[0] = dayOfMonth; + } else if (rule & WEEKDAY_OF_MONTH) { + r.by_day[0] = (dayOfWeek % 7 + 1) + (nthFromStart * 8); // Sunday = 1 + } else if (rule & LAST_WEEKDAY_OF_MONTH) { + r.by_day[0] = -(dayOfWeek % 7 + 1) - (nthFromEnd * 8); // Sunday = 1 + } + r.until = writeLocalICalDateTime(times.takeAt(times.size() - 1), preOffset); + icalproperty *prop = icalproperty_new_rrule(r); + if (useNewRRULE) { + // This RRULE doesn't start from the phase start date, so set it into + // a new STANDARD/DAYLIGHT component in the VTIMEZONE. + icalcomponent *c = icalcomponent_new_clone(phaseComp); + icalcomponent_add_property(c, icalproperty_new_dtstart(writeLocalICalDateTime(times[0], preOffset))); + icalcomponent_add_property(c, prop); + icalcomponent_add_component(tzcomp, c); + } else { + icalcomponent_add_property(phaseComp1, prop); + } + } else { + // Save dates for writing as RDATEs + for (int t = 0, tend = times.count() - 1; t < tend; ++t) { + rdates += times[t]; + } + } + useNewRRULE = true; + // All date/time values but the last have been added to the VTIMEZONE. + // Remove them from the list. + qdt = times.last(); // set 'qdt' for start of loop + times.clear(); + times += qdt; + } + rule = newRule; + } while (i < trcount); + + // Write remaining dates as RDATEs + for (int rd = 0, rdend = rdates.count(); rd < rdend; ++rd) { + dtperiod.time = writeLocalICalDateTime(rdates[rd], preOffset); + icalcomponent_add_property(phaseComp1, icalproperty_new_rdate(dtperiod)); + } + icalcomponent_add_component(tzcomp, phaseComp1); + icalcomponent_free(phaseComp); + } + + return tzcomp; +} + +icaltimezone *ICalTimeZoneParser::icaltimezoneFromQTimeZone(const QTimeZone &tz, const QDateTime &earliest) +{ + auto itz = icaltimezone_new(); + icaltimezone_set_component(itz, icalcomponentFromQTimeZone(tz, earliest)); + return itz; +} + +void ICalTimeZoneParser::parse(icalcomponent *calendar) +{ + for (auto *c = icalcomponent_get_first_component(calendar, ICAL_VTIMEZONE_COMPONENT); c; + c = icalcomponent_get_next_component(calendar, ICAL_VTIMEZONE_COMPONENT)) { + auto icalZone = parseTimeZone(c); + // icalZone.dump(); + if (!icalZone.id.isEmpty()) { + if (!icalZone.qZone.isValid()) { + icalZone.qZone = resolveICalTimeZone(icalZone); + } + if (!icalZone.qZone.isValid()) { + qWarning() << "Failed to map" << icalZone.id << "to a known IANA timezone"; + continue; + } + mCache->insert(icalZone.id, icalZone); + } + } +} + +QTimeZone ICalTimeZoneParser::resolveICalTimeZone(const ICalTimeZone &icalZone) +{ + const auto phase = icalZone.standard; + const auto now = QDateTime::currentDateTimeUtc(); + + const auto candidates = QTimeZone::availableTimeZoneIds(phase.utcOffset); + QMap matchedCandidates; + for (const auto &tzid : candidates) { + const QTimeZone candidate(tzid); + // This would be a fallback, candidate has transitions, but the phase does not + if (candidate.hasTransitions() == phase.transitions.isEmpty()) { + matchedCandidates.insert(0, candidate); + continue; + } + + // Without transitions, we can't do any more precise matching, so just + // accept this candidate and be done with it + if (!candidate.hasTransitions() && phase.transitions.isEmpty()) { + return candidate; + } + + // Calculate how many transitions this candidate shares with the phase. + // The candidate with the most matching transitions will win. + auto begin = std::lower_bound(phase.transitions.cbegin(), phase.transitions.cend(), now.addYears(-20)); + // If no transition older than 20 years is found, we will start from beginning + if (begin == phase.transitions.cend()) { + begin = phase.transitions.cbegin(); + } + auto end = std::upper_bound(begin, phase.transitions.cend(), now); + int matchedTransitions = 0; + for (auto it = begin; it != end; ++it) { + const auto &transition = *it; + const QTimeZone::OffsetDataList candidateTransitions = candidate.transitions(transition, transition); + if (candidateTransitions.isEmpty()) { + continue; + } + ++matchedTransitions; // 1 point for a matching transition + const auto candidateTransition = candidateTransitions[0]; + // FIXME: THIS IS HOW IT SHOULD BE: + // const auto abvs = transition.abbreviations(); + const auto abvs = phase.abbrevs; + for (const auto &abv : abvs) { + if (candidateTransition.abbreviation == QString::fromUtf8(abv)) { + matchedTransitions += 1024; // lots of points for a transition with a matching abbreviation + break; + } + } + } + matchedCandidates.insert(matchedTransitions, candidate); + } + + if (!matchedCandidates.isEmpty()) { + return matchedCandidates.value(matchedCandidates.lastKey()); + } + + return {}; +} + +ICalTimeZone ICalTimeZoneParser::parseTimeZone(icalcomponent *vtimezone) +{ + ICalTimeZone icalTz; + + if (auto tzidProp = icalcomponent_get_first_property(vtimezone, ICAL_TZID_PROPERTY)) { + icalTz.id = icalproperty_get_value_as_string(tzidProp); + + // If the VTIMEZONE is a known IANA time zone don't bother parsing the rest + // of the VTIMEZONE, get QTimeZone directly from Qt + if (QTimeZone::isTimeZoneIdAvailable(icalTz.id)) { + icalTz.qZone = QTimeZone(icalTz.id); + return icalTz; + } else { + // Not IANA, but maybe we can match it from Windows ID? + const auto ianaTzid = QTimeZone::windowsIdToDefaultIanaId(icalTz.id); + if (!ianaTzid.isEmpty()) { + icalTz.qZone = QTimeZone(ianaTzid); + return icalTz; + } + } + } + + for (icalcomponent *c = icalcomponent_get_first_component(vtimezone, ICAL_ANY_COMPONENT); c; + c = icalcomponent_get_next_component(vtimezone, ICAL_ANY_COMPONENT)) { + icalcomponent_kind kind = icalcomponent_isa(c); + switch (kind) { + case ICAL_XSTANDARD_COMPONENT: + // qDebug() << "---standard phase: found"; + parsePhase(c, false, icalTz.standard); + break; + case ICAL_XDAYLIGHT_COMPONENT: + // qDebug() << "---daylight phase: found"; + parsePhase(c, true, icalTz.daylight); + break; + + default: + qDebug() << "Unknown component:" << int(kind); + break; + } + } + + return icalTz; +} + +bool ICalTimeZoneParser::parsePhase(icalcomponent *c, bool daylight, ICalTimeZonePhase &phase) +{ + // Read the observance data for this standard/daylight savings phase + int utcOffset = 0; + int prevOffset = 0; + bool recurs = false; + bool found_dtstart = false; + bool found_tzoffsetfrom = false; + bool found_tzoffsetto = false; + icaltimetype dtstart = icaltime_null_time(); + QSet abbrevs; + + // Now do the ical reading. + icalproperty *p = icalcomponent_get_first_property(c, ICAL_ANY_PROPERTY); + while (p) { + icalproperty_kind kind = icalproperty_isa(p); + switch (kind) { + case ICAL_TZNAME_PROPERTY: { // abbreviated name for this time offset + // TZNAME can appear multiple times in order to provide language + // translations of the time zone offset name. + + // TODO: Does this cope with multiple language specifications? + QByteArray name = icalproperty_get_tzname(p); + // Outlook (2000) places "Standard Time" and "Daylight Time" in the TZNAME + // strings, which is totally useless. So ignore those. + if ((!daylight && name == "Standard Time") || (daylight && name == "Daylight Time")) { + break; + } + abbrevs.insert(name); + break; + } + case ICAL_DTSTART_PROPERTY: // local time at which phase starts + dtstart = icalproperty_get_dtstart(p); + found_dtstart = true; + break; + + case ICAL_TZOFFSETFROM_PROPERTY: // UTC offset immediately before start of phase + prevOffset = icalproperty_get_tzoffsetfrom(p); + found_tzoffsetfrom = true; + break; + + case ICAL_TZOFFSETTO_PROPERTY: + utcOffset = icalproperty_get_tzoffsetto(p); + found_tzoffsetto = true; + break; + + case ICAL_RDATE_PROPERTY: + case ICAL_RRULE_PROPERTY: + recurs = true; + break; + + default: + break; + } + p = icalcomponent_get_next_property(c, ICAL_ANY_PROPERTY); + } + + // Validate the phase data + if (!found_dtstart || !found_tzoffsetfrom || !found_tzoffsetto) { + qDebug() << "DTSTART/TZOFFSETFROM/TZOFFSETTO missing"; + return false; + } + + // Convert DTSTART to QDateTime, and from local time to UTC + dtstart.second -= prevOffset; + dtstart = icaltime_convert_to_zone(dtstart, icaltimezone_get_utc_timezone()); + const QDateTime utcStart = toQDateTime(icaltime_normalize(dtstart)); // UTC + + phase.abbrevs.unite(abbrevs); + phase.utcOffset = utcOffset; + phase.transitions += utcStart; + + if (recurs) { + /* RDATE or RRULE is specified. There should only be one or the other, but + * it doesn't really matter - the code can cope with both. + * Note that we had to get DTSTART, TZOFFSETFROM, TZOFFSETTO before reading + * recurrences. + */ + const QDateTime maxTime(MAX_DATE()); + Recurrence recur; + icalproperty *p = icalcomponent_get_first_property(c, ICAL_ANY_PROPERTY); + while (p) { + icalproperty_kind kind = icalproperty_isa(p); + switch (kind) { + case ICAL_RDATE_PROPERTY: { + icaltimetype t = icalproperty_get_rdate(p).time; + if (icaltime_is_date(t)) { + // RDATE with a DATE value inherits the (local) time from DTSTART + t.hour = dtstart.hour; + t.minute = dtstart.minute; + t.second = dtstart.second; + t.is_date = 0; + } + // RFC2445 states that RDATE must be in local time, + // but we support UTC as well to be safe. + if (!icaltime_is_utc(t)) { + t.second -= prevOffset; // convert to UTC + t = icaltime_convert_to_zone(t, icaltimezone_get_utc_timezone()); + t = icaltime_normalize(t); + } + phase.transitions += toQDateTime(t); + break; + } + case ICAL_RRULE_PROPERTY: { + RecurrenceRule r; + ICalFormat icf; + ICalFormatImpl impl(&icf); + impl.readRecurrence(icalproperty_get_rrule(p), &r); + r.setStartDt(utcStart); + // The end date time specified in an RRULE must be in UTC. + // We can not guarantee correctness if this is not the case. + if (r.duration() == 0 && r.endDt().timeSpec() != Qt::UTC) { + qWarning() << "UNTIL in RRULE must be specified in UTC"; + break; + } + const auto dts = r.timesInInterval(utcStart, maxTime); + for (int i = 0, end = dts.count(); i < end; ++i) { + phase.transitions += dts[i]; + } + break; + } + default: + break; + } + p = icalcomponent_get_next_property(c, ICAL_ANY_PROPERTY); + } + sortAndRemoveDuplicates(phase.transitions); + } + + return true; +} + +QByteArray ICalTimeZoneParser::vcaltimezoneFromQTimeZone(const QTimeZone &qtz, const QDateTime &earliest) +{ + auto icalTz = icalcomponentFromQTimeZone(qtz, earliest); + const QByteArray result(icalcomponent_as_ical_string(icalTz)); + icalmemory_free_ring(); + icalcomponent_free(icalTz); + return result; +} + +} // namespace KCalendarCore diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/icaltimezones_p.h dde-calendar-5.10.0/3rdparty/kcalendarcore/src/icaltimezones_p.h --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/icaltimezones_p.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/icaltimezones_p.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,93 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 2005-2007 David Jarvie + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +#ifndef KCALCORE_ICALTIMEZONES_P_H +#define KCALCORE_ICALTIMEZONES_P_H + +#include "incidencebase.h" + +#include +#include +#include + +#ifndef ICALCOMPONENT_H +typedef struct icalcomponent_impl icalcomponent; +#endif +#ifndef ICALTIMEZONE_DEFINED +#define ICALTIMEZONE_DEFINED +typedef struct _icaltimezone icaltimezone; +#endif + +namespace KCalendarCore { +class ICalTimeZonePhase; + +class ICalTimeZonePhase +{ +public: + void dump(); + + QSet abbrevs; // abbreviations of the phase + int utcOffset = 0; // UTC offset of the phase + QVector transitions; // times on which transition into this phase occurs +}; + +class ICalTimeZone +{ +public: + void dump(); + + QByteArray id; // original TZID + QTimeZone qZone; // QTimeZone mapped from TZID + ICalTimeZonePhase standard; // standard time + ICalTimeZonePhase daylight; // DST time +}; + +class Q_CORE_EXPORT ICalTimeZoneCache +{ +public: + explicit ICalTimeZoneCache(); + + void insert(const QByteArray &id, const ICalTimeZone &tz); + + QTimeZone tzForTime(const QDateTime &dt, const QByteArray &tzid) const; + +private: + QHash mCache; +}; + +using TimeZoneEarliestDate = QHash; + +class Q_CORE_EXPORT ICalTimeZoneParser +{ +public: + explicit ICalTimeZoneParser(ICalTimeZoneCache *cache); + + void parse(icalcomponent *calendar); + + static void updateTzEarliestDate(const IncidenceBase::Ptr &incidence, TimeZoneEarliestDate *earliestDate); + + static icaltimezone *icaltimezoneFromQTimeZone(const QTimeZone &qtz, const QDateTime &earliest); + static QByteArray vcaltimezoneFromQTimeZone(const QTimeZone &qtz, const QDateTime &earliest); + +private: + static icalcomponent *icalcomponentFromQTimeZone(const QTimeZone &qtz, const QDateTime &earliest); + + ICalTimeZone parseTimeZone(icalcomponent *zone); + bool parsePhase(icalcomponent *c, bool daylight, ICalTimeZonePhase &phase); + QTimeZone resolveICalTimeZone(const ICalTimeZone &icalZone); + + ICalTimeZoneCache *mCache; +}; + +} // namespace KCalendarCore + +inline uint qHash(const QTimeZone &tz) +{ + return qHash(tz.id()); +} + +#endif diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/incidencebase.cpp dde-calendar-5.10.0/3rdparty/kcalendarcore/src/incidencebase.cpp --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/incidencebase.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/incidencebase.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,738 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 2001,2004 Cornelius Schumacher + SPDX-FileCopyrightText: 2003-2004 Reinhold Kainhofer + SPDX-FileCopyrightText: 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + SPDX-FileContributor: Alvaro Manera + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +/** + @file + This file is part of the API for handling calendar data and + defines the IncidenceBase class. + + @brief + An abstract base class that provides a common base for all calendar incidence + classes. + + @author Cornelius Schumacher \ + @author Reinhold Kainhofer \ +*/ + +#include "incidencebase.h" +#include "calformat.h" +#include "utils_p.h" +#include "visitor.h" + +#include +#include + +#include + +#define KCALCORE_MAGIC_NUMBER 0xCA1C012E +#define KCALCORE_SERIALIZATION_VERSION 1 + +using namespace KCalendarCore; + +/** + Private class that helps to provide binary compatibility between releases. + @internal +*/ +//@cond PRIVATE +class Q_DECL_HIDDEN KCalendarCore::IncidenceBase::Private +{ +public: + Private() + : mUpdateGroupLevel(0) + , mUpdatedPending(false) + , mAllDay(false) + , mHasDuration(false) + { + } + + Private(const Private &other) + : mUpdateGroupLevel(0) + , mUpdatedPending(false) + , mAllDay(true) + , mHasDuration(false) + { + init(other); + } + + ~Private() + { + } + + void init(const Private &other); + + QDateTime mLastModified; // incidence last modified date + QDateTime mDtStart; // incidence start time + Person mOrganizer; // incidence person (owner) + QString mUid; // incidence unique id + Duration mDuration; // incidence duration + int mUpdateGroupLevel; // if non-zero, suppresses update() calls + bool mUpdatedPending = false; // true if an update has occurred since startUpdates() + bool mAllDay = false; // true if the incidence is all-day + bool mHasDuration = false; // true if the incidence has a duration + Attendee::List mAttendees; // list of incidence attendees + QStringList mComments; // list of incidence comments + QStringList mContacts; // list of incidence contacts + QList mObservers; // list of incidence observers + QSet mDirtyFields; // Fields that changed since last time the incidence was created + // or since resetDirtyFlags() was called + QUrl mUrl; // incidence url property +}; + +void IncidenceBase::Private::init(const Private &other) +{ + mLastModified = other.mLastModified; + mDtStart = other.mDtStart; + mOrganizer = other.mOrganizer; + mUid = other.mUid; + mDuration = other.mDuration; + mAllDay = other.mAllDay; + mHasDuration = other.mHasDuration; + + mComments = other.mComments; + mContacts = other.mContacts; + + mAttendees = other.mAttendees; + mAttendees.reserve(other.mAttendees.count()); + mUrl = other.mUrl; +} + +//@endcond + +IncidenceBase::IncidenceBase() + : d(new KCalendarCore::IncidenceBase::Private) +{ + mReadOnly = false; + setUid(CalFormat::createUniqueId()); +} + +IncidenceBase::IncidenceBase(const IncidenceBase &i) + : CustomProperties(i) + , d(new KCalendarCore::IncidenceBase::Private(*i.d)) +{ + mReadOnly = i.mReadOnly; +} + +IncidenceBase::~IncidenceBase() +{ + delete d; +} + +IncidenceBase &IncidenceBase::operator=(const IncidenceBase &other) +{ + Q_ASSERT(type() == other.type()); + + startUpdates(); + + // assign is virtual, will call the derived class's + IncidenceBase &ret = assign(other); + endUpdates(); + return ret; +} + +IncidenceBase &IncidenceBase::assign(const IncidenceBase &other) +{ + CustomProperties::operator=(other); + d->init(*other.d); + mReadOnly = other.mReadOnly; + d->mDirtyFields.clear(); + d->mDirtyFields.insert(FieldUnknown); + return *this; +} + +bool IncidenceBase::operator==(const IncidenceBase &i2) const +{ + if (i2.type() != type()) { + return false; + } else { + // equals is virtual, so here we're calling the derived class method + return equals(i2); + } +} + +bool IncidenceBase::operator!=(const IncidenceBase &i2) const +{ + return !operator==(i2); +} + +bool IncidenceBase::equals(const IncidenceBase &i2) const +{ + if (attendees().count() != i2.attendees().count()) { + // qDebug() << "Attendee count is different"; + return false; + } + + Attendee::List al1 = attendees(); + Attendee::List al2 = i2.attendees(); + Attendee::List::ConstIterator a1 = al1.constBegin(); + Attendee::List::ConstIterator a2 = al2.constBegin(); + // TODO Does the order of attendees in the list really matter? + // Please delete this comment if you know it's ok, kthx + for (; a1 != al1.constEnd() && a2 != al2.constEnd(); ++a1, ++a2) { + if (!(*a1 == *a2)) { + // qDebug() << "Attendees are different"; + return false; + } + } + + if (!CustomProperties::operator==(i2)) { + // qDebug() << "Properties are different"; + return false; + } + + // Don't compare lastModified, otherwise the operator is not + // of much use. We are not comparing for identity, after all. + // no need to compare mObserver + + bool a = ((dtStart() == i2.dtStart()) || (!dtStart().isValid() && !i2.dtStart().isValid())); + bool b = organizer() == i2.organizer(); + bool c = uid() == i2.uid(); + bool d = allDay() == i2.allDay(); + bool e = duration() == i2.duration(); + bool f = hasDuration() == i2.hasDuration(); + bool g = url() == i2.url(); + + // qDebug() << a << b << c << d << e << f << g; + return a && b && c && d && e && f && g; +} + +bool IncidenceBase::accept(Visitor &v, const IncidenceBase::Ptr &incidence) +{ + Q_UNUSED(v); + Q_UNUSED(incidence); + return false; +} + +void IncidenceBase::setUid(const QString &uid) +{ + if (d->mUid != uid) { + update(); + d->mUid = uid; + d->mDirtyFields.insert(FieldUid); + updated(); + } +} + +QString IncidenceBase::uid() const +{ + return d->mUid; +} + +void IncidenceBase::setLastModified(const QDateTime &lm) +{ + // DON'T! updated() because we call this from + // Calendar::updateEvent(). + + d->mDirtyFields.insert(FieldLastModified); + + // Convert to UTC and remove milliseconds part. + QDateTime current = lm.toUTC(); + QTime t = current.time(); + t.setHMS(t.hour(), t.minute(), t.second(), 0); + current.setTime(t); + + d->mLastModified = current; +} + +QDateTime IncidenceBase::lastModified() const +{ + return d->mLastModified; +} + +void IncidenceBase::setOrganizer(const Person &organizer) +{ + update(); + // we don't check for readonly here, because it is + // possible that by setting the organizer we are changing + // the event's readonly status... + d->mOrganizer = organizer; + + d->mDirtyFields.insert(FieldOrganizer); + + updated(); +} + +void IncidenceBase::setOrganizer(const QString &o) +{ + QString mail(o); + if (mail.startsWith(QLatin1String("MAILTO:"), Qt::CaseInsensitive)) { + mail.remove(0, 7); + } + + // split the string into full name plus email. + const Person organizer = Person::fromFullName(mail); + setOrganizer(organizer); +} + +Person IncidenceBase::organizer() const +{ + return d->mOrganizer; +} + +void IncidenceBase::setReadOnly(bool readOnly) +{ + mReadOnly = readOnly; +} + +bool IncidenceBase::isReadOnly() const +{ + return mReadOnly; +} + +void IncidenceBase::setDtStart(const QDateTime &dtStart) +{ + // if ( mReadOnly ) return; + + if (!dtStart.isValid() && type() != IncidenceBase::TypeTodo) { + qWarning() << "Invalid dtStart"; + } + + if (d->mDtStart != dtStart) { + update(); + d->mDtStart = dtStart; + d->mDirtyFields.insert(FieldDtStart); + updated(); + } +} + +QDateTime IncidenceBase::dtStart() const +{ + return d->mDtStart; +} + +bool IncidenceBase::allDay() const +{ + return d->mAllDay; +} + +void IncidenceBase::setAllDay(bool f) +{ + if (mReadOnly || f == d->mAllDay) { + return; + } + update(); + d->mAllDay = f; + if (d->mDtStart.isValid()) { + d->mDirtyFields.insert(FieldDtStart); + } + updated(); +} + +void IncidenceBase::shiftTimes(const QTimeZone &oldZone, const QTimeZone &newZone) +{ + update(); + d->mDtStart = d->mDtStart.toTimeZone(oldZone); + d->mDtStart.setTimeZone(newZone); + d->mDirtyFields.insert(FieldDtStart); + d->mDirtyFields.insert(FieldDtEnd); + updated(); +} + +void IncidenceBase::addComment(const QString &comment) +{ + d->mComments += comment; +} + +bool IncidenceBase::removeComment(const QString &comment) +{ + bool found = false; + QStringList::Iterator i; + + for (i = d->mComments.begin(); !found && i != d->mComments.end(); ++i) { + if ((*i) == comment) { + found = true; + d->mComments.erase(i); + } + } + + if (found) { + d->mDirtyFields.insert(FieldComment); + } + + return found; +} + +void IncidenceBase::clearComments() +{ + d->mDirtyFields.insert(FieldComment); + d->mComments.clear(); +} + +QStringList IncidenceBase::comments() const +{ + return d->mComments; +} + +void IncidenceBase::addContact(const QString &contact) +{ + if (!contact.isEmpty()) { + d->mContacts += contact; + d->mDirtyFields.insert(FieldContact); + } +} + +bool IncidenceBase::removeContact(const QString &contact) +{ + bool found = false; + QStringList::Iterator i; + + for (i = d->mContacts.begin(); !found && i != d->mContacts.end(); ++i) { + if ((*i) == contact) { + found = true; + d->mContacts.erase(i); + } + } + + if (found) { + d->mDirtyFields.insert(FieldContact); + } + + return found; +} + +void IncidenceBase::clearContacts() +{ + d->mDirtyFields.insert(FieldContact); + d->mContacts.clear(); +} + +QStringList IncidenceBase::contacts() const +{ + return d->mContacts; +} + +void IncidenceBase::addAttendee(const Attendee &a, bool doupdate) +{ + if (a.isNull() || mReadOnly) { + return; + } + Q_ASSERT(!a.uid().isEmpty()); + + if (doupdate) { + update(); + } + + d->mAttendees.append(a); + if (doupdate) { + d->mDirtyFields.insert(FieldAttendees); + updated(); + } +} + +Attendee::List IncidenceBase::attendees() const +{ + return d->mAttendees; +} + +int IncidenceBase::attendeeCount() const +{ + return d->mAttendees.count(); +} + +void IncidenceBase::setAttendees(const Attendee::List &attendees, bool doUpdate) +{ + if (mReadOnly) { + return; + } + + if (doUpdate) { + update(); + } + + // don't simply assign, we need the logic in addAttendee here too + clearAttendees(); + d->mAttendees.reserve(attendees.size()); + for (const auto &a : attendees) { + addAttendee(a, false); + } + + if (doUpdate) { + d->mDirtyFields.insert(FieldAttendees); + updated(); + } +} + +void IncidenceBase::clearAttendees() +{ + if (mReadOnly) { + return; + } + d->mDirtyFields.insert(FieldAttendees); + d->mAttendees.clear(); +} + +Attendee IncidenceBase::attendeeByMail(const QString &email) const +{ + Attendee::List::ConstIterator it; + for (it = d->mAttendees.constBegin(); it != d->mAttendees.constEnd(); ++it) { + if ((*it).email() == email) { + return *it; + } + } + + return {}; +} + +Attendee IncidenceBase::attendeeByMails(const QStringList &emails, const QString &email) const +{ + QStringList mails = emails; + if (!email.isEmpty()) { + mails.append(email); + } + + Attendee::List::ConstIterator itA; + for (itA = d->mAttendees.constBegin(); itA != d->mAttendees.constEnd(); ++itA) { + for (QStringList::const_iterator it = mails.constBegin(); it != mails.constEnd(); ++it) { + if ((*itA).email() == (*it)) { + return *itA; + } + } + } + + return {}; +} + +Attendee IncidenceBase::attendeeByUid(const QString &uid) const +{ + Attendee::List::ConstIterator it; + for (it = d->mAttendees.constBegin(); it != d->mAttendees.constEnd(); ++it) { + if ((*it).uid() == uid) { + return *it; + } + } + + return {}; +} + +void IncidenceBase::setDuration(const Duration &duration) +{ + update(); + d->mDuration = duration; + setHasDuration(true); + d->mDirtyFields.insert(FieldDuration); + updated(); +} + +Duration IncidenceBase::duration() const +{ + return d->mDuration; +} + +void IncidenceBase::setHasDuration(bool hasDuration) +{ + d->mHasDuration = hasDuration; +} + +bool IncidenceBase::hasDuration() const +{ + return d->mHasDuration; +} + +void IncidenceBase::setUrl(const QUrl &url) +{ + d->mDirtyFields.insert(FieldUrl); + d->mUrl = url; +} + +QUrl IncidenceBase::url() const +{ + return d->mUrl; +} + +void IncidenceBase::registerObserver(IncidenceBase::IncidenceObserver *observer) +{ + if (observer && !d->mObservers.contains(observer)) { + d->mObservers.append(observer); + } +} + +void IncidenceBase::unRegisterObserver(IncidenceBase::IncidenceObserver *observer) +{ + d->mObservers.removeAll(observer); +} + +void IncidenceBase::update() +{ + if (!d->mUpdateGroupLevel) { + d->mUpdatedPending = true; + const auto rid = recurrenceId(); + for (IncidenceObserver *o : qAsConst(d->mObservers)) { + o->incidenceUpdate(uid(), rid); + } + } +} + +void IncidenceBase::updated() +{ + if (d->mUpdateGroupLevel) { + d->mUpdatedPending = true; + } else { + const auto rid = recurrenceId(); + for (IncidenceObserver *o : qAsConst(d->mObservers)) { + o->incidenceUpdated(uid(), rid); + } + } +} + +void IncidenceBase::startUpdates() +{ + update(); + ++d->mUpdateGroupLevel; +} + +void IncidenceBase::endUpdates() +{ + if (d->mUpdateGroupLevel > 0) { + if (--d->mUpdateGroupLevel == 0 && d->mUpdatedPending) { + d->mUpdatedPending = false; + updated(); + } + } +} + +void IncidenceBase::customPropertyUpdate() +{ + update(); +} + +void IncidenceBase::customPropertyUpdated() +{ + updated(); +} + +QDateTime IncidenceBase::recurrenceId() const +{ + return QDateTime(); +} + +void IncidenceBase::resetDirtyFields() +{ + d->mDirtyFields.clear(); +} + +QSet IncidenceBase::dirtyFields() const +{ + return d->mDirtyFields; +} + +void IncidenceBase::setFieldDirty(IncidenceBase::Field field) +{ + d->mDirtyFields.insert(field); +} + +QUrl IncidenceBase::uri() const +{ + return QUrl(QStringLiteral("urn:x-ical:") + uid()); +} + +void IncidenceBase::setDirtyFields(const QSet &dirtyFields) +{ + d->mDirtyFields = dirtyFields; +} + +void IncidenceBase::serialize(QDataStream &out) const +{ + Q_UNUSED(out); +} + +void IncidenceBase::deserialize(QDataStream &in) +{ + Q_UNUSED(in); +} + +/** static */ +quint32 IncidenceBase::magicSerializationIdentifier() +{ + return KCALCORE_MAGIC_NUMBER; +} + +QDataStream &KCalendarCore::operator<<(QDataStream &out, const KCalendarCore::IncidenceBase::Ptr &i) +{ + if (!i) { + return out; + } + + out << static_cast(KCALCORE_MAGIC_NUMBER); // Magic number to identify KCalendarCore data + out << static_cast(KCALCORE_SERIALIZATION_VERSION); + out << static_cast(i->type()); + + out << *(static_cast(i.data())); + serializeQDateTimeAsKDateTime(out, i->d->mLastModified); + serializeQDateTimeAsKDateTime(out, i->d->mDtStart); + out << i->organizer() << i->d->mUid << i->d->mDuration << i->d->mAllDay << i->d->mHasDuration << i->d->mComments << i->d->mContacts + << i->d->mAttendees.count() << i->d->mUrl; + + for (const Attendee &attendee : qAsConst(i->d->mAttendees)) { + out << attendee; + } + + // Serialize the sub-class data. + i->serialize(out); + + return out; +} + +QDataStream &KCalendarCore::operator>>(QDataStream &in, KCalendarCore::IncidenceBase::Ptr &i) +{ + if (!i) { + return in; + } + + qint32 attendeeCount, type; + quint32 magic, version; + + in >> magic; + + if (magic != KCALCORE_MAGIC_NUMBER) { + qWarning() << "Invalid magic on serialized data"; + return in; + } + + in >> version; + + if (version > KCALCORE_MAGIC_NUMBER) { + qWarning() << "Invalid version on serialized data"; + return in; + } + + in >> type; + + in >> *(static_cast(i.data())); + deserializeKDateTimeAsQDateTime(in, i->d->mLastModified); + deserializeKDateTimeAsQDateTime(in, i->d->mDtStart); + in >> i->d->mOrganizer >> i->d->mUid >> i->d->mDuration >> i->d->mAllDay >> i->d->mHasDuration >> i->d->mComments >> i->d->mContacts >> attendeeCount + >> i->d->mUrl; + + i->d->mAttendees.clear(); + i->d->mAttendees.reserve(attendeeCount); + for (int it = 0; it < attendeeCount; it++) { + Attendee attendee; + in >> attendee; + i->d->mAttendees.append(attendee); + } + + // Deserialize the sub-class data. + i->deserialize(in); + + return in; +} + +IncidenceBase::IncidenceObserver::~IncidenceObserver() +{ +} + +QVariantList IncidenceBase::attendeesVariant() const +{ + QVariantList l; + l.reserve(d->mAttendees.size()); + std::transform(d->mAttendees.begin(), d->mAttendees.end(), std::back_inserter(l), [](const Attendee &a) { + return QVariant::fromValue(a); + }); + return l; +} diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/incidencebase.h dde-calendar-5.10.0/3rdparty/kcalendarcore/src/incidencebase.h --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/incidencebase.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/incidencebase.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,783 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 2001-2003 Cornelius Schumacher + SPDX-FileCopyrightText: 2003-2004 Reinhold Kainhofer + SPDX-FileCopyrightText: 2005 Rafal Rzepecki + SPDX-FileCopyrightText: 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + SPDX-FileContributor: Alvaro Manera + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +/** + @file + This file is part of the API for handling calendar data and + defines the IncidenceBase class. + + @author Cornelius Schumacher \ + @author Reinhold Kainhofer \ + @author Rafal Rzepecki \ + + @glossary @anchor incidence @b incidence: + General term for a calendar component. + Examples are events, to-dos, and journals. + + @glossary @anchor event @b event: + An @ref incidence that has a start and end time, typically representing some + occurrence of social or personal importance. May be recurring. + Examples are appointments, meetings, or holidays. + + @glossary @anchor to-do @b to-do: + An @ref incidence that has an optional start time and an optional due time + typically representing some undertaking to be performed. May be recurring. + Examples are "fix the bug" or "pay the bills". + + @glossary @anchor todo @b todo: + See @ref to-do. + + @glossary @anchor journal @b journal: + An @ref incidence with a start date that represents a diary or daily record + of one's activities. May @b not be recurring. +*/ + +#ifndef KCALCORE_INCIDENCEBASE_H +#define KCALCORE_INCIDENCEBASE_H + +#include "attendee.h" +#include "customproperties.h" +#include "duration.h" +#include "person.h" + +#include +#include +#include +#include +#include + +class QUrl; +class QDate; +class QTimeZone; + +namespace KCalendarCore { +/** List of dates */ +typedef QList DateList; + +/** List of times */ +typedef QList DateTimeList; + +class Event; +class Todo; +class Journal; +class FreeBusy; +class Visitor; + +/** + @brief + An abstract class that provides a common base for all calendar incidence + classes. + + define: organizer (person) + define: uid (same as the attendee uid?) + + Several properties are not allowed for VFREEBUSY objects (see rfc:2445), + so they are not in IncidenceBase. The hierarchy is: + + IncidenceBase + + FreeBusy + + Incidence + + Event + + Todo + + Journal + + So IncidenceBase contains all properties that are common to all classes, + and Incidence contains all additional properties that are common to + Events, Todos and Journals, but are not allowed for FreeBusy entries. +*/ +class Q_CORE_EXPORT IncidenceBase : public CustomProperties +{ + Q_GADGET + Q_PROPERTY(QString uid READ uid WRITE setUid) + Q_PROPERTY(QDateTime lastModified READ lastModified WRITE setLastModified) + Q_PROPERTY(QDateTime dtStart READ dtStart WRITE setDtStart) + Q_PROPERTY(bool allDay READ allDay WRITE setAllDay) + Q_PROPERTY(KCalendarCore::Person organizer READ organizer WRITE setOrganizer) + Q_PROPERTY(QVariantList attendees READ attendeesVariant) + +public: + /** + A shared pointer to an IncidenceBase. + */ + typedef QSharedPointer Ptr; + + /** + The different types of incidences, per RFC2445. + @see type(), typeStr() + */ + enum IncidenceType { + TypeEvent = 0, /**< Type is an event */ + TypeTodo, /**< Type is a to-do */ + TypeJournal, /**< Type is a journal */ + TypeFreeBusy, /**< Type is a free/busy */ + TypeUnknown, /**< Type unknown */ + }; + + /** + The different types of incidence date/times roles. + 不同类型的事件日期/时间角色。 + @see dateTime() + */ + enum DateTimeRole { + RoleAlarmStartOffset = 0, /**< Role for an incidence alarm's starting offset date/time */ + RoleAlarmEndOffset, /**< Role for an incidence alarm's ending offset date/time */ + RoleSort, /**< Role for an incidence's date/time used when sorting */ + RoleCalendarHashing, /**< Role for looking up an incidence in a Calendar */ + RoleStartTimeZone, /**< Role for determining an incidence's starting timezone */ + RoleEndTimeZone, /**< Role for determining an incidence's ending timezone */ + RoleEndRecurrenceBase, + RoleEnd, /**< Role for determining an incidence's dtEnd, will return + an invalid QDateTime if the incidence does not support dtEnd */ + RoleDisplayEnd, /**< Role used for display purposes, represents the end boundary + if an incidence supports dtEnd */ + RoleAlarm, /**< Role for determining the date/time of the first alarm. + Returns invalid time if the incidence doesn't have any alarm */ + RoleRecurrenceStart, /**< Role for determining the start of the recurrence. + Currently that's DTSTART for an event and DTDUE for a to-do. + (NOTE: If the incidence is a to-do, recurrence should be + calculated having DTSTART for a reference, not DT-DUE. + This is one place KCalendarCore isn't compliant with RFC2445) */ + RoleDisplayStart, /**< Role for display purposes, represents the start boundary of an + incidence. To-dos return dtDue here, for historical reasons */ + RoleDnD, /**< Role for determining new start and end dates after a DnD */ + }; + + /** + The different types of incidence fields. + //不同类型的入射场。 + */ + enum Field { + FieldDtStart, ///< Field representing the DTSTART component. + FieldDtEnd, ///< Field representing the DTEND component. + FieldLastModified, ///< Field representing the LAST-MODIFIED component. + FieldDescription, ///< Field representing the DESCRIPTION component. + FieldSummary, ///< Field representing the SUMMARY component. + FieldLocation, ///< Field representing the LOCATION component. + FieldCompleted, ///< Field representing the COMPLETED component. + FieldPercentComplete, ///< Field representing the PERCENT-COMPLETE component. + FieldDtDue, ///< Field representing the DUE component. + FieldCategories, ///< Field representing the CATEGORIES component. + FieldRelatedTo, ///< Field representing the RELATED-TO component. + FieldRecurrence, ///< Field representing the EXDATE, EXRULE, RDATE, and RRULE components. + FieldAttachment, ///< Field representing the ATTACH component. + FieldSecrecy, ///< Field representing the CLASS component. + FieldStatus, ///< Field representing the STATUS component. + FieldTransparency, ///< Field representing the TRANSPARENCY component. + FieldResources, ///< Field representing the RESOURCES component. + FieldPriority, ///< Field representing the PRIORITY component. + FieldGeoLatitude, ///< Field representing the latitude part of the GEO component. + FieldGeoLongitude, ///< Field representing the longitude part of the GEO component. + FieldRecurrenceId, ///< Field representing the RECURRENCE-ID component. + FieldAlarms, ///< Field representing the VALARM component. + FieldSchedulingId, ///< Field representing the X-KDE-LIBKCAL-ID component. + FieldAttendees, ///< Field representing the ATTENDEE component. + FieldOrganizer, ///< Field representing the ORGANIZER component. + FieldCreated, ///< Field representing the CREATED component. + FieldRevision, ///< Field representing the SEQUENCE component. + FieldDuration, ///< Field representing the DURATION component. + FieldContact, ///< Field representing the CONTACT component. + FieldComment, ///< Field representing the COMMENT component. + FieldUid, ///< Field representing the UID component. + FieldUnknown, ///< Something changed. Always set when you use the assignment operator. + FieldUrl, ///< Field representing the URL component. + FieldConferences, ///< Field representing the CONFERENCE component. + FieldColor, ///< Field representing the COLOR component. + }; + + /** + The IncidenceObserver class. + 事件观察者类。 + */ + class Q_CORE_EXPORT IncidenceObserver + { + public: + /** + Destroys the IncidenceObserver. + */ + virtual ~IncidenceObserver(); + + /** + The IncidenceObserver interface. + This function is called before any changes are made. + @param uid is the string containing the incidence @ref uid. + @param recurrenceId is possible recurrenceid of incidence. + */ + virtual void incidenceUpdate(const QString &uid, const QDateTime &recurrenceId) = 0; + + /** + The IncidenceObserver interface. + This function is called after changes are completed. + @param uid is the string containing the incidence @ref uid. + @param recurrenceId is possible recurrenceid of incidence. + */ + virtual void incidenceUpdated(const QString &uid, const QDateTime &recurrenceId) = 0; + }; + + /** + Constructs an empty IncidenceBase. + */ + IncidenceBase(); + + /** + Destroys the IncidenceBase. + */ + ~IncidenceBase() override; + + /** + Assignment operator. + All data belonging to derived classes are also copied. @see assign(). + The caller guarantees that both types match. + + @code + if ( i1.type() == i2.type() ) { + i1 = i2; + } else { + qDebug() << "Invalid assignment!"; + } + @endcode + + Dirty field FieldUnknown will be set. + + @param other is the IncidenceBase to assign. + */ + IncidenceBase &operator=(const IncidenceBase &other); + + /** + Compares this with IncidenceBase @p ib for equality. + All data belonging to derived classes are also compared. @see equals(). + @param ib is the IncidenceBase to compare against. + @return true if the incidences are equal; false otherwise. + */ + bool operator==(const IncidenceBase &ib) const; + + /** + Compares this with IncidenceBase @p ib for inequality. + @param ib is the IncidenceBase to compare against. + @return true if the incidences are /not/ equal; false otherwise. + */ + bool operator!=(const IncidenceBase &ib) const; + + /** + Accept IncidenceVisitor. A class taking part in the visitor mechanism + has to provide this implementation: +
+       bool accept(Visitor &v) { return v.visit(this); }
+     
+ + @param v is a reference to a Visitor object. + @param incidence is a valid IncidenceBase object for visiting. + */ + virtual bool accept(Visitor &v, const IncidenceBase::Ptr &incidence); + + /** + Returns the incidence type. + */ + virtual IncidenceType type() const = 0; + + /** + Prints the type of incidence as a string. + 将事件类型打印为字符串。 + */ + virtual QByteArray typeStr() const = 0; + + /** + Sets the unique id for the incidence to @p uid. + 将事件的唯一 id 设置为 uid。 + @param uid is the string containing the incidence @ref uid. + @see uid() + */ + void setUid(const QString &uid); + + /** + Returns the unique id (@ref uid) for the incidence. + @see setUid() + */ + Q_REQUIRED_RESULT QString uid() const; + + /** + Returns the uri for the incidence, of form urn:x-ical:\ + 返回事件的uri, + */ + Q_REQUIRED_RESULT QUrl uri() const; + + /** + Sets the time the incidence was last modified to @p lm. + It is stored as a UTC date/time. + + @param lm is the QDateTime when the incidence was last modified. + + @see lastModified() + */ + virtual void setLastModified(const QDateTime &lm); + + /** + Returns the time the incidence was last modified. + 返回上次修改事件的时间。 + @see setLastModified() + */ + Q_REQUIRED_RESULT QDateTime lastModified() const; + + /** + Sets the organizer for the incidence. + 设置事件的组织者。 + + @param organizer is a non-null Person to use as the incidence @ref organizer. + @see organizer(), setOrganizer(const QString &) + */ + void setOrganizer(const Person &organizer); + + /** + Sets the incidence organizer to any string @p organizer. + + @param organizer is a string to use as the incidence @ref organizer. + @see organizer(), setOrganizer(const Person &) + */ + void setOrganizer(const QString &organizer); + + /** + Returns the Person associated with this incidence. + If no Person was set through setOrganizer(), a default Person() + is returned. + @see setOrganizer(const QString &), setOrganizer(const Person &) + */ + Person organizer() const; + + /** + Sets readonly status. + 设置只读状态。 + + @param readOnly if set, the incidence is read-only; else the incidence + can be modified. + @see isReadOnly(). + */ + virtual void setReadOnly(bool readOnly); + + /** + Returns true the object is read-only; false otherwise. + @see setReadOnly() + */ + Q_REQUIRED_RESULT bool isReadOnly() const; + + /** + Sets the incidence's starting date/time with a QDateTime. + + @param dtStart is the incidence start date/time. + @see dtStart(). + */ + virtual void setDtStart(const QDateTime &dtStart); + + /** + Returns an incidence's starting date/time as a QDateTime. + @see setDtStart(). + */ + virtual QDateTime dtStart() const; + + /** + Sets the incidence duration. + + @param duration the incidence duration + + @see duration() + */ + virtual void setDuration(const Duration &duration); + + /** + Returns the length of the incidence duration. + @see setDuration() + */ + Q_REQUIRED_RESULT Duration duration() const; + + /** + Sets if the incidence has a duration. + @param hasDuration true if the incidence has a duration; false otherwise. + @see hasDuration() + */ + void setHasDuration(bool hasDuration); + + /** + Returns true if the incidence has a duration; false otherwise. + @see setHasDuration() + */ + Q_REQUIRED_RESULT bool hasDuration() const; + + /** + Returns true or false depending on whether the incidence is all-day. + i.e. has a date but no time attached to it. + @see setAllDay() + */ + Q_REQUIRED_RESULT bool allDay() const; + + /** + Sets whether the incidence is all-day, i.e. has a date but no time + attached to it. + + @param allDay sets whether the incidence is all-day. + + @see allDay() + */ + virtual void setAllDay(bool allDay); + + /** + Shift the times of the incidence so that they appear at the same clock + time as before but in a new time zone. The shift is done from a viewing + time zone rather than from the actual incidence time zone. + + For example, shifting an incidence whose start time is 09:00 + America/New York, using an old viewing time zone (@p oldSpec) + of Europe/London, to a new time zone (@p newSpec) of Europe/Paris, + will result in the time being shifted from 14:00 (which is the London + time of the incidence start) to 14:00 Paris time. + + @param oldZone the time zone which provides the clock times + @param newZone the new time zone + */ + virtual void shiftTimes(const QTimeZone &oldZone, const QTimeZone &newZone); + + /** + Adds a comment to the incidence. Does not add a linefeed character; simply + appends the text as specified. + 向事件添加注释。不添加换行字符; 仅按指定附加文本。 + + @param comment is the QString containing the comment to add. + @see removeComment(). + */ + void addComment(const QString &comment); + + /** + Removes a comment from the incidence. Removes the first comment whose + string is an exact match for the specified string in @p comment. + + @param comment is the QString containing the comment to remove. + @return true if match found, false otherwise. + @see addComment(). + */ + Q_REQUIRED_RESULT bool removeComment(const QString &comment); + + /** + Deletes all incidence comments. + */ + void clearComments(); + + /** + Returns all incidence comments as a list of strings. + 将所有关联注释作为字符串列表返回。 + */ + Q_REQUIRED_RESULT QStringList comments() const; + + /** + Adds a contact to thieincidence. Does not add a linefeed character; simply + appends the text as specified. + + @param contact is the QString containing the contact to add. + @see removeContact(). + */ + void addContact(const QString &contact); + + /** + Removes a contact from the incidence. Removes the first contact whose + string is an exact match for the specified string in @p contact. + + @param contact is the QString containing the contact to remove. + @return true if match found, false otherwise. + @see addContact(). + */ + Q_REQUIRED_RESULT bool removeContact(const QString &contact); + + /** + Deletes all incidence contacts. + */ + void clearContacts(); + + /** + Returns all incidence contacts as a list of strings. + */ + Q_REQUIRED_RESULT QStringList contacts() const; + + /** + Add Attendee to this incidence. + + @param attendee the attendee to add + @param doUpdate If true the Observers are notified, if false they are not. + */ + void addAttendee(const Attendee &attendee, bool doUpdate = true); + + /** + Removes all attendees from the incidence. + */ + void clearAttendees(); + + /** + Set the attendees of this incidence. + This replaces all previously set attendees, unlike addAttendee. + + @param attendees A list of attendees. + @param doUpdate If true the Observers are notified, if false they are not. + */ + void setAttendees(const Attendee::List &attendees, bool doUpdate = true); + + /** + Returns a list of incidence attendees. + All pointers in the list are valid. + */ + Q_REQUIRED_RESULT Attendee::List attendees() const; + + /** + Returns the number of incidence attendees. + */ + Q_REQUIRED_RESULT int attendeeCount() const; + + /** + Returns the attendee with the specified email address. + + @param email is a QString containing an email address of the + form "FirstName LastName ". + @see attendeeByMails(), attendeesByUid(). + */ + Attendee attendeeByMail(const QString &email) const; + + /** + Returns the first incidence attendee with one of the specified + email addresses. + + @param emails is a list of QStrings containing email addresses of the + form "FirstName LastName ". + @param email is a QString containing a single email address to search + in addition to the list specified in @p emails. + @see attendeeByMail(), attendeesByUid(). + */ + Attendee attendeeByMails(const QStringList &emails, const QString &email = QString()) const; + + /** + Returns the incidence attendee with the specified attendee @acronym UID. + + @param uid is a QString containing an attendee @acronym UID. + @see attendeeByMail(), attendeeByMails(). + */ + Attendee attendeeByUid(const QString &uid) const; + + /** + Sets the incidences url. + + This property can be used to point to a more dynamic rendition of the incidence. + I.e. a website related to the incidence. + + @param url of the incience. + @see url() + @since 4.12 + */ + void setUrl(const QUrl &url); + + /** + Returns the url. + @return incidences url value + @see setUrl() + @since 4.12 + */ + Q_REQUIRED_RESULT QUrl url() const; + + /** + Register observer. The observer is notified when the observed object + changes. + + @param observer is a pointer to an IncidenceObserver object that will be + watching this incidence. + @see unRegisterObserver() + */ + void registerObserver(IncidenceObserver *observer); + + /** + Unregister observer. It isn't notified anymore about changes. + + @param observer is a pointer to an IncidenceObserver object that will be + watching this incidence. + @see registerObserver(). + */ + void unRegisterObserver(IncidenceObserver *observer); + + /** + Call this to notify the observers after the IncidenceBase object will be + changed. + 调用此选项可在IncidenceBase对象发生更改后通知观察者。 + */ + void update(); + + /** + Call this to notify the observers after the IncidenceBase object has + changed. + */ + void updated(); + + /** + Call this when a group of updates is going to be made. This suppresses + change notifications until endUpdates() is called, at which point + updated() will automatically be called. + */ + void startUpdates(); + + /** + Call this when a group of updates is complete, to notify observers that + the instance has changed. This should be called in conjunction with + startUpdates(). + */ + void endUpdates(); + + /** + Returns a date/time corresponding to the specified DateTimeRole. + @param role is a DateTimeRole. + */ + virtual QDateTime dateTime(DateTimeRole role) const = 0; + + /** + Sets the date/time corresponding to the specified DateTimeRole. + @param dateTime is QDateTime value to set. + @param role is a DateTimeRole. + */ + virtual void setDateTime(const QDateTime &dateTime, DateTimeRole role) = 0; + + /** + Returns the Akonadi specific sub MIME type of a KCalendarCore::IncidenceBase item, + e.g. getting "application/x-vnd.akonadi.calendar.event" for a KCalendarCore::Event. + */ + virtual QLatin1String mimeType() const = 0; + + /** + Returns the incidence recurrenceId. + @return incidences recurrenceId value + @see setRecurrenceId(). + */ + virtual QDateTime recurrenceId() const; + + /** + Returns a QSet with all Fields that were changed since the incidence was created + or resetDirtyFields() was called. + + @see resetDirtyFields() + */ + QSet dirtyFields() const; + + /** + Sets which fields are dirty. + @see dirtyFields() + @since 4.8 + */ + void setDirtyFields(const QSet &); + + /** + Resets dirty fields. + @see dirtyFields() + */ + void resetDirtyFields(); + + /** + * Constant that identifies KCalendarCore data in a binary stream. + * + * @since 4.12 + */ + Q_REQUIRED_RESULT static quint32 magicSerializationIdentifier(); + +protected: + /** + Marks Field @p field as dirty. + @param field is the Field type to mark as dirty. + @see dirtyFields() + */ + void setFieldDirty(IncidenceBase::Field field); + + /** + @copydoc + CustomProperties::customPropertyUpdate() + */ + void customPropertyUpdate() override; + + /** + @copydoc + CustomProperties::customPropertyUpdated() + */ + void customPropertyUpdated() override; + + /** + Constructs an IncidenceBase as a copy of another IncidenceBase object. + @param ib is the IncidenceBase to copy. + */ + IncidenceBase(const IncidenceBase &ib); + + /** + Provides polymorfic comparison for equality. + Only called by IncidenceBase::operator==() which guarantees that + @p incidenceBase is of the right type. + @param incidenceBase is the IncidenceBase to compare against. + @return true if the incidences are equal; false otherwise. + */ + virtual bool equals(const IncidenceBase &incidenceBase) const; + + /** + Provides polymorfic assignment. + @param other is the IncidenceBase to assign. + */ + virtual IncidenceBase &assign(const IncidenceBase &other); + + /** + * Sub-type specific serialization. + */ + virtual void serialize(QDataStream &out) const; + /** + * Sub-type specific deserialization. + */ + virtual void deserialize(QDataStream &in); + + enum VirtualHook {}; + + /** + Standard trick to add virtuals later. + + @param id is any integer unique to this class which we will use to identify the method + to be called. + @param data is a pointer to some glob of data, typically a struct. + */ + virtual void virtual_hook(VirtualHook id, void *data) = 0; + + /** + Identifies a read-only incidence. + */ + bool mReadOnly; + +private: + //@cond PRIVATE + class Private; + Private *const d; + + Q_DECL_HIDDEN QVariantList attendeesVariant() const; + //@endcond + + friend Q_CORE_EXPORT QDataStream &operator<<(QDataStream &stream, const KCalendarCore::IncidenceBase::Ptr &); + + friend Q_CORE_EXPORT QDataStream &operator>>(QDataStream &stream, KCalendarCore::IncidenceBase::Ptr &); +}; + +/** + * Incidence serializer. + * + * @since 4.12 + */ +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &out, const KCalendarCore::IncidenceBase::Ptr &); + +/** + * Incidence deserializer. + * + * @since 4.12 + */ +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &in, KCalendarCore::IncidenceBase::Ptr &); +} // namespace KCalendarCore + +Q_DECLARE_METATYPE(KCalendarCore::IncidenceBase *) +Q_DECLARE_METATYPE(KCalendarCore::IncidenceBase::Ptr) + +#endif diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/incidence.cpp dde-calendar-5.10.0/3rdparty/kcalendarcore/src/incidence.cpp --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/incidence.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/incidence.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,1230 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 2001 Cornelius Schumacher + SPDX-FileCopyrightText: 2003-2004 Reinhold Kainhofer + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +/** + @file + This file is part of the API for handling calendar data and + defines the Incidence class. + + @brief + Provides the class common to non-FreeBusy (Events, To-dos, Journals) + calendar components known as incidences. + + @author Cornelius Schumacher \ + @author Reinhold Kainhofer \ +*/ + +#include "incidence.h" +#include "calformat.h" +#include "utils_p.h" + +#include +#include // for .toHtmlEscaped() and Qt::mightBeRichText() +#include +#include + +using namespace KCalendarCore; + +/** + Private class that helps to provide binary compatibility between releases. + @internal +*/ +//@cond PRIVATE +class Q_DECL_HIDDEN KCalendarCore::Incidence::Private +{ +public: + Private() + : mGeoLatitude(INVALID_LATLON) + , mGeoLongitude(INVALID_LATLON) + , mRecurrence(nullptr) + , mRevision(0) + , mPriority(0) + , mStatus(StatusNone) + , mSecrecy(SecrecyPublic) + , mDescriptionIsRich(false) + , mSummaryIsRich(false) + , mLocationIsRich(false) + , mHasGeo(false) + , mThisAndFuture(false) + , mLocalOnly(false) + { + } + + Private(const Private &p) + : mCreated(p.mCreated) + , mDescription(p.mDescription) + , mSummary(p.mSummary) + , mLocation(p.mLocation) + , mCategories(p.mCategories) + , mResources(p.mResources) + , mStatusString(p.mStatusString) + , mSchedulingID(p.mSchedulingID) + , mRelatedToUid(p.mRelatedToUid) + , mRecurrenceId(p.mRecurrenceId) + , mConferences(p.mConferences) + , mGeoLatitude(p.mGeoLatitude) + , mGeoLongitude(p.mGeoLongitude) + , mRecurrence(nullptr) + , mRevision(p.mRevision) + , mPriority(p.mPriority) + , mStatus(p.mStatus) + , mSecrecy(p.mSecrecy) + , mColor(p.mColor) + , mDescriptionIsRich(p.mDescriptionIsRich) + , mSummaryIsRich(p.mSummaryIsRich) + , mLocationIsRich(p.mLocationIsRich) + , mHasGeo(p.mHasGeo) + , mThisAndFuture(p.mThisAndFuture) + , mLocalOnly(false) + { + } + + void clear() + { + mAlarms.clear(); + mAttachments.clear(); + delete mRecurrence; + mRecurrence = nullptr; + } + + void init(Incidence *dest, const Incidence &src) + { + mRevision = src.d->mRevision; + mCreated = src.d->mCreated; + mDescription = src.d->mDescription; + mDescriptionIsRich = src.d->mDescriptionIsRich; + mSummary = src.d->mSummary; + mSummaryIsRich = src.d->mSummaryIsRich; + mCategories = src.d->mCategories; + mRelatedToUid = src.d->mRelatedToUid; + mResources = src.d->mResources; + mStatusString = src.d->mStatusString; + mStatus = src.d->mStatus; + mSecrecy = src.d->mSecrecy; + mPriority = src.d->mPriority; + mLocation = src.d->mLocation; + mLocationIsRich = src.d->mLocationIsRich; + mGeoLatitude = src.d->mGeoLatitude; + mGeoLongitude = src.d->mGeoLongitude; + mHasGeo = src.d->mHasGeo; + mRecurrenceId = src.d->mRecurrenceId; + mConferences = src.d->mConferences; + mThisAndFuture = src.d->mThisAndFuture; + mLocalOnly = src.d->mLocalOnly; + mColor = src.d->mColor; + + // Alarms and Attachments are stored in ListBase<...>, which is a QValueList<...*>. + // We need to really duplicate the objects stored therein, otherwise deleting + // i will also delete all attachments from this object (setAutoDelete...) + mAlarms.reserve(src.d->mAlarms.count()); + for (const Alarm::Ptr &alarm : qAsConst(src.d->mAlarms)) { + Alarm::Ptr b(new Alarm(*alarm.data())); + b->setParent(dest); + mAlarms.append(b); + } + + mAttachments = src.d->mAttachments; + if (src.d->mRecurrence) { + mRecurrence = new Recurrence(*(src.d->mRecurrence)); + mRecurrence->addObserver(dest); + } else { + mRecurrence = nullptr; + } + } + + QDateTime mCreated; // creation datetime + QString mDescription; // description string + QString mSummary; // summary string + QString mLocation; // location string + QStringList mCategories; // category list + Attachment::List mAttachments; // attachments list + Alarm::List mAlarms; // alarms list + QStringList mResources; // resources list (not calendar resources) + QString mStatusString; // status string, for custom status + QString mSchedulingID; // ID for scheduling mails + QMap mRelatedToUid; // incidence uid this is related to, for each relType + QDateTime mRecurrenceId; // recurrenceId + Conference::List mConferences; // conference list + + float mGeoLatitude; // Specifies latitude in decimal degrees + float mGeoLongitude; // Specifies longitude in decimal degrees + mutable Recurrence *mRecurrence; // recurrence + int mRevision; // revision number + int mPriority; // priority: 1 = highest, 2 = less, etc. + Status mStatus; // status + Secrecy mSecrecy; // secrecy + QString mColor; // background color + bool mDescriptionIsRich = false; // description string is richtext. + bool mSummaryIsRich = false; // summary string is richtext. + bool mLocationIsRich = false; // location string is richtext. + bool mHasGeo = false; // if incidence has geo data + bool mThisAndFuture = false; + bool mLocalOnly = false; // allow changes that won't go to the server +}; +//@endcond + +Incidence::Incidence() + : IncidenceBase() + , d(new KCalendarCore::Incidence::Private) +{ + recreate(); + resetDirtyFields(); +} + +Incidence::Incidence(const Incidence &i) + : IncidenceBase(i) + , Recurrence::RecurrenceObserver() + , d(new KCalendarCore::Incidence::Private(*i.d)) +{ + d->init(this, i); + resetDirtyFields(); +} + +Incidence::~Incidence() +{ + // Alarm has a raw incidence pointer, so we must set it to 0 + // so Alarm doesn't use it after Incidence is destroyed + for (const Alarm::Ptr &alarm : qAsConst(d->mAlarms)) { + alarm->setParent(nullptr); + } + delete d->mRecurrence; + delete d; +} + +//@cond PRIVATE +// A string comparison that considers that null and empty are the same +static bool stringCompare(const QString &s1, const QString &s2) +{ + return (s1.isEmpty() && s2.isEmpty()) || (s1 == s2); +} + +//@endcond +IncidenceBase &Incidence::assign(const IncidenceBase &other) +{ + if (&other != this) { + d->clear(); + // TODO: should relations be cleared out, as in destructor??? + IncidenceBase::assign(other); + const Incidence *i = static_cast(&other); + d->init(this, *i); + } + + return *this; +} + +bool Incidence::equals(const IncidenceBase &incidence) const +{ + if (!IncidenceBase::equals(incidence)) { + return false; + } + + // If they weren't the same type IncidenceBase::equals would had returned false already + const Incidence *i2 = static_cast(&incidence); + + const auto alarmList = alarms(); + const auto otherAlarmsList = i2->alarms(); + if (alarmList.count() != otherAlarmsList.count()) { + return false; + } + + Alarm::List::ConstIterator a1 = alarmList.constBegin(); + Alarm::List::ConstIterator a1end = alarmList.constEnd(); + Alarm::List::ConstIterator a2 = otherAlarmsList.constBegin(); + Alarm::List::ConstIterator a2end = otherAlarmsList.constEnd(); + for (; a1 != a1end && a2 != a2end; ++a1, ++a2) { + if (**a1 == **a2) { + continue; + } else { + return false; + } + } + + const auto attachmentList = attachments(); + const auto otherAttachmentList = i2->attachments(); + if (attachmentList.count() != otherAttachmentList.count()) { + return false; + } + + Attachment::List::ConstIterator att1 = attachmentList.constBegin(); + const Attachment::List::ConstIterator att1end = attachmentList.constEnd(); + Attachment::List::ConstIterator att2 = otherAttachmentList.constBegin(); + const Attachment::List::ConstIterator att2end = otherAttachmentList.constEnd(); + for (; att1 != att1end && att2 != att2end; ++att1, ++att2) { + if (*att1 == *att2) { + continue; + } else { + return false; + } + } + + bool recurrenceEqual = (d->mRecurrence == nullptr && i2->d->mRecurrence == nullptr); + if (!recurrenceEqual) { + recurrence(); // create if doesn't exist + i2->recurrence(); // create if doesn't exist + recurrenceEqual = d->mRecurrence != nullptr && i2->d->mRecurrence != nullptr && *d->mRecurrence == *i2->d->mRecurrence; + } + + if (d->mHasGeo == i2->d->mHasGeo) { + if (d->mHasGeo && (!qFuzzyCompare(d->mGeoLatitude, i2->d->mGeoLatitude) || !qFuzzyCompare(d->mGeoLongitude, i2->d->mGeoLongitude))) { + return false; + } + } else { + return false; + } + // clang-format off + return + recurrenceEqual + && created() == i2->created() + && stringCompare(description(), i2->description()) + && descriptionIsRich() == i2->descriptionIsRich() + && stringCompare(summary(), i2->summary()) + && summaryIsRich() == i2->summaryIsRich() + && categories() == i2->categories() + && stringCompare(relatedTo(), i2->relatedTo()) + && resources() == i2->resources() + && d->mStatus == i2->d->mStatus + && (d->mStatus == StatusNone || stringCompare(d->mStatusString, i2->d->mStatusString)) + && secrecy() == i2->secrecy() + && priority() == i2->priority() + && stringCompare(location(), i2->location()) + && locationIsRich() == i2->locationIsRich() + && stringCompare(color(), i2->color()) + && stringCompare(schedulingID(), i2->schedulingID()) + && recurrenceId() == i2->recurrenceId() + && conferences() == i2->conferences() + && thisAndFuture() == i2->thisAndFuture(); + // clang-format on +} + +QString Incidence::instanceIdentifier() const +{ + if (hasRecurrenceId()) { + return uid() + recurrenceId().toString(Qt::ISODate); + } + return uid(); +} + +void Incidence::recreate() +{ + const QDateTime nowUTC = QDateTime::currentDateTimeUtc(); + setCreated(nowUTC); + + setSchedulingID(QString(), CalFormat::createUniqueId()); + setRevision(0); + setLastModified(nowUTC); // NOLINT false clang-analyzer-optin.cplusplus.VirtualCall +} + +void Incidence::setLastModified(const QDateTime &lm) +{ + if (!d->mLocalOnly) { + IncidenceBase::setLastModified(lm); + } +} + +void Incidence::setReadOnly(bool readOnly) +{ + IncidenceBase::setReadOnly(readOnly); + if (d->mRecurrence) { + d->mRecurrence->setRecurReadOnly(readOnly); + } +} + +void Incidence::setLocalOnly(bool localOnly) +{ + if (mReadOnly) { + return; + } + d->mLocalOnly = localOnly; +} + +bool Incidence::localOnly() const +{ + return d->mLocalOnly; +} + +void Incidence::setAllDay(bool allDay) +{ + if (mReadOnly) { + return; + } + if (d->mRecurrence) { + d->mRecurrence->setAllDay(allDay); + } + IncidenceBase::setAllDay(allDay); +} + +void Incidence::setCreated(const QDateTime &created) +{ + if (mReadOnly || d->mLocalOnly) { + return; + } + + d->mCreated = created.toUTC(); + const auto ct = d->mCreated.time(); + // Remove milliseconds + d->mCreated.setTime(QTime(ct.hour(), ct.minute(), ct.second())); + setFieldDirty(FieldCreated); + + // FIXME: Shouldn't we call updated for the creation date, too? + // updated(); +} + +QDateTime Incidence::created() const +{ + return d->mCreated; +} + +void Incidence::setRevision(int rev) +{ + if (mReadOnly || d->mLocalOnly) { + return; + } + + update(); + + d->mRevision = rev; + setFieldDirty(FieldRevision); + updated(); +} + +int Incidence::revision() const +{ + return d->mRevision; +} + +void Incidence::setDtStart(const QDateTime &dt) +{ + IncidenceBase::setDtStart(dt); + if (d->mRecurrence && dirtyFields().contains(FieldDtStart)) { + d->mRecurrence->setStartDateTime(dt, allDay()); + } +} + +void Incidence::shiftTimes(const QTimeZone &oldZone, const QTimeZone &newZone) +{ + IncidenceBase::shiftTimes(oldZone, newZone); + if (d->mRecurrence) { + d->mRecurrence->shiftTimes(oldZone, newZone); + } + for (int i = 0, end = d->mAlarms.count(); i < end; ++i) { + d->mAlarms[i]->shiftTimes(oldZone, newZone); + } +} + +void Incidence::setDescription(const QString &description, bool isRich) +{ + if (mReadOnly) { + return; + } + update(); + d->mDescription = description; + d->mDescriptionIsRich = isRich; + setFieldDirty(FieldDescription); + updated(); +} + +void Incidence::setDescription(const QString &description) +{ + setDescription(description, Qt::mightBeRichText(description)); +} + +QString Incidence::description() const +{ + return d->mDescription; +} + +QString Incidence::richDescription() const +{ + if (descriptionIsRich()) { + return d->mDescription; + } else { + return d->mDescription.toHtmlEscaped().replace(QLatin1Char('\n'), QStringLiteral("
")); + } +} + +bool Incidence::descriptionIsRich() const +{ + return d->mDescriptionIsRich; +} + +void Incidence::setSummary(const QString &summary, bool isRich) +{ + if (mReadOnly) { + return; + } + if (d->mSummary != summary || d->mSummaryIsRich != isRich) { + update(); + d->mSummary = summary; + d->mSummaryIsRich = isRich; + setFieldDirty(FieldSummary); + updated(); + } +} + +void Incidence::setSummary(const QString &summary) +{ + setSummary(summary, Qt::mightBeRichText(summary)); +} + +QString Incidence::summary() const +{ + return d->mSummary; +} + +QString Incidence::richSummary() const +{ + if (summaryIsRich()) { + return d->mSummary; + } else { + return d->mSummary.toHtmlEscaped().replace(QLatin1Char('\n'), QStringLiteral("
")); + } +} + +bool Incidence::summaryIsRich() const +{ + return d->mSummaryIsRich; +} + +void Incidence::setCategories(const QStringList &categories) +{ + if (mReadOnly) { + return; + } + + update(); + d->mCategories = categories; + updated(); +} + +void Incidence::setCategories(const QString &catStr) +{ + if (mReadOnly) { + return; + } + update(); + setFieldDirty(FieldCategories); + + d->mCategories.clear(); + + if (catStr.isEmpty()) { + updated(); + return; + } + + d->mCategories = catStr.split(QLatin1Char(',')); + + QStringList::Iterator it; + for (it = d->mCategories.begin(); it != d->mCategories.end(); ++it) { + *it = (*it).trimmed(); + } + + updated(); +} + +QStringList Incidence::categories() const +{ + return d->mCategories; +} + +QString Incidence::categoriesStr() const +{ + return d->mCategories.join(QLatin1Char(',')); +} + +void Incidence::setRelatedTo(const QString &relatedToUid, RelType relType) +{ + // TODO: RFC says that an incidence can have more than one related-to field + // even for the same relType. + + if (d->mRelatedToUid[relType] != relatedToUid) { + update(); + d->mRelatedToUid[relType] = relatedToUid; + setFieldDirty(FieldRelatedTo); + updated(); + } +} + +QString Incidence::relatedTo(RelType relType) const +{ + return d->mRelatedToUid.value(relType); +} + +void Incidence::setColor(const QString &colorName) +{ + if (mReadOnly) { + return; + } + if (!stringCompare(d->mColor, colorName)) { + update(); + d->mColor = colorName; + setFieldDirty(FieldColor); + updated(); + } +} + +QString Incidence::color() const +{ + return d->mColor; +} + +// %%%%%%%%%%%% Recurrence-related methods %%%%%%%%%%%%%%%%%%%% + +Recurrence *Incidence::recurrence() const +{ + if (!d->mRecurrence) { + d->mRecurrence = new Recurrence(); + d->mRecurrence->setStartDateTime(dateTime(RoleRecurrenceStart), allDay()); + d->mRecurrence->setAllDay(allDay()); + d->mRecurrence->setRecurReadOnly(mReadOnly); + d->mRecurrence->addObserver(const_cast(this)); + } + + return d->mRecurrence; +} + +void Incidence::clearRecurrence() +{ + delete d->mRecurrence; + d->mRecurrence = nullptr; +} + +ushort Incidence::recurrenceType() const +{ + if (d->mRecurrence) { + return d->mRecurrence->recurrenceType(); + } else { + return Recurrence::rNone; + } +} + +bool Incidence::recurs() const +{ + if (d->mRecurrence) { + return d->mRecurrence->recurs(); + } else { + return false; + } +} + +bool Incidence::recursOn(const QDate &date, const QTimeZone &timeZone) const +{ + return d->mRecurrence && d->mRecurrence->recursOn(date, timeZone); +} + +bool Incidence::recursAt(const QDateTime &qdt) const +{ + return d->mRecurrence && d->mRecurrence->recursAt(qdt); +} + +QList Incidence::startDateTimesForDate(const QDate &date, const QTimeZone &timeZone) const +{ + QDateTime start = dtStart(); + QDateTime end = dateTime(RoleEndRecurrenceBase); + + QList result; + + // TODO_Recurrence: Also work if only due date is given... + if (!start.isValid() && !end.isValid()) { + return result; + } + + // if the incidence doesn't recur, + QDateTime kdate(date, {}, timeZone); + if (!recurs()) { + if (start.date() <= date && end.date() >= date) { + result << start; + } + return result; + } + + qint64 days = start.daysTo(end); + // Account for possible recurrences going over midnight, while the original event doesn't + QDate tmpday(date.addDays(-days - 1)); + QDateTime tmp; + while (tmpday <= date) { + if (recurrence()->recursOn(tmpday, timeZone)) { + const QList times = recurrence()->recurTimesOn(tmpday, timeZone); + for (const QTime &time : times) { + tmp = QDateTime(tmpday, time, start.timeZone()); + if (endDateForStart(tmp) >= kdate) { + result << tmp; + } + } + } + tmpday = tmpday.addDays(1); + } + return result; +} + +QList Incidence::startDateTimesForDateTime(const QDateTime &datetime) const +{ + QDateTime start = dtStart(); + QDateTime end = dateTime(RoleEndRecurrenceBase); + + QList result; + + // TODO_Recurrence: Also work if only due date is given... + if (!start.isValid() && !end.isValid()) { + return result; + } + + // if the incidence doesn't recur, + if (!recurs()) { + if (!(start > datetime || end < datetime)) { + result << start; + } + return result; + } + + qint64 days = start.daysTo(end); + // Account for possible recurrences going over midnight, while the original event doesn't + QDate tmpday(datetime.date().addDays(-days - 1)); + QDateTime tmp; + while (tmpday <= datetime.date()) { + if (recurrence()->recursOn(tmpday, datetime.timeZone())) { + // Get the times during the day (in start date's time zone) when recurrences happen + const QList times = recurrence()->recurTimesOn(tmpday, start.timeZone()); + for (const QTime &time : times) { + tmp = QDateTime(tmpday, time, start.timeZone()); + if (!(tmp > datetime || endDateForStart(tmp) < datetime)) { + result << tmp; + } + } + } + tmpday = tmpday.addDays(1); + } + return result; +} + +QDateTime Incidence::endDateForStart(const QDateTime &startDt) const +{ + QDateTime start = dtStart(); + QDateTime end = dateTime(RoleEndRecurrenceBase); + if (!end.isValid()) { + return start; + } + if (!start.isValid()) { + return end; + } + + return startDt.addSecs(start.secsTo(end)); +} + +void Incidence::addAttachment(const Attachment &attachment) +{ + if (mReadOnly || attachment.isEmpty()) { + return; + } + + update(); + d->mAttachments.append(attachment); + setFieldDirty(FieldAttachment); + updated(); +} + +void Incidence::deleteAttachments(const QString &mime) +{ + Attachment::List result; + Attachment::List::Iterator it = d->mAttachments.begin(); + while (it != d->mAttachments.end()) { + if ((*it).mimeType() != mime) { + result += *it; + } + ++it; + } + d->mAttachments = result; + setFieldDirty(FieldAttachment); +} + +Attachment::List Incidence::attachments() const +{ + return d->mAttachments; +} + +Attachment::List Incidence::attachments(const QString &mime) const +{ + Attachment::List attachments; + for (const Attachment &attachment : qAsConst(d->mAttachments)) { + if (attachment.mimeType() == mime) { + attachments.append(attachment); + } + } + return attachments; +} + +void Incidence::clearAttachments() +{ + setFieldDirty(FieldAttachment); + d->mAttachments.clear(); +} + +void Incidence::setResources(const QStringList &resources) +{ + if (mReadOnly) { + return; + } + + update(); + d->mResources = resources; + setFieldDirty(FieldResources); + updated(); +} + +QStringList Incidence::resources() const +{ + return d->mResources; +} + +void Incidence::setPriority(int priority) +{ + if (mReadOnly) { + return; + } + + update(); + d->mPriority = priority; + setFieldDirty(FieldPriority); + updated(); +} + +int Incidence::priority() const +{ + return d->mPriority; +} + +void Incidence::setStatus(Incidence::Status status) +{ + if (mReadOnly || status == StatusX) { + return; + } + + update(); + d->mStatus = status; + d->mStatusString.clear(); + setFieldDirty(FieldStatus); + updated(); +} + +void Incidence::setCustomStatus(const QString &status) +{ + if (mReadOnly) { + return; + } + + update(); + d->mStatus = status.isEmpty() ? StatusNone : StatusX; + d->mStatusString = status; + setFieldDirty(FieldStatus); + updated(); +} + +Incidence::Status Incidence::status() const +{ + return d->mStatus; +} + +QString Incidence::customStatus() const +{ + if (d->mStatus == StatusX) { + return d->mStatusString; + } else { + return QString(); + } +} + +void Incidence::setSecrecy(Incidence::Secrecy secrecy) +{ + if (mReadOnly) { + return; + } + + update(); + d->mSecrecy = secrecy; + setFieldDirty(FieldSecrecy); + updated(); +} + +Incidence::Secrecy Incidence::secrecy() const +{ + return d->mSecrecy; +} + +Alarm::List Incidence::alarms() const +{ + return d->mAlarms; +} + +Alarm::Ptr Incidence::newAlarm() +{ + Alarm::Ptr alarm(new Alarm(this)); + d->mAlarms.append(alarm); + return alarm; +} + +void Incidence::addAlarm(const Alarm::Ptr &alarm) +{ + update(); + d->mAlarms.append(alarm); + setFieldDirty(FieldAlarms); + updated(); +} + +void Incidence::removeAlarm(const Alarm::Ptr &alarm) +{ + const int index = d->mAlarms.indexOf(alarm); + if (index > -1) { + update(); + d->mAlarms.remove(index); + setFieldDirty(FieldAlarms); + updated(); + } +} + +void Incidence::clearAlarms() +{ + update(); + d->mAlarms.clear(); + setFieldDirty(FieldAlarms); + updated(); +} + +bool Incidence::hasEnabledAlarms() const +{ + for (const Alarm::Ptr &alarm : qAsConst(d->mAlarms)) { + if (alarm->enabled()) { + return true; + } + } + return false; +} + +Conference::List Incidence::conferences() const +{ + return d->mConferences; +} + +void Incidence::addConference(const Conference &conference) +{ + update(); + d->mConferences.push_back(conference); + setFieldDirty(FieldConferences); + updated(); +} + +void Incidence::setConferences(const Conference::List &conferences) +{ + update(); + d->mConferences = conferences; + setFieldDirty(FieldConferences); + updated(); +} + +void Incidence::clearConferences() +{ + update(); + d->mConferences.clear(); + setFieldDirty(FieldConferences); + updated(); +} + +void Incidence::setLocation(const QString &location, bool isRich) +{ + if (mReadOnly) { + return; + } + + if (d->mLocation != location || d->mLocationIsRich != isRich) { + update(); + d->mLocation = location; + d->mLocationIsRich = isRich; + setFieldDirty(FieldLocation); + updated(); + } +} + +void Incidence::setLocation(const QString &location) +{ + setLocation(location, Qt::mightBeRichText(location)); +} + +QString Incidence::location() const +{ + return d->mLocation; +} + +QString Incidence::richLocation() const +{ + if (locationIsRich()) { + return d->mLocation; + } else { + return d->mLocation.toHtmlEscaped().replace(QLatin1Char('\n'), QStringLiteral("
")); + } +} + +bool Incidence::locationIsRich() const +{ + return d->mLocationIsRich; +} + +void Incidence::setSchedulingID(const QString &sid, const QString &uid) +{ + if (!uid.isEmpty()) { + setUid(uid); + } + if (sid != d->mSchedulingID) { + d->mSchedulingID = sid; + setFieldDirty(FieldSchedulingId); + } +} + +QString Incidence::schedulingID() const +{ + if (d->mSchedulingID.isNull()) { + // Nothing set, so use the normal uid + return uid(); + } + return d->mSchedulingID; +} + +bool Incidence::hasGeo() const +{ + return d->mHasGeo; +} + +void Incidence::setHasGeo(bool hasGeo) +{ + if (mReadOnly) { + return; + } + + if (hasGeo == d->mHasGeo) { + return; + } + + update(); + d->mHasGeo = hasGeo; + setFieldDirty(FieldGeoLatitude); + setFieldDirty(FieldGeoLongitude); + updated(); +} + +float Incidence::geoLatitude() const +{ + return d->mGeoLatitude; +} + +void Incidence::setGeoLatitude(float geolatitude) +{ + if (mReadOnly) { + return; + } + + update(); + d->mGeoLatitude = geolatitude; + setFieldDirty(FieldGeoLatitude); + updated(); +} + +float Incidence::geoLongitude() const +{ + return d->mGeoLongitude; +} + +void Incidence::setGeoLongitude(float geolongitude) +{ + if (!mReadOnly) { + update(); + d->mGeoLongitude = geolongitude; + setFieldDirty(FieldGeoLongitude); + updated(); + } +} + +bool Incidence::hasRecurrenceId() const +{ + return (allDay() && d->mRecurrenceId.date().isValid()) || d->mRecurrenceId.isValid(); +} + +QDateTime Incidence::recurrenceId() const +{ + return d->mRecurrenceId; +} + +void Incidence::setThisAndFuture(bool thisAndFuture) +{ + d->mThisAndFuture = thisAndFuture; +} + +bool Incidence::thisAndFuture() const +{ + return d->mThisAndFuture; +} + +void Incidence::setRecurrenceId(const QDateTime &recurrenceId) +{ + if (!mReadOnly) { + update(); + d->mRecurrenceId = recurrenceId; + setFieldDirty(FieldRecurrenceId); + updated(); + } +} + +/** Observer interface for the recurrence class. If the recurrence is changed, + this method will be called for the incidence the recurrence object + belongs to. */ +void Incidence::recurrenceUpdated(Recurrence *recurrence) +{ + if (recurrence == d->mRecurrence) { + update(); + setFieldDirty(FieldRecurrence); + updated(); + } +} + +//@cond PRIVATE +#define ALT_DESC_FIELD "X-ALT-DESC" +#define ALT_DESC_PARAMETERS QStringLiteral("FMTTYPE=text/html") +//@endcond + +bool Incidence::hasAltDescription() const +{ + const QString value = nonKDECustomProperty(ALT_DESC_FIELD); + const QString parameter = nonKDECustomPropertyParameters(ALT_DESC_FIELD); + + return parameter == ALT_DESC_PARAMETERS && !value.isEmpty(); +} + +void Incidence::setAltDescription(const QString &altdescription) +{ + if (altdescription.isEmpty()) { + removeNonKDECustomProperty(ALT_DESC_FIELD); + } else { + setNonKDECustomProperty(ALT_DESC_FIELD, altdescription, ALT_DESC_PARAMETERS); + } +} + +QString Incidence::altDescription() const +{ + if (!hasAltDescription()) { + return QString(); + } else { + return nonKDECustomProperty(ALT_DESC_FIELD); + } +} + +/** static */ +QStringList Incidence::mimeTypes() +{ + return QStringList() << QStringLiteral("text/calendar") << KCalendarCore::Event::eventMimeType() << KCalendarCore::Todo::todoMimeType() + << KCalendarCore::Journal::journalMimeType(); +} + +void Incidence::serialize(QDataStream &out) const +{ + serializeQDateTimeAsKDateTime(out, d->mCreated); + out << d->mRevision << d->mDescription << d->mDescriptionIsRich << d->mSummary << d->mSummaryIsRich << d->mLocation << d->mLocationIsRich << d->mCategories + << d->mResources << d->mStatusString << d->mPriority << d->mSchedulingID << d->mGeoLatitude << d->mGeoLongitude << d->mHasGeo; + serializeQDateTimeAsKDateTime(out, d->mRecurrenceId); + out << d->mThisAndFuture << d->mLocalOnly << d->mStatus << d->mSecrecy << (d->mRecurrence ? true : false) << d->mAttachments.count() << d->mAlarms.count() + << d->mConferences.count() << d->mRelatedToUid; + + if (d->mRecurrence) { + out << d->mRecurrence; + } + + for (const Attachment &attachment : qAsConst(d->mAttachments)) { + out << attachment; + } + + for (const Alarm::Ptr &alarm : qAsConst(d->mAlarms)) { + out << alarm; + } + + for (const Conference &conf : qAsConst(d->mConferences)) { + out << conf; + } +} + +void Incidence::deserialize(QDataStream &in) +{ + quint32 status, secrecy; + bool hasRecurrence; + int attachmentCount, alarmCount, conferencesCount; + QMap relatedToUid; + deserializeKDateTimeAsQDateTime(in, d->mCreated); + in >> d->mRevision >> d->mDescription >> d->mDescriptionIsRich >> d->mSummary >> d->mSummaryIsRich >> d->mLocation >> d->mLocationIsRich >> d->mCategories + >> d->mResources >> d->mStatusString >> d->mPriority >> d->mSchedulingID >> d->mGeoLatitude >> d->mGeoLongitude >> d->mHasGeo; + deserializeKDateTimeAsQDateTime(in, d->mRecurrenceId); + in >> d->mThisAndFuture >> d->mLocalOnly >> status >> secrecy >> hasRecurrence >> attachmentCount >> alarmCount >> conferencesCount >> relatedToUid; + + if (hasRecurrence) { + d->mRecurrence = new Recurrence(); + d->mRecurrence->addObserver(const_cast(this)); + in >> d->mRecurrence; + } + + d->mAttachments.clear(); + d->mAlarms.clear(); + d->mConferences.clear(); + + d->mAttachments.reserve(attachmentCount); + for (int i = 0; i < attachmentCount; ++i) { + Attachment attachment; + in >> attachment; + d->mAttachments.append(attachment); + } + + d->mAlarms.reserve(alarmCount); + for (int i = 0; i < alarmCount; ++i) { + Alarm::Ptr alarm = Alarm::Ptr(new Alarm(this)); + in >> alarm; + d->mAlarms.append(alarm); + } + + d->mConferences.reserve(conferencesCount); + for (int i = 0; i < conferencesCount; ++i) { + Conference conf; + in >> conf; + d->mConferences.push_back(conf); + } + + d->mStatus = static_cast(status); + d->mSecrecy = static_cast(secrecy); + + d->mRelatedToUid.clear(); + + auto it = relatedToUid.cbegin(), end = relatedToUid.cend(); + for (; it != end; ++it) { + d->mRelatedToUid.insert(static_cast(it.key()), it.value()); + } +} + +namespace { +template +QVariantList toVariantList(int size, typename QVector::ConstIterator begin, typename QVector::ConstIterator end) +{ + QVariantList l; + l.reserve(size); + std::transform(begin, end, std::back_inserter(l), [](const T &val) { + return QVariant::fromValue(val); + }); + return l; +} + +} // namespace + +QVariantList Incidence::attachmentsVariant() const +{ + return toVariantList(d->mAttachments.size(), d->mAttachments.cbegin(), d->mAttachments.cend()); +} + +QVariantList Incidence::conferencesVariant() const +{ + return toVariantList(d->mConferences.size(), d->mConferences.cbegin(), d->mConferences.cend()); +} diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/incidence.h dde-calendar-5.10.0/3rdparty/kcalendarcore/src/incidence.h --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/incidence.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/incidence.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,927 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 2001-2003 Cornelius Schumacher + SPDX-FileCopyrightText: 2003-2004 Reinhold Kainhofer + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +/** + @file + This file is part of the API for handling calendar data and + defines the Incidence class. + + @author Cornelius Schumacher \ + @author Reinhold Kainhofer \ +*/ + +#ifndef KCALCORE_INCIDENCE_H +#define KCALCORE_INCIDENCE_H + +#include "alarm.h" +#include "attachment.h" +#include "conference.h" +#include "incidencebase.h" +#include "recurrence.h" + +#include + +//@cond PRIVATE +// Value used to signal invalid/unset latitude or longitude. +#define INVALID_LATLON 255.0 // krazy:exclude=defines (part of the API) +//@endcond + +namespace KCalendarCore { +/** + @brief + Provides the abstract base class common to non-FreeBusy (Events, To-dos, + Journals) calendar components known as incidences. + + Several properties are not allowed for VFREEBUSY objects (see rfc:2445), + so they are not in IncidenceBase. The hierarchy is: + + IncidenceBase + + FreeBusy + + Incidence + + Event + + Todo + + Journal + + So IncidenceBase contains all properties that are common to all classes, + and Incidence contains all additional properties that are common to + Events, Todos and Journals, but are not allowed for FreeBusy entries. +*/ +class Q_CORE_EXPORT Incidence : public IncidenceBase + , public Recurrence::RecurrenceObserver +{ + Q_GADGET + Q_PROPERTY(QString description READ description WRITE setDescription) + Q_PROPERTY(QString summary READ summary WRITE setSummary) + Q_PROPERTY(QString location READ location WRITE setLocation) + Q_PROPERTY(bool hasGeo READ hasGeo WRITE setHasGeo) + Q_PROPERTY(float geoLatitude READ geoLatitude WRITE setGeoLatitude) + Q_PROPERTY(float geoLongitude READ geoLongitude WRITE setGeoLongitude) + Q_PROPERTY(QStringList categories READ categories WRITE setCategories) + Q_PROPERTY(int priority READ priority WRITE setPriority) + Q_PROPERTY(QDateTime created READ created WRITE setCreated) + Q_PROPERTY(KCalendarCore::Incidence::Secrecy secrecy READ secrecy WRITE setSecrecy) + Q_PROPERTY(KCalendarCore::Incidence::Status status READ status WRITE setStatus) + Q_PROPERTY(QVariantList attachments READ attachmentsVariant) + Q_PROPERTY(QVariantList conferences READ conferencesVariant) +public: + /** + The different types of overall incidence status or confirmation. + The meaning is specific to the incidence type in context. + */ + enum Status { + StatusNone, /**< No status */ + StatusTentative, /**< event is tentative */ + StatusConfirmed, /**< event is definite */ + StatusCompleted, /**< to-do completed */ + StatusNeedsAction, /**< to-do needs action */ + StatusCanceled, /**< event or to-do canceled; journal removed */ + StatusInProcess, /**< to-do in process */ + StatusDraft, /**< journal is draft */ + StatusFinal, /**< journal is final */ + StatusX, /**< a non-standard status string */ + }; + Q_ENUM(Status) + + /** + The different types of incidence access classifications. + */ + enum Secrecy { + SecrecyPublic, /**< Not secret (default) */ + SecrecyPrivate, /**< Secret to the owner */ + SecrecyConfidential, /**< Secret to the owner and some others */ + }; + Q_ENUM(Secrecy) + + /** + The different types of RELTYPE values specified by the RFC. + Only RelTypeParent is supported for now. + */ + enum RelType { + RelTypeParent, /**< The related incidence is a parent. */ + RelTypeChild, /**< The related incidence is a child. */ + RelTypeSibling, /**< The related incidence is a peer. */ + }; + + /** + A shared pointer to an Incidence. + */ + typedef QSharedPointer Ptr; + + /** + List of incidences. + */ + typedef QVector List; + + /** + Constructs an empty incidence.* + */ + Incidence(); + + /** + Destroys an incidence. + */ + ~Incidence() override; + + /** + Returns an exact copy of this incidence. The returned object is owned + by the caller. + + Dirty fields are cleared. + */ + virtual Incidence *clone() const = 0; + + /** + Returns a unique identifier for a specific instance of an incidence. + 返回事件的特定实例的唯一标识符 + + Due to the recurrence-id, the uid is not unique for a KCalendarCore::Incidence. + @since 4.11 + */ + Q_REQUIRED_RESULT QString instanceIdentifier() const; + + /** + Set readonly state of incidence. + 设置关联的只读状态。 + @param readonly If true, the incidence is set to readonly, if false the + incidence is set to readwrite. + */ + void setReadOnly(bool readonly) override; + + /** + @copydoc IncidenceBase::setLastModified(). + */ + void setLastModified(const QDateTime &lm) override; + + /** + Set localOnly state of incidence. + A local only incidence can be updated but it will not increase the revision + number neither the modified date. + 设置事件的本地唯一状态。 + 一个只在本地发生的事件可以被更新,但它不会增加修订号和修改日期,编号,也不增加修改日期。 + + @param localonly If true, the incidence is set to localonly, if false the + incidence is set to normal stat. + */ + void setLocalOnly(bool localonly); + + /** + Get the localOnly status. + @return true if Local only, false otherwise. + + @see setLocalOnly() + */ + Q_REQUIRED_RESULT bool localOnly() const; + + /** + @copydoc IncidenceBase::setAllDay(). + */ + void setAllDay(bool allDay) override; + + /** + Recreate incidence. The incidence is made a new unique incidence, but already stored + information is preserved. Sets unique id, creation date, last + modification date and revision number. + + 重新创建事件。该事件被制成一个新的唯一事件,但已经存储的信息被保留下来。设置唯一的ID、创建日期、最后修改日期和修订号。 + */ + void recreate(); + + /** + Sets the incidence creation date/time. It is stored as a UTC date/time. + + @param dt is the creation date/time. + @see created(). + */ + void setCreated(const QDateTime &dt); + + /** + Returns the incidence creation date/time. + @see setCreated(). + */ + Q_REQUIRED_RESULT QDateTime created() const; + + /** + Sets the number of revisions this incidence has seen. + 设置此事件已看到的修订数。 + + @param rev is the incidence revision number. + @see revision(). + */ + void setRevision(int rev); + + /** + Returns the number of revisions this incidence has seen. + @see setRevision(). + */ + Q_REQUIRED_RESULT int revision() const; + + /** + Sets the incidence starting date/time. + + @param dt is the starting date/time. + @see IncidenceBase::dtStart(). + */ + void setDtStart(const QDateTime &dt) override; + + /** + @copydoc IncidenceBase::shiftTimes() + */ + void shiftTimes(const QTimeZone &oldZone, const QTimeZone &newZone) override; + + /** + Sets the incidence description. + + @param description is the incidence description string. + @param isRich if true indicates the description string contains richtext. + @see description(). + */ + void setDescription(const QString &description, bool isRich); + + /** + Sets the incidence description and tries to guess if the description + is rich text. + + @param description is the incidence description string. + @see description(). + */ + void setDescription(const QString &description); + + /** + Returns the incidence description. + @see setDescription(). + @see richDescription(). + */ + Q_REQUIRED_RESULT QString description() const; + + /** + Returns the incidence description in rich text format. + @see setDescription(). + @see description(). + */ + Q_REQUIRED_RESULT QString richDescription() const; + + /** + Returns true if incidence description contains RichText; false otherwise. + @see setDescription(), description(). + */ + Q_REQUIRED_RESULT bool descriptionIsRich() const; + + /** + Sets the incidence summary. + 设置事件摘要。 + @param summary is the incidence summary string. + @param isRich if true indicates the summary string contains richtext. + @see summary(). + */ + void setSummary(const QString &summary, bool isRich); + + /** + Sets the incidence summary and tries to guess if the summary is richtext. + + @param summary is the incidence summary string. + @see summary(). + */ + void setSummary(const QString &summary); + + /** + Returns the incidence summary. + @see setSummary(). + @see richSummary(). + */ + Q_REQUIRED_RESULT QString summary() const; + + /** + Returns the incidence summary in rich text format. + @see setSummary(). + @see summary(). + */ + Q_REQUIRED_RESULT QString richSummary() const; + + /** + Returns true if incidence summary contains RichText; false otherwise. + @see setSummary(), summary(). + */ + Q_REQUIRED_RESULT bool summaryIsRich() const; + + /** + Sets the incidence location. Do _not_ use with journals. + 设置关联位置。 + 不要和日记一起使用。 + + @param location is the incidence location string. + @param isRich if true indicates the location string contains richtext. + @see location(). + */ + void setLocation(const QString &location, bool isRich); + + /** + Sets the incidence location and tries to guess if the location is + richtext. Do _not_ use with journals. + + @param location is the incidence location string. + @see location(). + */ + void setLocation(const QString &location); + + /** + Returns the incidence location. Do _not_ use with journals. + @see setLocation(). + @see richLocation(). + */ + Q_REQUIRED_RESULT QString location() const; + + /** + Returns the incidence location in rich text format. + @see setLocation(). + @see location(). + */ + Q_REQUIRED_RESULT QString richLocation() const; + + /** + Returns true if incidence location contains RichText; false otherwise. + @see setLocation(), location(). + */ + Q_REQUIRED_RESULT bool locationIsRich() const; + + /** + Sets the incidence category list. + + @param categories is a list of category strings. + @see setCategories( const QString &), categories(). + */ + void setCategories(const QStringList &categories); + + /** + Sets the incidence category list based on a comma delimited string. + + @param catStr is a QString containing a list of categories which + are delimited by a comma character. + @see setCategories( const QStringList &), categories(). + */ + void setCategories(const QString &catStr); + + /** + Returns the incidence categories as a list of strings. + @see setCategories( const QStringList &), setCategories( const QString &). + */ + Q_REQUIRED_RESULT QStringList categories() const; + + /** + Returns the incidence categories as a comma separated string. + @see categories(). + */ + Q_REQUIRED_RESULT QString categoriesStr() const; + + /** + Relates another incidence to this one, by UID. This function should only + be used when constructing a calendar before the related incidence exists. + + @param uid is a QString containing a UID for another incidence. + @param relType specifies the relation type. + + @warning KCalendarCore only supports one related-to field per reltype for now. + + @see relatedTo(). + */ + void setRelatedTo(const QString &uid, RelType relType = RelTypeParent); + + /** + Returns a UID string for the incidence that is related to this one. + This function should only be used when constructing a calendar before + the related incidence exists. + + @warning KCalendarCore only supports one related-to field per reltype for now. + + @param relType specifies the relation type. + + @see setRelatedTo(). + */ + Q_REQUIRED_RESULT QString relatedTo(RelType relType = RelTypeParent) const; + + /** + Set the incidence color, as added in RFC7986. + 参考RFC7986,设置关联颜色。 + @param colorName a named color as defined in CSS3 color name, see + https://www.w3.org/TR/css-color-3/#svg-color. + @since: 5.76 + */ + void setColor(const QString &colorName); + + /** + Returns the color, if any is defined, for this incidence. + + @since: 5.76 + */ + Q_REQUIRED_RESULT QString color() const; + + // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + // %%%%% Convenience wrappers for property handling + // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + /** + Returns true if the alternative (=text/html) description is + available. + @see setAltDescription(), altDescription() + */ + Q_REQUIRED_RESULT bool hasAltDescription() const; + /** + Sets the incidence's alternative (=text/html) description. If + the text is empty, the property is removed. + + @param altdescription is the incidence altdescription string. + @see altAltdescription(). + */ + void setAltDescription(const QString &altdescription); + + /** + Returns the incidence alternative (=text/html) description. + @see setAltDescription(). + */ + Q_REQUIRED_RESULT QString altDescription() const; + + // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + // %%%%% Recurrence-related methods + // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + /** + Returns the recurrence rule associated with this incidence. If there is + none, returns an appropriate (non-0) object. + 返回与此事件关联的重复规则。如果没有,则返回适当的(非0)对象。 + */ + Recurrence *recurrence() const; + + /** + Removes all recurrence and exception rules and dates. + 删除所有重复和异常规则和日期。 + */ + void clearRecurrence(); + + /** + @copydoc Recurrence::recurs() + */ + Q_REQUIRED_RESULT bool recurs() const; + + /** + @copydoc Recurrence::recurrenceType() + */ + Q_REQUIRED_RESULT ushort recurrenceType() const; + + /** + @copydoc Recurrence::recursOn() + */ + virtual bool recursOn(const QDate &date, const QTimeZone &timeZone) const; + + /** + @copydoc Recurrence::recursAt() + */ + Q_REQUIRED_RESULT bool recursAt(const QDateTime &dt) const; + + /** + Calculates the start date/time for all recurrences that happen at some + time on the given date (might start before that date, but end on or + after the given date). + + @param date the date when the incidence should occur + @param timeSpec time specification for @p date. + @return the start date/time of all occurrences that overlap with the + given date; an empty list if the incidence does not overlap with the + date at all. + */ + virtual QList startDateTimesForDate(const QDate &date, const QTimeZone &timeZone) const; + + /** + Calculates the start date/time for all recurrences that happen at the + given time. + + @param datetime the date/time when the incidence should occur. + @return the start date/time of all occurrences that overlap with the + given date/time; an empty list if the incidence does not happen at the + given time at all. + */ + Q_REQUIRED_RESULT virtual QList startDateTimesForDateTime(const QDateTime &datetime) const; + + /** + Returns the end date/time of the incidence occurrence if it starts at + specified date/time. + + @param startDt is the specified starting date/time. + @return the corresponding end date/time for the occurrence; or the start + date/time if the end date/time is invalid; or the end date/time if + the start date/time is invalid. + */ + Q_REQUIRED_RESULT virtual QDateTime endDateForStart(const QDateTime &startDt) const; + + // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + // %%%%% Attachment-related methods + // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + /** + Adds an attachment to the incidence. + + @param attachment a valid Attachment object. + */ + void addAttachment(const Attachment &attachment); + + /** + Removes all attachments of the specified MIME type from the incidence. + The memory used by all the removed attachments is freed. + + @param mime is a QString containing the MIME type. + @see deleteAttachment(). + */ + void deleteAttachments(const QString &mime); + + /** + Returns a list of all incidence attachments. + @see attachments( const QString &). + */ + Q_REQUIRED_RESULT Attachment::List attachments() const; + + /** + Returns a list of all incidence attachments with the specified MIME type. + + @param mime is a QString containing the MIME type. + @see attachments(). + */ + Q_REQUIRED_RESULT Attachment::List attachments(const QString &mime) const; + + /** + Removes all attachments and frees the memory used by them. + @see deleteAttachments( const QString &). + */ + void clearAttachments(); + + // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + // %%%%% Secrecy and Status methods + // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + /** + Sets the incidence #Secrecy. + + @param secrecy is the incidence #Secrecy to set. + @see secrecy(), secrecyStr(). + */ + void setSecrecy(Secrecy secrecy); + + /** + Returns the incidence #Secrecy. + @see setSecrecy(), secrecyStr(). + */ + Q_REQUIRED_RESULT Secrecy secrecy() const; + + /** + Sets the incidence status to a standard #Status value. + Note that StatusX cannot be specified. + + @param status is the incidence #Status to set. + @see status(), setCustomStatus(). + */ + void setStatus(Status status); + + /** + Sets the incidence #Status to a non-standard status value. + + @param status is a non-standard status string. If empty, + the incidence #Status will be set to StatusNone. + @see setStatus(), status() customStatus(). + */ + void setCustomStatus(const QString &status); + + /** + Returns the non-standard status value. + @see setCustomStatus(). + */ + Q_REQUIRED_RESULT QString customStatus() const; + + /** + Returns the incidence #Status. + @see setStatus(), setCustomStatus(), statusStr(). + */ + Q_REQUIRED_RESULT Status status() const; + + // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + // %%%%% Other methods + // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + /** + Sets a list of incidence resources. (Note: resources in this context + means items used by the incidence such as money, fuel, hours, etc). + + @param resources is a list of resource strings. + @see resources(). + */ + void setResources(const QStringList &resources); + + /** + Returns the incidence resources as a list of strings. + @see setResources(). + */ + Q_REQUIRED_RESULT QStringList resources() const; + + /** + Sets the incidences priority. The priority must be an integer value + between 0 and 9, where 0 is undefined, 1 is the highest, and 9 is the + lowest priority (decreasing order). + + @param priority is the incidence priority to set. + @see priority(). + */ + void setPriority(int priority); + + /** + Returns the incidence priority. + @see setPriority(). + */ + Q_REQUIRED_RESULT int priority() const; + + /** + Returns true if the incidence has geo data, otherwise return false. + @see setHasGeo(), setGeoLatitude(float), setGeoLongitude(float). + */ + Q_REQUIRED_RESULT bool hasGeo() const; + + /** + Sets if the incidence has geo data. + @param hasGeo true if incidence has geo data, otherwise false + @see hasGeo(), geoLatitude(), geoLongitude(). + */ + void setHasGeo(bool hasGeo); + + /** + Set the incidences geoLatitude. + 设置事件地理纬度。 + @param geolatitude is the incidence geolatitude to set + @see geoLatitude(). + */ + void setGeoLatitude(float geolatitude); + + /** + Returns the incidence geoLatidude. + @return incidences geolatitude value + @see setGeoLatitude(). + */ + Q_REQUIRED_RESULT float geoLatitude() const; + + /** + Set the incidencesgeoLongitude. + @param geolongitude is the incidence geolongitude to set + @see geoLongitude(). + */ + void setGeoLongitude(float geolongitude); + + /** + Returns the incidence geoLongitude. + @return incidences geolongitude value + @see setGeoLongitude(). + */ + Q_REQUIRED_RESULT float geoLongitude() const; + + /** + Returns true if the incidence has recurrenceId, otherwise return false. + @see setRecurrenceId(QDateTime) + */ + Q_REQUIRED_RESULT bool hasRecurrenceId() const; + + /** + Set the incidences recurrenceId. + 设置重复ID + This field indicates that this is an exception to a recurring incidence. + The uid of this incidence MUST be the same as the one of the recurring main incidence. + @param recurrenceId is the incidence recurrenceId to set + @see recurrenceId(). + */ + void setRecurrenceId(const QDateTime &recurrenceId); + + /** + Returns the incidence recurrenceId. + @return incidences recurrenceId value + @see setRecurrenceId(). + */ + Q_REQUIRED_RESULT QDateTime recurrenceId() const override; + + /** + Set to true if the exception also applies to all future occurrences. + 如果异常也适用于将来的所有事件,则设置为 true。 + This option is only relevant if the incidence has a recurrenceId set. + 仅当发生率设置了重复 ID 时,此选项才相关。 + @param thisAndFuture value + @see thisAndFuture(), setRecurrenceId() + @since 4.11 + */ + void setThisAndFuture(bool thisAndFuture); + + /** + Returns true if the exception also applies to all future occurrences. + @return incidences thisAndFuture value + @see setThisAndFuture() + @since 4.11 + */ + Q_REQUIRED_RESULT bool thisAndFuture() const; + + // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + // %%%%% Alarm-related methods + // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + /** + Returns a list of all incidence alarms. + 返回所有事件警报的列表。 + */ + Q_REQUIRED_RESULT Alarm::List alarms() const; + + /** + Create a new incidence alarm. + */ + Alarm::Ptr newAlarm(); + + /** + Adds an alarm to the incidence. + + @param alarm is a pointer to a valid Alarm object. + @see removeAlarm(). + */ + void addAlarm(const Alarm::Ptr &alarm); + + /** + Removes the specified alarm from the incidence. + + @param alarm is a pointer to a valid Alarm object. + @see addAlarm(). + */ + void removeAlarm(const Alarm::Ptr &alarm); + + /** + Removes all alarms. + @see removeAlarm(). + */ + void clearAlarms(); + + /** + Returns true if any of the incidence alarms are enabled; false otherwise. + 如果任何一个事件警报被启用,返回true;否则返回false。 + */ + Q_REQUIRED_RESULT bool hasEnabledAlarms() const; + + // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + // %%%%% Conferences-related method + // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + /** + * Returns list of all incidence conferencing methods. + * @since 5.77 + */ + Q_REQUIRED_RESULT Conference::List conferences() const; + + /** + * Replaces all conferences in the incidence with given @p conferences + * + * @param conferences New conferences to store in the incidence. + * @since 5.77 + */ + void setConferences(const Conference::List &conferences); + + /** + * Adds a conference to the incidence. + * + * @param conferene A conference to add. + * @since 5.77 + */ + void addConference(const Conference &conference); + + /** + * Removes all conferences from the incidence. + * @since 5.77 + */ + void clearConferences(); + + // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + // %%%%% Other methods + // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + /** + Set the incidence scheduling ID. Do _not_ use with journals. + This is used for accepted invitations as the place to store the UID + of the invitation. It is later used again if updates to the + invitation comes in. + If we did not set a new UID on incidences from invitations, we can + end up with more than one resource having events with the same UID, + if you have access to other peoples resources. + + While constructing an incidence, when setting the scheduling ID, + you will always want to set the incidence UID too. Instead of calling + setUID() separately, you can pass the UID through @p uid so both + members are changed in one atomic operation ( don't forget that + setUID() emits incidenceUpdated() and whoever catches that signal + will have an half-initialized incidence, therefore, always set + the schedulingID and UID at the same time, and never with two separate + calls). + + @param sid is a QString containing the scheduling ID. + @param uid is a QString containing the incidence UID to set, if not + specified, the current UID isn't changed, and this parameter + is ignored. + @see schedulingID(). + */ + void setSchedulingID(const QString &sid, const QString &uid = QString()); + + /** + Returns the incidence scheduling ID. Do _not_ use with journals. + If a scheduling ID is not set, then return the incidence UID. + @see setSchedulingID(). + */ + Q_REQUIRED_RESULT QString schedulingID() const; + + /** + Observer interface for the recurrence class. If the recurrence is + changed, this method will be called for the incidence the recurrence + object belongs to. + 递归类的观察者接口。如果重复发生更改,将根据重复发生对象所属的发生率调用此方法。 + + @param recurrence is a pointer to a valid Recurrence object. + */ + void recurrenceUpdated(Recurrence *recurrence) override; + + /** + Returns the name of the icon that best represents this incidence. + + @param recurrenceId Some recurring incidences might use a different icon, + for example, completed to-do occurrences. Use this parameter to identify + the specific occurrence in a recurring serie. + */ + virtual QLatin1String iconName(const QDateTime &recurrenceId = {}) const = 0; + + /** + * Returns true if the incidence type supports groupware communication. + * @since 4.10 + */ + virtual bool supportsGroupwareCommunication() const = 0; + + /** + Returns the list of possible mime types in an Incidence object: + "text/calendar" + "application/x-vnd.akonadi.calendar.event" + "application/x-vnd.akonadi.calendar.todo" + "application/x-vnd.akonadi.calendar.journal" + + @since 4.12 + */ + Q_REQUIRED_RESULT static QStringList mimeTypes(); + +protected: + /** + Copy constructor. + @param other is the incidence to copy. + */ + Incidence(const Incidence &other); + + /** + Compares this with Incidence @p incidence for equality. + @param incidence is the Incidence to compare against. + @return true if the incidences are equal; false otherwise. + */ + bool equals(const IncidenceBase &incidence) const override; + + /** + @copydoc IncidenceBase::assign() + */ + IncidenceBase &assign(const IncidenceBase &other) override; + + void serialize(QDataStream &out) const override; + void deserialize(QDataStream &in) override; + +private: + /** + Disabled, not polymorphic. + Use IncidenceBase::operator= which is safe because it calls + virtual function assign. + @param other is another Incidence object to assign to this one. + */ + Incidence &operator=(const Incidence &other); + + Q_DECL_HIDDEN QVariantList attachmentsVariant() const; + Q_DECL_HIDDEN QVariantList conferencesVariant() const; + + //@cond PRIVATE + class Private; + Private *const d; + //@endcond +}; + +} // namespace KCalendarCore + +//@cond PRIVATE +inline uint qHash(const QSharedPointer &key) +{ + return qHash(key.data()); +} +//@endcond + +//@cond PRIVATE +Q_DECLARE_TYPEINFO(KCalendarCore::Incidence::Ptr, Q_MOVABLE_TYPE); +Q_DECLARE_METATYPE(KCalendarCore::Incidence *) +//@endcond + +#endif diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/journal.cpp dde-calendar-5.10.0/3rdparty/kcalendarcore/src/journal.cpp --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/journal.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/journal.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,126 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 2001 Cornelius Schumacher + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +/** + @file + This file is part of the API for handling calendar data and + defines the Journal class. + + @brief + Provides a Journal in the sense of RFC2445. + + @author Cornelius Schumacher \ +*/ + +#include "journal.h" +#include "visitor.h" + +#include + +using namespace KCalendarCore; + +Journal::Journal() + : d(nullptr) +{ +} + +Journal::Journal(const Journal &) = default; +Journal::~Journal() = default; + +Incidence::IncidenceType Journal::type() const +{ + return TypeJournal; +} + +QByteArray Journal::typeStr() const +{ + return QByteArrayLiteral("Journal"); +} + +Journal *Journal::clone() const +{ + return new Journal(*this); +} + +IncidenceBase &Journal::assign(const IncidenceBase &other) +{ + Incidence::assign(other); + return *this; +} + +bool Journal::equals(const IncidenceBase &journal) const +{ + return Incidence::equals(journal); +} + +bool Journal::accept(Visitor &v, const IncidenceBase::Ptr &incidence) +{ + return v.visit(incidence.staticCast()); +} + +QDateTime Journal::dateTime(DateTimeRole role) const +{ + switch (role) { + case RoleEnd: + case RoleEndTimeZone: + return QDateTime(); + case RoleDisplayStart: + case RoleDisplayEnd: + return dtStart(); + default: + return dtStart(); + } +} + +void Journal::setDateTime(const QDateTime &dateTime, DateTimeRole role) +{ + switch (role) { + case RoleDnD: { + setDtStart(dateTime); + break; + } + default: + qDebug() << "Unhandled role" << role; + } +} + +void Journal::virtual_hook(VirtualHook id, void *data) +{ + Q_UNUSED(id); + Q_UNUSED(data); +} + +QLatin1String Journal::mimeType() const +{ + return Journal::journalMimeType(); +} + +/* static */ +QLatin1String Journal::journalMimeType() +{ + return QLatin1String("application/x-vnd.akonadi.calendar.journal"); +} + +QLatin1String Journal::iconName(const QDateTime &) const +{ + return QLatin1String("view-pim-journal"); +} + +void Journal::serialize(QDataStream &out) const +{ + Incidence::serialize(out); +} + +void Journal::deserialize(QDataStream &in) +{ + Incidence::deserialize(in); +} + +bool Journal::supportsGroupwareCommunication() const +{ + return false; +} diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/journal.h dde-calendar-5.10.0/3rdparty/kcalendarcore/src/journal.h --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/journal.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/journal.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,164 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 2001-2003 Cornelius Schumacher + SPDX-FileCopyrightText: 2003-2004 Reinhold Kainhofer + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +/** + @file + This file is part of the API for handling calendar data and + defines the Journal class. + + @author Cornelius Schumacher \ + @author Reinhold Kainhofer \ +*/ +#ifndef KCALCORE_JOURNAL_H +#define KCALCORE_JOURNAL_H + +#include "incidence.h" + +namespace KCalendarCore { +/** + @brief + Provides a Journal in the sense of RFC2445. +*/ +class Q_CORE_EXPORT Journal : public Incidence +{ +public: + /** + A shared pointer to a Journal object. + */ + typedef QSharedPointer Ptr; + + /** + List of journals. + */ + typedef QVector List; + + ///@cond PRIVATE + // needed for Akonadi polymorphic payload support + typedef Incidence SuperClass; + ///@endcond + + /** + Constructs an empty journal. + */ + Journal(); + + /** Copy a journey object. */ + Journal(const Journal &); + + /** + Destroys a journal. + */ + ~Journal() override; + + /** + @copydoc + IncidenceBase::type() + */ + Q_REQUIRED_RESULT IncidenceType type() const override; + + /** + @copydoc + IncidenceBase::typeStr() + */ + Q_REQUIRED_RESULT QByteArray typeStr() const override; + + /** + Returns an exact copy of this journal. The returned object is owned + by the caller. + */ + Journal *clone() const override; + + /** + @copydoc + IncidenceBase::dateTime(DateTimeRole)const + */ + Q_REQUIRED_RESULT QDateTime dateTime(DateTimeRole role) const override; + + /** + @copydoc + IncidenceBase::setDateTime(const QDateTime &, DateTimeRole ) + */ + void setDateTime(const QDateTime &dateTime, DateTimeRole role) override; + + /** + @copydoc + IncidenceBase::mimeType() + */ + Q_REQUIRED_RESULT QLatin1String mimeType() const override; + + /** + @copydoc + Incidence::iconName() + */ + Q_REQUIRED_RESULT QLatin1String iconName(const QDateTime &recurrenceId = {}) const override; + + /** + @copydoc + Incidence::supportsGroupwareCommunication() + */ + Q_REQUIRED_RESULT bool supportsGroupwareCommunication() const override; + + /** + Returns the Akonadi specific sub MIME type of a KCalendarCore::Journal. + */ + Q_REQUIRED_RESULT static QLatin1String journalMimeType(); + +protected: + /** + Compare this with @p journal for equality. + + @param journal is the journal to compare. + */ + bool equals(const IncidenceBase &journal) const override; + + /** + @copydoc + IncidenceBase::assign() + */ + IncidenceBase &assign(const IncidenceBase &other) override; + + /** + @copydoc + IncidenceBase::virtual_hook() + */ + void virtual_hook(VirtualHook id, void *data) override; + +private: + /** + @copydoc + IncidenceBase::accept(Visitor &, const IncidenceBase::Ptr &) + */ + bool accept(Visitor &v, const IncidenceBase::Ptr &incidence) override; + + /** + Disabled, otherwise could be dangerous if you subclass Journal. + Use IncidenceBase::operator= which is safe because it calls + virtual function assign(). + @param other is another Journal object to assign to this one. + */ + Journal &operator=(const Journal &other) = delete; + + // For polymorfic serialization + void serialize(QDataStream &out) const override; + void deserialize(QDataStream &in) override; + + //@cond PRIVATE + class Private; + Private *const d; + //@endcond +}; + +} // namespace KCalendarCore + +//@cond PRIVATE +Q_DECLARE_TYPEINFO(KCalendarCore::Journal::Ptr, Q_MOVABLE_TYPE); +Q_DECLARE_METATYPE(KCalendarCore::Journal::Ptr) +Q_DECLARE_METATYPE(KCalendarCore::Journal *) +//@endcond + +#endif diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/memorycalendar.cpp dde-calendar-5.10.0/3rdparty/kcalendarcore/src/memorycalendar.cpp --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/memorycalendar.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/memorycalendar.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,771 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 1998 Preston Brown + SPDX-FileCopyrightText: 2001, 2003, 2004 Cornelius Schumacher + SPDX-FileCopyrightText: 2003-2004 Reinhold Kainhofer + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +/** + @file + This file is part of the API for handling calendar data and + defines the MemoryCalendar class. + + @brief + This class provides a calendar stored as a local file. + + @author Preston Brown \ + @author Cornelius Schumacher \ + */ + +#include "memorycalendar.h" +#include "calformat.h" + +#include +#include + +#include + +using namespace KCalendarCore; + +/** + Private class that helps to provide binary compatibility between releases. + @internal +*/ +//@cond PRIVATE +class Q_DECL_HIDDEN KCalendarCore::MemoryCalendar::Private +{ +private: + static constexpr int incidenceTypeCount = 4; + +public: + Private(MemoryCalendar *qq) + : q(qq) + , mFormat(nullptr) + , mUpdateLastModified(true) + { + } + ~Private() + { + } + + MemoryCalendar *q; + CalFormat *mFormat; // calendar format + QString mIncidenceBeingUpdated; // Instance identifier of Incidence currently being updated + bool mUpdateLastModified; // Call setLastModified() on incidence modific ations + + /** + * List of all incidences. + * First indexed by incidence->type(), then by incidence->uid(); + */ + QMultiHash mIncidences[incidenceTypeCount]; + + /** + * Has all incidences, indexed by identifier. + */ + QHash mIncidencesByIdentifier; + + /** + * List of all deleted incidences. + * First indexed by incidence->type(), then by incidence->uid(); + */ + QMultiHash mDeletedIncidences[incidenceTypeCount]; + + /** + * Contains incidences ( to-dos; non-recurring, non-multiday events; journals; ) + * indexed by start/due date. + * + * The QMap key is the incidence->type(). + * The QMultiHash key is the dtStart/dtDue() converted to calendar's timezone + * + * Note: We had 3 variables, mJournalsForDate, mTodosForDate and mEventsForDate + * but i merged them into one (indexed by type) because it simplifies code using + * it. No need to if else based on type. + */ + QMultiHash mIncidencesForDate[incidenceTypeCount]; + + void insertIncidence(const Incidence::Ptr &incidence); + + Incidence::Ptr incidence(const QString &uid, IncidenceBase::IncidenceType type, const QDateTime &recurrenceId = {}) const; + + bool deleteIncidence(const QString &uid, IncidenceBase::IncidenceType type, const QDateTime &recurrenceId = {}); + + Incidence::Ptr deletedIncidence(const QString &uid, const QDateTime &recurrenceId, IncidenceBase::IncidenceType type) const; + + void deleteAllIncidences(IncidenceBase::IncidenceType type); + + template + void forIncidences(const QMultiHash &incidences, const Key &key, std::function &&op) const + { + for (auto it = incidences.constFind(key), end = incidences.cend(); it != end && it.key() == key; ++it) { + op(it.value().template staticCast()); + } + } + + template + void forIncidences(const QMultiHash &incidences, std::function &&op) const + { + for (const auto &incidence : incidences) { + op(incidence.template staticCast()); + } + } + + template + typename IncidenceType::List castIncidenceList(const QMultiHash &incidences) const + { + typename IncidenceType::List list; + list.reserve(incidences.size()); + std::transform(incidences.cbegin(), incidences.cend(), std::back_inserter(list), [](const Incidence::Ptr &inc) { + return inc.staticCast(); + }); + return list; + } + + template + typename IncidenceType::List incidenceInstances(IncidenceBase::IncidenceType type, const Incidence::Ptr &incidence) const + { + typename IncidenceType::List list; + forIncidences(mIncidences[type], incidence->uid(), [&list](const typename IncidenceType::Ptr &incidence) { + if (incidence->hasRecurrenceId()) { + list.push_back(incidence); + } + }); + return list; + } + + Incidence::Ptr findIncidence(const QMultiHash &incidences, const QString &uid, const QDateTime &recurrenceId) const + { + for (auto it = incidences.constFind(uid), end = incidences.cend(); it != end && it.key() == uid; ++it) { + const auto &incidence = it.value(); + if (recurrenceId.isNull() && !incidence->hasRecurrenceId()) { + return incidence; + } else if (!recurrenceId.isNull() && incidence->hasRecurrenceId() && recurrenceId == incidence->recurrenceId()) { + return incidence; + } + } + return {}; + } +}; +//@endcond + +MemoryCalendar::MemoryCalendar(const QTimeZone &timeZone) + : Calendar(timeZone) + , d(new KCalendarCore::MemoryCalendar::Private(this)) +{ +} + +MemoryCalendar::MemoryCalendar(const QByteArray &timeZoneId) + : Calendar(timeZoneId) + , d(new KCalendarCore::MemoryCalendar::Private(this)) +{ +} + +MemoryCalendar::~MemoryCalendar() +{ + close(); // NOLINT false clang-analyzer-optin.cplusplus.VirtualCall + delete d; +} + +void MemoryCalendar::doSetTimeZone(const QTimeZone &timeZone) +{ + // Reset date based hashes before storing for the new zone. + for (auto &table : d->mIncidencesForDate) { + table.clear(); + } + + for (auto &table : d->mIncidences) { + for (const auto &incidence : table) { + const QDateTime dt = incidence->dateTime(Incidence::RoleCalendarHashing); + if (dt.isValid()) { + d->mIncidencesForDate[incidence->type()].insert(dt.toTimeZone(timeZone).date(), incidence); + } + } + } +} + +void MemoryCalendar::close() +{ + setObserversEnabled(false); + + // Don't call the virtual function deleteEvents() etc, the base class might have + // other ways of deleting the data. + d->deleteAllIncidences(Incidence::TypeEvent); + d->deleteAllIncidences(Incidence::TypeTodo); + d->deleteAllIncidences(Incidence::TypeJournal); + + d->mIncidencesByIdentifier.clear(); + for (auto &table : d->mDeletedIncidences) { + table.clear(); + } + + clearNotebookAssociations(); + + setModified(false); + + setObserversEnabled(true); +} + +bool MemoryCalendar::deleteIncidence(const Incidence::Ptr &incidence) +{ + // Handle orphaned children + // relations is an Incidence's property, not a Todo's, so + // we remove relations in deleteIncidence, not in deleteTodo. + removeRelations(incidence); + // Notify while the incidence is still available, + // this is necessary so korganizer still has time to query for exceptions + notifyIncidenceAboutToBeDeleted(incidence); + incidence->unRegisterObserver(this); + const Incidence::IncidenceType type = incidence->type(); + const QString &uid = incidence->uid(); + bool deleted = d->deleteIncidence(uid, type, incidence->recurrenceId()); + if (deleted) { + setModified(true); + if (deletionTracking()) { + d->mDeletedIncidences[type].insert(uid, incidence); + } + + // Delete child-incidences. + if (!incidence->hasRecurrenceId() && incidence->recurs()) { + deleteIncidenceInstances(incidence); + } + } else { + qWarning() << incidence->typeStr() << " not found. uid=" << uid; + } + notifyIncidenceDeleted(incidence); + return deleted; +} + +bool MemoryCalendar::deleteIncidenceInstances(const Incidence::Ptr &incidence) +{ + Incidence::List instances; + for (auto it = d->mIncidences[incidence->type()].constFind(incidence->uid()), end = d->mIncidences[incidence->type()].constEnd(); + it != end && it.key() == incidence->uid(); + ++it) { + if (it.value()->hasRecurrenceId()) { + qDebug() << "deleting child" + << ", type=" << int(incidence->type()) << ", uid=" + << incidence->uid() + // << ", start=" << i->dtStart() + << " from calendar"; + // Don't call deleteIncidence() now since it's modifying the + // mIncidences map we're iterating over. + instances.append(it.value()); + } + } + for (Incidence::Ptr instance : instances) { + deleteIncidence(instance); + } + + return true; +} + +//@cond PRIVATE +bool MemoryCalendar::Private::deleteIncidence(const QString &uid, IncidenceBase::IncidenceType type, const QDateTime &recurrenceId) +{ + for (auto it = mIncidences[type].find(uid), end = mIncidences[type].end(); it != end && it.key() == uid; ++it) { + Incidence::Ptr incidence = it.value(); + if (recurrenceId.isNull() && incidence->hasRecurrenceId()) { + continue; + } else if (!recurrenceId.isNull() && (!incidence->hasRecurrenceId() || recurrenceId != incidence->recurrenceId())) { + continue; + } + mIncidences[type].erase(it); + mIncidencesByIdentifier.remove(incidence->instanceIdentifier()); + const QDateTime dt = incidence->dateTime(Incidence::RoleCalendarHashing); + if (dt.isValid()) { + mIncidencesForDate[type].remove(dt.toTimeZone(q->timeZone()).date(), incidence); + } + return true; + } + return false; +} + +void MemoryCalendar::Private::deleteAllIncidences(Incidence::IncidenceType incidenceType) +{ + for (auto &incidence : mIncidences[incidenceType]) { + q->notifyIncidenceAboutToBeDeleted(incidence); + incidence->unRegisterObserver(q); + } + mIncidences[incidenceType].clear(); + mIncidencesForDate[incidenceType].clear(); +} + +Incidence::Ptr MemoryCalendar::Private::incidence(const QString &uid, Incidence::IncidenceType type, const QDateTime &recurrenceId) const +{ + return findIncidence(mIncidences[type], uid, recurrenceId); +} + +Incidence::Ptr MemoryCalendar::Private::deletedIncidence(const QString &uid, const QDateTime &recurrenceId, IncidenceBase::IncidenceType type) const +{ + if (!q->deletionTracking()) { + return Incidence::Ptr(); + } + + return findIncidence(mDeletedIncidences[type], uid, recurrenceId); +} + +void MemoryCalendar::Private::insertIncidence(const Incidence::Ptr &incidence) +{ + const QString uid = incidence->uid(); + const Incidence::IncidenceType type = incidence->type(); + if (!mIncidences[type].contains(uid, incidence)) { + mIncidences[type].insert(uid, incidence); + mIncidencesByIdentifier.insert(incidence->instanceIdentifier(), incidence); + const QDateTime dt = incidence->dateTime(Incidence::RoleCalendarHashing); + if (dt.isValid()) { + mIncidencesForDate[type].insert(dt.toTimeZone(q->timeZone()).date(), incidence); + } + + } else { +#ifndef NDEBUG + // if we already have an to-do with this UID, it must be the same incidence, + // otherwise something's really broken + Q_ASSERT(mIncidences[type].value(uid) == incidence); +#endif + } +} +//@endcond + +bool MemoryCalendar::addIncidence(const Incidence::Ptr &incidence) +{ + d->insertIncidence(incidence); + + notifyIncidenceAdded(incidence); + + incidence->registerObserver(this); + + setupRelations(incidence); + + setModified(true); + + return true; +} + +bool MemoryCalendar::addEvent(const Event::Ptr &event) +{ + return addIncidence(event); +} + +bool MemoryCalendar::deleteEvent(const Event::Ptr &event) +{ + return deleteIncidence(event); +} + +bool MemoryCalendar::deleteEventInstances(const Event::Ptr &event) +{ + return deleteIncidenceInstances(event); +} + +Event::Ptr MemoryCalendar::event(const QString &uid, const QDateTime &recurrenceId) const +{ + return d->incidence(uid, Incidence::TypeEvent, recurrenceId).staticCast(); +} + +Event::Ptr MemoryCalendar::deletedEvent(const QString &uid, const QDateTime &recurrenceId) const +{ + return d->deletedIncidence(uid, recurrenceId, Incidence::TypeEvent).staticCast(); +} + +bool MemoryCalendar::addTodo(const Todo::Ptr &todo) +{ + return addIncidence(todo); +} + +bool MemoryCalendar::deleteTodo(const Todo::Ptr &todo) +{ + return deleteIncidence(todo); +} + +bool MemoryCalendar::deleteTodoInstances(const Todo::Ptr &todo) +{ + return deleteIncidenceInstances(todo); +} + +Todo::Ptr MemoryCalendar::todo(const QString &uid, const QDateTime &recurrenceId) const +{ + return d->incidence(uid, Incidence::TypeTodo, recurrenceId).staticCast(); +} + +Todo::Ptr MemoryCalendar::deletedTodo(const QString &uid, const QDateTime &recurrenceId) const +{ + return d->deletedIncidence(uid, recurrenceId, Incidence::TypeTodo).staticCast(); +} + +Todo::List MemoryCalendar::rawTodos(TodoSortField sortField, SortDirection sortDirection) const +{ + return Calendar::sortTodos(d->castIncidenceList(d->mIncidences[Incidence::TypeTodo]), sortField, sortDirection); +} + +Todo::List MemoryCalendar::deletedTodos(TodoSortField sortField, SortDirection sortDirection) const +{ + if (!deletionTracking()) { + return Todo::List(); + } + + return Calendar::sortTodos(d->castIncidenceList(d->mDeletedIncidences[Incidence::TypeTodo]), sortField, sortDirection); +} + +Todo::List MemoryCalendar::todoInstances(const Incidence::Ptr &todo, TodoSortField sortField, SortDirection sortDirection) const +{ + return Calendar::sortTodos(d->incidenceInstances(Incidence::TypeTodo, todo), sortField, sortDirection); +} + +Todo::List MemoryCalendar::rawTodosForDate(const QDate &date) const +{ + Todo::List todoList; + + d->forIncidences(d->mIncidencesForDate[Incidence::TypeTodo], date, [&todoList](const Todo::Ptr &todo) { + todoList.append(todo); + }); + + // Iterate over all todos. Look for recurring todoss that occur on this date + d->forIncidences(d->mIncidences[Incidence::TypeTodo], [this, &todoList, &date](const Todo::Ptr &todo) { + if (todo->recurs() && todo->recursOn(date, timeZone())) { + todoList.append(todo); + } + }); + + return todoList; +} + +Todo::List MemoryCalendar::rawTodos(const QDate &start, const QDate &end, const QTimeZone &timeZone, bool inclusive) const +{ + Q_UNUSED(inclusive); // use only exact dtDue/dtStart, not dtStart and dtEnd + + Todo::List todoList; + const auto ts = timeZone.isValid() ? timeZone : this->timeZone(); + QDateTime st(start, QTime(0, 0, 0), ts); + QDateTime nd(end, QTime(23, 59, 59, 999), ts); + + // Get todos + for (const auto &incidence : d->mIncidences[Incidence::TypeTodo]) { + const auto todo = incidence.staticCast(); + if (!isVisible(todo)) { + continue; + } + + QDateTime rStart = todo->hasDueDate() ? todo->dtDue() : todo->hasStartDate() ? todo->dtStart() : QDateTime(); + if (!rStart.isValid()) { + continue; + } + + if (!todo->recurs()) { // non-recurring todos + if (nd.isValid() && nd < rStart) { + continue; + } + if (st.isValid() && rStart < st) { + continue; + } + } else { // recurring events + switch (todo->recurrence()->duration()) { + case -1: // infinite + break; + case 0: // end date given + default: // count given + QDateTime rEnd(todo->recurrence()->endDate(), QTime(23, 59, 59, 999), ts); + if (!rEnd.isValid()) { + continue; + } + if (st.isValid() && rEnd < st) { + continue; + } + break; + } // switch(duration) + } // if(recurs) + + todoList.append(todo); + } + + return todoList; +} + +Alarm::List MemoryCalendar::alarmsTo(const QDateTime &to) const +{ + return alarms(QDateTime(QDate(1900, 1, 1), QTime(0, 0, 0)), to); +} + +Alarm::List MemoryCalendar::alarms(const QDateTime &from, const QDateTime &to, bool excludeBlockedAlarms) const +{ + Q_UNUSED(excludeBlockedAlarms); + Alarm::List alarmList; + + d->forIncidences(d->mIncidences[Incidence::TypeEvent], [this, &alarmList, &from, &to](const Event::Ptr &e) { + if (e->recurs()) { + appendRecurringAlarms(alarmList, e, from, to); + } else { + appendAlarms(alarmList, e, from, to); + } + }); + + d->forIncidences(d->mIncidences[IncidenceBase::TypeTodo], [this, &alarmList, &from, &to](const Todo::Ptr &t) { + if (!t->isCompleted()) { + appendAlarms(alarmList, t, from, to); + if (t->recurs()) { + appendRecurringAlarms(alarmList, t, from, to); + } else { + appendAlarms(alarmList, t, from, to); + } + } + }); + + return alarmList; +} + +bool MemoryCalendar::updateLastModifiedOnChange() const +{ + return d->mUpdateLastModified; +} + +void MemoryCalendar::setUpdateLastModifiedOnChange(bool update) +{ + d->mUpdateLastModified = update; +} + +void MemoryCalendar::incidenceUpdate(const QString &uid, const QDateTime &recurrenceId) +{ + Incidence::Ptr inc = incidence(uid, recurrenceId); + + if (inc) { + if (!d->mIncidenceBeingUpdated.isEmpty()) { + qWarning() << "Incidence::update() called twice without an updated() call in between."; + } + + // Save it so we can detect changes to uid or recurringId. + d->mIncidenceBeingUpdated = inc->instanceIdentifier(); + + const QDateTime dt = inc->dateTime(Incidence::RoleCalendarHashing); + if (dt.isValid()) { + d->mIncidencesForDate[inc->type()].remove(dt.toTimeZone(timeZone()).date(), inc); + } + } +} + +void MemoryCalendar::incidenceUpdated(const QString &uid, const QDateTime &recurrenceId) +{ + Incidence::Ptr inc = incidence(uid, recurrenceId); + + if (inc) { + if (d->mIncidenceBeingUpdated.isEmpty()) { + qWarning() << "Incidence::updated() called twice without an update() call in between."; + } else if (inc->instanceIdentifier() != d->mIncidenceBeingUpdated) { + // Instance identifier changed, update our hash table + d->mIncidencesByIdentifier.remove(d->mIncidenceBeingUpdated); + d->mIncidencesByIdentifier.insert(inc->instanceIdentifier(), inc); + } + + d->mIncidenceBeingUpdated = QString(); + + if (d->mUpdateLastModified) { + inc->setLastModified(QDateTime::currentDateTimeUtc()); + } + // we should probably update the revision number here, + // or internally in the Event itself when certain things change. + // need to verify with ical documentation. + + const QDateTime dt = inc->dateTime(Incidence::RoleCalendarHashing); + if (dt.isValid()) { + d->mIncidencesForDate[inc->type()].insert(dt.toTimeZone(timeZone()).date(), inc); + } + + notifyIncidenceChanged(inc); + + setModified(true); + } +} + +Event::List MemoryCalendar::rawEventsForDate(const QDate &date, const QTimeZone &timeZone, EventSortField sortField, SortDirection sortDirection) const +{ + Event::List eventList; + + if (!date.isValid()) { + // There can't be events on invalid dates + return eventList; + } + + if (timeZone.isValid() && timeZone != this->timeZone()) { + // We cannot use the hash table on date, since time zone is different. + eventList = rawEvents(date, date, timeZone, false); + return Calendar::sortEvents(eventList, sortField, sortDirection); + } + + // Iterate over all non-recurring, single-day events that start on this date + d->forIncidences(d->mIncidencesForDate[Incidence::TypeEvent], date, [&eventList](const Event::Ptr &event) { + eventList.append(event); + }); + + // Iterate over all events. Look for recurring events that occur on this date + const auto ts = timeZone.isValid() ? timeZone : this->timeZone(); + for (const auto &event : d->mIncidences[Incidence::TypeEvent]) { + const auto ev = event.staticCast(); + if (ev->recurs()) { + if (ev->isMultiDay()) { + int extraDays = ev->dtStart().date().daysTo(ev->dtEnd().date()); + for (int i = 0; i <= extraDays; ++i) { + if (ev->recursOn(date.addDays(-i), ts)) { + eventList.append(ev); + break; + } + } + } else { + if (ev->recursOn(date, ts)) { + eventList.append(ev); + } + } + } else { + if (ev->isMultiDay()) { + if (ev->dtStart().toTimeZone(ts).date() <= date && ev->dtEnd().toTimeZone(ts).date() >= date) { + eventList.append(ev); + } + } + } + } + + return Calendar::sortEvents(eventList, sortField, sortDirection); +} + +Event::List MemoryCalendar::rawEvents(const QDate &start, const QDate &end, const QTimeZone &timeZone, bool inclusive) const +{ + Event::List eventList; + const auto ts = timeZone.isValid() ? timeZone : this->timeZone(); + QDateTime st(start, QTime(0, 0, 0), ts); + QDateTime nd(end, QTime(23, 59, 59, 999), ts); + + // Get non-recurring events + for (const auto &e : d->mIncidences[Incidence::TypeEvent]) { + const auto event = e.staticCast(); + QDateTime rStart = event->dtStart(); + if (nd.isValid() && nd < rStart) { + continue; + } + if (inclusive && st.isValid() && rStart < st) { + continue; + } + + if (!event->recurs()) { // non-recurring events + QDateTime rEnd = event->dtEnd(); + if (st.isValid() && rEnd < st) { + continue; + } + if (inclusive && nd.isValid() && nd < rEnd) { + continue; + } + } else { // recurring events + switch (event->recurrence()->duration()) { + case -1: // infinite + if (inclusive) { + continue; + } + break; + case 0: // end date given + default: // count given + QDateTime rEnd(event->recurrence()->endDate(), QTime(23, 59, 59, 999), ts); + if (!rEnd.isValid()) { + continue; + } + if (st.isValid() && rEnd < st) { + continue; + } + if (inclusive && nd.isValid() && nd < rEnd) { + continue; + } + break; + } // switch(duration) + } // if(recurs) + + eventList.append(event); + } + + return eventList; +} + +Event::List MemoryCalendar::rawEventsForDate(const QDateTime &kdt) const +{ + return rawEventsForDate(kdt.date(), kdt.timeZone()); +} + +Event::List MemoryCalendar::rawEvents(EventSortField sortField, SortDirection sortDirection) const +{ + return Calendar::sortEvents(d->castIncidenceList(d->mIncidences[Incidence::TypeEvent]), sortField, sortDirection); +} + +Event::List MemoryCalendar::deletedEvents(EventSortField sortField, SortDirection sortDirection) const +{ + if (!deletionTracking()) { + return Event::List(); + } + + return Calendar::sortEvents(d->castIncidenceList(d->mDeletedIncidences[Incidence::TypeEvent]), sortField, sortDirection); +} + +Event::List MemoryCalendar::eventInstances(const Incidence::Ptr &event, EventSortField sortField, SortDirection sortDirection) const +{ + return Calendar::sortEvents(d->incidenceInstances(Incidence::TypeEvent, event), sortField, sortDirection); +} + +bool MemoryCalendar::addJournal(const Journal::Ptr &journal) +{ + return addIncidence(journal); +} + +bool MemoryCalendar::deleteJournal(const Journal::Ptr &journal) +{ + return deleteIncidence(journal); +} + +bool MemoryCalendar::deleteJournalInstances(const Journal::Ptr &journal) +{ + return deleteIncidenceInstances(journal); +} + +Journal::Ptr MemoryCalendar::journal(const QString &uid, const QDateTime &recurrenceId) const +{ + return d->incidence(uid, Incidence::TypeJournal, recurrenceId).staticCast(); +} + +Journal::Ptr MemoryCalendar::deletedJournal(const QString &uid, const QDateTime &recurrenceId) const +{ + return d->deletedIncidence(uid, recurrenceId, Incidence::TypeJournal).staticCast(); +} + +Journal::List MemoryCalendar::rawJournals(JournalSortField sortField, SortDirection sortDirection) const +{ + return Calendar::sortJournals(d->castIncidenceList(d->mIncidences[Incidence::TypeJournal]), sortField, sortDirection); +} + +Journal::List MemoryCalendar::deletedJournals(JournalSortField sortField, SortDirection sortDirection) const +{ + if (!deletionTracking()) { + return Journal::List(); + } + + return Calendar::sortJournals(d->castIncidenceList(d->mDeletedIncidences[Incidence::TypeJournal]), sortField, sortDirection); +} + +Journal::List MemoryCalendar::journalInstances(const Incidence::Ptr &journal, JournalSortField sortField, SortDirection sortDirection) const +{ + return Calendar::sortJournals(d->incidenceInstances(Incidence::TypeJournal, journal), sortField, sortDirection); +} + +Journal::List MemoryCalendar::rawJournalsForDate(const QDate &date) const +{ + Journal::List journalList; + + d->forIncidences(d->mIncidencesForDate[Incidence::TypeJournal], date, [&journalList](const Journal::Ptr &journal) { + journalList.append(journal); + }); + + return journalList; +} + +Incidence::Ptr MemoryCalendar::instance(const QString &identifier) const +{ + return d->mIncidencesByIdentifier.value(identifier); +} + +void MemoryCalendar::virtual_hook(int id, void *data) +{ + Q_UNUSED(id); + Q_UNUSED(data); + Q_ASSERT(false); +} diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/memorycalendar.h dde-calendar-5.10.0/3rdparty/kcalendarcore/src/memorycalendar.h --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/memorycalendar.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/memorycalendar.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,325 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 1998 Preston Brown + SPDX-FileCopyrightText: 2001, 2003 Cornelius Schumacher + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +/** + @file + This file is part of the API for handling calendar data and + defines the MemoryCalendar class. + + Very simple implementation of a Calendar that is only in memory + + @author Preston Brown \ + @author Cornelius Schumacher \ + */ +#ifndef KCALCORE_MEMORYCALENDAR_H +#define KCALCORE_MEMORYCALENDAR_H + +#include "calendar.h" + +namespace KCalendarCore { +/** + @brief + This class provides a calendar stored in memory. + 此类提供存储在内存中的日历 +*/ +class Q_CORE_EXPORT MemoryCalendar : public Calendar +{ + Q_OBJECT +public: + /** + A shared pointer to a MemoryCalendar + */ + typedef QSharedPointer Ptr; + + /** + @copydoc Calendar::Calendar(const QTimeZone &) + */ + explicit MemoryCalendar(const QTimeZone &timeZone); + + /** + @copydoc Calendar::Calendar(const QString &) + */ + explicit MemoryCalendar(const QByteArray &timeZoneId); + + /** + @copydoc Calendar::~Calendar() + */ + ~MemoryCalendar() override; + + /** + Clears out the current calendar, freeing all used memory etc. etc. + */ + void close() override; + + /** + @copydoc Calendar::doSetTimeZone() + */ + void doSetTimeZone(const QTimeZone &timeZone) override; + + /** + @copydoc Calendar::deleteIncidence() + */ + bool deleteIncidence(const Incidence::Ptr &incidence) override; + + /** + @copydoc Calendar::deleteIncidenceInstances + */ + bool deleteIncidenceInstances(const Incidence::Ptr &incidence) override; + + /** + @copydoc Calendar::addIncidence() + */ + bool addIncidence(const Incidence::Ptr &incidence) override; + + // Event Specific Methods // + + /** + @copydoc Calendar::addEvent() + */ + bool addEvent(const Event::Ptr &event) override; + + /** + @copydoc Calendar::deleteEvent() + */ + bool deleteEvent(const Event::Ptr &event) override; + + /** + @copydoc Calendar::deleteEventInstances() + */ + bool deleteEventInstances(const Event::Ptr &event) override; + + /** + @copydoc Calendar::rawEvents(EventSortField, SortDirection)const + */ + Q_REQUIRED_RESULT Event::List rawEvents(EventSortField sortField = EventSortUnsorted, SortDirection sortDirection = SortDirectionAscending) const override; + + /** + @copydoc Calendar::rawEvents(const QDate &, const QDate &, const QTimeZone &, bool)const + */ + Q_REQUIRED_RESULT Event::List rawEvents(const QDate &start, const QDate &end, const QTimeZone &timeZone = {}, bool inclusive = false) const override; + + /** + Returns an unfiltered list of all Events which occur on the given date. + + @param date request unfiltered Event list for this QDate only. + @param timeZone time zone to interpret @p date, or the calendar's + default time zone if none is specified + @param sortField specifies the EventSortField. + @param sortDirection specifies the SortDirection. + + @return the list of unfiltered Events occurring on the specified QDate. + */ + Q_REQUIRED_RESULT Event::List rawEventsForDate(const QDate &date, + const QTimeZone &timeZone = {}, + EventSortField sortField = EventSortUnsorted, + SortDirection sortDirection = SortDirectionAscending) const override; + + /** + @copydoc Calendar::rawEventsForDate(const QDateTime &)const + */ + Q_REQUIRED_RESULT Event::List rawEventsForDate(const QDateTime &dt) const override; + + /** + * Returns an incidence by identifier. + * @see Incidence::instanceIdentifier() + * @since 4.11 + */ + Incidence::Ptr instance(const QString &identifier) const; + + /** + @copydoc Calendar::event() + */ + Q_REQUIRED_RESULT Event::Ptr event(const QString &uid, const QDateTime &recurrenceId = {}) const override; + + /** + @copydoc Calendar::deletedEvent() + */ + Q_REQUIRED_RESULT Event::Ptr deletedEvent(const QString &uid, const QDateTime &recurrenceId = {}) const override; + + /** + @copydoc Calendar::deletedEvents(EventSortField, SortDirection)const + */ + Q_REQUIRED_RESULT Event::List deletedEvents(EventSortField sortField = EventSortUnsorted, + SortDirection sortDirection = SortDirectionAscending) const override; + + /** + @copydoc Calendar::eventInstances(const Incidence::Ptr &, EventSortField, SortDirection)const + */ + Q_REQUIRED_RESULT Event::List eventInstances(const Incidence::Ptr &event, + EventSortField sortField = EventSortUnsorted, + SortDirection sortDirection = SortDirectionAscending) const override; + + // To-do Specific Methods // + + /** + @copydoc Calendar::addTodo() + */ + bool addTodo(const Todo::Ptr &todo) override; + + /** + @copydoc Calendar::deleteTodo() + */ + bool deleteTodo(const Todo::Ptr &todo) override; + + /** + @copydoc Calendar::deleteTodoInstances() + */ + bool deleteTodoInstances(const Todo::Ptr &todo) override; + + /** + @copydoc Calendar::rawTodos(TodoSortField, SortDirection)const + */ + Q_REQUIRED_RESULT Todo::List rawTodos(TodoSortField sortField = TodoSortUnsorted, SortDirection sortDirection = SortDirectionAscending) const override; + + /** + @copydoc Calendar::rawTodos(const QDate &, const QDate &, const QTimeZone &, bool)const + */ + Q_REQUIRED_RESULT Todo::List rawTodos(const QDate &start, const QDate &end, const QTimeZone &timeZone = {}, bool inclusive = false) const override; + + /** + @copydoc Calendar::rawTodosForDate() + */ + Q_REQUIRED_RESULT Todo::List rawTodosForDate(const QDate &date) const override; + + /** + @copydoc Calendar::todo() + */ + Q_REQUIRED_RESULT Todo::Ptr todo(const QString &uid, const QDateTime &recurrenceId = {}) const override; + + /** + @copydoc Calendar::deletedTodo() + */ + Q_REQUIRED_RESULT Todo::Ptr deletedTodo(const QString &uid, const QDateTime &recurrenceId = {}) const override; + + /** + @copydoc Calendar::deletedTodos(TodoSortField, SortDirection)const + */ + Q_REQUIRED_RESULT Todo::List deletedTodos(TodoSortField sortField = TodoSortUnsorted, SortDirection sortDirection = SortDirectionAscending) const override; + + /** + @copydoc Calendar::todoInstances(const Incidence::Ptr &, TodoSortField, SortDirection)const + */ + Q_REQUIRED_RESULT Todo::List + todoInstances(const Incidence::Ptr &todo, TodoSortField sortField = TodoSortUnsorted, SortDirection sortDirection = SortDirectionAscending) const override; + + // Journal Specific Methods // + + /** + @copydoc Calendar::addJournal() + */ + bool addJournal(const Journal::Ptr &journal) override; + + /** + @copydoc Calendar::deleteJournal() + */ + bool deleteJournal(const Journal::Ptr &journal) override; + + /** + @copydoc Calendar::deleteJournalInstances() + */ + bool deleteJournalInstances(const Journal::Ptr &journal) override; + + /** + @copydoc Calendar::rawJournals() + */ + Q_REQUIRED_RESULT Journal::List rawJournals(JournalSortField sortField = JournalSortUnsorted, + SortDirection sortDirection = SortDirectionAscending) const override; + + /** + @copydoc Calendar::rawJournalsForDate() + */ + Q_REQUIRED_RESULT Journal::List rawJournalsForDate(const QDate &date) const override; + + /** + @copydoc Calendar::journal() + */ + Journal::Ptr journal(const QString &uid, const QDateTime &recurrenceId = {}) const override; + + /** + @copydoc Calendar::deletedJournal() + */ + Journal::Ptr deletedJournal(const QString &uid, const QDateTime &recurrenceId = {}) const override; + + /** + @copydoc Calendar::deletedJournals(JournalSortField, SortDirection)const + */ + Q_REQUIRED_RESULT Journal::List deletedJournals(JournalSortField sortField = JournalSortUnsorted, + SortDirection sortDirection = SortDirectionAscending) const override; + + /** + @copydoc Calendar::journalInstances(const Incidence::Ptr &, + JournalSortField, SortDirection)const + */ + Q_REQUIRED_RESULT Journal::List journalInstances(const Incidence::Ptr &journal, + JournalSortField sortField = JournalSortUnsorted, + SortDirection sortDirection = SortDirectionAscending) const override; + + // Alarm Specific Methods // + + /** + @copydoc Calendar::alarms() + */ + Q_REQUIRED_RESULT Alarm::List alarms(const QDateTime &from, const QDateTime &to, bool excludeBlockedAlarms = false) const override; + + /** + Return a list of Alarms that occur before the specified timestamp. + + @param to is the ending timestamp. + @return the list of Alarms occurring before the specified QDateTime. + */ + Q_REQUIRED_RESULT Alarm::List alarmsTo(const QDateTime &to) const; // TODO KF6 remove, already defined in Calendar + + /** + Return true if the memory calendar is updating the lastModified field + of incidence owned by the calendar on any incidence change. + + @since 5.80 + */ + bool updateLastModifiedOnChange() const; + + /** + Govern if the memory calendar is changing the lastModified field of incidence + it owns, on incidence updates. + + @param update, when true, the lastModified field of an incidence owned by the + calendar is set to the current date time on any change of the incidence. + + @since 5.80 + */ + void setUpdateLastModifiedOnChange(bool update); + + /** + @copydoc Calendar::incidenceUpdate(const QString &,const QDateTime &) + */ + void incidenceUpdate(const QString &uid, const QDateTime &recurrenceId) override; + + /** + @copydoc Calendar::incidenceUpdated(const QString &,const QDateTime &) + */ + void incidenceUpdated(const QString &uid, const QDateTime &recurrenceId) override; + + using QObject::event; // prevent warning about hidden virtual method + +protected: + /** + @copydoc IncidenceBase::virtual_hook() + */ + void virtual_hook(int id, void *data) override; + +private: + //@cond PRIVATE + class Private; + Private *const d; + //@endcond + + Q_DISABLE_COPY(MemoryCalendar) +}; + +} // namespace KCalendarCore + +#endif diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/occurrenceiterator.cpp dde-calendar-5.10.0/3rdparty/kcalendarcore/src/occurrenceiterator.cpp --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/occurrenceiterator.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/occurrenceiterator.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,229 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 2013 Christian Mollekopf + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +/** + @file + This file is part of the API for handling calendar data and + defines the OccurrenceIterator class. + + @brief + This class provides an iterator to iterate over all occurrences of incidences. + + @author Christian Mollekopf \ + */ + +#include "occurrenceiterator.h" +#include "calendar.h" +#include "calfilter.h" + +#include + +using namespace KCalendarCore; + +/** + Private class that helps to provide binary compatibility between releases. + @internal +*/ +//@cond PRIVATE +class Q_DECL_HIDDEN KCalendarCore::OccurrenceIterator::Private +{ +public: + Private(OccurrenceIterator *qq) + : q(qq) + , occurrenceIt(occurrenceList) + { + } + + OccurrenceIterator *q; + QDateTime start; + QDateTime end; + + struct Occurrence { + Occurrence() + { + } + + Occurrence(const Incidence::Ptr &i, const QDateTime &recurrenceId, const QDateTime &startDate) + : incidence(i) + , recurrenceId(recurrenceId) + , startDate(startDate) + { + } + + Incidence::Ptr incidence; + QDateTime recurrenceId; + QDateTime startDate; + }; + QList occurrenceList; + QListIterator occurrenceIt; + Occurrence current; + + /* + * KCalendarCore::CalFilter can't handle individual occurrences. + * When filtering completed to-dos, the CalFilter doesn't hide + * them if it's a recurring to-do. + */ + bool occurrenceIsHidden(const Calendar &calendar, const Incidence::Ptr &inc, const QDateTime &occurrenceDate) + { + if ((inc->type() == Incidence::TypeTodo) && calendar.filter() && (calendar.filter()->criteria() & KCalendarCore::CalFilter::HideCompletedTodos)) { + if (inc->recurs()) { + const Todo::Ptr todo = inc.staticCast(); + if (todo && (occurrenceDate < todo->dtDue())) { + return true; + } + } else if (inc->hasRecurrenceId()) { + const Todo::Ptr mainTodo = calendar.todo(inc->uid()); + if (mainTodo && mainTodo->isCompleted()) { + return true; + } + } + } + return false; + } + + void setupIterator(const Calendar &calendar, const Incidence::List &incidences) + { + for (const Incidence::Ptr &inc : qAsConst(incidences)) { + if (inc->hasRecurrenceId()) { + continue; + } + if (inc->recurs()) { + QHash recurrenceIds; + QDateTime incidenceRecStart = inc->dateTime(Incidence::RoleRecurrenceStart); + // const bool isAllDay = inc->allDay(); + const auto lstInstances = calendar.instances(inc); + for (const Incidence::Ptr &exception : lstInstances) { + if (incidenceRecStart.isValid()) { + recurrenceIds.insert(exception->recurrenceId().toTimeZone(incidenceRecStart.timeZone()), exception); + } + } + const auto occurrences = inc->recurrence()->timesInInterval(start, end); + Incidence::Ptr incidence(inc), lastInc(inc); + qint64 offset(0), lastOffset(0); + QDateTime occurrenceStartDate; + for (const auto &recurrenceId : qAsConst(occurrences)) { + occurrenceStartDate = recurrenceId; + + bool resetIncidence = false; + if (recurrenceIds.contains(recurrenceId)) { + // TODO: exclude exceptions where the start/end is not within + // (so the occurrence of the recurrence is omitted, but no exception is added) + if (recurrenceIds.value(recurrenceId)->status() == Incidence::StatusCanceled) { + continue; + } + + incidence = recurrenceIds.value(recurrenceId); + occurrenceStartDate = incidence->dtStart(); + resetIncidence = !incidence->thisAndFuture(); + offset = incidence->recurrenceId().secsTo(incidence->dtStart()); + if (incidence->thisAndFuture()) { + lastInc = incidence; + lastOffset = offset; + } + } else if (inc != incidence) { // thisAndFuture exception is active + occurrenceStartDate = occurrenceStartDate.addSecs(offset); + } + + if (!occurrenceIsHidden(calendar, incidence, occurrenceStartDate)) { + occurrenceList << Private::Occurrence(incidence, recurrenceId, occurrenceStartDate); + } + + if (resetIncidence) { + incidence = lastInc; + offset = lastOffset; + } + } + } else { + occurrenceList << Private::Occurrence(inc, {}, inc->dtStart()); + } + } + occurrenceIt = QListIterator(occurrenceList); + } +}; +//@endcond + +/** + * Right now there is little point in the iterator, but: + * With an iterator it should be possible to solve this more memory efficiently + * and with immediate results at the beginning of the selected timeframe. + * Either all events are iterated simoulatneously, resulting in occurrences + * of all events in parallel in the correct time-order, or incidence after + * incidence, which would be even more efficient. + * + * By making this class a friend of calendar, we could also use the internally + * available data structures. + */ +OccurrenceIterator::OccurrenceIterator(const Calendar &calendar, const QDateTime &start, const QDateTime &end) + : d(new KCalendarCore::OccurrenceIterator::Private(this)) +{ + d->start = start; + d->end = end; + + Event::List events = calendar.rawEvents(start.date(), end.date(), start.timeZone()); + if (calendar.filter()) { + calendar.filter()->apply(&events); + } + + Todo::List todos = calendar.rawTodos(start.date(), end.date(), start.timeZone()); + if (calendar.filter()) { + calendar.filter()->apply(&todos); + } + + Journal::List journals; + const Journal::List allJournals = calendar.rawJournals(); + for (const KCalendarCore::Journal::Ptr &journal : allJournals) { + const QDate journalStart = journal->dtStart().toTimeZone(start.timeZone()).date(); + if (journal->dtStart().isValid() && journalStart >= start.date() && journalStart <= end.date()) { + journals << journal; + } + } + + if (calendar.filter()) { + calendar.filter()->apply(&journals); + } + + const Incidence::List incidences = KCalendarCore::Calendar::mergeIncidenceList(events, todos, journals); + d->setupIterator(calendar, incidences); +} + +OccurrenceIterator::OccurrenceIterator(const Calendar &calendar, const Incidence::Ptr &incidence, const QDateTime &start, const QDateTime &end) + : d(new KCalendarCore::OccurrenceIterator::Private(this)) +{ + Q_ASSERT(incidence); + d->start = start; + d->end = end; + d->setupIterator(calendar, Incidence::List() << incidence); +} + +OccurrenceIterator::~OccurrenceIterator() +{ +} + +bool OccurrenceIterator::hasNext() const +{ + return d->occurrenceIt.hasNext(); +} + +void OccurrenceIterator::next() +{ + d->current = d->occurrenceIt.next(); +} + +Incidence::Ptr OccurrenceIterator::incidence() const +{ + return d->current.incidence; +} + +QDateTime OccurrenceIterator::occurrenceStartDate() const +{ + return d->current.startDate; +} + +QDateTime OccurrenceIterator::recurrenceId() const +{ + return d->current.recurrenceId; +} diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/occurrenceiterator.h dde-calendar-5.10.0/3rdparty/kcalendarcore/src/occurrenceiterator.h --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/occurrenceiterator.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/occurrenceiterator.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,87 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 2013 Christian Mollekopf + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +/** + @file + This file is part of the API for handling calendar data and + defines the OccurrenceIterator class. + + @author Christian Mollekopf \ + */ + +#ifndef KCALCORE_OCCURRENCEITERATOR_H +#define KCALCORE_OCCURRENCEITERATOR_H + +#include "incidence.h" + +namespace KCalendarCore { +class Calendar; +/** + * Iterate over calendar items in a calendar. + * + * The iterator takes recurrences and exceptions to recurrences into account + * + * The iterator does not iterate the occurrences of all incidences chronologically. + * @since 4.11 + */ +class Q_CORE_EXPORT OccurrenceIterator +{ +public: + /** + * Creates iterator that iterates over all occurrences of all incidences + * between @param start and @param end (inclusive) + */ + explicit OccurrenceIterator(const Calendar &calendar, const QDateTime &start = QDateTime(), const QDateTime &end = QDateTime()); + + /** + * Creates iterator that iterates over all occurrences + * of @param incidence between @param start and @param end (inclusive) + */ + OccurrenceIterator(const Calendar &calendar, + const KCalendarCore::Incidence::Ptr &incidence, + const QDateTime &start = QDateTime(), + const QDateTime &end = QDateTime()); + ~OccurrenceIterator(); + bool hasNext() const; + + /** + * Advance iterator to the next occurrence. + */ + void next(); + + /** + * Returns either main incidence or exception, depending on occurrence. + */ + Incidence::Ptr incidence() const; + + /** + * Returns the start date of the occurrence + * + * This is either the occurrence date, or the start date of an exception + * which overrides that occurrence. + */ + QDateTime occurrenceStartDate() const; + + /** + * Returns the recurrence Id. + * + * This is the date where the occurrence starts without exceptions, + * this id is used to identify one exact occurrence. + */ + QDateTime recurrenceId() const; + +private: + Q_DISABLE_COPY(OccurrenceIterator) + //@cond PRIVATE + class Private; + QScopedPointer d; + //@endcond +}; + +} // namespace KCalendarCore + +#endif diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/period.cpp dde-calendar-5.10.0/3rdparty/kcalendarcore/src/period.cpp --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/period.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/period.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,160 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 2001 Cornelius Schumacher + SPDX-FileCopyrightText: 2007 David Jarvie + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +/** + @file + This file is part of the API for handling calendar data and + defines the Period class. + + @brief + Represents a period of time. + + @author Cornelius Schumacher \ +*/ + +#include "period.h" +#include "utils_p.h" + +#include +#include + +using namespace KCalendarCore; + +//@cond PRIVATE +class Q_DECL_HIDDEN KCalendarCore::Period::Private +{ +public: + Private() + : mHasDuration(false) + , mDailyDuration(false) + { + } + Private(const QDateTime &start, const QDateTime &end, bool hasDuration) + : mStart(start) + , mEnd(end) + , mHasDuration(hasDuration) + , mDailyDuration(false) + { + } + QDateTime mStart; // period starting date/time + QDateTime mEnd; // period ending date/time + bool mHasDuration = false; // does period have a duration? + bool mDailyDuration = false; // duration is defined as number of days, not seconds +}; +//@endcond + +Period::Period() + : d(new KCalendarCore::Period::Private()) +{ +} + +Period::Period(const QDateTime &start, const QDateTime &end) + : d(new KCalendarCore::Period::Private(start, end, false)) +{ +} + +Period::Period(const QDateTime &start, const Duration &duration) + : d(new KCalendarCore::Period::Private(start, duration.end(start), true)) +{ + d->mDailyDuration = duration.isDaily(); +} + +Period::Period(const Period &period) + : d(new KCalendarCore::Period::Private(*period.d)) +{ +} + +Period::~Period() +{ + delete d; +} + +bool Period::operator<(const Period &other) const +{ + return d->mStart < other.d->mStart; +} + +bool Period::operator==(const Period &other) const +{ + return ((d->mStart == other.d->mStart) || (!d->mStart.isValid() && !other.d->mStart.isValid())) + && ((d->mEnd == other.d->mEnd) || (!d->mEnd.isValid() && !other.d->mEnd.isValid())) && d->mHasDuration == other.d->mHasDuration; +} + +Period &Period::operator=(const Period &other) +{ + // check for self assignment + if (&other == this) { + return *this; + } + + *d = *other.d; + return *this; +} + +QDateTime Period::start() const +{ + return d->mStart; +} + +QDateTime Period::end() const +{ + return d->mEnd; +} + +Duration Period::duration() const +{ + if (d->mHasDuration) { + return Duration(d->mStart, d->mEnd, d->mDailyDuration ? Duration::Days : Duration::Seconds); + } else { + return Duration(d->mStart, d->mEnd); + } +} + +Duration Period::duration(Duration::Type type) const +{ + return Duration(d->mStart, d->mEnd, type); +} + +bool Period::hasDuration() const +{ + return d->mHasDuration; +} + +void Period::shiftTimes(const QTimeZone &oldZone, const QTimeZone &newZone) +{ + if (oldZone.isValid() && newZone.isValid() && oldZone != newZone) { + d->mStart = d->mStart.toTimeZone(oldZone); + d->mStart.setTimeZone(newZone); + d->mEnd = d->mEnd.toTimeZone(oldZone); + d->mEnd.setTimeZone(newZone); + } +} + +QDataStream &KCalendarCore::operator<<(QDataStream &stream, const KCalendarCore::Period &period) +{ + serializeQDateTimeAsKDateTime(stream, period.d->mStart); + serializeQDateTimeAsKDateTime(stream, period.d->mEnd); + return stream << period.d->mDailyDuration << period.d->mHasDuration; +} + +QDataStream &KCalendarCore::operator>>(QDataStream &stream, KCalendarCore::Period &period) +{ + deserializeKDateTimeAsQDateTime(stream, period.d->mStart); + deserializeKDateTimeAsQDateTime(stream, period.d->mEnd); + stream >> period.d->mDailyDuration >> period.d->mHasDuration; + return stream; +} + +uint KCalendarCore::qHash(const KCalendarCore::Period &key) +{ + if (key.hasDuration()) { + return qHash(key.duration()); + } else { + return qHash(key.start().toString() + key.end().toString()); + } +} diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/period.h dde-calendar-5.10.0/3rdparty/kcalendarcore/src/period.h --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/period.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/period.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,212 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 2001-2003 Cornelius Schumacher + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +/** + @file + This file is part of the API for handling calendar data and + defines the Period class. + + @brief + Represents a period of time. + + @author Cornelius Schumacher \ +*/ +#ifndef KCALCORE_PERIOD_H +#define KCALCORE_PERIOD_H + +#include "duration.h" + +#include +#include +#include +#include + +class QTimeZone; + +namespace KCalendarCore { +/** + The period can be defined by either a start time and an end time or + by a start time and a duration. +*/ +class Q_CORE_EXPORT Period +{ +public: + /** + List of periods. + */ + typedef QVector List; + + /** + Constructs a period without a duration. + */ + Period(); + + /** + Constructs a period from @p start to @p end. + + @param start the time the period begins. + @param end the time the period ends. + */ + Period(const QDateTime &start, const QDateTime &end); + + /** + Constructs a period from @p start and lasting @p duration. + + @param start the time when the period starts. + @param duration how long the period lasts. + */ + Period(const QDateTime &start, const Duration &duration); + + /** + Constructs a period by copying another period object + + @param period the period to copy + */ + + Period(const Period &period); + + /** + Destroys a period. + */ + ~Period(); + + /** + Returns true if the start of this period is earlier than the start of + the @p other one. + + @param other is the other period to compare. + */ + bool operator<(const Period &other) const; + + /** + Returns true if the start of this period is later than the start of + the @p other one. + + @param other the other period to compare + */ + bool operator>(const Period &other) const + { + return other.operator<(*this); + } + + /** + Returns true if this period is equal to the @p other one. + Even if their start and end times are the same, two periods are + considered not equal if one is defined in terms of a duration and the + other in terms of a start and end time. + + @param other the other period to compare + */ + bool operator==(const Period &other) const; + + /** + Returns true if this period is not equal to the @p other one. + + @param other the other period to compare + @see operator==() + */ + bool operator!=(const Period &other) const + { + return !operator==(other); + } + + /** + Sets this period equal to the @p other one. + + @param other is the other period to compare. + */ + Period &operator=(const Period &other); + + /** + Returns when this period starts. + */ + Q_REQUIRED_RESULT QDateTime start() const; + + /** + Returns when this period ends. + */ + Q_REQUIRED_RESULT QDateTime end() const; + + /** + Returns the duration of the period. + + If the period is defined in terms of a start and end time, the duration + is computed from these. In this case, if the time of day in @p start and + @p end is equal, and their time specifications (i.e. time zone etc.) are + the same, the duration will be set in terms of days. Otherwise, the + duration will be set in terms of seconds. + + If the period is defined in terms of a duration, that duration is + returned unchanged. + */ + Q_REQUIRED_RESULT Duration duration() const; + + /** + Returns the duration of the period. + + If the period is defined in terms of a start and end time, the duration + is first computed from these. + + If @p type is Days, and the duration is not an exact number of days, + the duration will be rounded down to the nearest whole number of days. + + @param type the unit of time to use (seconds or days) + */ + Q_REQUIRED_RESULT Duration duration(Duration::Type type) const; + + /** + Returns true if this period has a set duration, false + if it just has a start and an end. + */ + Q_REQUIRED_RESULT bool hasDuration() const; + + /** + Shift the times of the period so that they appear at the same clock + time as before but in a new time zone. The shift is done from a viewing + time zone rather than from the actual period time zone. + + For example, shifting a period whose start time is 09:00 America/New York, + using an old viewing time zone (@p oldSpec) of Europe/London, to a new + time zone (@p newSpec) of Europe/Paris, will result in the time being + shifted from 14:00 (which is the London time of the period start) to + 14:00 Paris time. + + @param oldZone the time zone which provides the clock times + @param newZone the new time zone + */ + void shiftTimes(const QTimeZone &oldZone, const QTimeZone &newZone); + +private: + //@cond PRIVATE + class Private; + Private *const d; + //@endcond + + friend Q_CORE_EXPORT QDataStream &operator<<(QDataStream &stream, const KCalendarCore::Period &period); + + friend Q_CORE_EXPORT QDataStream &operator>>(QDataStream &stream, KCalendarCore::Period &period); +}; + +/** Write @p period to the datastream @p stream, in binary format. */ +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &stream, const KCalendarCore::Period &period); + +/** Read a Period object into @p period from @p stream, in binary format. */ +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &stream, KCalendarCore::Period &period); + +/** + Return a hash value for a Period argument. + @param key is a Period. +*/ +Q_CORE_EXPORT uint qHash(const KCalendarCore::Period &key); +} // namespace KCalendarCore + +//@cond PRIVATE +Q_DECLARE_METATYPE(KCalendarCore::Period) +Q_DECLARE_TYPEINFO(KCalendarCore::Period, Q_MOVABLE_TYPE); +//@endcond + +#endif diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/person.cpp dde-calendar-5.10.0/3rdparty/kcalendarcore/src/person.cpp --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/person.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/person.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,364 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 2001 Cornelius Schumacher + SPDX-FileCopyrightText: 2003-2004 Reinhold Kainhofer + SPDX-FileCopyrightText: 2010 Casey Link + SPDX-FileCopyrightText: 2009-2010 Klaralvdalens Datakonsult AB, a KDAB Group company + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +/** + @file + This file is part of the API for handling calendar data and + defines the Person class. + + @brief + Represents a person, by name and email address. + + @author Cornelius Schumacher \ + @author Reinhold Kainhofer \ +*/ + +#include "person.h" +#include "person_p.h" + +#include +#include + +using namespace KCalendarCore; + +/** + Private class that helps to provide binary compatibility between releases. + @internal +*/ +//@cond PRIVATE +class Q_DECL_HIDDEN KCalendarCore::Person::Private : public QSharedData +{ +public: + QString mName; // person name + QString mEmail; // person email address +}; +//@endcond + +Person::Person() + : d(new KCalendarCore::Person::Private) +{ +} + +Person::Person(const QString &name, const QString &email) + : d(new KCalendarCore::Person::Private) +{ + d->mName = name; + d->mEmail = email; +} + +Person::Person(const Person &person) + : d(person.d) +{ +} + +Person::~Person() = default; + +bool KCalendarCore::Person::operator==(const Person &person) const +{ + return d->mName == person.d->mName && d->mEmail == person.d->mEmail; +} + +bool KCalendarCore::Person::operator!=(const Person &person) const +{ + return !(*this == person); +} + +Person &KCalendarCore::Person::operator=(const Person &person) +{ + // check for self assignment + if (&person == this) { + return *this; + } + + d = person.d; + return *this; +} + +QString KCalendarCore::fullNameHelper(const QString &name, const QString &email) +{ + if (name.isEmpty()) { + return email; + } + if (email.isEmpty()) { + return name; + } + // Taken from KContacts::Addressee::fullEmail + QString fullName = name; + const QRegularExpression needQuotes(QStringLiteral("[^ 0-9A-Za-z\\x{0080}-\\x{FFFF}]")); + bool weNeedToQuote = name.indexOf(needQuotes) != -1; + if (weNeedToQuote) { + if (fullName[0] != QLatin1Char('"')) { + fullName.prepend(QLatin1Char('"')); + } + if (fullName[fullName.length() - 1] != QLatin1Char('"')) { + fullName.append(QLatin1Char('"')); + } + } + return fullName + QStringLiteral(" <") + email + QLatin1Char('>'); +} + +QString Person::fullName() const +{ + return fullNameHelper(d->mName, d->mEmail); +} + +QString Person::name() const +{ + return d->mName; +} + +QString Person::email() const +{ + return d->mEmail; +} + +bool Person::isEmpty() const +{ + return d->mEmail.isEmpty() && d->mName.isEmpty(); +} + +void Person::setName(const QString &name) +{ + d->mName = name; +} + +void Person::setEmail(const QString &email) +{ + if (email.startsWith(QLatin1String("mailto:"), Qt::CaseInsensitive)) { + d->mEmail = email.mid(7); + } else { + d->mEmail = email; + } +} + +bool Person::isValidEmail(const QString &email) +{ + const int pos = email.lastIndexOf(QLatin1Char('@')); + return (pos > 0) && (email.lastIndexOf(QLatin1Char('.')) > pos) && ((email.length() - pos) > 4); +} + +uint KCalendarCore::qHash(const KCalendarCore::Person &key) +{ + return qHash(key.fullName()); +} + +QDataStream &KCalendarCore::operator<<(QDataStream &stream, const KCalendarCore::Person &person) +{ + return stream << person.d->mName << person.d->mEmail << (int)(0); +} + +QDataStream &KCalendarCore::operator>>(QDataStream &stream, Person &person) +{ + int count; + stream >> person.d->mName >> person.d->mEmail >> count; + return stream; +} + +// The following function was lifted directly from KPIMUtils +// in order to eliminate the dependency on that library. +// Any changes made here should be ported there, and vice versa. +static bool extractEmailAddressAndName(const QString &aStr, QString &mail, QString &name) +{ + name.clear(); + mail.clear(); + + const int len = aStr.length(); + const char cQuotes = '"'; + + bool bInComment = false; + bool bInQuotesOutsideOfEmail = false; + int i = 0, iAd = 0, iMailStart = 0, iMailEnd = 0; + QChar c; + unsigned int commentstack = 0; + + // Find the '@' of the email address + // skipping all '@' inside "(...)" comments: + while (i < len) { + c = aStr[i]; + if (QLatin1Char('(') == c) { + commentstack++; + } + if (QLatin1Char(')') == c) { + commentstack--; + } + bInComment = commentstack != 0; + if (QLatin1Char('"') == c && !bInComment) { + bInQuotesOutsideOfEmail = !bInQuotesOutsideOfEmail; + } + + if (!bInComment && !bInQuotesOutsideOfEmail) { + if (QLatin1Char('@') == c) { + iAd = i; + break; // found it + } + } + ++i; + } + + if (!iAd) { + // We suppose the user is typing the string manually and just + // has not finished typing the mail address part. + // So we take everything that's left of the '<' as name and the rest as mail + for (i = 0; len > i; ++i) { + c = aStr[i]; + if (QLatin1Char('<') != c) { + name.append(c); + } else { + break; + } + } + mail = aStr.mid(i + 1); + if (mail.endsWith(QLatin1Char('>'))) { + mail.chop(1); + } + + } else { + // Loop backwards until we find the start of the string + // or a ',' that is outside of a comment + // and outside of quoted text before the leading '<'. + bInComment = false; + bInQuotesOutsideOfEmail = false; + for (i = iAd - 1; 0 <= i; --i) { + c = aStr[i]; + if (bInComment) { + if (QLatin1Char('(') == c) { + if (!name.isEmpty()) { + name.prepend(QLatin1Char(' ')); + } + bInComment = false; + } else { + name.prepend(c); // all comment stuff is part of the name + } + } else if (bInQuotesOutsideOfEmail) { + if (QLatin1Char(cQuotes) == c) { + bInQuotesOutsideOfEmail = false; + } else if (c != QLatin1Char('\\')) { + name.prepend(c); + } + } else { + // found the start of this addressee ? + if (QLatin1Char(',') == c) { + break; + } + // stuff is before the leading '<' ? + if (iMailStart) { + if (QLatin1Char(cQuotes) == c) { + bInQuotesOutsideOfEmail = true; // end of quoted text found + } else { + name.prepend(c); + } + } else { + switch (c.toLatin1()) { + case '<': + iMailStart = i; + break; + case ')': + if (!name.isEmpty()) { + name.prepend(QLatin1Char(' ')); + } + bInComment = true; + break; + default: + if (QLatin1Char(' ') != c) { + mail.prepend(c); + } + } + } + } + } + + name = name.simplified(); + mail = mail.simplified(); + + if (mail.isEmpty()) { + return false; + } + + mail.append(QLatin1Char('@')); + + // Loop forward until we find the end of the string + // or a ',' that is outside of a comment + // and outside of quoted text behind the trailing '>'. + bInComment = false; + bInQuotesOutsideOfEmail = false; + int parenthesesNesting = 0; + for (i = iAd + 1; len > i; ++i) { + c = aStr[i]; + if (bInComment) { + if (QLatin1Char(')') == c) { + if (--parenthesesNesting == 0) { + bInComment = false; + if (!name.isEmpty()) { + name.append(QLatin1Char(' ')); + } + } else { + // nested ")", add it + name.append(QLatin1Char(')')); // name can't be empty here + } + } else { + if (QLatin1Char('(') == c) { + // nested "(" + ++parenthesesNesting; + } + name.append(c); // all comment stuff is part of the name + } + } else if (bInQuotesOutsideOfEmail) { + if (QLatin1Char(cQuotes) == c) { + bInQuotesOutsideOfEmail = false; + } else if (c != QLatin1Char('\\')) { + name.append(c); + } + } else { + // found the end of this addressee ? + if (QLatin1Char(',') == c) { + break; + } + // stuff is behind the trailing '>' ? + if (iMailEnd) { + if (QLatin1Char(cQuotes) == c) { + bInQuotesOutsideOfEmail = true; // start of quoted text found + } else { + name.append(c); + } + } else { + switch (c.toLatin1()) { + case '>': + iMailEnd = i; + break; + case '(': + if (!name.isEmpty()) { + name.append(QLatin1Char(' ')); + } + if (++parenthesesNesting > 0) { + bInComment = true; + } + break; + default: + if (QLatin1Char(' ') != c) { + mail.append(c); + } + } + } + } + } + } + + name = name.simplified(); + mail = mail.simplified(); + + return !(name.isEmpty() || mail.isEmpty()); +} + +Person Person::fromFullName(const QString &fullName) +{ + QString email, name; + extractEmailAddressAndName(fullName, email, name); + return Person(name, email); +} diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/person.h dde-calendar-5.10.0/3rdparty/kcalendarcore/src/person.h --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/person.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/person.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,192 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 2001-2003 Cornelius Schumacher + SPDX-FileCopyrightText: 2003-2004 Reinhold Kainhofer + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +/** + @file + This file is part of the API for handling calendar data and + defines the Person class. + + @author Cornelius Schumacher \ + @author Reinhold Kainhofer \ +*/ + +#ifndef KCALCORE_PERSON_H +#define KCALCORE_PERSON_H + +#include +#include +#include +#include + +namespace KCalendarCore { +/** + @brief + Represents a person, by name and email address. + + This class represents a person, with a name and an email address. + It supports the "FirstName LastName\ " format. +*/ +class Q_CORE_EXPORT Person +{ + Q_GADGET + Q_PROPERTY(bool isEmpty READ isEmpty) + Q_PROPERTY(QString fullName READ fullName) + Q_PROPERTY(QString name READ name WRITE setName) + Q_PROPERTY(QString email READ email WRITE setEmail) + +public: + /** + List of persons. + */ + typedef QVector List; + + /** + Constructs a blank person. + */ + Person(); + + /** + Constructs a person with name and email address taken from @p fullName. + + @param fullName is the name and email of the person in the form + "FirstName LastName \". + @return A Person object. + */ + static Person fromFullName(const QString &fullName); + + /** + Constructs a person with the name @p name and email address @p email. + + @param name is the name of this person. + @param email is the email address of this person. + */ + Person(const QString &name, const QString &email); + + /** + Constructs a person as a copy of another person object. + @param person is the person to copy. + */ + Person(const Person &person); + + /** + Destroys a person. + */ + virtual ~Person(); + + /** + Returns true if the person name and email address are empty. + */ + Q_REQUIRED_RESULT bool isEmpty() const; + + /** + Returns the full name of this person. + @return A QString containing the person's full name in the form + "FirstName LastName \". + */ + Q_REQUIRED_RESULT QString fullName() const; + + /** + Sets the name of the person to @p name. + + @param name is the name of this person. + + @see name() + */ + void setName(const QString &name); + + /** + Returns the person name string. + + @see setName() + */ + Q_REQUIRED_RESULT QString name() const; + + /** + Sets the email address for this person to @p email. + + @param email is the email address for this person. + + @see email() + */ + void setEmail(const QString &email); + + /** + Returns the email address for this person. + @return A QString containing the person's email address. + @see setEmail() + */ + Q_REQUIRED_RESULT QString email() const; + + /** + Returns true if person's email address is valid. + Simple email validity check, test that there: + * is at least one @ + * is at least one character in the local part + * is at least one dot in the domain part + * is at least four characters in the domain (assuming that no-one has an address at the tld, + that the tld is at least 2 chars) + + @param email is the email address to validate + */ + Q_REQUIRED_RESULT static bool isValidEmail(const QString &email); + + /** + Compares this with @p person for equality. + + @param person is the person to compare. + */ + bool operator==(const Person &person) const; + + /** + Compares this with @p person for non-equality. + + @param person is the person to compare. + */ + bool operator!=(const Person &person) const; + + /** + Sets this person equal to @p person. + + @param person is the person to copy. + */ + Person &operator=(const Person &person); + +private: + //@cond PRIVATE + class Private; + QSharedDataPointer d; + //@endcond + + friend Q_CORE_EXPORT QDataStream &operator<<(QDataStream &s, const KCalendarCore::Person &person); + friend Q_CORE_EXPORT QDataStream &operator>>(QDataStream &s, KCalendarCore::Person &person); +}; + +/** + Serializes the @p person object into the @p stream. +*/ +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &stream, const KCalendarCore::Person &person); + +/** + Initializes the @p person object from the @p stream. +*/ +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &stream, KCalendarCore::Person &person); + +/** + Return a hash value for a Person argument. + @param key is a Person. +*/ +Q_CORE_EXPORT uint qHash(const KCalendarCore::Person &key); + +} // namespace KCalendarCore + +//@cond PRIVATE +Q_DECLARE_TYPEINFO(KCalendarCore::Person, Q_MOVABLE_TYPE); +Q_DECLARE_METATYPE(KCalendarCore::Person) +//@endcond + +#endif diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/person_p.h dde-calendar-5.10.0/3rdparty/kcalendarcore/src/person_p.h --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/person_p.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/person_p.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,18 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 2019 Volker Krause + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ + +#ifndef KCALCORE_PERSON_P_H +#define KCALCORE_PERSON_P_H + +class QString; + +namespace KCalendarCore { +QString fullNameHelper(const QString &name, const QString &email); +} + +#endif diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/recurrence.cpp dde-calendar-5.10.0/3rdparty/kcalendarcore/src/recurrence.cpp --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/recurrence.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/recurrence.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,1513 @@ +/* + This file is part of kcalcore library. + + SPDX-FileCopyrightText: 1998 Preston Brown + SPDX-FileCopyrightText: 2001 Cornelius Schumacher + SPDX-FileCopyrightText: 2002, 2006 David Jarvie + SPDX-FileCopyrightText: 2005 Reinhold Kainhofer + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +#include "recurrence.h" +#include "recurrencehelper_p.h" +#include "utils_p.h" + +#include +#include +#include +#include +#include + +using namespace KCalendarCore; + +//@cond PRIVATE +class Q_DECL_HIDDEN KCalendarCore::Recurrence::Private +{ +public: + Private() + : mCachedType(rMax) + , mAllDay(false) + , mRecurReadOnly(false) + { + } + + Private(const Private &p) + : mRDateTimes(p.mRDateTimes) + , mRDates(p.mRDates) + , mExDateTimes(p.mExDateTimes) + , mExDates(p.mExDates) + , mStartDateTime(p.mStartDateTime) + , mCachedType(p.mCachedType) + , mAllDay(p.mAllDay) + , mRecurReadOnly(p.mRecurReadOnly) + { + } + + bool operator==(const Private &p) const; + + RecurrenceRule::List mExRules; + RecurrenceRule::List mRRules; + QList mRDateTimes; + DateList mRDates; + QList mExDateTimes; + DateList mExDates; + QDateTime mStartDateTime; // date/time of first recurrence + QList mObservers; + + // Cache the type of the recurrence with the old system (e.g. MonthlyPos) + //使用旧系统缓存重复发生的类型 + mutable ushort mCachedType; + + bool mAllDay = false; // the recurrence has no time, just a date + bool mRecurReadOnly = false; +}; + +bool Recurrence::Private::operator==(const Recurrence::Private &p) const +{ + // qDebug() << mStartDateTime << p.mStartDateTime; + if ((mStartDateTime != p.mStartDateTime && (mStartDateTime.isValid() || p.mStartDateTime.isValid())) || mAllDay != p.mAllDay + || mRecurReadOnly != p.mRecurReadOnly || mExDates != p.mExDates || mExDateTimes != p.mExDateTimes || mRDates != p.mRDates + || mRDateTimes != p.mRDateTimes) { + return false; + } + + // Compare the rrules, exrules! Assume they have the same order... This only + // matters if we have more than one rule (which shouldn't be the default anyway) + int i; + int end = mRRules.count(); + if (end != p.mRRules.count()) { + return false; + } + for (i = 0; i < end; ++i) { + if (*mRRules[i] != *p.mRRules[i]) { + return false; + } + } + end = mExRules.count(); + if (end != p.mExRules.count()) { + return false; + } + for (i = 0; i < end; ++i) { + if (*mExRules[i] != *p.mExRules[i]) { + return false; + } + } + return true; +} +//@endcond + +Recurrence::Recurrence() + : d(new KCalendarCore::Recurrence::Private()) +{ +} + +Recurrence::Recurrence(const Recurrence &r) + : RecurrenceRule::RuleObserver() + , d(new KCalendarCore::Recurrence::Private(*r.d)) +{ + int i, end; + d->mRRules.reserve(r.d->mRRules.count()); + for (i = 0, end = r.d->mRRules.count(); i < end; ++i) { + RecurrenceRule *rule = new RecurrenceRule(*r.d->mRRules[i]); + d->mRRules.append(rule); + rule->addObserver(this); + } + d->mExRules.reserve(r.d->mExRules.count()); + for (i = 0, end = r.d->mExRules.count(); i < end; ++i) { + RecurrenceRule *rule = new RecurrenceRule(*r.d->mExRules[i]); + d->mExRules.append(rule); + rule->addObserver(this); + } +} + +Recurrence::~Recurrence() +{ + qDeleteAll(d->mExRules); + qDeleteAll(d->mRRules); + delete d; +} + +bool Recurrence::operator==(const Recurrence &recurrence) const +{ + return *d == *recurrence.d; +} + +void Recurrence::addObserver(RecurrenceObserver *observer) +{ + if (!d->mObservers.contains(observer)) { + d->mObservers.append(observer); + } +} + +void Recurrence::removeObserver(RecurrenceObserver *observer) +{ + d->mObservers.removeAll(observer); +} + +QDateTime Recurrence::startDateTime() const +{ + return d->mStartDateTime; +} + +bool Recurrence::allDay() const +{ + return d->mAllDay; +} + +void Recurrence::setAllDay(bool allDay) +{ + if (d->mRecurReadOnly || allDay == d->mAllDay) { + return; + } + + d->mAllDay = allDay; + for (int i = 0, end = d->mRRules.count(); i < end; ++i) { + d->mRRules[i]->setAllDay(allDay); + } + for (int i = 0, end = d->mExRules.count(); i < end; ++i) { + d->mExRules[i]->setAllDay(allDay); + } + updated(); +} + +RecurrenceRule *Recurrence::defaultRRule(bool create) const +{ + if (d->mRRules.isEmpty()) { + if (!create || d->mRecurReadOnly) { + return nullptr; + } + RecurrenceRule *rrule = new RecurrenceRule(); + rrule->setStartDt(startDateTime()); + const_cast(this)->addRRule(rrule); + return rrule; + } else { + return d->mRRules[0]; + } +} + +RecurrenceRule *Recurrence::defaultRRuleConst() const +{ + return d->mRRules.isEmpty() ? nullptr : d->mRRules[0]; +} + +void Recurrence::updated() +{ + // recurrenceType() re-calculates the type if it's rMax + d->mCachedType = rMax; + for (int i = 0, end = d->mObservers.count(); i < end; ++i) { + if (d->mObservers[i]) { + d->mObservers[i]->recurrenceUpdated(this); + } + } +} + +bool Recurrence::recurs() const +{ + return !d->mRRules.isEmpty() || !d->mRDates.isEmpty() || !d->mRDateTimes.isEmpty(); +} + +ushort Recurrence::recurrenceType() const +{ + if (d->mCachedType == rMax) { + d->mCachedType = recurrenceType(defaultRRuleConst()); + } + return d->mCachedType; +} + +ushort Recurrence::recurrenceType(const RecurrenceRule *rrule) +{ + if (!rrule) { + return rNone; + } + RecurrenceRule::PeriodType type = rrule->recurrenceType(); + + // BYSETPOS, BYWEEKNUMBER and BYSECOND were not supported in old versions + if (!rrule->bySetPos().isEmpty() || !rrule->bySeconds().isEmpty() || !rrule->byWeekNumbers().isEmpty()) { + return rOther; + } + + // It wasn't possible to set BYMINUTES, BYHOUR etc. by the old code. So if + // it's set, it's none of the old types + if (!rrule->byMinutes().isEmpty() || !rrule->byHours().isEmpty()) { + return rOther; + } + + // Possible combinations were: + // BYDAY: with WEEKLY, MONTHLY, YEARLY + // BYMONTHDAY: with MONTHLY, YEARLY + // BYMONTH: with YEARLY + // BYYEARDAY: with YEARLY + if ((!rrule->byYearDays().isEmpty() && type != RecurrenceRule::rYearly) || (!rrule->byMonths().isEmpty() && type != RecurrenceRule::rYearly)) { + return rOther; + } + if (!rrule->byDays().isEmpty()) { + if (type != RecurrenceRule::rYearly && type != RecurrenceRule::rMonthly && type != RecurrenceRule::rWeekly) { + return rOther; + } + } + + switch (type) { + case RecurrenceRule::rNone: + return rNone; + case RecurrenceRule::rMinutely: + return rMinutely; + case RecurrenceRule::rHourly: + return rHourly; + case RecurrenceRule::rDaily: + return rDaily; + case RecurrenceRule::rWeekly: + return rWeekly; + case RecurrenceRule::rMonthly: { + if (rrule->byDays().isEmpty()) { + return rMonthlyDay; + } else if (rrule->byMonthDays().isEmpty()) { + return rMonthlyPos; + } else { + return rOther; // both position and date specified + } + } + case RecurrenceRule::rYearly: { + // Possible combinations: + // rYearlyMonth: [BYMONTH &] BYMONTHDAY + // rYearlyDay: BYYEARDAY + // rYearlyPos: [BYMONTH &] BYDAY + if (!rrule->byDays().isEmpty()) { + // can only by rYearlyPos + if (rrule->byMonthDays().isEmpty() && rrule->byYearDays().isEmpty()) { + return rYearlyPos; + } else { + return rOther; + } + } else if (!rrule->byYearDays().isEmpty()) { + // Can only be rYearlyDay + if (rrule->byMonths().isEmpty() && rrule->byMonthDays().isEmpty()) { + return rYearlyDay; + } else { + return rOther; + } + } else { + return rYearlyMonth; + } + } + default: + return rOther; + } +} + +bool Recurrence::recursOn(const QDate &qd, const QTimeZone &timeZone) const +{ + // Don't waste time if date is before the start of the recurrence + if (QDateTime(qd, QTime(23, 59, 59), timeZone) < d->mStartDateTime) { + return false; + } + + // First handle dates. Exrules override + if (std::binary_search(d->mExDates.constBegin(), d->mExDates.constEnd(), qd)) { + return false; + } + + int i, end; + // For all-day events a matching exrule excludes the whole day + // since exclusions take precedence over inclusions, we know it can't occur on that day. + if (allDay()) { + for (i = 0, end = d->mExRules.count(); i < end; ++i) { + if (d->mExRules[i]->recursOn(qd, timeZone)) { + return false; + } + } + } + + if (std::binary_search(d->mRDates.constBegin(), d->mRDates.constEnd(), qd)) { + return true; + } + + // Check if it might recur today at all. + bool recurs = (startDate() == qd); + for (i = 0, end = d->mRDateTimes.count(); i < end && !recurs; ++i) { + recurs = (d->mRDateTimes[i].toTimeZone(timeZone).date() == qd); + } + for (i = 0, end = d->mRRules.count(); i < end && !recurs; ++i) { + recurs = d->mRRules[i]->recursOn(qd, timeZone); + } + // If the event wouldn't recur at all, simply return false, don't check ex* + if (!recurs) { + return false; + } + + // Check if there are any times for this day excluded, either by exdate or exrule: + bool exon = false; + for (i = 0, end = d->mExDateTimes.count(); i < end && !exon; ++i) { + exon = (d->mExDateTimes[i].toTimeZone(timeZone).date() == qd); + } + if (!allDay()) { // we have already checked all-day times above + for (i = 0, end = d->mExRules.count(); i < end && !exon; ++i) { + exon = d->mExRules[i]->recursOn(qd, timeZone); + } + } + + if (!exon) { + // Simple case, nothing on that day excluded, return the value from before + return recurs; + } else { + // Harder part: I don't think there is any way other than to calculate the + // whole list of items for that day. + // TODO: consider whether it would be more efficient to call + // Rule::recurTimesOn() instead of Rule::recursOn() from the start + TimeList timesForDay(recurTimesOn(qd, timeZone)); + return !timesForDay.isEmpty(); + } +} + +bool Recurrence::recursAt(const QDateTime &dt) const +{ + // Convert to recurrence's time zone for date comparisons, and for more efficient time comparisons + const auto dtrecur = dt.toTimeZone(d->mStartDateTime.timeZone()); + + // if it's excluded anyway, don't bother to check if it recurs at all. + if (std::binary_search(d->mExDateTimes.constBegin(), d->mExDateTimes.constEnd(), dtrecur) + || std::binary_search(d->mExDates.constBegin(), d->mExDates.constEnd(), dtrecur.date())) { + return false; + } + int i, end; + for (i = 0, end = d->mExRules.count(); i < end; ++i) { + if (d->mExRules[i]->recursAt(dtrecur)) { + return false; + } + } + + // Check explicit recurrences, then rrules. + if (startDateTime() == dtrecur || std::binary_search(d->mRDateTimes.constBegin(), d->mRDateTimes.constEnd(), dtrecur)) { + return true; + } + for (i = 0, end = d->mRRules.count(); i < end; ++i) { + if (d->mRRules[i]->recursAt(dtrecur)) { + return true; + } + } + + return false; +} + +/** Calculates the cumulative end of the whole recurrence (rdates and rrules). + If any rrule is infinite, or the recurrence doesn't have any rrules or + rdates, an invalid date is returned. */ +QDateTime Recurrence::endDateTime() const +{ + QList dts; + dts << startDateTime(); + if (!d->mRDates.isEmpty()) { + dts << QDateTime(d->mRDates.last(), QTime(0, 0, 0), d->mStartDateTime.timeZone()); + } + if (!d->mRDateTimes.isEmpty()) { + dts << d->mRDateTimes.last(); + } + for (int i = 0, end = d->mRRules.count(); i < end; ++i) { + auto rl = d->mRRules[i]->endDt(); + // if any of the rules is infinite, the whole recurrence is + if (!rl.isValid()) { + return QDateTime(); + } + dts << rl; + } + sortAndRemoveDuplicates(dts); + return dts.isEmpty() ? QDateTime() : dts.last(); +} + +/** Calculates the cumulative end of the whole recurrence (rdates and rrules). + If any rrule is infinite, or the recurrence doesn't have any rrules or + rdates, an invalid date is returned. */ +QDate Recurrence::endDate() const +{ + QDateTime end(endDateTime()); + return end.isValid() ? end.date() : QDate(); +} + +void Recurrence::setEndDate(const QDate &date) +{ + QDateTime dt(date, d->mStartDateTime.time(), d->mStartDateTime.timeZone()); + if (allDay()) { + dt.setTime(QTime(23, 59, 59)); + } + setEndDateTime(dt); +} + +void Recurrence::setEndDateTime(const QDateTime &dateTime) +{ + if (d->mRecurReadOnly) { + return; + } + RecurrenceRule *rrule = defaultRRule(true); + if (!rrule) { + return; + } + + // If the recurrence rule has a duration, and we're trying to set an invalid end date, + // we have to skip setting it to avoid setting the field dirty. + // The end date is already invalid since the duration is set and end date/duration + // are mutually exclusive. + // We can't use inequality check below, because endDt() also returns a valid date + // for a duration (it is calculated from the duration). + if (rrule->duration() > 0 && !dateTime.isValid()) { + return; + } + + if (dateTime != rrule->endDt()) { + rrule->setEndDt(dateTime); + updated(); + } +} + +int Recurrence::duration() const +{ + RecurrenceRule *rrule = defaultRRuleConst(); + return rrule ? rrule->duration() : 0; +} + +int Recurrence::durationTo(const QDateTime &datetime) const +{ + // Emulate old behavior: This is just an interface to the first rule! + RecurrenceRule *rrule = defaultRRuleConst(); + return rrule ? rrule->durationTo(datetime) : 0; +} + +int Recurrence::durationTo(const QDate &date) const +{ + return durationTo(QDateTime(date, QTime(23, 59, 59), d->mStartDateTime.timeZone())); +} + +void Recurrence::setDuration(int duration) +{ + if (d->mRecurReadOnly) { + return; + } + + RecurrenceRule *rrule = defaultRRule(true); + if (!rrule) { + return; + } + + if (duration != rrule->duration()) { + rrule->setDuration(duration); + updated(); + } +} + +void Recurrence::shiftTimes(const QTimeZone &oldTz, const QTimeZone &newTz) +{ + if (d->mRecurReadOnly) { + return; + } + + d->mStartDateTime = d->mStartDateTime.toTimeZone(oldTz); + d->mStartDateTime.setTimeZone(newTz); + + int i, end; + for (i = 0, end = d->mRDateTimes.count(); i < end; ++i) { + d->mRDateTimes[i] = d->mRDateTimes[i].toTimeZone(oldTz); + d->mRDateTimes[i].setTimeZone(newTz); + } + for (i = 0, end = d->mExDateTimes.count(); i < end; ++i) { + d->mExDateTimes[i] = d->mExDateTimes[i].toTimeZone(oldTz); + d->mExDateTimes[i].setTimeZone(newTz); + } + for (i = 0, end = d->mRRules.count(); i < end; ++i) { + d->mRRules[i]->shiftTimes(oldTz, newTz); + } + for (i = 0, end = d->mExRules.count(); i < end; ++i) { + d->mExRules[i]->shiftTimes(oldTz, newTz); + } +} + +void Recurrence::unsetRecurs() +{ + if (d->mRecurReadOnly) { + return; + } + qDeleteAll(d->mRRules); + d->mRRules.clear(); + updated(); +} + +void Recurrence::clear() +{ + if (d->mRecurReadOnly) { + return; + } + qDeleteAll(d->mRRules); + d->mRRules.clear(); + qDeleteAll(d->mExRules); + d->mExRules.clear(); + d->mRDates.clear(); + d->mRDateTimes.clear(); + d->mExDates.clear(); + d->mExDateTimes.clear(); + d->mCachedType = rMax; + updated(); +} + +void Recurrence::setRecurReadOnly(bool readOnly) +{ + d->mRecurReadOnly = readOnly; +} + +bool Recurrence::recurReadOnly() const +{ + return d->mRecurReadOnly; +} + +QDate Recurrence::startDate() const +{ + return d->mStartDateTime.date(); +} + +void Recurrence::setStartDateTime(const QDateTime &start, bool isAllDay) +{ + if (d->mRecurReadOnly) { + return; + } + d->mStartDateTime = start; + setAllDay(isAllDay); // set all RRULEs and EXRULEs + + int i, end; + for (i = 0, end = d->mRRules.count(); i < end; ++i) { + d->mRRules[i]->setStartDt(start); + } + for (i = 0, end = d->mExRules.count(); i < end; ++i) { + d->mExRules[i]->setStartDt(start); + } + updated(); +} + +int Recurrence::frequency() const +{ + RecurrenceRule *rrule = defaultRRuleConst(); + return rrule ? rrule->frequency() : 0; +} + +// Emulate the old behaviour. Make this methods just an interface to the +// first rrule +void Recurrence::setFrequency(int freq) +{ + if (d->mRecurReadOnly || freq <= 0) { + return; + } + + RecurrenceRule *rrule = defaultRRule(true); + if (rrule) { + rrule->setFrequency(freq); + } + updated(); +} + +// WEEKLY + +int Recurrence::weekStart() const +{ + RecurrenceRule *rrule = defaultRRuleConst(); + return rrule ? rrule->weekStart() : 1; +} + +// Emulate the old behavior +QBitArray Recurrence::days() const +{ + QBitArray days(7); + days.fill(0); + RecurrenceRule *rrule = defaultRRuleConst(); + if (rrule) { + const QList &bydays = rrule->byDays(); + for (int i = 0; i < bydays.size(); ++i) { + if (bydays.at(i).pos() == 0) { + days.setBit(bydays.at(i).day() - 1); + } + } + } + return days; +} + +// MONTHLY + +// Emulate the old behavior +QList Recurrence::monthDays() const +{ + RecurrenceRule *rrule = defaultRRuleConst(); + if (rrule) { + return rrule->byMonthDays(); + } else { + return QList(); + } +} + +// Emulate the old behavior +QList Recurrence::monthPositions() const +{ + RecurrenceRule *rrule = defaultRRuleConst(); + return rrule ? rrule->byDays() : QList(); +} + +// YEARLY + +QList Recurrence::yearDays() const +{ + RecurrenceRule *rrule = defaultRRuleConst(); + return rrule ? rrule->byYearDays() : QList(); +} + +QList Recurrence::yearDates() const +{ + return monthDays(); +} + +QList Recurrence::yearMonths() const +{ + RecurrenceRule *rrule = defaultRRuleConst(); + return rrule ? rrule->byMonths() : QList(); +} + +QList Recurrence::yearPositions() const +{ + return monthPositions(); +} + +RecurrenceRule *Recurrence::setNewRecurrenceType(RecurrenceRule::PeriodType type, int freq) +{ + if (d->mRecurReadOnly || freq <= 0) { + return nullptr; + } + + // Ignore the call if nothing has change + if (defaultRRuleConst() && defaultRRuleConst()->recurrenceType() == type && frequency() == freq) { + return nullptr; + } + + qDeleteAll(d->mRRules); + d->mRRules.clear(); + updated(); + RecurrenceRule *rrule = defaultRRule(true); + if (!rrule) { + return nullptr; + } + rrule->setRecurrenceType(type); + rrule->setFrequency(freq); + rrule->setDuration(-1); + return rrule; +} + +void Recurrence::setMinutely(int _rFreq) +{ + if (setNewRecurrenceType(RecurrenceRule::rMinutely, _rFreq)) { + updated(); + } +} + +void Recurrence::setHourly(int _rFreq) +{ + if (setNewRecurrenceType(RecurrenceRule::rHourly, _rFreq)) { + updated(); + } +} + +void Recurrence::setDaily(int _rFreq) +{ + if (setNewRecurrenceType(RecurrenceRule::rDaily, _rFreq)) { + updated(); + } +} + +void Recurrence::setWeekly(int freq, int weekStart) +{ + RecurrenceRule *rrule = setNewRecurrenceType(RecurrenceRule::rWeekly, freq); + if (!rrule) { + return; + } + rrule->setWeekStart(weekStart); + updated(); +} + +void Recurrence::setWeekly(int freq, const QBitArray &days, int weekStart) +{ + setWeekly(freq, weekStart); + addMonthlyPos(0, days); +} + +void Recurrence::addWeeklyDays(const QBitArray &days) +{ + addMonthlyPos(0, days); +} + +void Recurrence::setMonthly(int freq) +{ + if (setNewRecurrenceType(RecurrenceRule::rMonthly, freq)) { + updated(); + } +} + +void Recurrence::addMonthlyPos(short pos, const QBitArray &days) +{ + // Allow 53 for yearly! + if (d->mRecurReadOnly || pos > 53 || pos < -53) { + return; + } + + RecurrenceRule *rrule = defaultRRule(false); + if (!rrule) { + return; + } + bool changed = false; + QList positions = rrule->byDays(); + + for (int i = 0; i < 7; ++i) { + if (days.testBit(i)) { + RecurrenceRule::WDayPos p(pos, i + 1); + if (!positions.contains(p)) { + changed = true; + positions.append(p); + } + } + } + if (changed) { + rrule->setByDays(positions); + updated(); + } +} + +void Recurrence::addMonthlyPos(short pos, ushort day) +{ + // Allow 53 for yearly! + if (d->mRecurReadOnly || pos > 53 || pos < -53) { + return; + } + + RecurrenceRule *rrule = defaultRRule(false); + if (!rrule) { + return; + } + QList positions = rrule->byDays(); + + RecurrenceRule::WDayPos p(pos, day); + if (!positions.contains(p)) { + positions.append(p); + setMonthlyPos(positions); + } +} + +void Recurrence::setMonthlyPos(const QList &monthlyDays) +{ + if (d->mRecurReadOnly) { + return; + } + + RecurrenceRule *rrule = defaultRRule(true); + if (!rrule) { + return; + } + + // TODO: sort lists + // the position inside the list has no meaning, so sort the list before testing if it changed + + if (monthlyDays != rrule->byDays()) { + rrule->setByDays(monthlyDays); + updated(); + } +} + +void Recurrence::addMonthlyDate(short day) +{ + if (d->mRecurReadOnly || day > 31 || day < -31) { + return; + } + + RecurrenceRule *rrule = defaultRRule(true); + if (!rrule) { + return; + } + + QList monthDays = rrule->byMonthDays(); + if (!monthDays.contains(day)) { + monthDays.append(day); + setMonthlyDate(monthDays); + } +} + +void Recurrence::setMonthlyDate(const QList &monthlyDays) +{ + if (d->mRecurReadOnly) { + return; + } + + RecurrenceRule *rrule = defaultRRule(true); + if (!rrule) { + return; + } + + QList mD(monthlyDays); + QList rbD(rrule->byMonthDays()); + + sortAndRemoveDuplicates(mD); + sortAndRemoveDuplicates(rbD); + + if (mD != rbD) { + rrule->setByMonthDays(monthlyDays); + updated(); + } +} + +void Recurrence::setYearly(int freq) +{ + if (setNewRecurrenceType(RecurrenceRule::rYearly, freq)) { + updated(); + } +} + +// Daynumber within year +void Recurrence::addYearlyDay(int day) +{ + RecurrenceRule *rrule = defaultRRule(false); // It must already exist! + if (!rrule) { + return; + } + + QList days = rrule->byYearDays(); + if (!days.contains(day)) { + days << day; + setYearlyDay(days); + } +} + +void Recurrence::setYearlyDay(const QList &days) +{ + RecurrenceRule *rrule = defaultRRule(false); // It must already exist! + if (!rrule) { + return; + } + + QList d(days); + QList bYD(rrule->byYearDays()); + + sortAndRemoveDuplicates(d); + sortAndRemoveDuplicates(bYD); + + if (d != bYD) { + rrule->setByYearDays(days); + updated(); + } +} + +// day part of date within year +void Recurrence::addYearlyDate(int day) +{ + addMonthlyDate(day); +} + +void Recurrence::setYearlyDate(const QList &dates) +{ + setMonthlyDate(dates); +} + +// day part of date within year, given as position (n-th weekday) +void Recurrence::addYearlyPos(short pos, const QBitArray &days) +{ + addMonthlyPos(pos, days); +} + +void Recurrence::setYearlyPos(const QList &days) +{ + setMonthlyPos(days); +} + +// month part of date within year +void Recurrence::addYearlyMonth(short month) +{ + if (d->mRecurReadOnly || month < 1 || month > 12) { + return; + } + + RecurrenceRule *rrule = defaultRRule(false); + if (!rrule) { + return; + } + + QList months = rrule->byMonths(); + if (!months.contains(month)) { + months << month; + setYearlyMonth(months); + } +} + +void Recurrence::setYearlyMonth(const QList &months) +{ + if (d->mRecurReadOnly) { + return; + } + + RecurrenceRule *rrule = defaultRRule(false); + if (!rrule) { + return; + } + + QList m(months); + QList bM(rrule->byMonths()); + + sortAndRemoveDuplicates(m); + sortAndRemoveDuplicates(bM); + + if (m != bM) { + rrule->setByMonths(months); + updated(); + } +} + +TimeList Recurrence::recurTimesOn(const QDate &date, const QTimeZone &timeZone) const +{ + // qDebug() << "recurTimesOn(" << date << ")"; + int i, end; + TimeList times; + + // The whole day is excepted + if (std::binary_search(d->mExDates.constBegin(), d->mExDates.constEnd(), date)) { + return times; + } + + // EXRULE takes precedence over RDATE entries, so for all-day events, + // a matching excule also excludes the whole day automatically + if (allDay()) { + for (i = 0, end = d->mExRules.count(); i < end; ++i) { + if (d->mExRules[i]->recursOn(date, timeZone)) { + return times; + } + } + } + + QDateTime dt = startDateTime().toTimeZone(timeZone); + if (dt.date() == date) { + times << dt.time(); + } + + bool foundDate = false; + for (i = 0, end = d->mRDateTimes.count(); i < end; ++i) { + dt = d->mRDateTimes[i].toTimeZone(timeZone); + if (dt.date() == date) { + times << dt.time(); + foundDate = true; + } else if (foundDate) { + break; // <= Assume that the rdatetime list is sorted + } + } + for (i = 0, end = d->mRRules.count(); i < end; ++i) { + times += d->mRRules[i]->recurTimesOn(date, timeZone); + } + sortAndRemoveDuplicates(times); + + foundDate = false; + TimeList extimes; + for (i = 0, end = d->mExDateTimes.count(); i < end; ++i) { + dt = d->mExDateTimes[i].toTimeZone(timeZone); + if (dt.date() == date) { + extimes << dt.time(); + foundDate = true; + } else if (foundDate) { + break; + } + } + if (!allDay()) { // we have already checked all-day times above + for (i = 0, end = d->mExRules.count(); i < end; ++i) { + extimes += d->mExRules[i]->recurTimesOn(date, timeZone); + } + } + sortAndRemoveDuplicates(extimes); + inplaceSetDifference(times, extimes); + return times; +} + +QList Recurrence::timesInInterval(const QDateTime &start, const QDateTime &end) const +{ + int i, count; + QList times; + for (i = 0, count = d->mRRules.count(); i < count; ++i) { + times += d->mRRules[i]->timesInInterval(start, end); + } + + // add rdatetimes that fit in the interval + for (i = 0, count = d->mRDateTimes.count(); i < count; ++i) { + if (d->mRDateTimes[i] >= start && d->mRDateTimes[i] <= end) { + times += d->mRDateTimes[i]; + } + } + + // add rdates that fit in the interval + QDateTime kdt = d->mStartDateTime; + for (i = 0, count = d->mRDates.count(); i < count; ++i) { + kdt.setDate(d->mRDates[i]); + if (kdt >= start && kdt <= end) { + times += kdt; + } + } + + // Recurrence::timesInInterval(...) doesn't explicitly add mStartDateTime to the list + // of times to be returned. It calls mRRules[i]->timesInInterval(...) which include + // mStartDateTime. + // So, If we have rdates/rdatetimes but don't have any rrule we must explicitly + // add mStartDateTime to the list, otherwise we won't see the first occurrence. + if ((!d->mRDates.isEmpty() || !d->mRDateTimes.isEmpty()) && d->mRRules.isEmpty() && start <= d->mStartDateTime && end >= d->mStartDateTime) { + times += d->mStartDateTime; + } + + sortAndRemoveDuplicates(times); + + // Remove excluded times + int idt = 0; + int enddt = times.count(); + for (i = 0, count = d->mExDates.count(); i < count && idt < enddt; ++i) { + while (idt < enddt && times[idt].date() < d->mExDates[i]) { + ++idt; + } + while (idt < enddt && times[idt].date() == d->mExDates[i]) { + times.removeAt(idt); + --enddt; + } + } + QList extimes; + for (i = 0, count = d->mExRules.count(); i < count; ++i) { + extimes += d->mExRules[i]->timesInInterval(start, end); + } + extimes += d->mExDateTimes; + sortAndRemoveDuplicates(extimes); + inplaceSetDifference(times, extimes); + return times; +} + +QDateTime Recurrence::getNextDateTime(const QDateTime &preDateTime) const +{ + QDateTime nextDT = preDateTime; + // prevent infinite loops, e.g. when an exrule extinguishes an rrule (e.g. + // the exrule is identical to the rrule). If an occurrence is found, break + // out of the loop by returning that QDateTime + // TODO_Recurrence: Is a loop counter of 1000 really okay? I mean for secondly + // recurrence, an exdate might exclude more than 1000 intervals! + int loop = 0; + while (loop < 1000) { + // Outline of the algo: + // 1) Find the next date/time after preDateTime when the event could recur + // 1.0) Add the start date if it's after preDateTime + // 1.1) Use the next occurrence from the explicit RDATE lists + // 1.2) Add the next recurrence for each of the RRULEs + // 2) Take the earliest recurrence of these = QDateTime nextDT + // 3) If that date/time is not excluded, either explicitly by an EXDATE or + // by an EXRULE, return nextDT as the next date/time of the recurrence + // 4) If it's excluded, start all at 1), but starting at nextDT (instead + // of preDateTime). Loop at most 1000 times. + ++loop; + // First, get the next recurrence from the RDate lists + QList dates; + if (nextDT < startDateTime()) { + dates << startDateTime(); + } + + // Assume that the rdatetime list is sorted + const auto it = std::upper_bound(d->mRDateTimes.constBegin(), d->mRDateTimes.constEnd(), nextDT); + if (it != d->mRDateTimes.constEnd()) { + dates << *it; + } + + QDateTime kdt(startDateTime()); + for (const auto &date : qAsConst(d->mRDates)) { + kdt.setDate(date); + if (kdt > nextDT) { + dates << kdt; + break; + } + } + + // Add the next occurrences from all RRULEs. + for (const auto &rule : qAsConst(d->mRRules)) { + QDateTime dt = rule->getNextDate(nextDT); + if (dt.isValid()) { + dates << dt; + } + } + + // Take the first of these (all others can't be used later on) + sortAndRemoveDuplicates(dates); + if (dates.isEmpty()) { + return QDateTime(); + } + nextDT = dates.first(); + + // Check if that date/time is excluded explicitly or by an exrule: + if (!std::binary_search(d->mExDates.constBegin(), d->mExDates.constEnd(), nextDT.date()) + && !std::binary_search(d->mExDateTimes.constBegin(), d->mExDateTimes.constEnd(), nextDT)) { + bool allowed = true; + for (const auto &rule : qAsConst(d->mExRules)) { + allowed = allowed && !rule->recursAt(nextDT); + } + if (allowed) { + return nextDT; + } + } + } + + // Couldn't find a valid occurrences in 1000 loops, something is wrong! + return QDateTime(); +} + +QDateTime Recurrence::getPreviousDateTime(const QDateTime &afterDateTime) const +{ + QDateTime prevDT = afterDateTime; + // prevent infinite loops, e.g. when an exrule extinguishes an rrule (e.g. + // the exrule is identical to the rrule). If an occurrence is found, break + // out of the loop by returning that QDateTime + int loop = 0; + while (loop < 1000) { + // Outline of the algo: + // 1) Find the next date/time after preDateTime when the event could recur + // 1.1) Use the next occurrence from the explicit RDATE lists + // 1.2) Add the next recurrence for each of the RRULEs + // 2) Take the earliest recurrence of these = QDateTime nextDT + // 3) If that date/time is not excluded, either explicitly by an EXDATE or + // by an EXRULE, return nextDT as the next date/time of the recurrence + // 4) If it's excluded, start all at 1), but starting at nextDT (instead + // of preDateTime). Loop at most 1000 times. + ++loop; + // First, get the next recurrence from the RDate lists + QList dates; + if (prevDT > startDateTime()) { + dates << startDateTime(); + } + + const auto it = strictLowerBound(d->mRDateTimes.constBegin(), d->mRDateTimes.constEnd(), prevDT); + if (it != d->mRDateTimes.constEnd()) { + dates << *it; + } + + QDateTime kdt(startDateTime()); + for (const auto &date : qAsConst(d->mRDates)) { + kdt.setDate(date); + if (kdt < prevDT) { + dates << kdt; + break; + } + } + + // Add the previous occurrences from all RRULEs. + for (const auto &rule : qAsConst(d->mRRules)) { + QDateTime dt = rule->getPreviousDate(prevDT); + if (dt.isValid()) { + dates << dt; + } + } + + // Take the last of these (all others can't be used later on) + sortAndRemoveDuplicates(dates); + if (dates.isEmpty()) { + return QDateTime(); + } + prevDT = dates.last(); + + // Check if that date/time is excluded explicitly or by an exrule: + if (!std::binary_search(d->mExDates.constBegin(), d->mExDates.constEnd(), prevDT.date()) + && !std::binary_search(d->mExDateTimes.constBegin(), d->mExDateTimes.constEnd(), prevDT)) { + bool allowed = true; + for (const auto &rule : qAsConst(d->mExRules)) { + allowed = allowed && !rule->recursAt(prevDT); + } + if (allowed) { + return prevDT; + } + } + } + + // Couldn't find a valid occurrences in 1000 loops, something is wrong! + return QDateTime(); +} + +/***************************** PROTECTED FUNCTIONS ***************************/ + +RecurrenceRule::List Recurrence::rRules() const +{ + return d->mRRules; +} + +void Recurrence::addRRule(RecurrenceRule *rrule) +{ + if (d->mRecurReadOnly || !rrule) { + return; + } + + rrule->setAllDay(d->mAllDay); + d->mRRules.append(rrule); + rrule->addObserver(this); + updated(); +} + +void Recurrence::removeRRule(RecurrenceRule *rrule) +{ + if (d->mRecurReadOnly) { + return; + } + + d->mRRules.removeAll(rrule); + rrule->removeObserver(this); + updated(); +} + +void Recurrence::deleteRRule(RecurrenceRule *rrule) +{ + if (d->mRecurReadOnly) { + return; + } + + d->mRRules.removeAll(rrule); + delete rrule; + updated(); +} + +RecurrenceRule::List Recurrence::exRules() const +{ + return d->mExRules; +} + +void Recurrence::addExRule(RecurrenceRule *exrule) +{ + if (d->mRecurReadOnly || !exrule) { + return; + } + + exrule->setAllDay(d->mAllDay); + d->mExRules.append(exrule); + exrule->addObserver(this); + updated(); +} + +void Recurrence::removeExRule(RecurrenceRule *exrule) +{ + if (d->mRecurReadOnly) { + return; + } + + d->mExRules.removeAll(exrule); + exrule->removeObserver(this); + updated(); +} + +void Recurrence::deleteExRule(RecurrenceRule *exrule) +{ + if (d->mRecurReadOnly) { + return; + } + + d->mExRules.removeAll(exrule); + delete exrule; + updated(); +} + +QList Recurrence::rDateTimes() const +{ + return d->mRDateTimes; +} + +void Recurrence::setRDateTimes(const QList &rdates) +{ + if (d->mRecurReadOnly) { + return; + } + + d->mRDateTimes = rdates; + sortAndRemoveDuplicates(d->mRDateTimes); + updated(); +} + +void Recurrence::addRDateTime(const QDateTime &rdate) +{ + if (d->mRecurReadOnly) { + return; + } + + setInsert(d->mRDateTimes, rdate); + updated(); +} + +DateList Recurrence::rDates() const +{ + return d->mRDates; +} + +void Recurrence::setRDates(const DateList &rdates) +{ + if (d->mRecurReadOnly) { + return; + } + + d->mRDates = rdates; + sortAndRemoveDuplicates(d->mRDates); + updated(); +} + +void Recurrence::addRDate(const QDate &rdate) +{ + if (d->mRecurReadOnly) { + return; + } + + setInsert(d->mRDates, rdate); + updated(); +} + +QList Recurrence::exDateTimes() const +{ + return d->mExDateTimes; +} + +void Recurrence::setExDateTimes(const QList &exdates) +{ + if (d->mRecurReadOnly) { + return; + } + + d->mExDateTimes = exdates; + sortAndRemoveDuplicates(d->mExDateTimes); +} + +void Recurrence::addExDateTime(const QDateTime &exdate) +{ + if (d->mRecurReadOnly) { + return; + } + + setInsert(d->mExDateTimes, exdate); + updated(); +} + +DateList Recurrence::exDates() const +{ + return d->mExDates; +} + +void Recurrence::setExDates(const DateList &exdates) +{ + if (d->mRecurReadOnly) { + return; + } + + DateList l = exdates; + sortAndRemoveDuplicates(l); + + if (d->mExDates != l) { + d->mExDates = l; + updated(); + } +} + +void Recurrence::addExDate(const QDate &exdate) +{ + if (d->mRecurReadOnly) { + return; + } + + setInsert(d->mExDates, exdate); + updated(); +} + +void Recurrence::recurrenceChanged(RecurrenceRule *) +{ + updated(); +} + +// %%%%%%%%%%%%%%%%%% end:Recurrencerule %%%%%%%%%%%%%%%%%% + +void Recurrence::dump() const +{ + int i; + int count = d->mRRules.count(); + qDebug() << " -)" << count << "RRULEs:"; + for (i = 0; i < count; ++i) { + qDebug() << " -) RecurrenceRule: "; + d->mRRules[i]->dump(); + } + count = d->mExRules.count(); + qDebug() << " -)" << count << "EXRULEs:"; + for (i = 0; i < count; ++i) { + qDebug() << " -) ExceptionRule :"; + d->mExRules[i]->dump(); + } + + count = d->mRDates.count(); + qDebug() << " -)" << count << "Recurrence Dates:"; + for (i = 0; i < count; ++i) { + qDebug() << " " << d->mRDates[i]; + } + count = d->mRDateTimes.count(); + qDebug() << " -)" << count << "Recurrence Date/Times:"; + for (i = 0; i < count; ++i) { + qDebug() << " " << d->mRDateTimes[i]; + } + count = d->mExDates.count(); + qDebug() << " -)" << count << "Exceptions Dates:"; + for (i = 0; i < count; ++i) { + qDebug() << " " << d->mExDates[i]; + } + count = d->mExDateTimes.count(); + qDebug() << " -)" << count << "Exception Date/Times:"; + for (i = 0; i < count; ++i) { + qDebug() << " " << d->mExDateTimes[i]; + } +} + +Recurrence::RecurrenceObserver::~RecurrenceObserver() +{ +} + +Q_CORE_EXPORT QDataStream &KCalendarCore::operator<<(QDataStream &out, KCalendarCore::Recurrence *r) +{ + if (!r) { + return out; + } + + serializeQDateTimeList(out, r->d->mRDateTimes); + serializeQDateTimeList(out, r->d->mExDateTimes); + out << r->d->mRDates; + serializeQDateTimeAsKDateTime(out, r->d->mStartDateTime); + out << r->d->mCachedType << r->d->mAllDay << r->d->mRecurReadOnly << r->d->mExDates << r->d->mExRules.count() << r->d->mRRules.count(); + + for (RecurrenceRule *rule : qAsConst(r->d->mExRules)) { + out << rule; + } + + for (RecurrenceRule *rule : qAsConst(r->d->mRRules)) { + out << rule; + } + + return out; +} + +Q_CORE_EXPORT QDataStream &KCalendarCore::operator>>(QDataStream &in, KCalendarCore::Recurrence *r) +{ + if (!r) { + return in; + } + + int rruleCount, exruleCount; + + deserializeQDateTimeList(in, r->d->mRDateTimes); + deserializeQDateTimeList(in, r->d->mExDateTimes); + in >> r->d->mRDates; + deserializeKDateTimeAsQDateTime(in, r->d->mStartDateTime); + in >> r->d->mCachedType >> r->d->mAllDay >> r->d->mRecurReadOnly >> r->d->mExDates >> exruleCount >> rruleCount; + + r->d->mExRules.clear(); + r->d->mRRules.clear(); + + for (int i = 0; i < exruleCount; ++i) { + RecurrenceRule *rule = new RecurrenceRule(); + rule->addObserver(r); + in >> rule; + r->d->mExRules.append(rule); + } + + for (int i = 0; i < rruleCount; ++i) { + RecurrenceRule *rule = new RecurrenceRule(); + rule->addObserver(r); + in >> rule; + r->d->mRRules.append(rule); + } + + return in; +} diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/recurrence.h dde-calendar-5.10.0/3rdparty/kcalendarcore/src/recurrence.h --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/recurrence.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/recurrence.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,680 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 1998 Preston Brown + SPDX-FileCopyrightText: 2001, 2003 Cornelius Schumacher + SPDX-FileCopyrightText: 2002, 2006 David Jarvie + SPDX-FileCopyrightText: 2005 Reinhold Kainhofer + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +#ifndef KCALCORE_RECURRENCE_H +#define KCALCORE_RECURRENCE_H + +#include "recurrencerule.h" + +class QBitArray; +class QTimeZone; + +namespace KCalendarCore { +class RecurrenceRule; + +/** + This class represents a recurrence rule for a calendar incidence. + 此类表示日历事件的重复规则。 + + It manages all recurrence rules, recurrence date/times, exception rules + and exception date times that can appear inside calendar items. + Each recurrence rule and exception rule is represented as an object + of type RecurrenceRule. + + 它管理日历项中可能出现的所有定期规则、定期日期/时间、异常规则和异常日期时间。 + 每个递归规则和异常规则都表示为RecurrenceRule类型的对象。 + + For the simple case where at most one recurrence + rule is present, this class provides shortcut methods to set the type: + setMinutely() + setHourly() + setDaily() + setWeekly() + setMonthly() + setYearly() + to set/get general information about the recurrence: + setEndDate() + setEndDateTime() + duration() + durationTo() + setDuration() + frequency() + setFrequency() + and to set/get specific information about the recurrence within the interval: + days() + monthDays() + monthPositions() + yearDays() + yearDates() + yearMonths() + yearPositions() + addMonthlyPos() + addMonthlyDate() + addYearlyDay() + addYearlyDate() + addYearlyPos() + addYearlyMonth() + These are all available so that you don't have to work on the RecurrenceRule + objects themselves. + In other words, in that simple situation the interface stays almost the + same compared to the old Recurrence class, which allowed only one + recurrence rule. + + As soon as your recurrence consists of multiple recurrence rules or exception + rules, you cannot use the methods mentioned above any more (since each rule + will have a different type and different settings). If you still call + any of them, the set*ly methods will remove all rules and add one rule with + the specified type. The add* and the other set* methods will change only + the first recurrence rule, but leave the others untouched. +*/ +class Q_CORE_EXPORT Recurrence : public RecurrenceRule::RuleObserver +{ +public: + class RecurrenceObserver + { + public: + virtual ~RecurrenceObserver(); + /** This method will be called on each change of the recurrence object */ + virtual void recurrenceUpdated(Recurrence *r) = 0; + }; + + /** enumeration for describing how an event recurs, if at all. */ + enum { + rNone = 0, + rMinutely = 0x001, + rHourly = 0x0002, + rDaily = 0x0003, + rWeekly = 0x0004, + rMonthlyPos = 0x0005, + rMonthlyDay = 0x0006, + rYearlyMonth = 0x0007, + rYearlyDay = 0x0008, + rYearlyPos = 0x0009, + rOther = 0x000A, + rMax = 0x00FF, + }; + + /** + Constructs an empty recurrence. + */ + Recurrence(); + + /** + Copy constructor. + @param r instance to copy from + */ + Recurrence(const Recurrence &r); + + /** + Destructor. + */ + ~Recurrence() override; + + /** + Comparison operator for equality. + @param r instance to compare with + @return true if recurrences are the same, false otherwise + */ + bool operator==(const Recurrence &r) const; + + /** + Comparison operator for inequality. + @param r instance to compare with + @return true if recurrences are the different, false if the same + */ + bool operator!=(const Recurrence &r) const + { + return !operator==(r); + } + + Recurrence &operator=(const Recurrence &r) = delete; + + /** Return the start date/time of the recurrence (Time for all-day recurrences will be 0:00). + * 返回重复的开始日期/时间 (全天重复的时间为0:00) + @return the current start/time of the recurrence. */ + Q_REQUIRED_RESULT QDateTime startDateTime() const; + /** Return the start date/time of the recurrence + * 返回重复的开始日期/时间 + */ + Q_REQUIRED_RESULT QDate startDate() const; + /** Set start of recurrence. + @param start the new start date or date/time of the recurrence. + @param isAllDay if true, the recurrence is set to all-day. Otherwise the recurrence is set + to non-all-day. + */ + void setStartDateTime(const QDateTime &start, bool isAllDay); + + /** Set whether the recurrence has no time, just a date. + * All-day means -- according to rfc2445 -- that the event has no time + * associated. + * N.B. This property is derived by default from whether setStartDateTime() is + * called with a date-only or date/time parameter. + * @return whether the recurrence has a time (false) or it is just a date (true). */ + Q_REQUIRED_RESULT bool allDay() const; + /** Sets whether the dtstart is a all-day (i.e. has no time attached) + @param allDay If the recurrence is for all-day item (true) or has a time associated (false). + */ + void setAllDay(bool allDay); + + /** Set if recurrence is read-only or can be changed. */ + void setRecurReadOnly(bool readOnly); + + /** Returns true if the recurrence is read-only, or false if it can be changed. */ + //如果重复周期是只读的,则返回 true;如果可以更改,则返回 false。 + Q_REQUIRED_RESULT bool recurReadOnly() const; + + /** Returns whether the event recurs at all. */ + //返回事件是否再次发生 + Q_REQUIRED_RESULT bool recurs() const; + + /** Returns the event's recurrence status. See the enumeration at the top + * of this file for possible values. */ + Q_REQUIRED_RESULT ushort recurrenceType() const; + + /** Returns the recurrence status for a recurrence rule. + * 返回重复规则的重复状态。 + * See the enumeration at the top of this file for possible values. + * 有关可能的值,请参阅此文件顶部的枚举。 + * + * @param rrule the recurrence rule to get the type for + */ + static ushort recurrenceType(const RecurrenceRule *rrule); + + /** + Returns true if the date specified is one on which the event will recur. + + @param date date to check. + @param timeZone time zone for the @p date. + */ + bool recursOn(const QDate &date, const QTimeZone &timeZone) const; + + /** + Returns true if the date/time specified is one at which the event will + recur. Times are rounded down to the nearest minute to determine the + result. + 如果指定的日期/时间是事件将再次发生的日期/时间,则返回true。时间四舍五入到最近的分钟以确定结果。 + + @param dt is the date/time to check. + */ + bool recursAt(const QDateTime &dt) const; + + /** + Removes all recurrence rules. Recurrence dates and exceptions are + not removed. + 删除所有重复规则。不会删除重复日期和例外情况。 + */ + void unsetRecurs(); + + /** + Removes all recurrence and exception rules and dates. + */ + void clear(); + + /** Returns a list of the times on the specified date at which the + * recurrence will occur. The returned times should be interpreted in the + * context of @p timeSpec. + * @param date the date for which to find the recurrence times + * @param timeZone timezone for @p date + */ + Q_REQUIRED_RESULT TimeList recurTimesOn(const QDate &date, const QTimeZone &timeZone) const; + + /** Returns a list of all the times at which the recurrence will occur + * between two specified times. + * + * There is a (large) maximum limit to the number of times returned. If due to + * this limit the list is incomplete, this is indicated by the last entry being + * set to an invalid QDateTime value. If you need further values, call the + * method again with a start time set to just after the last valid time returned. + * + * @param start inclusive start of interval + * @param end inclusive end of interval + * @return list of date/time values + */ + Q_REQUIRED_RESULT QList timesInInterval(const QDateTime &start, const QDateTime &end) const; + + /** Returns the start date/time of the earliest recurrence with a start date/time after + * the specified date/time. + * If the recurrence has no time, the next date after the specified date is returned. + * @param preDateTime the date/time after which to find the recurrence. + * @return start date/time of next recurrence (strictly later than the given + * QDateTime), or invalid date if none. + */ + Q_REQUIRED_RESULT QDateTime getNextDateTime(const QDateTime &preDateTime) const; + + /** Returns the date and time of the last previous recurrence, before the specified date/time. + * If a time later than 00:00:00 is specified and the recurrence has no time, 00:00:00 on + * the specified date is returned if that date recurs. + * + * @param afterDateTime the date/time before which to find the recurrence. + * @return date/time of previous recurrence (strictly earlier than the given + * QDateTime), or invalid date if none. + */ + Q_REQUIRED_RESULT QDateTime getPreviousDateTime(const QDateTime &afterDateTime) const; + + /** Returns frequency of recurrence, in terms of the recurrence time period type. */ + Q_REQUIRED_RESULT int frequency() const; + + /** Sets the frequency of recurrence, in terms of the recurrence time period type. */ + void setFrequency(int freq); + + /** + * Returns -1 if the event recurs infinitely, 0 if the end date is set, + * otherwise the total number of recurrences, including the initial occurrence. + * 如果事件无限重复,则返回-1;如果设置了结束日期,则返回0;否则返回包括初始事件在内的重复总数。 + */ + Q_REQUIRED_RESULT int duration() const; + + /** Sets the total number of times the event is to occur, including both the + * first and last. */ + void setDuration(int duration); + + /** Returns the number of recurrences up to and including the date/time specified. + * 返回指定日期/时间之前(包括指定日期/时间)的重复次数。 + * @warning This function can be very time consuming - use it sparingly! + */ + Q_REQUIRED_RESULT int durationTo(const QDateTime &dt) const; + + /** Returns the number of recurrences up to and including the date specified. + * @warning This function can be very time consuming - use it sparingly! + */ + Q_REQUIRED_RESULT int durationTo(const QDate &date) const; + + /** Returns the date/time of the last recurrence. + * An invalid date is returned if the recurrence has no end. + */ + Q_REQUIRED_RESULT QDateTime endDateTime() const; + + /** Returns the date of the last recurrence. + * 返回最后一次重复的日期。 + * An invalid date is returned if the recurrence has no end. + */ + Q_REQUIRED_RESULT QDate endDate() const; + + /** Sets the date of the last recurrence. The end time is set to the recurrence start time. + * @param endDate the ending date after which to stop recurring. If the + * recurrence is not all-day, the end time will be 23:59.*/ + void setEndDate(const QDate &endDate); + + /** Sets the date and time of the last recurrence. + * @param endDateTime the ending date/time after which to stop recurring. */ + void setEndDateTime(const QDateTime &endDateTime); + + /** + Shift the times of the recurrence so that they appear at the same clock + time as before but in a new time zone. The shift is done from a viewing + time zone rather than from the actual recurrence time zone. + + For example, shifting a recurrence whose start time is 09:00 America/New York, + using an old viewing time zone (@p oldSpec) of Europe/London, to a new time + zone (@p newSpec) of Europe/Paris, will result in the time being shifted + from 14:00 (which is the London time of the recurrence start) to 14:00 Paris + time. + + @param oldZone the time specification which provides the clock times + @param newZone the new time specification + */ + void shiftTimes(const QTimeZone &oldZone, const QTimeZone &newZone); + + /** Sets an event to recur minutely. By default infinite recurrence is used. + To set an end date use the method setEndDate and to set the number + of occurrences use setDuration. + + This method clears all recurrence rules and adds one rule with a + minutely recurrence. All other recurrence components (recurrence + date/times, exception date/times and exception rules) are not + modified. + * @param freq the frequency to recur, e.g. 2 is every other minute + */ + void setMinutely(int freq); + + /** Sets an event to recur hourly. By default infinite recurrence is used. + The minute of the recurrence is taken from the start date (if you + need to change it, you will have to modify the defaultRRule's + byMinute list manually. + To set an end date use the method setEndDate and to set the number + of occurrences use setDuration. + + This method clears all recurrence rules and adds one rule with a + hourly recurrence. All other recurrence components (recurrence + date/times, exception date/times and exception rules) are not + modified. + * @param freq the frequency to recur, e.g. 2 is every other hour + */ + void setHourly(int freq); + + /** Sets an event to recur daily. By default infinite recurrence is used. + The minute and second of the recurrence is taken from the start date + (if you need to change them, you will have to modify the defaultRRule's + byMinute list manually. + To set an end date use the method setEndDate and to set the number + of occurrences use setDuration. + + This method clears all recurrence rules and adds one rule with a + daily recurrence. All other recurrence components (recurrence + date/times, exception date/times and exception rules) are not + modified. + * @param freq the frequency to recur, e.g. 2 is every other day + */ + void setDaily(int freq); + + /** Sets an event to recur weekly. By default infinite recurrence is used. + To set an end date use the method setEndDate and to set the number + of occurrences use setDuration. + + This method clears all recurrence rules and adds one rule with a + weekly recurrence. All other recurrence components (recurrence + date/times, exception date/times and exception rules) are not + modified. + * @param freq the frequency to recur, e.g. every other week etc. + * @param weekStart the first day of the week (Monday=1 .. Sunday=7, default is Monday). + */ + void setWeekly(int freq, int weekStart = 1); + /** Sets an event to recur weekly. By default infinite recurrence is used. + To set an end date use the method setEndDate and to set the number + of occurrences use setDuration. + + This method clears all recurrence rules and adds one rule with a + weekly recurrence. All other recurrence components (recurrence + date/times, exception date/times and exception rules) are not + modified. + * @param freq the frequency to recur, e.g. every other week etc. + * @param days a 7 bit array indicating which days on which to recur (bit 0 = Monday). + * @param weekStart the first day of the week (Monday=1 .. Sunday=7, default is Monday). + */ + void setWeekly(int freq, const QBitArray &days, int weekStart = 1); + + /** Adds days to the weekly day recurrence list. + * @param days a 7 bit array indicating which days on which to recur (bit 0 = Monday). + */ + void addWeeklyDays(const QBitArray &days); + /** Returns the first day of the week. Uses only the + * first RRULE if present (i.e. a second RRULE as well as all EXRULES are + * ignored! + * @return Weekday of the first day of the week (Monday=1 .. Sunday=7) + */ + int weekStart() const; + + /** Returns week day mask (bit 0 = Monday). */ + Q_REQUIRED_RESULT QBitArray days() const; // Emulate the old behavior + + /** Sets an event to recur monthly. By default infinite recurrence is used. + The date of the monthly recurrence will be taken from the start date + unless you explicitly add one or more recurrence dates with + addMonthlyDate or a recurrence position in the month (e.g. first + monday) using addMonthlyPos. + To set an end date use the method setEndDate and to set the number + of occurrences use setDuration. + + This method clears all recurrence rules and adds one rule with a + monthly recurrence. All other recurrence components (recurrence + date/times, exception date/times and exception rules) are not + modified. + * @param freq the frequency to recur, e.g. 3 for every third month. + */ + void setMonthly(int freq); + + /** Adds a position (e.g. first monday) to the monthly recurrence rule. + * @param pos the position in the month for the recurrence, with valid + * values being 1-5 (5 weeks max in a month). + * @param days the days for the position to recur on (bit 0 = Monday). + * Example: pos = 2, and bits 0 and 2 are set in days: + * the rule is to repeat every 2nd Monday and Wednesday in the month. + */ + void addMonthlyPos(short pos, const QBitArray &days); + void addMonthlyPos(short pos, ushort day); + + void setMonthlyPos(const QList &monthlyDays); + + /** Adds a date (e.g. the 15th of each month) to the monthly day + * recurrence list. + * @param day the date in the month to recur. + */ + void addMonthlyDate(short day); + + void setMonthlyDate(const QList &monthlyDays); + + /** Returns list of day positions in months. */ + Q_REQUIRED_RESULT QList monthPositions() const; + + /** Returns list of day numbers of a month. */ + // Emulate old behavior + Q_REQUIRED_RESULT QList monthDays() const; + + /** Sets an event to recur yearly. By default, this will recur every year + * on the same date (e.g. every year on April 15 if the start date was + * April 15). + * The day of the year can be specified with addYearlyDay(). + * The day of the month can be specified with addYearlyByDate + * If both a month and a day ar specified with addYearlyMonth and + * addYearlyDay, the day is understood as day number within the month. + * + * A position (e.g. 3rd Sunday of year/month, or last Friday of year/month) + * can be specified with addYearlyPos. Again, if a month is specified, + * this position is understood as within that month, otherwise within + * the year. + * + * By default infinite recurrence is used. To set an end date use the + * method setEndDate and to set the number of occurrences use setDuration. + + This method clears all recurrence rules and adds one rule with a + yearly recurrence. All other recurrence components (recurrence + date/times, exception date/times and exception rules) are not + modified. + * @param freq the frequency to recur, e.g. 3 for every third year. + */ + void setYearly(int freq); + + /** Adds day number of year within a yearly recurrence. + * By default infinite recurrence is used. To set an end date use the + * method setEndDate and to set the number of occurrences use setDuration. + * @param day the day of the year for the event. E.g. if day is 60, this + * means Feb 29 in leap years and March 1 in non-leap years. + */ + void addYearlyDay(int day); + + void setYearlyDay(const QList &days); + + /** Adds date within a yearly recurrence. The month(s) for the recurrence + * can be specified with addYearlyMonth(), otherwise the month of the + * start date is used. + * + * By default infinite recurrence is used. To set an end date use the + * method setEndDate and to set the number of occurrences use setDuration. + * @param date the day of the month for the event + */ + void addYearlyDate(int date); + + void setYearlyDate(const QList &dates); + + /** Adds month in yearly recurrence. You can specify specific day numbers + * within the months (by calling addYearlyDate()) or specific day positions + * within the month (by calling addYearlyPos). + * @param _rNum the month in which the event shall recur. + */ + void addYearlyMonth(short _rNum); + + void setYearlyMonth(const QList &months); + + /** Adds position within month/year within a yearly recurrence. If months + * are specified (via addYearlyMonth()), the parameters are understood as + * position within these months, otherwise within the year. + * + * 在每年重复的月/年内增加头寸。如果指定了月份 (通过添加年度月份 ()),则参数应理解为这些月份内的位置,否则应理解为年份内的位置。 + * + * By default infinite recurrence is used. + * To set an end date use the method setEndDate and to set the number + * of occurrences use setDuration. + * @param pos the position in the month/year for the recurrence, with valid + * values being 1 to 53 and -1 to -53 (53 weeks max in a year). + * @param days the days for the position to recur on (bit 0 = Monday). + * Example: pos = 2, and bits 0 and 2 are set in days + * If months are specified (via addYearlyMonth), e.g. March, the rule is + * to repeat every year on the 2nd Monday and Wednesday of March. + * If no months are specified, the file is to repeat every year on the + * 2nd Monday and Wednesday of the year. + */ + void addYearlyPos(short pos, const QBitArray &days); + + void setYearlyPos(const QList &days); + + /** Returns the day numbers within a yearly recurrence. + * @return the days of the year for the event. E.g. if the list contains + * 60, this means the recurrence happens on day 60 of the year, i.e. + * on Feb 29 in leap years and March 1 in non-leap years. + */ + Q_REQUIRED_RESULT QList yearDays() const; + + /** Returns the dates within a yearly recurrence. + * @return the days of the month for the event. E.g. if the list contains + * 13, this means the recurrence happens on the 13th of the month. + * The months for the recurrence can be obtained through + * yearlyMonths(). If this list is empty, the month of the start + * date is used. + */ + Q_REQUIRED_RESULT QList yearDates() const; + + /** Returns the months within a yearly recurrence. + * @return the months for the event. E.g. if the list contains + * 11, this means the recurrence happens in November. + * The days for the recurrence can be obtained either through + * yearDates() if they are given as dates within the month or + * through yearlyPositions() if they are given as positions within the + * month. If none is specified, the date of the start date is used. + */ + Q_REQUIRED_RESULT QList yearMonths() const; + + /** Returns the positions within a yearly recurrence. + * @return the positions for the event, either within a month (if months + * are set through addYearlyMonth()) or within the year. + * E.g. if the list contains {Pos=3, Day=5}, this means the third + * friday. If a month is set this position is understoodas third + * Friday in the given months, otherwise as third Friday of the + * year. + */ + /** Returns list of day positions in months, for a recursYearlyPos recurrence rule. */ + Q_REQUIRED_RESULT QList yearPositions() const; + + /** Upper date limit for recurrences */ + static const QDate MAX_DATE; + + /** + Debug output. + */ + void dump() const; + + // RRULE + Q_REQUIRED_RESULT RecurrenceRule::List rRules() const; + /** + Add a recurrence rule to the recurrence. + 将重复规则添加到重复中。 + @param rrule the recurrence rule to add + */ + void addRRule(RecurrenceRule *rrule); + + /** + Remove a recurrence rule from the recurrence. + @p rrule is not deleted; it is the responsibility of the caller + to ensure that it is deleted. + @param rrule the recurrence rule to remove + */ + void removeRRule(RecurrenceRule *rrule); + + /** + Remove a recurrence rule from the recurrence and delete it. + @param rrule the recurrence rule to remove + */ + void deleteRRule(RecurrenceRule *rrule); + + // EXRULE + Q_REQUIRED_RESULT RecurrenceRule::List exRules() const; + + /** + Add an exception rule to the recurrence. + + 向重复添加例外规则。 + @param exrule the exception rule to add + */ + void addExRule(RecurrenceRule *exrule); + + /** + Remove an exception rule from the recurrence. + @p exrule is not deleted; it is the responsibility of the caller + to ensure that it is deleted. + @param exrule the exception rule to remove + */ + void removeExRule(RecurrenceRule *exrule); + + /** + Remove an exception rule from the recurrence and delete it. + @param exrule the exception rule to remove + */ + void deleteExRule(RecurrenceRule *exrule); + + // RDATE + Q_REQUIRED_RESULT QList rDateTimes() const; + Q_REQUIRED_RESULT DateList rDates() const; + void setRDateTimes(const QList &rdates); + void setRDates(const DateList &rdates); + void addRDateTime(const QDateTime &rdate); + void addRDate(const QDate &rdate); + + // ExDATE + Q_REQUIRED_RESULT QList exDateTimes() const; + Q_REQUIRED_RESULT DateList exDates() const; + void setExDateTimes(const QList &exdates); + void setExDates(const DateList &exdates); + void addExDateTime(const QDateTime &exdate); + void addExDate(const QDate &exdate); + + RecurrenceRule *defaultRRule(bool create = false) const; + RecurrenceRule *defaultRRuleConst() const; + void updated(); + + /** + Installs an observer. Whenever some setting of this recurrence + object is changed, the recurrenceUpdated( Recurrence* ) method + of each observer will be called to inform it of changes. + @param observer the Recurrence::Observer-derived object, which + will be installed as an observer of this object. + */ + void addObserver(RecurrenceObserver *observer); + /** + Removes an observer that was added with addObserver. If the + given object was not an observer, it does nothing. + @param observer the Recurrence::Observer-derived object to + be removed from the list of observers of this object. + */ + void removeObserver(RecurrenceObserver *observer); + + void recurrenceChanged(RecurrenceRule *) override; + +protected: + RecurrenceRule *setNewRecurrenceType(RecurrenceRule::PeriodType type, int freq); + +private: + //@cond PRIVATE + class Private; + Private *const d; + //@endcond + + friend Q_CORE_EXPORT QDataStream &operator<<(QDataStream &out, KCalendarCore::Recurrence *); + friend Q_CORE_EXPORT QDataStream &operator>>(QDataStream &in, KCalendarCore::Recurrence *); +}; + +/** + * Recurrence serializer and deserializer. + * @since 4.12 + */ +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &out, KCalendarCore::Recurrence *); +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &in, KCalendarCore::Recurrence *); + +} // namespace KCalendarCore + +#endif diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/recurrencehelper_p.h dde-calendar-5.10.0/3rdparty/kcalendarcore/src/recurrencehelper_p.h --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/recurrencehelper_p.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/recurrencehelper_p.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,55 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 2019 Volker Krause + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ + +#ifndef KCALCORE_RECURRENCEHELPER_P_H +#define KCALCORE_RECURRENCEHELPER_P_H + +#include + +namespace KCalendarCore { +template +inline void sortAndRemoveDuplicates(T &container) +{ + std::sort(container.begin(), container.end()); + container.erase(std::unique(container.begin(), container.end()), container.end()); +} + +template +inline void inplaceSetDifference(T &set1, const T &set2) +{ + auto beginIt = set1.begin(); + for (const auto &elem : set2) { + const auto it = std::lower_bound(beginIt, set1.end(), elem); + if (it != set1.end() && *it == elem) { + beginIt = set1.erase(it); + } + } +} + +template +inline void setInsert(Container &c, const Value &v) +{ + const auto it = std::lower_bound(c.begin(), c.end(), v); + if (it == c.end() || *it != v) { + c.insert(it, v); + } +} + +template +inline It strictLowerBound(It begin, It end, const Value &v) +{ + const auto it = std::lower_bound(begin, end, v); + if (it == end || (*it) >= v) { + return it == begin ? end : (it - 1); + } + return it; +} + +} // namespace KCalendarCore + +#endif diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/recurrencerule.cpp dde-calendar-5.10.0/3rdparty/kcalendarcore/src/recurrencerule.cpp --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/recurrencerule.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/recurrencerule.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,2276 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 2005 Reinhold Kainhofer + SPDX-FileCopyrightText: 2006-2008 David Jarvie + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +#include "recurrencerule.h" +#include "recurrencehelper_p.h" +#include "utils_p.h" + +#include +#include +#include +#include +#include + +using namespace KCalendarCore; + +// Maximum number of intervals to process +//要处理的最大间隔数 +const int LOOP_LIMIT = 10000; + +#ifndef NDEBUG +static QString dumpTime(const QDateTime &dt, bool allDay); // for debugging +#endif + +/*========================================================================= += = += IMPORTANT CODING NOTE: = += = += Recurrence handling code is time critical, especially for sub-daily = += recurrences. For example, if getNextDate() is called repeatedly to = += check all consecutive occurrences over a few years, on a slow machine = += this could take many seconds to complete in the worst case. Simple = += sub-daily recurrences are optimised by use of mTimedRepetition. = += = +==========================================================================*/ + +/************************************************************************** + * DateHelper * + **************************************************************************/ +//@cond PRIVATE +class DateHelper +{ +public: +#ifndef NDEBUG + static QString dayName(short day); +#endif + static QDate getNthWeek(int year, int weeknumber, short weekstart = 1); + static int weekNumbersInYear(int year, short weekstart = 1); + static int getWeekNumber(const QDate &date, short weekstart, int *year = nullptr); + static int getWeekNumberNeg(const QDate &date, short weekstart, int *year = nullptr); + // Convert to QDate, allowing for day < 0. + // month and day must be non-zero. + static QDate getDate(int year, int month, int day) + { + if (day >= 0) { + return QDate(year, month, day); + } else { + if (++month > 12) { + month = 1; + ++year; + } + return QDate(year, month, 1).addDays(day); + } + } +}; + +#ifndef NDEBUG +// TODO: Move to a general library / class, as we need the same in the iCal +// generator and in the xcal format +QString DateHelper::dayName(short day) +{ + switch (day) { + case 1: + return QStringLiteral("MO"); + case 2: + return QStringLiteral("TU"); + case 3: + return QStringLiteral("WE"); + case 4: + return QStringLiteral("TH"); + case 5: + return QStringLiteral("FR"); + case 6: + return QStringLiteral("SA"); + case 7: + return QStringLiteral("SU"); + default: + return QStringLiteral("??"); + } +} +#endif + +QDate DateHelper::getNthWeek(int year, int weeknumber, short weekstart) +{ + if (weeknumber == 0) { + return QDate(); + } + + // Adjust this to the first day of week #1 of the year and add 7*weekno days. + QDate dt(year, 1, 4); // Week #1 is the week that contains Jan 4 + int adjust = -(7 + dt.dayOfWeek() - weekstart) % 7; + if (weeknumber > 0) { + dt = dt.addDays(7 * (weeknumber - 1) + adjust); + } else if (weeknumber < 0) { + dt = dt.addYears(1); + dt = dt.addDays(7 * weeknumber + adjust); + } + return dt; +} + +int DateHelper::getWeekNumber(const QDate &date, short weekstart, int *year) +{ + int y = date.year(); + QDate dt(y, 1, 4); // <= definitely in week #1 + dt = dt.addDays(-(7 + dt.dayOfWeek() - weekstart) % 7); // begin of week #1 + + qint64 daysto = dt.daysTo(date); + if (daysto < 0) { + // in first week of year + --y; + dt = QDate(y, 1, 4); + dt = dt.addDays(-(7 + dt.dayOfWeek() - weekstart) % 7); // begin of week #1 + daysto = dt.daysTo(date); + } else if (daysto > 355) { + // near the end of the year - check if it's next year + QDate dtn(y + 1, 1, 4); // <= definitely first week of next year + dtn = dtn.addDays(-(7 + dtn.dayOfWeek() - weekstart) % 7); + qint64 dayston = dtn.daysTo(date); + if (dayston >= 0) { + // in first week of next year; + ++y; + daysto = dayston; + } + } + if (year) { + *year = y; + } + return daysto / 7 + 1; +} + +int DateHelper::weekNumbersInYear(int year, short weekstart) +{ + QDate dt(year, 1, weekstart); + QDate dt1(year + 1, 1, weekstart); + return dt.daysTo(dt1) / 7; +} + +// Week number from the end of the year +int DateHelper::getWeekNumberNeg(const QDate &date, short weekstart, int *year) +{ + int weekpos = getWeekNumber(date, weekstart, year); + return weekNumbersInYear(*year, weekstart) - weekpos - 1; +} +//@endcond + +/************************************************************************** + * WDayPos * + **************************************************************************/ + +bool RecurrenceRule::WDayPos::operator==(const RecurrenceRule::WDayPos &pos2) const +{ + return mDay == pos2.mDay && mPos == pos2.mPos; +} + +bool RecurrenceRule::WDayPos::operator!=(const RecurrenceRule::WDayPos &pos2) const +{ + return !operator==(pos2); +} + +/************************************************************************** + * Constraint * + **************************************************************************/ +//@cond PRIVATE +class Constraint +{ +public: + typedef QVector List; + + Constraint() + { + } + explicit Constraint(const QTimeZone &, int wkst = 1); + Constraint(const QDateTime &dt, RecurrenceRule::PeriodType type, int wkst); + void clear(); + void setYear(int n) + { + year = n; + useCachedDt = false; + } + void setMonth(int n) + { + month = n; + useCachedDt = false; + } + void setDay(int n) + { + day = n; + useCachedDt = false; + } + void setHour(int n) + { + hour = n; + useCachedDt = false; + } + void setMinute(int n) + { + minute = n; + useCachedDt = false; + } + void setSecond(int n) + { + second = n; + useCachedDt = false; + } + void setWeekday(int n) + { + weekday = n; + useCachedDt = false; + } + void setWeekdaynr(int n) + { + weekdaynr = n; + useCachedDt = false; + } + void setWeeknumber(int n) + { + weeknumber = n; + useCachedDt = false; + } + void setYearday(int n) + { + yearday = n; + useCachedDt = false; + } + void setWeekstart(int n) + { + weekstart = n; + useCachedDt = false; + } + + int year; // 0 means unspecified + int month; // 0 means unspecified + int day; // 0 means unspecified + int hour; // -1 means unspecified + int minute; // -1 means unspecified + int second; // -1 means unspecified + int weekday; // 0 means unspecified + int weekdaynr; // index of weekday in month/year (0=unspecified) + int weeknumber; // 0 means unspecified + int yearday; // 0 means unspecified + int weekstart; // first day of week (1=monday, 7=sunday, 0=unspec.) + QTimeZone timeZone; // time zone etc. to use + + bool readDateTime(const QDateTime &dt, RecurrenceRule::PeriodType type); + bool matches(const QDate &dt, RecurrenceRule::PeriodType type) const; + bool matches(const QDateTime &dt, RecurrenceRule::PeriodType type) const; + bool merge(const Constraint &interval); + bool isConsistent(RecurrenceRule::PeriodType period) const; + bool increase(RecurrenceRule::PeriodType type, int freq); + QDateTime intervalDateTime(RecurrenceRule::PeriodType type) const; + QList dateTimes(RecurrenceRule::PeriodType type) const; + void appendDateTime(const QDate &date, const QTime &time, QList &list) const; + void dump() const; + +private: + mutable bool useCachedDt; + mutable QDateTime cachedDt; +}; + +Constraint::Constraint(const QTimeZone &timeZone, int wkst) + : weekstart(wkst) + , timeZone(timeZone) +{ + clear(); +} + +Constraint::Constraint(const QDateTime &dt, RecurrenceRule::PeriodType type, int wkst) + : weekstart(wkst) + , timeZone(dt.timeZone()) +{ + clear(); + readDateTime(dt, type); +} + +void Constraint::clear() +{ + year = 0; + month = 0; + day = 0; + hour = -1; + minute = -1; + second = -1; + weekday = 0; + weekdaynr = 0; + weeknumber = 0; + yearday = 0; + useCachedDt = false; +} + +bool Constraint::matches(const QDate &dt, RecurrenceRule::PeriodType type) const +{ + // If the event recurs in week 53 or 1, the day might not belong to the same + // year as the week it is in. E.g. Jan 1, 2005 is in week 53 of year 2004. + // So we can't simply check the year in that case! + if (weeknumber == 0) { + if (year > 0 && year != dt.year()) { + return false; + } + } else { + int y = 0; + if (weeknumber > 0 && weeknumber != DateHelper::getWeekNumber(dt, weekstart, &y)) { + return false; + } + if (weeknumber < 0 && weeknumber != DateHelper::getWeekNumberNeg(dt, weekstart, &y)) { + return false; + } + if (year > 0 && year != y) { + return false; + } + } + + if (month > 0 && month != dt.month()) { + return false; + } + if (day > 0 && day != dt.day()) { + return false; + } + if (day < 0 && dt.day() != (dt.daysInMonth() + day + 1)) { + return false; + } + if (weekday > 0) { + if (weekday != dt.dayOfWeek()) { + return false; + } + if (weekdaynr != 0) { + // If it's a yearly recurrence and a month is given, the position is + // still in the month, not in the year. + if ((type == RecurrenceRule::rMonthly) || (type == RecurrenceRule::rYearly && month > 0)) { + // Monthly + if (weekdaynr > 0 && weekdaynr != (dt.day() - 1) / 7 + 1) { + return false; + } + if (weekdaynr < 0 && weekdaynr != -((dt.daysInMonth() - dt.day()) / 7 + 1)) { + return false; + } + } else { + // Yearly + if (weekdaynr > 0 && weekdaynr != (dt.dayOfYear() - 1) / 7 + 1) { + return false; + } + if (weekdaynr < 0 && weekdaynr != -((dt.daysInYear() - dt.dayOfYear()) / 7 + 1)) { + return false; + } + } + } + } + if (yearday > 0 && yearday != dt.dayOfYear()) { + return false; + } + if (yearday < 0 && yearday != dt.daysInYear() - dt.dayOfYear() + 1) { + return false; + } + return true; +} + +/* Check for a match with the specified date/time. + * The date/time's time specification must correspond with that of the start date/time. + */ +bool Constraint::matches(const QDateTime &dt, RecurrenceRule::PeriodType type) const +{ + if ((hour >= 0 && hour != dt.time().hour()) || (minute >= 0 && minute != dt.time().minute()) || (second >= 0 && second != dt.time().second()) + || !matches(dt.date(), type)) { + return false; + } + return true; +} + +bool Constraint::isConsistent(RecurrenceRule::PeriodType /*period*/) const +{ + // TODO: Check for consistency, e.g. byyearday=3 and bymonth=10 + return true; +} + +// Return a date/time set to the constraint values, but with those parts less +// significant than the given period type set to 1 (for dates) or 0 (for times). +QDateTime Constraint::intervalDateTime(RecurrenceRule::PeriodType type) const +{ + if (useCachedDt) { + return cachedDt; + } + QDate d; + QTime t(0, 0, 0); + bool subdaily = true; + switch (type) { + case RecurrenceRule::rSecondly: + t.setHMS(hour, minute, second); + break; + case RecurrenceRule::rMinutely: + t.setHMS(hour, minute, 0); + break; + case RecurrenceRule::rHourly: + t.setHMS(hour, 0, 0); + break; + case RecurrenceRule::rDaily: + break; + case RecurrenceRule::rWeekly: + d = DateHelper::getNthWeek(year, weeknumber, weekstart); + subdaily = false; + break; + case RecurrenceRule::rMonthly: + d.setDate(year, month, 1); + subdaily = false; + break; + case RecurrenceRule::rYearly: + d.setDate(year, 1, 1); + subdaily = false; + break; + default: + break; + } + if (subdaily) { + d = DateHelper::getDate(year, (month > 0) ? month : 1, day ? day : 1); + } + cachedDt = QDateTime(d, t, timeZone); + useCachedDt = true; + return cachedDt; +} + +bool Constraint::merge(const Constraint &interval) +{ +// clang-format off +#define mergeConstraint( name, cmparison ) \ + if ( interval.name cmparison ) { \ + if ( !( name cmparison ) ) { \ + name = interval.name; \ + } else if ( name != interval.name ) { \ + return false;\ + } \ + } + // clang-format on + + useCachedDt = false; + + mergeConstraint(year, > 0); + mergeConstraint(month, > 0); + mergeConstraint(day, != 0); + mergeConstraint(hour, >= 0); + mergeConstraint(minute, >= 0); + mergeConstraint(second, >= 0); + + mergeConstraint(weekday, != 0); + mergeConstraint(weekdaynr, != 0); + mergeConstraint(weeknumber, != 0); + mergeConstraint(yearday, != 0); + +#undef mergeConstraint + return true; +} + +// Y M D | H Mn S | WD #WD | WN | YD +// required: +// x | x x x | | | +// 0) Trivial: Exact date given, maybe other restrictions +// x x x | x x x | | | +// 1) Easy case: no weekly restrictions -> at most a loop through possible dates +// x + + | x x x | - - | - | - +// 2) Year day is given -> date known +// x | x x x | | | + +// 3) week number is given -> loop through all days of that week. Further +// restrictions will be applied in the end, when we check all dates for +// consistency with the constraints +// x | x x x | | + | (-) +// 4) week day is specified -> +// x | x x x | x ? | (-)| (-) +// 5) All possiblecases have already been treated, so this must be an error! + +QList Constraint::dateTimes(RecurrenceRule::PeriodType type) const +{ + QList result; + if (!isConsistent(type)) { + return result; + } + + // TODO_Recurrence: Handle all-day + QTime tm(hour, minute, second); + + bool done = false; + if (day && month > 0) { + appendDateTime(DateHelper::getDate(year, month, day), tm, result); + done = true; + } + + if (!done && weekday == 0 && weeknumber == 0 && yearday == 0) { + // Easy case: date is given, not restrictions by week or yearday + uint mstart = (month > 0) ? month : 1; + uint mend = (month <= 0) ? 12 : month; + for (uint m = mstart; m <= mend; ++m) { + uint dstart, dend; + if (day > 0) { + dstart = dend = day; + } else if (day < 0) { + QDate date(year, month, 1); + dstart = dend = date.daysInMonth() + day + 1; + } else { + QDate date(year, month, 1); + dstart = 1; + dend = date.daysInMonth(); + } + uint d = dstart; + for (QDate dt(year, m, dstart);; dt = dt.addDays(1)) { + appendDateTime(dt, tm, result); + if (++d > dend) { + break; + } + } + } + done = true; + } + + // Else: At least one of the week / yearday restrictions was given... + // If we have a yearday (and of course a year), we know the exact date + if (!done && yearday != 0) { + // yearday < 0 means from end of year, so we'll need Jan 1 of the next year + QDate d(year + ((yearday > 0) ? 0 : 1), 1, 1); + d = d.addDays(yearday - ((yearday > 0) ? 1 : 0)); + appendDateTime(d, tm, result); + done = true; + } + + // Else: If we have a weeknumber, we have at most 7 possible dates, loop through them + if (!done && weeknumber != 0) { + QDate wst(DateHelper::getNthWeek(year, weeknumber, weekstart)); + if (weekday != 0) { + wst = wst.addDays((7 + weekday - weekstart) % 7); + appendDateTime(wst, tm, result); + } else { + for (int i = 0; i < 7; ++i) { + appendDateTime(wst, tm, result); + wst = wst.addDays(1); + } + } + done = true; + } + + // weekday is given + if (!done && weekday != 0) { + QDate dt(year, 1, 1); + // If type == yearly and month is given, pos is still in month not year! + // TODO_Recurrence: Correct handling of n-th BYDAY... + int maxloop = 53; + bool inMonth = (type == RecurrenceRule::rMonthly) || (type == RecurrenceRule::rYearly && month > 0); + if (inMonth && month > 0) { + dt = QDate(year, month, 1); + maxloop = 5; + } + if (weekdaynr < 0) { + // From end of period (month, year) => relative to begin of next period + if (inMonth) { + dt = dt.addMonths(1); + } else { + dt = dt.addYears(1); + } + } + int adj = (7 + weekday - dt.dayOfWeek()) % 7; + dt = dt.addDays(adj); // correct first weekday of the period + + if (weekdaynr > 0) { + dt = dt.addDays((weekdaynr - 1) * 7); + appendDateTime(dt, tm, result); + } else if (weekdaynr < 0) { + dt = dt.addDays(weekdaynr * 7); + appendDateTime(dt, tm, result); + } else { + // loop through all possible weeks, non-matching will be filtered later + for (int i = 0; i < maxloop; ++i) { + appendDateTime(dt, tm, result); + dt = dt.addDays(7); + } + } + } // weekday != 0 + + // Only use those times that really match all other constraints, too + QList valid; + for (int i = 0, iend = result.count(); i < iend; ++i) { + if (matches(result[i], type)) { + valid.append(result[i]); + } + } + // Don't sort it here, would be unnecessary work. The results from all + // constraints will be merged to one big list of the interval. Sort that one! + return valid; +} + +void Constraint::appendDateTime(const QDate &date, const QTime &time, QList &list) const +{ + QDateTime dt(date, time, timeZone); + if (dt.isValid()) { + list.append(dt); + } +} + +bool Constraint::increase(RecurrenceRule::PeriodType type, int freq) +{ + // convert the first day of the interval to QDateTime + intervalDateTime(type); + + // Now add the intervals + switch (type) { + case RecurrenceRule::rSecondly: + cachedDt = cachedDt.addSecs(freq); + break; + case RecurrenceRule::rMinutely: + cachedDt = cachedDt.addSecs(60 * freq); + break; + case RecurrenceRule::rHourly: + cachedDt = cachedDt.addSecs(3600 * freq); + break; + case RecurrenceRule::rDaily: + cachedDt = cachedDt.addDays(freq); + break; + case RecurrenceRule::rWeekly: + cachedDt = cachedDt.addDays(7 * freq); + break; + case RecurrenceRule::rMonthly: + cachedDt = cachedDt.addMonths(freq); + break; + case RecurrenceRule::rYearly: + cachedDt = cachedDt.addYears(freq); + break; + default: + break; + } + // Convert back from QDateTime to the Constraint class + readDateTime(cachedDt, type); + useCachedDt = true; // readDateTime() resets this + + return true; +} + +// Set the constraint's value appropriate to 'type', to the value contained in a date/time. +bool Constraint::readDateTime(const QDateTime &dt, RecurrenceRule::PeriodType type) +{ + switch (type) { + // Really fall through! Only weekly needs to be treated differently! + case RecurrenceRule::rSecondly: + second = dt.time().second(); + Q_FALLTHROUGH(); + case RecurrenceRule::rMinutely: + minute = dt.time().minute(); + Q_FALLTHROUGH(); + case RecurrenceRule::rHourly: + hour = dt.time().hour(); + Q_FALLTHROUGH(); + case RecurrenceRule::rDaily: + day = dt.date().day(); + Q_FALLTHROUGH(); + case RecurrenceRule::rMonthly: + month = dt.date().month(); + Q_FALLTHROUGH(); + case RecurrenceRule::rYearly: + year = dt.date().year(); + break; + case RecurrenceRule::rWeekly: + // Determine start day of the current week, calculate the week number from that + weeknumber = DateHelper::getWeekNumber(dt.date(), weekstart, &year); + break; + default: + break; + } + useCachedDt = false; + return true; +} +//@endcond + +/************************************************************************** + * RecurrenceRule::Private * + **************************************************************************/ + +//@cond PRIVATE +class Q_DECL_HIDDEN KCalendarCore::RecurrenceRule::Private +{ +public: + Private(RecurrenceRule *parent) + : mParent(parent) + , mPeriod(rNone) + , mFrequency(0) + , mDuration(-1) + , mWeekStart(1) + , mIsReadOnly(false) + , mAllDay(false) + { + setDirty(); + } + + Private(RecurrenceRule *parent, const Private &p); + + Private &operator=(const Private &other); + bool operator==(const Private &other) const; + void clear(); + void setDirty(); + void buildConstraints(); + bool buildCache() const; + Constraint getNextValidDateInterval(const QDateTime &preDate, PeriodType type) const; + Constraint getPreviousValidDateInterval(const QDateTime &afterDate, PeriodType type) const; + QList datesForInterval(const Constraint &interval, PeriodType type) const; + + RecurrenceRule *mParent; + QString mRRule; // RRULE string + PeriodType mPeriod; + QDateTime mDateStart; // start of recurrence (but mDateStart is not an occurrence + // unless it matches the rule) + uint mFrequency; + /** how often it recurs: + < 0 means no end date, + < 0表示没有结束日期, + 0 means an explicit end date, + 0表示明确的结束日期, + positive values give the number of occurrences */ + int mDuration; + QDateTime mDateEnd; + + QList mBySeconds; // values: second 0-59 + QList mByMinutes; // values: minute 0-59 + QList mByHours; // values: hour 0-23 + + QList mByDays; // n-th weekday of the month or year + QList mByMonthDays; // values: day -31 to -1 and 1-31 + QList mByYearDays; // values: day -366 to -1 and 1-366 + QList mByWeekNumbers; // values: week -53 to -1 and 1-53 + QList mByMonths; // values: month 1-12 + QList mBySetPos; // values: position -366 to -1 and 1-366 + short mWeekStart; // first day of the week (1=Monday, 7=Sunday) 一周的第一天 + + Constraint::List mConstraints; + QList mObservers; + + // Cache for duration + mutable QList mCachedDates; + mutable QDateTime mCachedDateEnd; + mutable QDateTime mCachedLastDate; // when mCachedDateEnd invalid, last date checked 当mCachedDateEnd无效时,检查最后日期 + mutable bool mCached; + + bool mIsReadOnly; + bool mAllDay; + bool mNoByRules; // no BySeconds, ByMinutes, ... rules exist + uint mTimedRepetition; // repeats at a regular number of seconds interval, or 0 +}; + +RecurrenceRule::Private::Private(RecurrenceRule *parent, const Private &p) + : mParent(parent) + , mRRule(p.mRRule) + , mPeriod(p.mPeriod) + , mDateStart(p.mDateStart) + , mFrequency(p.mFrequency) + , mDuration(p.mDuration) + , mDateEnd(p.mDateEnd) + , + + mBySeconds(p.mBySeconds) + , mByMinutes(p.mByMinutes) + , mByHours(p.mByHours) + , mByDays(p.mByDays) + , mByMonthDays(p.mByMonthDays) + , mByYearDays(p.mByYearDays) + , mByWeekNumbers(p.mByWeekNumbers) + , mByMonths(p.mByMonths) + , mBySetPos(p.mBySetPos) + , mWeekStart(p.mWeekStart) + , + + mIsReadOnly(p.mIsReadOnly) + , mAllDay(p.mAllDay) + , mNoByRules(p.mNoByRules) +{ + setDirty(); +} + +RecurrenceRule::Private &RecurrenceRule::Private::operator=(const Private &p) +{ + // check for self assignment + if (&p == this) { + return *this; + } + + mRRule = p.mRRule; + mPeriod = p.mPeriod; + mDateStart = p.mDateStart; + mFrequency = p.mFrequency; + mDuration = p.mDuration; + mDateEnd = p.mDateEnd; + + mBySeconds = p.mBySeconds; + mByMinutes = p.mByMinutes; + mByHours = p.mByHours; + mByDays = p.mByDays; + mByMonthDays = p.mByMonthDays; + mByYearDays = p.mByYearDays; + mByWeekNumbers = p.mByWeekNumbers; + mByMonths = p.mByMonths; + mBySetPos = p.mBySetPos; + mWeekStart = p.mWeekStart; + + mIsReadOnly = p.mIsReadOnly; + mAllDay = p.mAllDay; + mNoByRules = p.mNoByRules; + + setDirty(); + + return *this; +} + +bool RecurrenceRule::Private::operator==(const Private &r) const +{ + return mPeriod == r.mPeriod && ((mDateStart == r.mDateStart) || (!mDateStart.isValid() && !r.mDateStart.isValid())) && mDuration == r.mDuration + && ((mDateEnd == r.mDateEnd) || (!mDateEnd.isValid() && !r.mDateEnd.isValid())) && mFrequency == r.mFrequency && mIsReadOnly == r.mIsReadOnly + && mAllDay == r.mAllDay && mBySeconds == r.mBySeconds && mByMinutes == r.mByMinutes && mByHours == r.mByHours && mByDays == r.mByDays + && mByMonthDays == r.mByMonthDays && mByYearDays == r.mByYearDays && mByWeekNumbers == r.mByWeekNumbers && mByMonths == r.mByMonths + && mBySetPos == r.mBySetPos && mWeekStart == r.mWeekStart && mNoByRules == r.mNoByRules; +} + +void RecurrenceRule::Private::clear() +{ + if (mIsReadOnly) { + return; + } + mPeriod = rNone; + mBySeconds.clear(); + mByMinutes.clear(); + mByHours.clear(); + mByDays.clear(); + mByMonthDays.clear(); + mByYearDays.clear(); + mByWeekNumbers.clear(); + mByMonths.clear(); + mBySetPos.clear(); + mWeekStart = 1; + mNoByRules = false; + + setDirty(); +} + +void RecurrenceRule::Private::setDirty() +{ + buildConstraints(); + mCached = false; + mCachedDates.clear(); + for (int i = 0, iend = mObservers.count(); i < iend; ++i) { + if (mObservers[i]) { + mObservers[i]->recurrenceChanged(mParent); + } + } +} +//@endcond + +/************************************************************************** + * RecurrenceRule * + **************************************************************************/ + +RecurrenceRule::RecurrenceRule() + : d(new Private(this)) +{ +} + +RecurrenceRule::RecurrenceRule(const RecurrenceRule &r) + : d(new Private(this, *r.d)) +{ +} + +RecurrenceRule::~RecurrenceRule() +{ + delete d; +} + +bool RecurrenceRule::operator==(const RecurrenceRule &r) const +{ + return *d == *r.d; +} + +RecurrenceRule &RecurrenceRule::operator=(const RecurrenceRule &r) +{ + // check for self assignment + if (&r == this) { + return *this; + } + + *d = *r.d; + + return *this; +} + +void RecurrenceRule::addObserver(RuleObserver *observer) +{ + if (!d->mObservers.contains(observer)) { + d->mObservers.append(observer); + } +} + +void RecurrenceRule::removeObserver(RuleObserver *observer) +{ + d->mObservers.removeAll(observer); +} + +void RecurrenceRule::setRecurrenceType(PeriodType period) +{ + if (isReadOnly()) { + return; + } + d->mPeriod = period; + d->setDirty(); +} + +QDateTime RecurrenceRule::endDt(bool *result) const +{ + if (result) { + *result = false; + } + if (d->mPeriod == rNone) { + return QDateTime(); + } + if (d->mDuration < 0) { + return QDateTime(); + } + if (d->mDuration == 0) { + if (result) { + *result = true; + } + return d->mDateEnd; + } + + // N occurrences. Check if we have a full cache. If so, return the cached end date. + if (!d->mCached) { + // If not enough occurrences can be found (i.e. inconsistent constraints) + if (!d->buildCache()) { + return QDateTime(); + } + } + if (result) { + *result = true; + } + return d->mCachedDateEnd; +} + +void RecurrenceRule::setEndDt(const QDateTime &dateTime) +{ + if (isReadOnly()) { + return; + } + d->mDateEnd = dateTime; + if (d->mDateEnd.isValid()) { + d->mDuration = 0; // set to 0 because there is an end date/time + } + d->setDirty(); +} + +void RecurrenceRule::setDuration(int duration) +{ + if (isReadOnly()) { + return; + } + d->mDuration = duration; + d->setDirty(); +} + +void RecurrenceRule::setAllDay(bool allDay) +{ + if (isReadOnly()) { + return; + } + d->mAllDay = allDay; + d->setDirty(); +} + +void RecurrenceRule::clear() +{ + d->clear(); +} + +void RecurrenceRule::setDirty() +{ + d->setDirty(); +} + +void RecurrenceRule::setStartDt(const QDateTime &start) +{ + if (isReadOnly()) { + return; + } + d->mDateStart = start; + d->setDirty(); +} + +void RecurrenceRule::setFrequency(int freq) +{ + if (isReadOnly() || freq <= 0) { + return; + } + d->mFrequency = freq; + d->setDirty(); +} + +void RecurrenceRule::setBySeconds(const QList &bySeconds) +{ + if (isReadOnly()) { + return; + } + d->mBySeconds = bySeconds; + d->setDirty(); +} + +void RecurrenceRule::setByMinutes(const QList &byMinutes) +{ + if (isReadOnly()) { + return; + } + d->mByMinutes = byMinutes; + d->setDirty(); +} + +void RecurrenceRule::setByHours(const QList &byHours) +{ + if (isReadOnly()) { + return; + } + d->mByHours = byHours; + d->setDirty(); +} + +void RecurrenceRule::setByDays(const QList &byDays) +{ + if (isReadOnly()) { + return; + } + d->mByDays = byDays; + d->setDirty(); +} + +void RecurrenceRule::setByMonthDays(const QList &byMonthDays) +{ + if (isReadOnly()) { + return; + } + d->mByMonthDays = byMonthDays; + d->setDirty(); +} + +void RecurrenceRule::setByYearDays(const QList &byYearDays) +{ + if (isReadOnly()) { + return; + } + d->mByYearDays = byYearDays; + d->setDirty(); +} + +void RecurrenceRule::setByWeekNumbers(const QList &byWeekNumbers) +{ + if (isReadOnly()) { + return; + } + d->mByWeekNumbers = byWeekNumbers; + d->setDirty(); +} + +void RecurrenceRule::setByMonths(const QList &byMonths) +{ + if (isReadOnly()) { + return; + } + d->mByMonths = byMonths; + d->setDirty(); +} + +void RecurrenceRule::setBySetPos(const QList &bySetPos) +{ + if (isReadOnly()) { + return; + } + d->mBySetPos = bySetPos; + d->setDirty(); +} + +void RecurrenceRule::setWeekStart(short weekStart) +{ + if (isReadOnly()) { + return; + } + d->mWeekStart = weekStart; + d->setDirty(); +} + +void RecurrenceRule::shiftTimes(const QTimeZone &oldTz, const QTimeZone &newTz) +{ + d->mDateStart = d->mDateStart.toTimeZone(oldTz); + d->mDateStart.setTimeZone(newTz); + if (d->mDuration == 0) { + d->mDateEnd = d->mDateEnd.toTimeZone(oldTz); + d->mDateEnd.setTimeZone(newTz); + } + d->setDirty(); +} + +// Taken from recurrence.cpp +// int RecurrenceRule::maxIterations() const +// { +// /* Find the maximum number of iterations which may be needed to reach the +// * next actual occurrence of a monthly or yearly recurrence. +// * More than one iteration may be needed if, for example, it's the 29th February, +// * the 31st day of the month or the 5th Monday, and the month being checked is +// * February or a 30-day month. +// * The following recurrences may never occur: +// * - For rMonthlyDay: if the frequency is a whole number of years. +// * - For rMonthlyPos: if the frequency is an even whole number of years. +// * - For rYearlyDay, rYearlyMonth: if the frequency is a multiple of 4 years. +// * - For rYearlyPos: if the frequency is an even number of years. +// * The maximum number of iterations needed, assuming that it does actually occur, +// * was found empirically. +// */ +// switch (recurs) { +// case rMonthlyDay: +// return (rFreq % 12) ? 6 : 8; +// +// case rMonthlyPos: +// if (rFreq % 12 == 0) { +// // Some of these frequencies may never occur +// return (rFreq % 84 == 0) ? 364 // frequency = multiple of 7 years +// : (rFreq % 48 == 0) ? 7 // frequency = multiple of 4 years +// : (rFreq % 24 == 0) ? 14 : 28; // frequency = multiple of 2 or 1 year +// } +// // All other frequencies will occur sometime +// if (rFreq > 120) +// return 364; // frequencies of > 10 years will hit the date limit first +// switch (rFreq) { +// case 23: return 50; +// case 46: return 38; +// case 56: return 138; +// case 66: return 36; +// case 89: return 54; +// case 112: return 253; +// default: return 25; // most frequencies will need < 25 iterations +// } +// +// case rYearlyMonth: +// case rYearlyDay: +// return 8; // only 29th Feb or day 366 will need more than one iteration +// +// case rYearlyPos: +// if (rFreq % 7 == 0) +// return 364; // frequencies of a multiple of 7 years will hit the date limit first +// if (rFreq % 2 == 0) { +// // Some of these frequencies may never occur +// return (rFreq % 4 == 0) ? 7 : 14; // frequency = even number of years +// } +// return 28; +// } +// return 1; +// } + +//@cond PRIVATE +void RecurrenceRule::Private::buildConstraints() +{ + mTimedRepetition = 0; + mNoByRules = mBySetPos.isEmpty(); + mConstraints.clear(); + Constraint con(mDateStart.timeZone()); + if (mWeekStart > 0) { + con.setWeekstart(mWeekStart); + } + mConstraints.append(con); + + int c, cend; + int i, iend; + Constraint::List tmp; + +// clang-format off +#define intConstraint( list, setElement ) \ + if ( !list.isEmpty() ) { \ + mNoByRules = false; \ + iend = list.count(); \ + if ( iend == 1 ) { \ + for ( c = 0, cend = mConstraints.count(); c < cend; ++c ) { \ + mConstraints[c].setElement( list[0] ); \ + } \ + } else { \ + tmp.reserve(mConstraints.count() * iend); \ + for ( c = 0, cend = mConstraints.count(); c < cend; ++c ) { \ + for ( i = 0; i < iend; ++i ) { \ + con = mConstraints[c]; \ + con.setElement( list[i] ); \ + tmp.append( con ); \ + } \ + } \ + mConstraints = tmp; \ + tmp.clear(); \ + } \ + } + // clang-format on + + intConstraint(mBySeconds, setSecond); + intConstraint(mByMinutes, setMinute); + intConstraint(mByHours, setHour); + intConstraint(mByMonthDays, setDay); + intConstraint(mByMonths, setMonth); + intConstraint(mByYearDays, setYearday); + intConstraint(mByWeekNumbers, setWeeknumber); +#undef intConstraint + + if (!mByDays.isEmpty()) { + mNoByRules = false; + tmp.reserve(mConstraints.count() * mByDays.count()); + for (c = 0, cend = mConstraints.count(); c < cend; ++c) { + for (i = 0, iend = mByDays.count(); i < iend; ++i) { + con = mConstraints[c]; + con.setWeekday(mByDays[i].day()); + con.setWeekdaynr(mByDays[i].pos()); + tmp.append(con); + } + } + mConstraints = tmp; + tmp.clear(); + } + +// clang-format off +#define fixConstraint( setElement, value ) \ + { \ + for ( c = 0, cend = mConstraints.count(); c < cend; ++c ) { \ + mConstraints[c].setElement( value ); \ + } \ + } + // clang-format on + // Now determine missing values from DTSTART. This can speed up things, + // because we have more restrictions and save some loops. + + // TODO: Does RFC 2445 intend to restrict the weekday in all cases of weekly? + if (mPeriod == rWeekly && mByDays.isEmpty()) { + fixConstraint(setWeekday, mDateStart.date().dayOfWeek()); + } + + // Really fall through in the cases, because all smaller time intervals are + // constrained from dtstart + switch (mPeriod) { + case rYearly: + if (mByDays.isEmpty() && mByWeekNumbers.isEmpty() && mByYearDays.isEmpty() && mByMonths.isEmpty()) { + fixConstraint(setMonth, mDateStart.date().month()); + } + Q_FALLTHROUGH(); + case rMonthly: + if (mByDays.isEmpty() && mByWeekNumbers.isEmpty() && mByYearDays.isEmpty() && mByMonthDays.isEmpty()) { + fixConstraint(setDay, mDateStart.date().day()); + } + Q_FALLTHROUGH(); + case rWeekly: + case rDaily: + if (mByHours.isEmpty()) { + fixConstraint(setHour, mDateStart.time().hour()); + } + Q_FALLTHROUGH(); + case rHourly: + if (mByMinutes.isEmpty()) { + fixConstraint(setMinute, mDateStart.time().minute()); + } + Q_FALLTHROUGH(); + case rMinutely: + if (mBySeconds.isEmpty()) { + fixConstraint(setSecond, mDateStart.time().second()); + } + Q_FALLTHROUGH(); + case rSecondly: + default: + break; + } +#undef fixConstraint + + if (mNoByRules) { + switch (mPeriod) { + case rHourly: + mTimedRepetition = mFrequency * 3600; + break; + case rMinutely: + mTimedRepetition = mFrequency * 60; + break; + case rSecondly: + mTimedRepetition = mFrequency; + break; + default: + break; + } + } else { + for (c = 0, cend = mConstraints.count(); c < cend;) { + if (mConstraints[c].isConsistent(mPeriod)) { + ++c; + } else { + mConstraints.removeAt(c); + --cend; + } + } + } +} + +// Build and cache a list of all occurrences. +//生成并缓存所有事件的列表。 + +// Only call buildCache() if mDuration > 0. +bool RecurrenceRule::Private::buildCache() const +{ + Q_ASSERT(mDuration > 0); + // Build the list of all occurrences of this event (we need that to determine + // the end date!) + Constraint interval(getNextValidDateInterval(mDateStart, mPeriod)); + + auto dts = datesForInterval(interval, mPeriod); + // Only use dates after the event has started (start date is only included + // if it matches) + const auto it = strictLowerBound(dts.begin(), dts.end(), mDateStart); + if (it != dts.end()) { + dts.erase(dts.begin(), it + 1); + } + + // some validity checks to avoid infinite loops (i.e. if we have + // done this loop already 10000 times, bail out ) + for (int loopnr = 0; loopnr < LOOP_LIMIT && dts.count() < mDuration; ++loopnr) { + interval.increase(mPeriod, mFrequency); + // The returned date list is already sorted! + dts += datesForInterval(interval, mPeriod); + } + if (dts.count() > mDuration) { + // we have picked up more occurrences than necessary, remove them + // 我们发现了更多不必要的事件,将其删除 + dts.erase(dts.begin() + mDuration, dts.end()); + } + mCached = true; + mCachedDates = dts; + + // it = dts.begin(); + // while ( it != dts.end() ) { + // qDebug() << " -=>" << dumpTime(*it); + // ++it; + // } + if (int(dts.count()) == mDuration) { + mCachedDateEnd = dts.last(); + return true; + } else { + // The cached date list is incomplete + mCachedDateEnd = QDateTime(); + mCachedLastDate = interval.intervalDateTime(mPeriod); + return false; + } +} +//@endcond + +bool RecurrenceRule::dateMatchesRules(const QDateTime &kdt) const +{ + QDateTime dt = kdt.toTimeZone(d->mDateStart.timeZone()); + for (int i = 0, iend = d->mConstraints.count(); i < iend; ++i) { + if (d->mConstraints[i].matches(dt, recurrenceType())) { + return true; + } + } + return false; +} + +bool RecurrenceRule::recursOn(const QDate &qd, const QTimeZone &timeZone) const +{ + int i, iend; + + if (!qd.isValid() || !d->mDateStart.isValid()) { + // There can't be recurrences on invalid dates + return false; + } + + if (allDay()) { + // It's a date-only rule, so it has no time specification. + // Therefore ignore 'timeSpec'. + if (qd < d->mDateStart.date()) { + return false; + } + // Start date is only included if it really matches + QDate endDate; + if (d->mDuration >= 0) { + endDate = endDt().date(); + if (qd > endDate) { + return false; + } + } + + // The date must be in an appropriate interval (getNextValidDateInterval), + // Plus it must match at least one of the constraints + bool match = false; + for (i = 0, iend = d->mConstraints.count(); i < iend && !match; ++i) { + match = d->mConstraints[i].matches(qd, recurrenceType()); + } + if (!match) { + return false; + } + + QDateTime start(qd, QTime(0, 0, 0), timeZone); // d->mDateStart.timeZone()); + Constraint interval(d->getNextValidDateInterval(start, recurrenceType())); + // Constraint::matches is quite efficient, so first check if it can occur at + // all before we calculate all actual dates. + if (!interval.matches(qd, recurrenceType())) { + return false; + } + // We really need to obtain the list of dates in this interval, since + // otherwise BYSETPOS will not work (i.e. the date will match the interval, + // but BYSETPOS selects only one of these matching dates! + QDateTime end = start.addDays(1); + do { + auto dts = d->datesForInterval(interval, recurrenceType()); + for (i = 0, iend = dts.count(); i < iend; ++i) { + if (dts[i].date() >= qd) { + return dts[i].date() == qd; + } + } + interval.increase(recurrenceType(), frequency()); + } while (interval.intervalDateTime(recurrenceType()) < end); + return false; + } + + // It's a date-time rule, so we need to take the time specification into account. + QDateTime start(qd, QTime(0, 0, 0), timeZone); + QDateTime end = start.addDays(1).toTimeZone(d->mDateStart.timeZone()); + start = start.toTimeZone(d->mDateStart.timeZone()); + if (end < d->mDateStart) { + return false; + } + if (start < d->mDateStart) { + start = d->mDateStart; + } + + // Start date is only included if it really matches + if (d->mDuration >= 0) { + QDateTime endRecur = endDt(); + if (endRecur.isValid()) { + if (start > endRecur) { + return false; + } + if (end > endRecur) { + end = endRecur; // limit end-of-day time to end of recurrence rule + } + } + } + + if (d->mTimedRepetition) { + // It's a simple sub-daily recurrence with no constraints + int n = static_cast((d->mDateStart.secsTo(start) - 1) % d->mTimedRepetition); + return start.addSecs(d->mTimedRepetition - n) < end; + } + + // Find the start and end dates in the time spec for the rule + QDate startDay = start.date(); + QDate endDay = end.addSecs(-1).date(); + int dayCount = startDay.daysTo(endDay) + 1; + + // The date must be in an appropriate interval (getNextValidDateInterval), + // Plus it must match at least one of the constraints + bool match = false; + for (i = 0, iend = d->mConstraints.count(); i < iend && !match; ++i) { + match = d->mConstraints[i].matches(startDay, recurrenceType()); + for (int day = 1; day < dayCount && !match; ++day) { + match = d->mConstraints[i].matches(startDay.addDays(day), recurrenceType()); + } + } + if (!match) { + return false; + } + + Constraint interval(d->getNextValidDateInterval(start, recurrenceType())); + // Constraint::matches is quite efficient, so first check if it can occur at + // all before we calculate all actual dates. + Constraint intervalm = interval; + do { + match = intervalm.matches(startDay, recurrenceType()); + for (int day = 1; day < dayCount && !match; ++day) { + match = intervalm.matches(startDay.addDays(day), recurrenceType()); + } + if (match) { + break; + } + intervalm.increase(recurrenceType(), frequency()); + } while (intervalm.intervalDateTime(recurrenceType()).isValid() && intervalm.intervalDateTime(recurrenceType()) < end); + if (!match) { + return false; + } + + // We really need to obtain the list of dates in this interval, since + // otherwise BYSETPOS will not work (i.e. the date will match the interval, + // but BYSETPOS selects only one of these matching dates! + do { + auto dts = d->datesForInterval(interval, recurrenceType()); + const auto it = std::lower_bound(dts.constBegin(), dts.constEnd(), start); + if (it != dts.constEnd()) { + return *it <= end; + } + interval.increase(recurrenceType(), frequency()); + } while (interval.intervalDateTime(recurrenceType()).isValid() && interval.intervalDateTime(recurrenceType()) < end); + + return false; +} + +bool RecurrenceRule::recursAt(const QDateTime &kdt) const +{ + // Convert to the time spec used by this recurrence rule + QDateTime dt(kdt.toTimeZone(d->mDateStart.timeZone())); + + if (allDay()) { + return recursOn(dt.date(), dt.timeZone()); + } + if (dt < d->mDateStart) { + return false; + } + // Start date is only included if it really matches + if (d->mDuration >= 0 && dt > endDt()) { + return false; + } + + if (d->mTimedRepetition) { + // It's a simple sub-daily recurrence with no constraints + return !(d->mDateStart.secsTo(dt) % d->mTimedRepetition); + } + + // The date must be in an appropriate interval (getNextValidDateInterval), + // Plus it must match at least one of the constraints + if (!dateMatchesRules(dt)) { + return false; + } + // if it recurs every interval, speed things up... + // if ( d->mFrequency == 1 && d->mBySetPos.isEmpty() && d->mByDays.isEmpty() ) return true; + Constraint interval(d->getNextValidDateInterval(dt, recurrenceType())); + // TODO_Recurrence: Does this work with BySetPos??? + if (interval.matches(dt, recurrenceType())) { + return true; + } + return false; +} + +TimeList RecurrenceRule::recurTimesOn(const QDate &date, const QTimeZone &timeZone) const +{ + TimeList lst; + if (allDay()) { + return lst; + } + QDateTime start(date, QTime(0, 0, 0), timeZone); + QDateTime end = start.addDays(1).addSecs(-1); + auto dts = timesInInterval(start, end); // returns between start and end inclusive + for (int i = 0, iend = dts.count(); i < iend; ++i) { + lst += dts[i].toTimeZone(timeZone).time(); + } + return lst; +} + +/** Returns the number of recurrences up to and including the date/time specified. */ +int RecurrenceRule::durationTo(const QDateTime &dt) const +{ + // Convert to the time spec used by this recurrence rule + QDateTime toDate(dt.toTimeZone(d->mDateStart.timeZone())); + // Easy cases: + // either before start, or after all recurrences and we know their number + if (toDate < d->mDateStart) { + return 0; + } + // Start date is only included if it really matches + if (d->mDuration > 0 && toDate >= endDt()) { + return d->mDuration; + } + + if (d->mTimedRepetition) { + // It's a simple sub-daily recurrence with no constraints + return static_cast(d->mDateStart.secsTo(toDate) / d->mTimedRepetition); + } + + return timesInInterval(d->mDateStart, toDate).count(); +} + +int RecurrenceRule::durationTo(const QDate &date) const +{ + return durationTo(QDateTime(date, QTime(23, 59, 59), d->mDateStart.timeZone())); +} + +QDateTime RecurrenceRule::getPreviousDate(const QDateTime &afterDate) const +{ + // Convert to the time spec used by this recurrence rule + QDateTime toDate(afterDate.toTimeZone(d->mDateStart.timeZone())); + + // Invalid starting point, or beyond end of recurrence + if (!toDate.isValid() || toDate < d->mDateStart) { + return QDateTime(); + } + + if (d->mTimedRepetition) { + // It's a simple sub-daily recurrence with no constraints + QDateTime prev = toDate; + if (d->mDuration >= 0 && endDt().isValid() && toDate > endDt()) { + prev = endDt().addSecs(1).toTimeZone(d->mDateStart.timeZone()); + } + int n = static_cast((d->mDateStart.secsTo(prev) - 1) % d->mTimedRepetition); + if (n < 0) { + return QDateTime(); // before recurrence start + } + prev = prev.addSecs(-n - 1); + return prev >= d->mDateStart ? prev : QDateTime(); + } + + // If we have a cache (duration given), use that + if (d->mDuration > 0) { + if (!d->mCached) { + d->buildCache(); + } + const auto it = strictLowerBound(d->mCachedDates.constBegin(), d->mCachedDates.constEnd(), toDate); + if (it != d->mCachedDates.constEnd()) { + return *it; + } + return QDateTime(); + } + + QDateTime prev = toDate; + if (d->mDuration >= 0 && endDt().isValid() && toDate > endDt()) { + prev = endDt().addSecs(1).toTimeZone(d->mDateStart.timeZone()); + } + + Constraint interval(d->getPreviousValidDateInterval(prev, recurrenceType())); + const auto dts = d->datesForInterval(interval, recurrenceType()); + const auto it = strictLowerBound(dts.begin(), dts.end(), prev); + if (it != dts.end()) { + return ((*it) >= d->mDateStart) ? (*it) : QDateTime(); + } + + // Previous interval. As soon as we find an occurrence, we're done. + while (interval.intervalDateTime(recurrenceType()) > d->mDateStart) { + interval.increase(recurrenceType(), -int(frequency())); + // The returned date list is sorted + auto dts = d->datesForInterval(interval, recurrenceType()); + // The list is sorted, so take the last one. + if (!dts.isEmpty()) { + prev = dts.last(); + if (prev.isValid() && prev >= d->mDateStart) { + return prev; + } else { + return QDateTime(); + } + } + } + return QDateTime(); +} + +QDateTime RecurrenceRule::getNextDate(const QDateTime &preDate) const +{ + // Convert to the time spec used by this recurrence rule + QDateTime fromDate(preDate.toTimeZone(d->mDateStart.timeZone())); + // Beyond end of recurrence + if (d->mDuration >= 0 && endDt().isValid() && fromDate >= endDt()) { + return QDateTime(); + } + + // Start date is only included if it really matches + if (fromDate < d->mDateStart) { + fromDate = d->mDateStart.addSecs(-1); + } + + if (d->mTimedRepetition) { + // It's a simple sub-daily recurrence with no constraints + int n = static_cast((d->mDateStart.secsTo(fromDate) + 1) % d->mTimedRepetition); + QDateTime next = fromDate.addSecs(d->mTimedRepetition - n + 1); + return d->mDuration < 0 || !endDt().isValid() || next <= endDt() ? next : QDateTime(); + } + + if (d->mDuration > 0) { + if (!d->mCached) { + d->buildCache(); + } + const auto it = std::upper_bound(d->mCachedDates.constBegin(), d->mCachedDates.constEnd(), fromDate); + if (it != d->mCachedDates.constEnd()) { + return *it; + } + } + + QDateTime end = endDt(); + Constraint interval(d->getNextValidDateInterval(fromDate, recurrenceType())); + const auto dts = d->datesForInterval(interval, recurrenceType()); + const auto it = std::upper_bound(dts.begin(), dts.end(), fromDate); + if (it != dts.end()) { + return (d->mDuration < 0 || *it <= end) ? *it : QDateTime(); + } + interval.increase(recurrenceType(), frequency()); + if (d->mDuration >= 0 && interval.intervalDateTime(recurrenceType()) > end) { + return QDateTime(); + } + + // Increase the interval. The first occurrence that we find is the result (if + // if's before the end date). + // TODO: some validity checks to avoid infinite loops for contradictory constraints + int loop = 0; + do { + auto dts = d->datesForInterval(interval, recurrenceType()); + if (!dts.isEmpty()) { + QDateTime ret(dts[0]); + if (d->mDuration >= 0 && ret > end) { + return QDateTime(); + } else { + return ret; + } + } + interval.increase(recurrenceType(), frequency()); + } while (++loop < LOOP_LIMIT && (d->mDuration < 0 || interval.intervalDateTime(recurrenceType()) < end)); + return QDateTime(); +} + +QList RecurrenceRule::timesInInterval(const QDateTime &dtStart, const QDateTime &dtEnd) const +{ + const QDateTime start = dtStart.toTimeZone(d->mDateStart.timeZone()); + const QDateTime end = dtEnd.toTimeZone(d->mDateStart.timeZone()); + QList result; + if (end < d->mDateStart) { + return result; // before start of recurrence + } + QDateTime enddt = end; + if (d->mDuration >= 0) { + const QDateTime endRecur = endDt(); + if (endRecur.isValid()) { + if (start > endRecur) { + return result; // beyond end of recurrence + } + if (end >= endRecur) { + enddt = endRecur; // limit end time to end of recurrence rule + } + } + } + + if (d->mTimedRepetition) { + // It's a simple sub-daily recurrence with no constraints + + // Seconds to add to interval start, to get first occurrence which is within interval + qint64 offsetFromNextOccurrence; + if (d->mDateStart < start) { + offsetFromNextOccurrence = d->mTimedRepetition - (d->mDateStart.secsTo(start) % d->mTimedRepetition); + } else { + offsetFromNextOccurrence = -(d->mDateStart.secsTo(start) % d->mTimedRepetition); + } + QDateTime dt = start.addSecs(offsetFromNextOccurrence); + if (dt <= enddt) { + int numberOfOccurrencesWithinInterval = static_cast(dt.secsTo(enddt) / d->mTimedRepetition) + 1; + // limit n by a sane value else we can "explode". + numberOfOccurrencesWithinInterval = qMin(numberOfOccurrencesWithinInterval, LOOP_LIMIT); + for (int i = 0; i < numberOfOccurrencesWithinInterval; dt = dt.addSecs(d->mTimedRepetition), ++i) { + result += dt; + } + } + return result; + } + + QDateTime st = start < d->mDateStart ? d->mDateStart : start; + bool done = false; + if (d->mDuration > 0) { + if (!d->mCached) { + d->buildCache(); + } + if (d->mCachedDateEnd.isValid() && start > d->mCachedDateEnd) { + return result; // beyond end of recurrence + } + const auto it = std::lower_bound(d->mCachedDates.constBegin(), d->mCachedDates.constEnd(), start); + if (it != d->mCachedDates.constEnd()) { + const auto itEnd = std::upper_bound(it, d->mCachedDates.constEnd(), enddt); + if (itEnd != d->mCachedDates.constEnd()) { + done = true; + } + std::copy(it, itEnd, std::back_inserter(result)); + } + if (d->mCachedDateEnd.isValid()) { + done = true; + } else if (!result.isEmpty()) { + result += QDateTime(); // indicate that the returned list is incomplete + done = true; + } + if (done) { + return result; + } + // We don't have any result yet, but we reached the end of the incomplete cache + st = d->mCachedLastDate.addSecs(1); + } + + Constraint interval(d->getNextValidDateInterval(st, recurrenceType())); + int loop = 0; + do { + auto dts = d->datesForInterval(interval, recurrenceType()); + auto it = dts.begin(); + auto itEnd = dts.end(); + if (loop == 0) { + it = std::lower_bound(dts.begin(), dts.end(), st); + } + itEnd = std::upper_bound(it, dts.end(), enddt); + if (itEnd != dts.end()) { + loop = LOOP_LIMIT; + } + std::copy(it, itEnd, std::back_inserter(result)); + // Increase the interval. + interval.increase(recurrenceType(), frequency()); + } while (++loop < LOOP_LIMIT && interval.intervalDateTime(recurrenceType()) <= end); + return result; +} + +//@cond PRIVATE +// Find the date/time of the occurrence at or before a date/time, +// for a given period type. +// Return a constraint whose value appropriate to 'type', is set to +// the value contained in the date/time. +Constraint RecurrenceRule::Private::getPreviousValidDateInterval(const QDateTime &dt, PeriodType type) const +{ + long periods = 0; + QDateTime start = mDateStart; + QDateTime nextValid(start); + int modifier = 1; + QDateTime toDate(dt.toTimeZone(start.timeZone())); + // for super-daily recurrences, don't care about the time part + + // Find the #intervals since the dtstart and round to the next multiple of + // the frequency + switch (type) { + // Really fall through for sub-daily, since the calculations only differ + // by the factor 60 and 60*60! Same for weekly and daily (factor 7) + case rHourly: + modifier *= 60; + Q_FALLTHROUGH(); + case rMinutely: + modifier *= 60; + Q_FALLTHROUGH(); + case rSecondly: + periods = static_cast(start.secsTo(toDate) / modifier); + // round it down to the next lower multiple of frequency: + if (mFrequency > 0) { + periods = (periods / mFrequency) * mFrequency; + } + nextValid = start.addSecs(modifier * periods); + break; + case rWeekly: + toDate = toDate.addDays(-(7 + toDate.date().dayOfWeek() - mWeekStart) % 7); + start = start.addDays(-(7 + start.date().dayOfWeek() - mWeekStart) % 7); + modifier *= 7; + Q_FALLTHROUGH(); + case rDaily: + periods = start.daysTo(toDate) / modifier; + // round it down to the next lower multiple of frequency: + if (mFrequency > 0) { + periods = (periods / mFrequency) * mFrequency; + } + nextValid = start.addDays(modifier * periods); + break; + case rMonthly: { + periods = 12 * (toDate.date().year() - start.date().year()) + (toDate.date().month() - start.date().month()); + // round it down to the next lower multiple of frequency: + if (mFrequency > 0) { + periods = (periods / mFrequency) * mFrequency; + } + // set the day to the first day of the month, so we don't have problems + // with non-existent days like Feb 30 or April 31 + start.setDate(QDate(start.date().year(), start.date().month(), 1)); + nextValid.setDate(start.date().addMonths(periods)); + break; + } + case rYearly: + periods = (toDate.date().year() - start.date().year()); + // round it down to the next lower multiple of frequency: + if (mFrequency > 0) { + periods = (periods / mFrequency) * mFrequency; + } + nextValid.setDate(start.date().addYears(periods)); + break; + default: + break; + } + + return Constraint(nextValid, type, mWeekStart); +} + +// Find the date/time of the next occurrence at or after a date/time, +// for a given period type. +// Return a constraint whose value appropriate to 'type', is set to the +// value contained in the date/time. +Constraint RecurrenceRule::Private::getNextValidDateInterval(const QDateTime &dt, PeriodType type) const +{ + // TODO: Simplify this! + long periods = 0; + QDateTime start = mDateStart; + QDateTime nextValid(start); + int modifier = 1; + QDateTime toDate(dt.toTimeZone(start.timeZone())); + // for super-daily recurrences, don't care about the time part + + // Find the #intervals since the dtstart and round to the next multiple of + // the frequency + switch (type) { + // Really fall through for sub-daily, since the calculations only differ + // by the factor 60 and 60*60! Same for weekly and daily (factor 7) + case rHourly: + modifier *= 60; + Q_FALLTHROUGH(); + case rMinutely: + modifier *= 60; + Q_FALLTHROUGH(); + case rSecondly: + periods = static_cast(start.secsTo(toDate) / modifier); + periods = qMax(0L, periods); + if (periods > 0 && mFrequency > 0) { + periods += (mFrequency - 1 - ((periods - 1) % mFrequency)); + } + nextValid = start.addSecs(modifier * periods); + break; + case rWeekly: + // correct both start date and current date to start of week + toDate = toDate.addDays(-(7 + toDate.date().dayOfWeek() - mWeekStart) % 7); + start = start.addDays(-(7 + start.date().dayOfWeek() - mWeekStart) % 7); + modifier *= 7; + Q_FALLTHROUGH(); + case rDaily: + periods = start.daysTo(toDate) / modifier; + periods = qMax(0L, periods); + if (periods > 0 && mFrequency > 0) { + periods += (mFrequency - 1 - ((periods - 1) % mFrequency)); + } + nextValid = start.addDays(modifier * periods); + break; + case rMonthly: { + periods = 12 * (toDate.date().year() - start.date().year()) + (toDate.date().month() - start.date().month()); + periods = qMax(0L, periods); + if (periods > 0 && mFrequency > 0) { + periods += (mFrequency - 1 - ((periods - 1) % mFrequency)); + } + // set the day to the first day of the month, so we don't have problems + // with non-existent days like Feb 30 or April 31 + start.setDate(QDate(start.date().year(), start.date().month(), 1)); + nextValid.setDate(start.date().addMonths(periods)); + break; + } + case rYearly: + periods = (toDate.date().year() - start.date().year()); + periods = qMax(0L, periods); + if (periods > 0 && mFrequency > 0) { + periods += (mFrequency - 1 - ((periods - 1) % mFrequency)); + } + nextValid.setDate(start.date().addYears(periods)); + break; + default: + break; + } + + return Constraint(nextValid, type, mWeekStart); +} + +QList RecurrenceRule::Private::datesForInterval(const Constraint &interval, PeriodType type) const +{ + /* -) Loop through constraints, + -) merge interval with each constraint + -) if merged constraint is not consistent => ignore that constraint + -) if complete => add that one date to the date list + -) Loop through all missing fields => For each add the resulting + */ + QList lst; + for (int i = 0, iend = mConstraints.count(); i < iend; ++i) { + Constraint merged(interval); + if (merged.merge(mConstraints[i])) { + // If the information is incomplete, we can't use this constraint + if (merged.year > 0 && merged.hour >= 0 && merged.minute >= 0 && merged.second >= 0) { + // We have a valid constraint, so get all datetimes that match it and + // append it to all date/times of this interval + QList lstnew = merged.dateTimes(type); + lst += lstnew; + } + } + } + // Sort it so we can apply the BySetPos. Also some logic relies on this being sorted + sortAndRemoveDuplicates(lst); + + /*if ( lst.isEmpty() ) { + qDebug() << " No Dates in Interval"; + } else { + qDebug() << " Dates:"; + for ( int i = 0, iend = lst.count(); i < iend; ++i ) { + qDebug()<< " -)" << dumpTime(lst[i]); + } + qDebug() << " ---------------------"; + }*/ + if (!mBySetPos.isEmpty()) { + auto tmplst = lst; + lst.clear(); + for (int i = 0, iend = mBySetPos.count(); i < iend; ++i) { + int pos = mBySetPos[i]; + if (pos > 0) { + --pos; + } + if (pos < 0) { + pos += tmplst.count(); + } + if (pos >= 0 && pos < tmplst.count()) { + lst.append(tmplst[pos]); + } + } + sortAndRemoveDuplicates(lst); + } + + return lst; +} +//@endcond + +void RecurrenceRule::dump() const +{ +#ifndef NDEBUG + if (!d->mRRule.isEmpty()) { + qDebug() << " RRULE=" << d->mRRule; + } + qDebug() << " Read-Only:" << isReadOnly(); + + qDebug() << " Period type:" << int(recurrenceType()) << ", frequency:" << frequency(); + qDebug() << " #occurrences:" << duration(); + qDebug() << " start date:" << dumpTime(startDt(), allDay()) << ", end date:" << dumpTime(endDt(), allDay()); +// clang-format off +#define dumpByIntList(list,label) \ + if ( !list.isEmpty() ) {\ + QStringList lst;\ + for ( int i = 0, iend = list.count(); i < iend; ++i ) {\ + lst.append( QString::number( list[i] ) );\ + }\ + qDebug() << " " << label << lst.join(QLatin1String(", ") );\ + } + // clang-format on + dumpByIntList(d->mBySeconds, QStringLiteral("BySeconds: ")); + dumpByIntList(d->mByMinutes, QStringLiteral("ByMinutes: ")); + dumpByIntList(d->mByHours, QStringLiteral("ByHours: ")); + if (!d->mByDays.isEmpty()) { + QStringList lst; + for (int i = 0, iend = d->mByDays.count(); i < iend; ++i) { + lst.append((d->mByDays[i].pos() ? QString::number(d->mByDays[i].pos()) : QLatin1String("")) + DateHelper::dayName(d->mByDays[i].day())); + } + qDebug() << " ByDays: " << lst.join(QLatin1String(", ")); + } + dumpByIntList(d->mByMonthDays, QStringLiteral("ByMonthDays:")); + dumpByIntList(d->mByYearDays, QStringLiteral("ByYearDays: ")); + dumpByIntList(d->mByWeekNumbers, QStringLiteral("ByWeekNr: ")); + dumpByIntList(d->mByMonths, QStringLiteral("ByMonths: ")); + dumpByIntList(d->mBySetPos, QStringLiteral("BySetPos: ")); +#undef dumpByIntList + + qDebug() << " Week start:" << DateHelper::dayName(d->mWeekStart); + + qDebug() << " Constraints:"; + // dump constraints + for (int i = 0, iend = d->mConstraints.count(); i < iend; ++i) { + d->mConstraints[i].dump(); + } +#endif +} + +//@cond PRIVATE +void Constraint::dump() const +{ + qDebug() << " ~> Y=" << year << ", M=" << month << ", D=" << day << ", H=" << hour << ", m=" << minute << ", S=" << second + << ", wd=" << weekday << ",#wd=" << weekdaynr << ", #w=" << weeknumber << ", yd=" << yearday; +} +//@endcond + +QString dumpTime(const QDateTime &dt, bool isAllDay) +{ +#ifndef NDEBUG + if (!dt.isValid()) { + return QString(); + } + QString result; + if (isAllDay) { + result = dt.toString(QStringLiteral("ddd yyyy-MM-dd t")); + } else { + result = dt.toString(QStringLiteral("ddd yyyy-MM-dd hh:mm:ss t")); + } + return result; +#else + Q_UNUSED(dt); + Q_UNUSED(isAllDay); + return QString(); +#endif +} + +QDateTime RecurrenceRule::startDt() const +{ + return d->mDateStart; +} + +RecurrenceRule::PeriodType RecurrenceRule::recurrenceType() const +{ + return d->mPeriod; +} + +uint RecurrenceRule::frequency() const +{ + return d->mFrequency; +} + +int RecurrenceRule::duration() const +{ + return d->mDuration; +} + +QString RecurrenceRule::rrule() const +{ + return d->mRRule; +} + +void RecurrenceRule::setRRule(const QString &rrule) +{ + d->mRRule = rrule; +} + +bool RecurrenceRule::isReadOnly() const +{ + return d->mIsReadOnly; +} + +void RecurrenceRule::setReadOnly(bool readOnly) +{ + d->mIsReadOnly = readOnly; +} + +bool RecurrenceRule::recurs() const +{ + return d->mPeriod != rNone; +} + +bool RecurrenceRule::allDay() const +{ + return d->mAllDay; +} + +const QList &RecurrenceRule::bySeconds() const +{ + return d->mBySeconds; +} + +const QList &RecurrenceRule::byMinutes() const +{ + return d->mByMinutes; +} + +const QList &RecurrenceRule::byHours() const +{ + return d->mByHours; +} + +const QList &RecurrenceRule::byDays() const +{ + return d->mByDays; +} + +const QList &RecurrenceRule::byMonthDays() const +{ + return d->mByMonthDays; +} + +const QList &RecurrenceRule::byYearDays() const +{ + return d->mByYearDays; +} + +const QList &RecurrenceRule::byWeekNumbers() const +{ + return d->mByWeekNumbers; +} + +const QList &RecurrenceRule::byMonths() const +{ + return d->mByMonths; +} + +const QList &RecurrenceRule::bySetPos() const +{ + return d->mBySetPos; +} + +short RecurrenceRule::weekStart() const +{ + return d->mWeekStart; +} + +RecurrenceRule::RuleObserver::~RuleObserver() +{ +} + +RecurrenceRule::WDayPos::WDayPos(int ps, short dy) + : mDay(dy) + , mPos(ps) +{ +} + +void RecurrenceRule::WDayPos::setDay(short dy) +{ + mDay = dy; +} + +short RecurrenceRule::WDayPos::day() const +{ + return mDay; +} + +void RecurrenceRule::WDayPos::setPos(int ps) +{ + mPos = ps; +} + +int RecurrenceRule::WDayPos::pos() const +{ + return mPos; +} + +QDataStream &operator<<(QDataStream &out, const Constraint &c) +{ + out << c.year << c.month << c.day << c.hour << c.minute << c.second << c.weekday << c.weekdaynr << c.weeknumber << c.yearday << c.weekstart; + serializeQTimeZoneAsSpec(out, c.timeZone); + out << false; // for backwards compatibility + + return out; +} + +QDataStream &operator>>(QDataStream &in, Constraint &c) +{ + bool secondOccurrence; // no longer used + in >> c.year >> c.month >> c.day >> c.hour >> c.minute >> c.second >> c.weekday >> c.weekdaynr >> c.weeknumber >> c.yearday >> c.weekstart; + deserializeSpecAsQTimeZone(in, c.timeZone); + in >> secondOccurrence; + return in; +} + +Q_CORE_EXPORT QDataStream &KCalendarCore::operator<<(QDataStream &out, const KCalendarCore::RecurrenceRule::WDayPos &w) +{ + out << w.mDay << w.mPos; + return out; +} + +Q_CORE_EXPORT QDataStream &KCalendarCore::operator>>(QDataStream &in, KCalendarCore::RecurrenceRule::WDayPos &w) +{ + in >> w.mDay >> w.mPos; + return in; +} + +Q_CORE_EXPORT QDataStream &KCalendarCore::operator<<(QDataStream &out, const KCalendarCore::RecurrenceRule *r) +{ + if (!r) { + return out; + } + + RecurrenceRule::Private *d = r->d; + out << d->mRRule << static_cast(d->mPeriod); + serializeQDateTimeAsKDateTime(out, d->mDateStart); + out << d->mFrequency << d->mDuration; + serializeQDateTimeAsKDateTime(out, d->mDateEnd); + out << d->mBySeconds << d->mByMinutes << d->mByHours << d->mByDays << d->mByMonthDays << d->mByYearDays << d->mByWeekNumbers << d->mByMonths << d->mBySetPos + << d->mWeekStart << d->mConstraints << d->mAllDay << d->mNoByRules << d->mTimedRepetition << d->mIsReadOnly; + + return out; +} + +Q_CORE_EXPORT QDataStream &KCalendarCore::operator>>(QDataStream &in, const KCalendarCore::RecurrenceRule *r) +{ + if (!r) { + return in; + } + + RecurrenceRule::Private *d = r->d; + quint32 period; + in >> d->mRRule >> period; + deserializeKDateTimeAsQDateTime(in, d->mDateStart); + in >> d->mFrequency >> d->mDuration; + deserializeKDateTimeAsQDateTime(in, d->mDateEnd); + in >> d->mBySeconds >> d->mByMinutes >> d->mByHours >> d->mByDays >> d->mByMonthDays >> d->mByYearDays >> d->mByWeekNumbers >> d->mByMonths >> d->mBySetPos + >> d->mWeekStart >> d->mConstraints >> d->mAllDay >> d->mNoByRules >> d->mTimedRepetition >> d->mIsReadOnly; + + d->mPeriod = static_cast(period); + + return in; +} diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/recurrencerule.h dde-calendar-5.10.0/3rdparty/kcalendarcore/src/recurrencerule.h --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/recurrencerule.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/recurrencerule.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,368 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 1998 Preston Brown + SPDX-FileCopyrightText: 2001, 2003 Cornelius Schumacher + SPDX-FileCopyrightText: 2002, 2006, 2007 David Jarvie + SPDX-FileCopyrightText: 2005 Reinhold Kainhofer + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +#ifndef KCALCORE_RECURRENCERULE_H +#define KCALCORE_RECURRENCERULE_H + +#include +#include + +class QTimeZone; + +namespace KCalendarCore { +// These two are duplicates wrt. incidencebase.h +typedef QList DateList; +/* List of times */ +typedef QList TimeList; + +/** + This class represents a recurrence rule for a calendar incidence. + 此类表示日历事件的重复规则。 +*/ +class Q_CORE_EXPORT RecurrenceRule +{ +public: + class RuleObserver + { + public: + virtual ~RuleObserver(); + /** This method is called on each change of the recurrence object + * 对递归对象的每次更改都会调用此方法 + */ + virtual void recurrenceChanged(RecurrenceRule *) = 0; + }; + typedef QList List; + + /** enum for describing the frequency how an event recurs, if at all. + * 枚举,用于描述事件递归的频率(如果有)。 + */ + enum PeriodType { + rNone = 0, + rSecondly, + rMinutely, + rHourly, + rDaily, + rWeekly, + rMonthly, + rYearly, + }; + + /** structure for describing the n-th weekday of the month/year. + * 用于描述月/年的第n个工作日的结构。 + */ + class Q_CORE_EXPORT WDayPos // krazy:exclude=dpointer + { + public: + explicit WDayPos(int ps = 0, short dy = 0); + void setDay(short dy); + short day() const; + void setPos(int ps); + int pos() const; + + bool operator==(const RecurrenceRule::WDayPos &pos2) const; + bool operator!=(const RecurrenceRule::WDayPos &pos2) const; + + protected: + short mDay; // Weekday, 1=monday, 7=sunday + int mPos; // week of the day (-1 for last, 1 for first, 0 for all weeks) + // Bounded by -366 and +366, 0 means all weeks in that period + + friend Q_CORE_EXPORT QDataStream &operator<<(QDataStream &out, const KCalendarCore::RecurrenceRule::WDayPos &); + friend Q_CORE_EXPORT QDataStream &operator>>(QDataStream &in, KCalendarCore::RecurrenceRule::WDayPos &); + }; + + RecurrenceRule(); + RecurrenceRule(const RecurrenceRule &r); + ~RecurrenceRule(); + + bool operator==(const RecurrenceRule &r) const; + bool operator!=(const RecurrenceRule &r) const + { + return !operator==(r); + } + + RecurrenceRule &operator=(const RecurrenceRule &r); + + /** Set if recurrence is read-only or can be changed. + * .设置重复周期是只读的还是可以更改的 + * + */ + void setReadOnly(bool readOnly); + + /** + Returns true if the recurrence is read-only; false if it can be changed. + + 如果重复周期为只读,则返回true;如果可以更改,则为false。 + */ + Q_REQUIRED_RESULT bool isReadOnly() const; + + /** + Returns the event's recurrence status. See the enumeration at the top + of this file for possible values. + 返回事件的重复状态。有关可能的值,请参阅此文件顶部的枚举。 + */ + Q_REQUIRED_RESULT bool recurs() const; + void setRecurrenceType(PeriodType period); + Q_REQUIRED_RESULT PeriodType recurrenceType() const; + + /** Turns off recurrence for the event. */ + void clear(); + + /** + Returns the recurrence frequency, in terms of the recurrence time period type. + 返回按重复时间段类型表示的重复频率。 + */ + Q_REQUIRED_RESULT uint frequency() const; + + /** + Sets the recurrence frequency, in terms of the recurrence time period type. + 根据重复时间段类型设置重复频率。 + */ + void setFrequency(int freq); + + /** + Returns the recurrence start date/time. + Note that the recurrence does not necessarily occur on the start date/time. + For this to happen, it must actually match the rule. + + 返回定期开始日期/时间。 + + 请注意,重复不一定发生在开始日期/时间。 + + 要做到这一点,它必须符合规则。 + */ + Q_REQUIRED_RESULT QDateTime startDt() const; + + /** + Sets the recurrence start date/time. + Note that setting the start date/time does not make the recurrence occur + on that date/time, it simply sets a lower limit to when the recurrences + take place (this applies only for the by- rules, not for i.e. an hourly + rule where the startDt is the first occurrence). + + 设置定期开始日期/时间。 + 请注意,设置开始日期/时间不会使重复发生在该日期/时间,它只会设置重复发生的时间下限(这仅适用于by规则,而不适用于startDt是第一次发生的每小时规则)。 + + Note that setting @p start to a date-only value does not make an all-day + recurrence: to do this, call setAllDay(true). + + @param start the recurrence's start date and time + */ + void setStartDt(const QDateTime &start); + + /** Returns whether the start date has no time associated. All-Day + means -- according to rfc2445 -- that the event has no time associate. */ + Q_REQUIRED_RESULT bool allDay() const; + + /** Sets whether the dtstart is all-day (i.e. has no time attached) + * + * @param allDay Whether start datetime is all-day + */ + void setAllDay(bool allDay); + + /** Returns the date and time of the last recurrence. + * An invalid date is returned if the recurrence has no end. + * @param result if non-null, *result is updated to true if successful, + * or false if there is no recurrence or its end date cannot be determined. + */ + Q_REQUIRED_RESULT QDateTime endDt(bool *result = nullptr) const; + + /** Sets the date and time of the last recurrence. + * @param endDateTime the ending date/time after which to stop recurring. */ + void setEndDt(const QDateTime &endDateTime); + + /** + * Returns -1 if the event recurs infinitely, 0 if the end date is set, + * otherwise the total number of recurrences, including the initial occurrence. + * 如果事件无限重复,则返回-1;如果设置了结束日期,则返回0;否则返回包括初始事件在内的重复总数。 + */ + Q_REQUIRED_RESULT int duration() const; + + /** Sets the total number of times the event is to occur, including both the + * first and last. + * 设置事件发生的总次数,包括第一次和最后一次。 + */ + void setDuration(int duration); + + /** Returns the number of recurrences up to and including the date/time specified. */ + //返回指定日期/时间之前(包括指定日期/时间)的复发次数 + Q_REQUIRED_RESULT int durationTo(const QDateTime &dt) const; + + /** Returns the number of recurrences up to and including the date specified. + * 返回指定日期之前(包括指定日期)的重复次数。 + */ + Q_REQUIRED_RESULT int durationTo(const QDate &date) const; + + /** + Shift the times of the rule so that they appear at the same clock + time as before but in a new time zone. The shift is done from a viewing + time zone rather than from the actual rule time zone. + + For example, shifting a rule whose start time is 09:00 America/New York, + using an old viewing time zone (@p oldTz) of Europe/London, to a new time + zone (@p newTz) of Europe/Paris, will result in the time being shifted + from 14:00 (which is the London time of the rule start) to 14:00 Paris + time. + + @param oldTz the time specification which provides the clock times + @param newTz the new time specification + */ + void shiftTimes(const QTimeZone &oldTz, const QTimeZone &newTz); + + /** Returns true if the date specified is one on which the event will + * recur. The start date returns true only if it actually matches the rule. + * 如果指定的日期是事件将再次发生的日期,则返回true。仅当开始日期与规则实际匹配时,才会返回true。 + * @param date date to check + * @param timeZone time specification for @p date + */ + Q_REQUIRED_RESULT bool recursOn(const QDate &date, const QTimeZone &timeZone) const; + + /** Returns true if the date/time specified is one at which the event will + * recur. Times are rounded down to the nearest minute to determine the result. + * The start date/time returns true only if it actually matches the rule. + * 如果指定的日期/时间是事件将重复出现的日期/时间,则返回 true。时间向下舍入到最接近的分钟以确定结果。开始日期/时间仅当实际与规则匹配时才返回 true。 + * @param dt the date+time to check for recurrency + */ + Q_REQUIRED_RESULT bool recursAt(const QDateTime &dt) const; + + /** Returns true if the date matches the rules. It does not necessarily + mean that this is an actual occurrence. In particular, the method does + not check if the date is after the end date, or if the frequency interval + matches. + + @param dt the date+time to check for matching the rules + */ + Q_REQUIRED_RESULT bool dateMatchesRules(const QDateTime &dt) const; + + /** Returns a list of the times on the specified date at which the + * recurrence will occur. The returned times should be interpreted in the + * context of @p timeZone. + * 返回在指定日期重复发生的时间列表。 + * @param date the date for which to find the recurrence times + * @param timeZone time specification for @p date + */ + Q_REQUIRED_RESULT TimeList recurTimesOn(const QDate &date, const QTimeZone &timeZone) const; + + /** Returns a list of all the times at which the recurrence will occur + * between two specified times. + * 返回在两个指定时间之间重复发生的所有时间的列表。 + * There is a (large) maximum limit to the number of times returned. If due to + * this limit the list is incomplete, this is indicated by the last entry being + * set to an invalid QDateTime value. If you need further values, call the + * method again with a start time set to just after the last valid time returned. + * @param start inclusive start of interval + * @param end inclusive end of interval + * @return list of date/time values + */ + Q_REQUIRED_RESULT QList timesInInterval(const QDateTime &start, const QDateTime &end) const; + + /** Returns the date and time of the next recurrence, after the specified date/time. + * 返回指定日期/时间之后下次重复的日期和时间。 + * If the recurrence has no time, the next date after the specified date is returned. + * @param preDateTime the date/time after which to find the recurrence. + * @return date/time of next recurrence, or invalid date if none. + */ + Q_REQUIRED_RESULT QDateTime getNextDate(const QDateTime &preDateTime) const; + + /** Returns the date and time of the last previous recurrence, before the specified date/time. + * 返回指定日期/时间之前上次重复的日期和时间。 + * If a time later than 00:00:00 is specified and the recurrence has no time, 00:00:00 on + * the specified date is returned if that date recurs. + * @param afterDateTime the date/time before which to find the recurrence. + * @return date/time of previous recurrence, or invalid date if none. + */ + Q_REQUIRED_RESULT QDateTime getPreviousDate(const QDateTime &afterDateTime) const; + + void setBySeconds(const QList &bySeconds); + void setByMinutes(const QList &byMinutes); + void setByHours(const QList &byHours); + + void setByDays(const QList &byDays); + void setByMonthDays(const QList &byMonthDays); + void setByYearDays(const QList &byYearDays); + void setByWeekNumbers(const QList &byWeekNumbers); + void setByMonths(const QList &byMonths); + void setBySetPos(const QList &bySetPos); + void setWeekStart(short weekStart); + + const QList &bySeconds() const; + const QList &byMinutes() const; + const QList &byHours() const; + + const QList &byDays() const; + const QList &byMonthDays() const; + const QList &byYearDays() const; + const QList &byWeekNumbers() const; + const QList &byMonths() const; + const QList &bySetPos() const; + short weekStart() const; + + /** + Set the RRULE string for the rule. + This is merely stored for future reference. The string is not used in any way + by the RecurrenceRule. + + @param rrule the RRULE string + */ + void setRRule(const QString &rrule); + Q_REQUIRED_RESULT QString rrule() const; + + void setDirty(); + /** + Installs an observer. Whenever some setting of this recurrence + object is changed, the recurrenceUpdated( Recurrence* ) method + of each observer will be called to inform it of changes. + 安装一个观察者。每当此递归对象的某些设置发生更改时,将调用每个观察者的recurrenceUpdated(recurrence*)方法来通知其更改。 + @param observer the Recurrence::Observer-derived object, which + will be installed as an observer of this object. + */ + void addObserver(RuleObserver *observer); + + /** + Removes an observer that was added with addObserver. If the + given object was not an observer, it does nothing. + @param observer the Recurrence::Observer-derived object to + be removed from the list of observers of this object. + */ + void removeObserver(RuleObserver *observer); + + /** + Debug output. + */ + void dump() const; + +private: + //@cond PRIVATE + class Private; + Private *const d; + //@endcond + + friend Q_CORE_EXPORT QDataStream &operator<<(QDataStream &out, const KCalendarCore::RecurrenceRule *); + friend Q_CORE_EXPORT QDataStream &operator>>(QDataStream &in, const KCalendarCore::RecurrenceRule *); +}; + +/** + * RecurrenceRule serializer and deserializer. + * @since 4.12 + */ +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &out, const KCalendarCore::RecurrenceRule *); +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &in, const KCalendarCore::RecurrenceRule *); + +/** + * RecurrenceRule::WDayPos serializer and deserializer. + * @since 4.12 + */ +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &out, const KCalendarCore::RecurrenceRule::WDayPos &); +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &in, KCalendarCore::RecurrenceRule::WDayPos &); +} // namespace KCalendarCore + +Q_DECLARE_TYPEINFO(KCalendarCore::RecurrenceRule::WDayPos, Q_MOVABLE_TYPE); + +#endif diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/schedulemessage.cpp dde-calendar-5.10.0/3rdparty/kcalendarcore/src/schedulemessage.cpp --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/schedulemessage.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/schedulemessage.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,90 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 2001, 2004 Cornelius Schumacher + SPDX-FileCopyrightText: 2004 Reinhold Kainhofer + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ + +#include "schedulemessage.h" + +#include + +using namespace KCalendarCore; + +//@cond PRIVATE +class Q_DECL_HIDDEN KCalendarCore::ScheduleMessage::Private +{ +public: + Private() + { + } + + IncidenceBase::Ptr mIncidence; + iTIPMethod mMethod; + Status mStatus; + QString mError; + + ~Private() + { + } +}; +//@endcond + +ScheduleMessage::ScheduleMessage(const IncidenceBase::Ptr &incidence, iTIPMethod method, ScheduleMessage::Status status) + : d(new KCalendarCore::ScheduleMessage::Private) +{ + d->mIncidence = incidence; + d->mMethod = method; + d->mStatus = status; +} + +ScheduleMessage::~ScheduleMessage() +{ + delete d; +} + +IncidenceBase::Ptr ScheduleMessage::event() const +{ + return d->mIncidence; +} + +iTIPMethod ScheduleMessage::method() const +{ + return d->mMethod; +} + +QString ScheduleMessage::methodName(iTIPMethod method) +{ + switch (method) { + case iTIPPublish: + return QStringLiteral("Publish"); + case iTIPRequest: + return QStringLiteral("Request"); + case iTIPRefresh: + return QStringLiteral("Refresh"); + case iTIPCancel: + return QStringLiteral("Cancel"); + case iTIPAdd: + return QStringLiteral("Add"); + case iTIPReply: + return QStringLiteral("Reply"); + case iTIPCounter: + return QStringLiteral("Counter"); + case iTIPDeclineCounter: + return QStringLiteral("Decline Counter"); + default: + return QStringLiteral("Unknown"); + } +} + +ScheduleMessage::Status ScheduleMessage::status() const +{ + return d->mStatus; +} + +QString ScheduleMessage::error() const +{ + return d->mError; +} diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/schedulemessage.h dde-calendar-5.10.0/3rdparty/kcalendarcore/src/schedulemessage.h --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/schedulemessage.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/schedulemessage.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,107 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 2001-2003 Cornelius Schumacher + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +#ifndef KCALCORE_SCHEDULEMESSAGE_H +#define KCALCORE_SCHEDULEMESSAGE_H + +#include "incidencebase.h" + +namespace KCalendarCore { +class IncidenceBase; + +/** + iTIP methods. +*/ +enum iTIPMethod { + iTIPPublish, /**< Event, to-do, journal or freebusy posting */ + iTIPRequest, /**< Event, to-do or freebusy scheduling request */ + iTIPReply, /**< Event, to-do or freebusy reply to request */ + iTIPAdd, /**< Event, to-do or journal additional property request */ + iTIPCancel, /**< Event, to-do or journal cancellation notice */ + iTIPRefresh, /**< Event or to-do description update request */ + iTIPCounter, /**< Event or to-do submit counter proposal */ + iTIPDeclineCounter, /**< Event or to-do decline a counter proposal */ + iTIPNoMethod, /**< No method */ +}; + +/** + @brief + A Scheduling message class. + + This class provides an encapsulation of a scheduling message. + It associates an incidence with an iTIPMethod and status information. +*/ +class Q_CORE_EXPORT ScheduleMessage +{ +public: + /** + Message status. + */ + enum Status { + PublishNew, /**< New message posting */ + PublishUpdate, /**< Updated message */ + Obsolete, /**< obsolete */ + RequestNew, /**< Request new message posting */ + RequestUpdate, /**< Request updated message */ + Unknown, /**< No status */ + }; + + /** + A shared pointer to a ScheduleMessage. + */ + typedef QSharedPointer Ptr; + + /** + Creates a scheduling message with method as defined in iTIPMethod and a status. + @param incidence a pointer to a valid Incidence to be associated with this message. + @param method an iTIPMethod. + @param status a Status. + */ + ScheduleMessage(const IncidenceBase::Ptr &incidence, iTIPMethod method, Status status); + + /** + Destructor. + */ + ~ScheduleMessage(); + + /** + Returns the event associated with this message. + */ + IncidenceBase::Ptr event() const; + + /** + Returns the iTIP method associated with this message. + */ + Q_REQUIRED_RESULT iTIPMethod method() const; + + /** + Returns a machine-readable (not translatable) name for a iTIP method. + @param method an iTIPMethod. + */ + Q_REQUIRED_RESULT static QString methodName(iTIPMethod method); + + /** + Returns the status of this message. + */ + Q_REQUIRED_RESULT Status status() const; + + /** + Returns the error message if there is any. + */ + Q_REQUIRED_RESULT QString error() const; + +private: + //@cond PRIVATE + Q_DISABLE_COPY(ScheduleMessage) + class Private; + Private *const d; + //@endcond +}; + +} // namespace KCalendarCore + +#endif diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/sorting.cpp dde-calendar-5.10.0/3rdparty/kcalendarcore/src/sorting.cpp --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/sorting.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/sorting.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,443 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + SPDX-FileContributor: Alvaro Manera + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +#include "sorting.h" + +// PENDING(kdab) Review +// The QString::compare() need to be replace by a DUI string comparisons. +// See http://qt.gitorious.org/maemo-6-ui-framework/libdui +// If not compiled in "meego-mode" should we be using locale compares? + +using namespace KCalendarCore; + +/** + * How one QDateTime compares with another. + * + * If any all-day events are involved, comparison of QDateTime values + * requires them to be considered as representing time periods. An all-day + * instance represents a time period from 00:00:00 to 23:59:59.999 on a given + * date, while a date/time instance can be considered to represent a time + * period whose start and end times are the same. They may therefore be + * earlier or later, or may overlap or be contained one within the other. + * + * Values may be OR'ed with each other in any combination of 'consecutive' + * intervals to represent different types of relationship. + * + * In the descriptions of the values below, + * - s1 = start time of first instance + * - e1 = end time of first instance + * - s2 = start time of second instance + * - e2 = end time of second instance. + */ +enum DateTimeComparison { + Before = 0x01, /**< The first QDateTime is strictly earlier than the second, + * i.e. e1 < s2. + */ + AtStart = 0x02, /**< The first QDateTime starts at the same time as the second, + * and ends before the end of the second, + * i.e. s1 = s2, e1 < e2. + */ + Inside = 0x04, /**< The first QDateTime starts after the start of the second, + * and ends before the end of the second, + * i.e. s1 > s2, e1 < e2. + */ + AtEnd = 0x08, /**< The first QDateTime starts after the start of the second, + * and ends at the same time as the second, + * i.e. s1 > s2, e1 = e2. + */ + After = 0x10, /**< The first QDateTime is strictly later than the second, + * i.e. s1 > e2. + */ + Equal = AtStart | Inside | AtEnd, + /**< Simultaneous, i.e. s1 = s2 && e1 = e2. + */ + Outside = Before | AtStart | Inside | AtEnd | After, + /**< The first QDateTime starts before the start of the other, + * and ends after the end of the other, + * i.e. s1 < s2, e1 > e2. + */ + StartsAt = AtStart | Inside | AtEnd | After, + /**< The first QDateTime starts at the same time as the other, + * and ends after the end of the other, + * i.e. s1 = s2, e1 > e2. + */ + EndsAt = Before | AtStart | Inside | AtEnd, + /**< The first QDateTime starts before the start of the other, + * and ends at the same time as the other, + * i.e. s1 < s2, e1 = e2. + */ +}; + +/** + * Compare two QDateTime instances to determine whether they are + * simultaneous, earlier or later. + + * The comparison takes time zones into account: if the two instances have + * different time zones, they are first converted to UTC before comparing. + * + * If both instances are not all-day values, the first instance is considered to + * be either simultaneous, earlier or later, and does not overlap. + * + * If one instance is all-day and the other is a not all-day, the first instance + * is either strictly earlier, strictly later, or overlaps. + * + * If both instance are all-day, they are considered simultaneous if both + * their start of day and end of day times are simultaneous with each + * other. (Both start and end of day times need to be considered in case a + * daylight savings change occurs during that day.) Otherwise, the first instance + * can be strictly earlier, earlier but overlapping, later but overlapping, + * or strictly later. + * + * Note that if either instance is a local time (Qt::TimeSpec of Qt::LocalTime), + * the result cannot be guaranteed to be correct, since by definition they + * contain no information about time zones or daylight savings changes. + * + * @return DateTimeComparison indicating the relationship of dt1 to dt2 + * @see operator==(), operator!=(), operator<(), operator<=(), operator>=(), operator>() + */ + +DateTimeComparison compare(const QDateTime &dt1, bool isAllDay1, const QDateTime &dt2, bool isAllDay2) +{ + QDateTime start1, start2; + // FIXME When secondOccurrence is available in QDateTime + // const bool conv = (!d->equalSpec(*other.d) || d->secondOccurrence() != other.d->secondOccurrence()); + const bool conv = dt1.timeSpec() != dt2.timeSpec() || (dt1.timeSpec() == Qt::OffsetFromUTC && dt1.offsetFromUtc() != dt2.offsetFromUtc()) + || (dt1.timeSpec() == Qt::TimeZone && dt1.timeZone() != dt2.timeZone()); + if (conv) { + // Different time specs or one is a time which occurs twice, + // so convert to UTC before comparing + start1 = dt1.toUTC(); + start2 = dt2.toUTC(); + } else { + // Same time specs, so no need to convert to UTC + start1 = dt1; + start2 = dt2; + } + if (isAllDay1 || isAllDay2) { + // At least one of the instances is date-only, so we need to compare + // time periods rather than just times. + QDateTime end1, end2; + if (conv) { + if (isAllDay1) { + QDateTime dt(dt1); + dt.setTime(QTime(23, 59, 59, 999)); + end1 = dt.toUTC(); + } else { + end1 = start1; + } + if (isAllDay2) { + QDateTime dt(dt2); + dt.setTime(QTime(23, 59, 59, 999)); + end2 = dt.toUTC(); + } else { + end2 = start2; + } + } else { + if (isAllDay1) { + end1 = QDateTime(dt1.date(), QTime(23, 59, 59, 999), Qt::LocalTime); + } else { + end1 = dt1; + } + if (isAllDay2) { + end2 = QDateTime(dt2.date(), QTime(23, 59, 59, 999), Qt::LocalTime); + } else { + end2 = dt2; + } + } + + if (start1 == start2) { + return !isAllDay1 ? AtStart + : (end1 == end2) ? Equal + : (end1 < end2) ? static_cast(AtStart | Inside) + : static_cast(AtStart | Inside | AtEnd | After); + } + + if (start1 < start2) { + return (end1 < start2) ? Before + : (end1 == end2) ? static_cast(Before | AtStart | Inside | AtEnd) + : (end1 == start2) ? static_cast(Before | AtStart) + : (end1 < end2) ? static_cast(Before | AtStart | Inside) + : Outside; + } else { + return (start1 > end2) ? After + : (start1 == end2) ? (end1 == end2 ? AtEnd : static_cast(AtEnd | After)) + : (end1 == end2) ? static_cast(Inside | AtEnd) + : (end1 < end2) ? Inside + : static_cast(Inside | AtEnd | After); + } + } + return (start1 == start2) ? Equal : (start1 < start2) ? Before : After; +} + +bool KCalendarCore::Events::startDateLessThan(const Event::Ptr &e1, const Event::Ptr &e2) +{ + DateTimeComparison res = compare(e1->dtStart(), e1->allDay(), e2->dtStart(), e2->allDay()); + if (res == Equal) { + return Events::summaryLessThan(e1, e2); + } else { + return (res & Before || res & AtStart); + } +} + +bool KCalendarCore::Events::startDateMoreThan(const Event::Ptr &e1, const Event::Ptr &e2) +{ + DateTimeComparison res = compare(e1->dtStart(), e1->allDay(), e2->dtStart(), e2->allDay()); + if (res == Equal) { + return Events::summaryMoreThan(e1, e2); + } else { + return (res & After || res & AtEnd); + } +} + +bool KCalendarCore::Events::summaryLessThan(const Event::Ptr &e1, const Event::Ptr &e2) +{ + return QString::compare(e1->summary(), e2->summary(), Qt::CaseInsensitive) < 0; +} + +bool KCalendarCore::Events::summaryMoreThan(const Event::Ptr &e1, const Event::Ptr &e2) +{ + return QString::compare(e1->summary(), e2->summary(), Qt::CaseInsensitive) > 0; +} + +bool KCalendarCore::Events::endDateLessThan(const Event::Ptr &e1, const Event::Ptr &e2) +{ + DateTimeComparison res = compare(e1->dtEnd(), e1->allDay(), e2->dtEnd(), e2->allDay()); + if (res == Equal) { + return Events::summaryLessThan(e1, e2); + } else { + return (res & Before || res & AtStart); + } +} + +bool KCalendarCore::Events::endDateMoreThan(const Event::Ptr &e1, const Event::Ptr &e2) +{ + DateTimeComparison res = compare(e1->dtEnd(), e1->allDay(), e2->dtEnd(), e2->allDay()); + if (res == Equal) { + return Events::summaryMoreThan(e1, e2); + } else { + return (res & After || res & AtEnd); + } +} + +bool KCalendarCore::Journals::dateLessThan(const Journal::Ptr &j1, const Journal::Ptr &j2) +{ + DateTimeComparison res = compare(j1->dtStart(), j1->allDay(), j2->dtStart(), j2->allDay()); + return (res & Before || res & AtStart); +} + +bool KCalendarCore::Journals::dateMoreThan(const Journal::Ptr &j1, const Journal::Ptr &j2) +{ + DateTimeComparison res = compare(j1->dtStart(), j1->allDay(), j2->dtStart(), j2->allDay()); + return (res & After || res & AtEnd); +} + +bool KCalendarCore::Journals::summaryLessThan(const Journal::Ptr &j1, const Journal::Ptr &j2) +{ + return QString::compare(j1->summary(), j2->summary(), Qt::CaseInsensitive) < 0; +} + +bool KCalendarCore::Journals::summaryMoreThan(const Journal::Ptr &j1, const Journal::Ptr &j2) +{ + return QString::compare(j1->summary(), j2->summary(), Qt::CaseInsensitive) > 0; +} + +bool KCalendarCore::Todos::startDateLessThan(const Todo::Ptr &t1, const Todo::Ptr &t2) +{ + DateTimeComparison res = compare(t1->dtStart(), t1->allDay(), t2->dtStart(), t2->allDay()); + if (res == Equal) { + return Todos::summaryLessThan(t1, t2); + } else { + return (res & Before || res & AtStart); + } +} + +bool KCalendarCore::Todos::startDateMoreThan(const Todo::Ptr &t1, const Todo::Ptr &t2) +{ + DateTimeComparison res = compare(t1->dtStart(), t1->allDay(), t2->dtStart(), t2->allDay()); + if (res == Equal) { + return Todos::summaryMoreThan(t1, t2); + } else { + return (res & After || res & AtEnd); + } +} + +bool KCalendarCore::Todos::dueDateLessThan(const Todo::Ptr &t1, const Todo::Ptr &t2) +{ + if (!t1->hasDueDate()) { + return false; + } + if (!t2->hasDueDate()) { + return true; + } + DateTimeComparison res = compare(t1->dtDue(), t1->allDay(), t2->dtDue(), t2->allDay()); + if (res == Equal) { + return Todos::summaryLessThan(t1, t2); + } else { + return (res & Before || res & AtStart); + } +} + +bool KCalendarCore::Todos::dueDateMoreThan(const Todo::Ptr &t1, const Todo::Ptr &t2) +{ + if (!t2->hasDueDate()) { + return false; + } + if (!t1->hasDueDate()) { + return true; + } + DateTimeComparison res = compare(t1->dtDue(), t1->allDay(), t2->dtDue(), t2->allDay()); + if (res == Equal) { + return Todos::summaryMoreThan(t1, t2); + } else { + return (res & After || res & AtEnd); + } +} + +bool KCalendarCore::Todos::priorityLessThan(const Todo::Ptr &t1, const Todo::Ptr &t2) +{ + if (t1->priority() < t2->priority()) { + return true; + } else if (t1->priority() == t2->priority()) { + return Todos::summaryLessThan(t1, t2); + } else { + return false; + } +} + +bool KCalendarCore::Todos::priorityMoreThan(const Todo::Ptr &t1, const Todo::Ptr &t2) +{ + if (t1->priority() > t2->priority()) { + return true; + } else if (t1->priority() == t2->priority()) { + return Todos::summaryMoreThan(t1, t2); + } else { + return false; + } +} + +bool KCalendarCore::Todos::percentLessThan(const Todo::Ptr &t1, const Todo::Ptr &t2) +{ + if (t1->percentComplete() < t2->percentComplete()) { + return true; + } else if (t1->percentComplete() == t2->percentComplete()) { + return Todos::summaryLessThan(t1, t2); + } else { + return false; + } +} + +bool KCalendarCore::Todos::percentMoreThan(const Todo::Ptr &t1, const Todo::Ptr &t2) +{ + if (t1->percentComplete() > t2->percentComplete()) { + return true; + } else if (t1->percentComplete() == t2->percentComplete()) { + return Todos::summaryMoreThan(t1, t2); + } else { + return false; + } +} + +bool KCalendarCore::Todos::summaryLessThan(const Todo::Ptr &t1, const Todo::Ptr &t2) +{ + return QString::compare(t1->summary(), t2->summary(), Qt::CaseInsensitive) < 0; +} + +bool KCalendarCore::Todos::summaryMoreThan(const Todo::Ptr &t1, const Todo::Ptr &t2) +{ + return QString::compare(t1->summary(), t2->summary(), Qt::CaseInsensitive) > 0; +} + +bool KCalendarCore::Todos::createdLessThan(const Todo::Ptr &t1, const Todo::Ptr &t2) +{ + DateTimeComparison res = compare(t1->created(), t1->allDay(), t2->created(), t2->allDay()); + if (res == Equal) { + return Todos::summaryLessThan(t1, t2); + } else { + return (res & Before || res & AtStart); + } +} + +bool KCalendarCore::Todos::createdMoreThan(const Todo::Ptr &t1, const Todo::Ptr &t2) +{ + DateTimeComparison res = compare(t1->created(), t1->allDay(), t2->created(), t2->allDay()); + if (res == Equal) { + return Todos::summaryMoreThan(t1, t2); + } else { + return (res & After || res & AtEnd); + } +} + +bool KCalendarCore::Incidences::dateLessThan(const Incidence::Ptr &i1, const Incidence::Ptr &i2) +{ + DateTimeComparison res = compare(i1->dateTime(Incidence::RoleSort), i1->allDay(), i2->dateTime(Incidence::RoleSort), i2->allDay()); + if (res == Equal) { + return Incidences::summaryLessThan(i1, i2); + } else { + return (res & Before || res & AtStart); + } +} + +bool KCalendarCore::Incidences::dateMoreThan(const Incidence::Ptr &i1, const Incidence::Ptr &i2) +{ + DateTimeComparison res = compare(i1->dateTime(Incidence::RoleSort), i1->allDay(), i2->dateTime(Incidence::RoleSort), i2->allDay()); + if (res == Equal) { + return Incidences::summaryMoreThan(i1, i2); + } else { + return (res & After || res & AtEnd); + } +} + +bool KCalendarCore::Incidences::createdLessThan(const Incidence::Ptr &i1, const Incidence::Ptr &i2) +{ + DateTimeComparison res = compare(i1->created(), i1->allDay(), i2->created(), i2->allDay()); + if (res == Equal) { + return Incidences::summaryLessThan(i1, i2); + } else { + return (res & Before || res & AtStart); + } +} + +bool KCalendarCore::Incidences::createdMoreThan(const Incidence::Ptr &i1, const Incidence::Ptr &i2) +{ + DateTimeComparison res = compare(i1->created(), i1->allDay(), i2->created(), i2->allDay()); + if (res == Equal) { + return Incidences::summaryMoreThan(i1, i2); + } else { + return (res & After || res & AtEnd); + } +} + +bool KCalendarCore::Incidences::summaryLessThan(const Incidence::Ptr &i1, const Incidence::Ptr &i2) +{ + return QString::compare(i1->summary(), i2->summary(), Qt::CaseInsensitive) < 0; +} + +bool KCalendarCore::Incidences::summaryMoreThan(const Incidence::Ptr &i1, const Incidence::Ptr &i2) +{ + return QString::compare(i1->summary(), i2->summary(), Qt::CaseInsensitive) > 0; +} + +bool KCalendarCore::Incidences::categoriesLessThan(const Incidence::Ptr &i1, const Incidence::Ptr &i2) +{ + const auto res = QString::compare(i1->categoriesStr(), i2->categoriesStr(), Qt::CaseSensitive); + if (res == 0) { + return Incidences::summaryLessThan(i1, i2); + } else { + return res < 0; + } +} + +bool KCalendarCore::Incidences::categoriesMoreThan(const Incidence::Ptr &i1, const Incidence::Ptr &i2) +{ + const auto res = QString::compare(i1->categoriesStr(), i2->categoriesStr(), Qt::CaseSensitive); + if (res == 0) { + return Incidences::summaryMoreThan(i1, i2); + } else { + return res > 0; + } +} diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/sorting.h dde-calendar-5.10.0/3rdparty/kcalendarcore/src/sorting.h --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/sorting.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/sorting.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,99 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + SPDX-FileContributor: Alvaro Manera + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +#ifndef KCALCORE_SORTING_H +#define KCALCORE_SORTING_H + +#include "event.h" +#include "freebusy.h" +#include "journal.h" +#include "person.h" +#include "todo.h" + +namespace KCalendarCore { +namespace Events { +Q_CORE_EXPORT bool startDateLessThan(const Event::Ptr &e1, const Event::Ptr &e2); + +Q_CORE_EXPORT bool summaryLessThan(const Event::Ptr &e1, const Event::Ptr &e2); + +Q_CORE_EXPORT bool summaryMoreThan(const Event::Ptr &e1, const Event::Ptr &e2); + +Q_CORE_EXPORT bool startDateMoreThan(const Event::Ptr &e1, const Event::Ptr &e2); + +Q_CORE_EXPORT bool endDateLessThan(const Event::Ptr &e1, const Event::Ptr &e2); + +Q_CORE_EXPORT bool endDateMoreThan(const Event::Ptr &e1, const Event::Ptr &e2); +} // namespace Events + +namespace Todos { +Q_CORE_EXPORT bool startDateLessThan(const Todo::Ptr &t1, const Todo::Ptr &t2); + +Q_CORE_EXPORT bool startDateMoreThan(const Todo::Ptr &t1, const Todo::Ptr &t2); + +Q_CORE_EXPORT bool dueDateLessThan(const Todo::Ptr &t1, const Todo::Ptr &t2); + +Q_CORE_EXPORT bool dueDateMoreThan(const Todo::Ptr &t1, const Todo::Ptr &t2); + +Q_CORE_EXPORT bool priorityLessThan(const Todo::Ptr &t1, const Todo::Ptr &t2); + +Q_CORE_EXPORT bool priorityMoreThan(const Todo::Ptr &t1, const Todo::Ptr &t2); + +Q_CORE_EXPORT bool percentLessThan(const Todo::Ptr &t1, const Todo::Ptr &t2); + +Q_CORE_EXPORT bool percentMoreThan(const Todo::Ptr &t1, const Todo::Ptr &t2); + +Q_CORE_EXPORT bool summaryLessThan(const Todo::Ptr &t1, const Todo::Ptr &t2); + +Q_CORE_EXPORT bool summaryMoreThan(const Todo::Ptr &t1, const Todo::Ptr &t2); + +Q_CORE_EXPORT bool createdLessThan(const Todo::Ptr &t1, const Todo::Ptr &t2); + +Q_CORE_EXPORT bool createdMoreThan(const Todo::Ptr &t1, const Todo::Ptr &t2); +} // namespace Todos + +namespace Journals { +Q_CORE_EXPORT bool dateLessThan(const Journal::Ptr &j1, const Journal::Ptr &j2); + +Q_CORE_EXPORT bool dateMoreThan(const Journal::Ptr &j1, const Journal::Ptr &j2); + +Q_CORE_EXPORT bool summaryLessThan(const Journal::Ptr &j1, const Journal::Ptr &j2); + +Q_CORE_EXPORT bool summaryMoreThan(const Journal::Ptr &j1, const Journal::Ptr &j2); +} // namespace Journals + +namespace Incidences { +Q_CORE_EXPORT bool dateLessThan(const Incidence::Ptr &i1, const Incidence::Ptr &i2); + +Q_CORE_EXPORT bool dateMoreThan(const Incidence::Ptr &i1, const Incidence::Ptr &i2); + +Q_CORE_EXPORT bool createdLessThan(const Incidence::Ptr &i1, const Incidence::Ptr &i2); + +Q_CORE_EXPORT bool createdMoreThan(const Incidence::Ptr &i1, const Incidence::Ptr &i2); + +Q_CORE_EXPORT bool summaryLessThan(const Incidence::Ptr &i1, const Incidence::Ptr &i2); + +Q_CORE_EXPORT bool summaryMoreThan(const Incidence::Ptr &i1, const Incidence::Ptr &i2); + +/** + * Compare the categories (tags) of two incidences, as returned by categoriesStr(). + * If they are equal, return summaryLessThan(). + * @since 5.83 + */ +Q_CORE_EXPORT bool categoriesLessThan(const Incidence::Ptr &i1, const Incidence::Ptr &i2); + +/** + * Compare the categories (tags) of two incidences, as returned by categoriesStr(). + * If they are equal, return summaryMoreThan(). + * @since 5.83 + */ +Q_CORE_EXPORT bool categoriesMoreThan(const Incidence::Ptr &i1, const Incidence::Ptr &i2); +} // namespace Incidences + +} // namespace KCalendarCore + +#endif diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/todo.cpp dde-calendar-5.10.0/3rdparty/kcalendarcore/src/todo.cpp --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/todo.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/todo.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,562 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 2001-2003 Cornelius Schumacher + SPDX-FileCopyrightText: 2009 Allen Winter + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +/** + @file + This file is part of the API for handling calendar data and + defines the Todo class. + + @brief + Provides a To-do in the sense of RFC2445. + + @author Cornelius Schumacher \ + @author Allen Winter \ +*/ + +#include "todo.h" +#include "recurrence.h" +#include "utils_p.h" +#include "visitor.h" + +#include +#include + +using namespace KCalendarCore; + +/** + Private class that helps to provide binary compatibility between releases. + @internal +*/ +//@cond PRIVATE +class Q_DECL_HIDDEN KCalendarCore::Todo::Private +{ +public: + Private() + { + } + Private(const KCalendarCore::Todo::Private &other) + { + init(other); + } + + void init(const KCalendarCore::Todo::Private &other); + + QDateTime mDtDue; // to-do due date (if there is one) + // ALSO the first occurrence of a recurring to-do + QDateTime mDtRecurrence; // next occurrence (for recurring to-dos) + QDateTime mCompleted; // to-do completion date (if it has been completed) + int mPercentComplete = 0; // to-do percent complete [0,100] + + /** + Returns true if the todo got a new date, else false will be returned. + */ + bool recurTodo(Todo *todo); +}; + +void KCalendarCore::Todo::Private::init(const KCalendarCore::Todo::Private &other) +{ + mDtDue = other.mDtDue; + mDtRecurrence = other.mDtRecurrence; + mCompleted = other.mCompleted; + mPercentComplete = other.mPercentComplete; +} + +//@endcond + +Todo::Todo() + : d(new KCalendarCore::Todo::Private) +{ +} + +Todo::Todo(const Todo &other) + : Incidence(other) + , d(new KCalendarCore::Todo::Private(*other.d)) +{ +} + +Todo::Todo(const Incidence &other) + : Incidence(other) + , d(new KCalendarCore::Todo::Private) +{ +} + +Todo::~Todo() +{ + delete d; +} + +Todo *Todo::clone() const +{ + return new Todo(*this); +} + +IncidenceBase &Todo::assign(const IncidenceBase &other) +{ + if (&other != this) { + Incidence::assign(other); + const Todo *t = static_cast(&other); + d->init(*(t->d)); + } + return *this; +} + +bool Todo::equals(const IncidenceBase &todo) const +{ + if (!Incidence::equals(todo)) { + return false; + } else { + // If they weren't the same type IncidenceBase::equals would had returned false already + const Todo *t = static_cast(&todo); + return ((dtDue() == t->dtDue()) || (!dtDue().isValid() && !t->dtDue().isValid())) && hasDueDate() == t->hasDueDate() + && hasStartDate() == t->hasStartDate() && ((completed() == t->completed()) || (!completed().isValid() && !t->completed().isValid())) + && hasCompletedDate() == t->hasCompletedDate() && percentComplete() == t->percentComplete(); + } +} + +Incidence::IncidenceType Todo::type() const +{ + return TypeTodo; +} + +QByteArray Todo::typeStr() const +{ + return QByteArrayLiteral("Todo"); +} +void Todo::setDtDue(const QDateTime &dtDue, bool first) +{ + startUpdates(); + + // int diffsecs = d->mDtDue.secsTo(dtDue); + + /*if (mReadOnly) return; + const Alarm::List& alarms = alarms(); + for (Alarm *alarm = alarms.first(); alarm; alarm = alarms.next()) { + if (alarm->enabled()) { + alarm->setTime(alarm->time().addSecs(diffsecs)); + } + }*/ + + if (recurs() && !first) { + d->mDtRecurrence = dtDue; + } else { + d->mDtDue = dtDue; + } + + if (recurs() && dtDue.isValid() && (!dtStart().isValid() || dtDue < recurrence()->startDateTime())) { + qDebug() << "To-do recurrences are now calculated against DTSTART. Fixing legacy to-do."; + setDtStart(dtDue); + } + + /*const Alarm::List& alarms = alarms(); + for (Alarm *alarm = alarms.first(); alarm; alarm = alarms.next()) + alarm->setAlarmStart(d->mDtDue);*/ + setFieldDirty(FieldDtDue); + endUpdates(); +} + +QDateTime Todo::dtDue(bool first) const +{ + if (!hasDueDate()) { + return QDateTime(); + } + + const QDateTime start = IncidenceBase::dtStart(); + if (recurs() && !first && d->mDtRecurrence.isValid()) { + if (start.isValid()) { + // This is the normal case, recurring to-dos have a valid DTSTART. + const qint64 duration = start.daysTo(d->mDtDue); + QDateTime dt = d->mDtRecurrence.addDays(duration); + dt.setTime(d->mDtDue.time()); + return dt; + } else { + // This is a legacy case, where recurrence was calculated against DTDUE + return d->mDtRecurrence; + } + } + + return d->mDtDue; +} + +bool Todo::hasDueDate() const +{ + return d->mDtDue.isValid(); +} + +bool Todo::hasStartDate() const +{ + return IncidenceBase::dtStart().isValid(); +} + +QDateTime Todo::dtStart() const +{ + return dtStart(/*first=*/false); +} + +QDateTime Todo::dtStart(bool first) const +{ + if (!hasStartDate()) { + return QDateTime(); + } + + if (recurs() && !first && d->mDtRecurrence.isValid()) { + return d->mDtRecurrence; + } else { + return IncidenceBase::dtStart(); + } +} + +bool Todo::isCompleted() const +{ + return d->mPercentComplete == 100 || status() == StatusCompleted || hasCompletedDate(); +} + +void Todo::setCompleted(bool completed) +{ + update(); + if (completed) { + d->mPercentComplete = 100; + } else { + d->mPercentComplete = 0; + if (hasCompletedDate()) { + d->mCompleted = QDateTime(); + setFieldDirty(FieldCompleted); + } + } + setFieldDirty(FieldPercentComplete); + updated(); + + setStatus(completed ? StatusCompleted : StatusNone); // Calls update()/updated(). +} + +QDateTime Todo::completed() const +{ + if (hasCompletedDate()) { + return d->mCompleted; + } else { + return QDateTime(); + } +} + +void Todo::setCompleted(const QDateTime &completed) +{ + update(); + if (!d->recurTodo(this)) { + if (d->mPercentComplete != 100) { + d->mPercentComplete = 100; + setFieldDirty(FieldPercentComplete); + } + if (d->mCompleted.isValid() != completed.isValid()) { + d->mCompleted = completed.toUTC(); + setFieldDirty(FieldCompleted); + } + } + updated(); + if (status() != StatusNone) { + setStatus(StatusCompleted); // Calls update()/updated() + } +} + +bool Todo::hasCompletedDate() const +{ + return d->mCompleted.isValid(); +} + +int Todo::percentComplete() const +{ + return d->mPercentComplete; +} + +void Todo::setPercentComplete(int percent) +{ + if (percent > 100) { + percent = 100; + } else if (percent < 0) { + percent = 0; + } + + update(); + if (percent != d->mPercentComplete) { + d->mPercentComplete = percent; + setFieldDirty(FieldPercentComplete); + } + if (percent != 100 && d->mCompleted.isValid()) { + d->mCompleted = QDateTime(); + setFieldDirty(FieldCompleted); + } + updated(); + if (percent != 100 && status() == Incidence::StatusCompleted) { + setStatus(Incidence::StatusNone); // Calls update()/updated(). + } +} + +bool Todo::isInProgress(bool first) const +{ + if (isOverdue()) { + return false; + } + + if (d->mPercentComplete > 0) { + return true; + } + + if (hasStartDate() && hasDueDate()) { + if (allDay()) { + QDate currDate = QDate::currentDate(); + if (dtStart(first).date() <= currDate && currDate < dtDue(first).date()) { + return true; + } + } else { + QDateTime currDate = QDateTime::currentDateTimeUtc(); + if (dtStart(first) <= currDate && currDate < dtDue(first)) { + return true; + } + } + } + + return false; +} + +bool Todo::isOpenEnded() const +{ + if (!hasDueDate() && !isCompleted()) { + return true; + } + return false; +} + +bool Todo::isNotStarted(bool first) const +{ + if (d->mPercentComplete > 0) { + return false; + } + + if (!hasStartDate()) { + return false; + } + + if (allDay()) { + if (dtStart(first).date() >= QDate::currentDate()) { + return false; + } + } else { + if (dtStart(first) >= QDateTime::currentDateTimeUtc()) { + return false; + } + } + return true; +} + +void Todo::shiftTimes(const QTimeZone &oldZone, const QTimeZone &newZone) +{ + Incidence::shiftTimes(oldZone, newZone); + d->mDtDue = d->mDtDue.toTimeZone(oldZone); + d->mDtDue.setTimeZone(newZone); + if (recurs()) { + d->mDtRecurrence = d->mDtRecurrence.toTimeZone(oldZone); + d->mDtRecurrence.setTimeZone(newZone); + } + if (hasCompletedDate()) { + d->mCompleted = d->mCompleted.toTimeZone(oldZone); + d->mCompleted.setTimeZone(newZone); + } +} + +void Todo::setDtRecurrence(const QDateTime &dt) +{ + d->mDtRecurrence = dt; + setFieldDirty(FieldRecurrence); +} + +QDateTime Todo::dtRecurrence() const +{ + return d->mDtRecurrence.isValid() ? d->mDtRecurrence : d->mDtDue; +} + +bool Todo::recursOn(const QDate &date, const QTimeZone &timeZone) const +{ + QDate today = QDate::currentDate(); + return Incidence::recursOn(date, timeZone) && !(date < today && d->mDtRecurrence.date() < today && d->mDtRecurrence > recurrence()->startDateTime()); +} + +bool Todo::isOverdue() const +{ + if (!dtDue().isValid()) { + return false; // if it's never due, it can't be overdue + } + + const bool inPast = allDay() ? dtDue().date() < QDate::currentDate() : dtDue() < QDateTime::currentDateTimeUtc(); + + return inPast && !isCompleted(); +} + +void Todo::setAllDay(bool allday) +{ + if (allday != allDay() && !mReadOnly) { + if (hasDueDate()) { + setFieldDirty(FieldDtDue); + } + Incidence::setAllDay(allday); + } +} + +//@cond PRIVATE +bool Todo::Private::recurTodo(Todo *todo) +{ + if (todo && todo->recurs()) { + Recurrence *r = todo->recurrence(); + const QDateTime recurrenceEndDateTime = r->endDateTime(); + QDateTime nextOccurrenceDateTime = r->getNextDateTime(todo->dtStart()); + + if ((r->duration() == -1 || (nextOccurrenceDateTime.isValid() && recurrenceEndDateTime.isValid() && nextOccurrenceDateTime <= recurrenceEndDateTime))) { + // We convert to the same timeSpec so we get the correct .date() + const auto rightNow = QDateTime::currentDateTimeUtc().toTimeZone(nextOccurrenceDateTime.timeZone()); + const bool isDateOnly = todo->allDay(); + + /* Now we search for the occurrence that's _after_ the currentUtcDateTime, or + * if it's dateOnly, the occurrrence that's _during or after today_. + * The reason we use "<" for date only, but "<=" for occurrences with time is that + * if it's date only, the user can still complete that occurrence today, so that's + * the current occurrence that needs completing. + */ + while (!todo->recursAt(nextOccurrenceDateTime) || (!isDateOnly && nextOccurrenceDateTime <= rightNow) + || (isDateOnly && nextOccurrenceDateTime.date() < rightNow.date())) { + if (!nextOccurrenceDateTime.isValid() || (nextOccurrenceDateTime > recurrenceEndDateTime && r->duration() != -1)) { + return false; + } + nextOccurrenceDateTime = r->getNextDateTime(nextOccurrenceDateTime); + } + + todo->setDtRecurrence(nextOccurrenceDateTime); + todo->setCompleted(false); + todo->setRevision(todo->revision() + 1); + + return true; + } + } + + return false; +} +//@endcond + +bool Todo::accept(Visitor &v, const IncidenceBase::Ptr &incidence) +{ + return v.visit(incidence.staticCast()); +} + +QDateTime Todo::dateTime(DateTimeRole role) const +{ + switch (role) { + case RoleAlarmStartOffset: + return dtStart(); + case RoleAlarmEndOffset: + return dtDue(); + case RoleSort: + // Sorting to-dos first compares dtDue, then dtStart if + // dtDue doesn't exist + return hasDueDate() ? dtDue() : dtStart(); + case RoleCalendarHashing: + return dtDue(); + case RoleStartTimeZone: + return dtStart(); + case RoleEndTimeZone: + return dtDue(); + case RoleEndRecurrenceBase: + return dtDue(); + case RoleDisplayStart: + case RoleDisplayEnd: + return dtDue().isValid() ? dtDue() : dtStart(); + case RoleAlarm: + if (alarms().isEmpty()) { + return QDateTime(); + } else { + Alarm::Ptr alarm = alarms().at(0); + if (alarm->hasStartOffset() && hasStartDate()) { + return dtStart(); + } else if (alarm->hasEndOffset() && hasDueDate()) { + return dtDue(); + } else { + // The application shouldn't add alarms on to-dos without dates. + return QDateTime(); + } + } + case RoleRecurrenceStart: + if (dtStart().isValid()) { + return dtStart(); + } + return dtDue(); // For the sake of backwards compatibility + // where we calculated recurrences based on dtDue + case RoleEnd: + return dtDue(); + default: + return QDateTime(); + } +} + +void Todo::setDateTime(const QDateTime &dateTime, DateTimeRole role) +{ + switch (role) { + case RoleDnD: + setDtDue(dateTime); + break; + case RoleEnd: + setDtDue(dateTime, true); + break; + default: + qDebug() << "Unhandled role" << role; + } +} + +void Todo::virtual_hook(VirtualHook id, void *data) +{ + Q_UNUSED(id); + Q_UNUSED(data); +} + +QLatin1String Todo::mimeType() const +{ + return Todo::todoMimeType(); +} + +QLatin1String Todo::todoMimeType() +{ + return QLatin1String("application/x-vnd.akonadi.calendar.todo"); +} + +QLatin1String Todo::iconName(const QDateTime &recurrenceId) const +{ + const bool usesCompletedTaskPixmap = isCompleted() || (recurs() && recurrenceId.isValid() && (recurrenceId < dtStart(/*first=*/false))); + + if (usesCompletedTaskPixmap) { + return QLatin1String("task-complete"); + } else { + return QLatin1String("view-calendar-tasks"); + } +} + +void Todo::serialize(QDataStream &out) const +{ + Incidence::serialize(out); + serializeQDateTimeAsKDateTime(out, d->mDtDue); + serializeQDateTimeAsKDateTime(out, d->mDtRecurrence); + serializeQDateTimeAsKDateTime(out, d->mCompleted); + out << d->mPercentComplete; +} + +void Todo::deserialize(QDataStream &in) +{ + Incidence::deserialize(in); + deserializeKDateTimeAsQDateTime(in, d->mDtDue); + deserializeKDateTimeAsQDateTime(in, d->mDtRecurrence); + deserializeKDateTimeAsQDateTime(in, d->mCompleted); + in >> d->mPercentComplete; +} + +bool Todo::supportsGroupwareCommunication() const +{ + return true; +} diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/todo.h dde-calendar-5.10.0/3rdparty/kcalendarcore/src/todo.h --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/todo.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/todo.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,367 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 2001-2003 Cornelius Schumacher + SPDX-FileCopyrightText: 2009 Allen Winter + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +/** + @file + This file is part of the API for handling calendar data and + defines the Todo class. + + @author Cornelius Schumacher \ + @author Allen Winter \ +*/ + +#ifndef KCALCORE_TODO_H +#define KCALCORE_TODO_H + +#include "incidence.h" + +namespace KCalendarCore { +/** + @brief + Provides a To-do in the sense of RFC2445. +*/ +class Q_CORE_EXPORT Todo : public Incidence +{ +public: + /** + A shared pointer to a Todo object. + */ + typedef QSharedPointer Ptr; + + /** + List of to-dos. + */ + typedef QVector List; + + ///@cond PRIVATE + // needed for Akonadi polymorphic payload support + typedef Incidence SuperClass; + ///@endcond + + /** + Constructs an empty to-do. + */ + Todo(); + + /** + Copy constructor. + @param other is the to-do to copy. + */ + Todo(const Todo &other); + + /** + Costructs a todo out of an incidence + This constructs allows to make it easy to create a todo from an event. + @param other is the incidence to copy. + @since 4.14 + */ + Todo(const Incidence &other); // krazy:exclude=explicit (copy ctor) + + /** + Destroys a to-do. + */ + ~Todo() override; + + /** + @copydoc IncidenceBase::type() + */ + Q_REQUIRED_RESULT IncidenceType type() const override; + + /** + @copydoc IncidenceBase::typeStr() + */ + Q_REQUIRED_RESULT QByteArray typeStr() const override; + + /** + Returns an exact copy of this todo. The returned object is owned by the caller. + @return A pointer to a Todo containing an exact copy of this object. + */ + Todo *clone() const override; + + /** + Sets due date and time. + + @param dtDue The due date/time. + @param first If true and the todo recurs, the due date of the first + occurrence will be returned. If false and recurrent, the date of the + current occurrence will be returned. If non-recurrent, the normal due + date will be returned. + */ + void setDtDue(const QDateTime &dtDue, bool first = false); + + /** + Returns the todo due datetime. + + @param first If true and the todo recurs, the due datetime of the first + occurrence will be returned. If false and recurrent, the datetime of the + current occurrence will be returned. If non-recurrent, the normal due + datetime will be returned. + @return A QDateTime containing the todo due datetime. + */ + Q_REQUIRED_RESULT QDateTime dtDue(bool first = false) const; + + /** + Returns if the todo has a due datetime. + @return true if the todo has a due datetime; false otherwise. + */ + Q_REQUIRED_RESULT bool hasDueDate() const; + + /** + Returns if the todo has a start datetime. + @return true if the todo has a start datetime; false otherwise. + */ + Q_REQUIRED_RESULT bool hasStartDate() const; + + /** + @copydoc IncidenceBase::dtStart() + */ + Q_REQUIRED_RESULT QDateTime dtStart() const override; + + /** + Returns the start datetime of the todo. + + @param first If true, the start datetime of the todo will be returned; + also, if the todo recurs, the start datetime of the first occurrence + will be returned. + If false and the todo recurs, the relative start datetime will be returned, + based on the datetime returned by dtRecurrence(). + @return A QDateTime for the start datetime of the todo. + */ + Q_REQUIRED_RESULT QDateTime dtStart(bool first) const; + + /** + Returns whether the todo is completed or not. + @return true if the todo is 100% completed, has status @c StatusCompleted, + or has a completed date; false otherwise. + + @see isOverdue, isInProgress(), isOpenEnded(), isNotStarted(bool), + setCompleted(), percentComplete() + */ + Q_REQUIRED_RESULT bool isCompleted() const; + + /** + Sets completion percentage and status. + + @param completed If @c true, percentage complete is set to 100%, and + status is set to @c StatusCompleted; the completion date is @b not set or cleared. + If @c false, percentage complete is set to 0%, + status is set to @c StatusNone, and the completion date is cleared. + + + @see isCompleted(), percentComplete(), hasCompletedDate() + */ + void setCompleted(bool completed); + + /** + Returns what percentage of the to-do is completed. + @return The percentage complete of the to-do as an integer between 0 and 100, inclusive. + @see setPercentComplete(), isCompleted() + */ + Q_REQUIRED_RESULT int percentComplete() const; + + /** + Sets what percentage of the to-do is completed. + + To prevent inconsistency, if @p percent is not 100, completed() is cleared, + and if status() is StatusCompleted it is reset to StatusNone. + + @param percent is the completion percentage. Values greater than 100 are + treated as 100; values less than p are treated as 0. + + @see isCompleted(), setCompleted() + */ + void setPercentComplete(int percent); + + /** + Returns the to-do was completion datetime. + + @return A QDateTime for the completion datetime of the to-do. + @see hasCompletedDate() + */ + Q_REQUIRED_RESULT QDateTime completed() const; + + /** + Marks this Todo, or its current recurrence, as completed. + + If the todo does not recur, its completion percentage is set to 100%, + and its completion date is set to @p completeDate. If its status is not + StatusNone, it is set to StatusCompleted. + + @note + If @p completeDate is invalid, the completion date is cleared, but the + todo is still "complete". + + If the todo recurs, the first incomplete recurrence is marked complete. + + @param completeDate is the to-do completion date. + @see completed(), hasCompletedDate() + */ + void setCompleted(const QDateTime &completeDate); + + /** + Returns if the to-do has a completion datetime. + + @return true if the to-do has a date associated with completion; false otherwise. + @see setCompleted(), completed() + */ + bool hasCompletedDate() const; + + /** + Returns true, if the to-do is in-progress (started, or >0% completed); + otherwise return false. If the to-do is overdue, then it is not + considered to be in-progress. + + @param first If true, the start and due dates of the todo will be used; + also, if the todo recurs, the start date and due date of the first + occurrence will be used. + If false and the todo recurs, the relative start and due dates will be + used, based on the date returned by dtRecurrence(). + @see isOverdue(), isCompleted(), isOpenEnded(), isNotStarted(bool) + */ + Q_REQUIRED_RESULT bool isInProgress(bool first) const; + + /** + Returns true, if the to-do is open-ended (no due date); false otherwise. + @see isOverdue(), isCompleted(), isInProgress(), isNotStarted(bool) + */ + Q_REQUIRED_RESULT bool isOpenEnded() const; + + /** + Returns true, if the to-do has yet to be started (no start date and 0% + completed); otherwise return false. + + @param first If true, the start date of the todo will be used; + also, if the todo recurs, the start date of the first occurrence + will be used. + If false and the todo recurs, the relative start date will be used, + based on the date returned by dtRecurrence(). + @see isOverdue(), isCompleted(), isInProgress(), isOpenEnded() + */ + Q_REQUIRED_RESULT bool isNotStarted(bool first) const; + + /** + @copydoc IncidenceBase::shiftTimes() + */ + void shiftTimes(const QTimeZone &oldZone, const QTimeZone &newZone) override; + + /** + @copydoc IncidenceBase::setAllDay(). + */ + void setAllDay(bool allDay) override; + + /** + Sets the due date/time of the current occurrence if recurrent. + + @param dt is the + */ + void setDtRecurrence(const QDateTime &dt); + + /** + Returns the due date/time of the current occurrence if recurrent. + */ + Q_REQUIRED_RESULT QDateTime dtRecurrence() const; + + /** + Returns true if the @p date specified is one on which the to-do will + recur. Todos are a special case, hence the overload. It adds an extra + check, which make it return false if there's an occurrence between + the recur start and today. + + @param date is the date to check. + @param timeZone is the time zone + */ + bool recursOn(const QDate &date, const QTimeZone &timeZone) const override; + + /** + Returns true if this todo is overdue (e.g. due date is lower than today + and not completed), else false. + @see isCompleted(), isInProgress(), isOpenEnded(), isNotStarted(bool) + */ + bool isOverdue() const; + + /** + @copydoc IncidenceBase::dateTime() + */ + Q_REQUIRED_RESULT QDateTime dateTime(DateTimeRole role) const override; + + /** + @copydoc IncidenceBase::setDateTime() + */ + void setDateTime(const QDateTime &dateTime, DateTimeRole role) override; + + /** + @copydoc IncidenceBase::mimeType() + */ + Q_REQUIRED_RESULT QLatin1String mimeType() const override; + + /** + @copydoc Incidence::iconName() + */ + Q_REQUIRED_RESULT QLatin1String iconName(const QDateTime &recurrenceId = {}) const override; + + /** + @copydoc + Incidence::supportsGroupwareCommunication() + */ + bool supportsGroupwareCommunication() const override; + + /** + Returns the Akonadi specific sub MIME type of a KCalendarCore::Todo. + */ + Q_REQUIRED_RESULT static QLatin1String todoMimeType(); + +protected: + /** + Compare this with @p todo for equality. + @param todo is the to-do to compare. + */ + bool equals(const IncidenceBase &todo) const override; + + /** + @copydoc IncidenceBase::assign() + */ + IncidenceBase &assign(const IncidenceBase &other) override; + + /** + @copydoc IncidenceBase::virtual_hook() + */ + void virtual_hook(VirtualHook id, void *data) override; + +private: + /** + @copydoc IncidenceBase::accept() + */ + bool accept(Visitor &v, const IncidenceBase::Ptr &incidence) override; + + /** + Disabled, otherwise could be dangerous if you subclass Todo. + Use IncidenceBase::operator= which is safe because it calls + virtual function assign(). + @param other is another Todo object to assign to this one. + */ + Todo &operator=(const Todo &other); + + // For polymorfic serialization + void serialize(QDataStream &out) const override; + void deserialize(QDataStream &in) override; + + //@cond PRIVATE + class Private; + Private *const d; + //@endcond +}; + +} // namespace KCalendarCore + +//@cond PRIVATE +Q_DECLARE_TYPEINFO(KCalendarCore::Todo::Ptr, Q_MOVABLE_TYPE); +Q_DECLARE_METATYPE(KCalendarCore::Todo::Ptr) +Q_DECLARE_METATYPE(KCalendarCore::Todo *) +//@endcond + +#endif diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/utils.cpp dde-calendar-5.10.0/3rdparty/kcalendarcore/src/utils.cpp --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/utils.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/utils.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,119 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 2017 Daniel Vrátil + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ + +#include "utils_p.h" + +#include +#include + +// To remain backwards compatible we need to (de)serialize QDateTime the way KDateTime +// was (de)serialized +void KCalendarCore::serializeQDateTimeAsKDateTime(QDataStream &out, const QDateTime &dt) +{ + out << dt.date() << dt.time(); + switch (dt.timeSpec()) { + case Qt::UTC: + out << static_cast('u'); + break; + case Qt::OffsetFromUTC: + out << static_cast('o') << dt.offsetFromUtc(); + break; + case Qt::TimeZone: + serializeQTimeZoneAsSpec(out, dt.timeZone()); + break; + case Qt::LocalTime: + out << static_cast('c'); + break; + } + const bool isDateOnly = dt.date().isValid() && !dt.time().isValid(); + out << quint8(isDateOnly ? 0x01 : 0x00); +} + +void KCalendarCore::deserializeKDateTimeAsQDateTime(QDataStream &in, QDateTime &dt) +{ + QDate date; + QTime time; + quint8 ts, flags; + + in >> date >> time >> ts; + switch (static_cast(ts)) { + case 'u': + dt = QDateTime(date, time, Qt::UTC); + break; + case 'o': { + int offset; + in >> offset; + dt = QDateTime(date, time, Qt::OffsetFromUTC, offset); + break; + } + case 'z': { + QString tzid; + in >> tzid; + dt = QDateTime(date, time, QTimeZone(tzid.toUtf8())); + break; + } + case 'c': + dt = QDateTime(date, time, Qt::LocalTime); + break; + } + + // unused, we don't have a special handling for date-only QDateTime + in >> flags; +} + +void KCalendarCore::serializeQTimeZoneAsSpec(QDataStream &out, const QTimeZone &tz) +{ + out << static_cast('z') << (tz.isValid() ? QString::fromUtf8(tz.id()) : QString()); +} + +void KCalendarCore::deserializeSpecAsQTimeZone(QDataStream &in, QTimeZone &tz) +{ + quint8 ts; + in >> ts; + switch (static_cast(ts)) { + case 'u': + tz = QTimeZone::utc(); + return; + case 'o': { + int offset; + in >> offset; + tz = QTimeZone(offset); + return; + } + case 'z': { + QString tzid; + in >> tzid; + tz = QTimeZone(tzid.toUtf8()); + return; + } + case 'c': + tz = QTimeZone::systemTimeZone(); + break; + } +} + +void KCalendarCore::serializeQDateTimeList(QDataStream &out, const QList &list) +{ + out << list.size(); + for (const auto &i : list) { + serializeQDateTimeAsKDateTime(out, i); + } +} + +void KCalendarCore::deserializeQDateTimeList(QDataStream &in, QList &list) +{ + int size; + in >> size; + list.clear(); + list.reserve(size); + for (int i = 0; i < size; ++i) { + QDateTime dt; + deserializeKDateTimeAsQDateTime(in, dt); + list << dt; + } +} diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/utils_p.h dde-calendar-5.10.0/3rdparty/kcalendarcore/src/utils_p.h --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/utils_p.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/utils_p.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,31 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 2017 Daniel Vrátil + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ + +#ifndef KCALCORE_UTILS_H +#define KCALCORE_UTILS_H + +#include + +class QDataStream; + +namespace KCalendarCore { +/** + * Helpers to retain backwards compatibility of binary serialization. + */ +void serializeQDateTimeAsKDateTime(QDataStream &out, const QDateTime &dt); +Q_CORE_EXPORT void deserializeKDateTimeAsQDateTime(QDataStream &in, QDateTime &dt); + +void serializeQDateTimeList(QDataStream &out, const QList &list); +void deserializeQDateTimeList(QDataStream &in, QList &list); + +void serializeQTimeZoneAsSpec(QDataStream &out, const QTimeZone &tz); +void deserializeSpecAsQTimeZone(QDataStream &in, QTimeZone &tz); + +} // namespace KCalendarCore + +#endif diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/vcalformat.cpp dde-calendar-5.10.0/3rdparty/kcalendarcore/src/vcalformat.cpp --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/vcalformat.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/vcalformat.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,1676 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 1998 Preston Brown + SPDX-FileCopyrightText: 2001 Cornelius Schumacher + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +/** + @file + This file is part of the API for handling calendar data and + defines the VCalFormat base class. + + This class implements the vCalendar format. It provides methods for + loading/saving/converting vCalendar format data into the internal + representation as Calendar and Incidences. + + @brief + vCalendar format implementation. + + @author Preston Brown \ + @author Cornelius Schumacher \ +*/ +#include "vcalformat.h" +#include "calendar.h" +#include "exceptions.h" + +extern "C" { +#include "libical/vcc.h" +#include "libical/vobject.h" +} + +#include +#include +#include // for .toHtmlEscaped() and Qt::mightBeRichText() +#include +#include + +using namespace KCalendarCore; + +/** + Private class that helps to provide binary compatibility between releases. + @internal +*/ +//@cond PRIVATE +template +void removeAllVCal(QVector> &c, const QSharedPointer &x) +{ + if (c.count() < 1) { + return; + } + + int cnt = c.count(x); + if (cnt != 1) { + qCritical() << "There number of relatedTos for this incidence is " << cnt << " (there must be 1 relatedTo only)"; + Q_ASSERT_X(false, "removeAllVCal", "Count is not 1."); + return; + } + + c.remove(c.indexOf(x)); +} + +class Q_DECL_HIDDEN KCalendarCore::VCalFormat::Private +{ +public: + Calendar::Ptr mCalendar; + Event::List mEventsRelate; // Events with relations + Todo::List mTodosRelate; // To-dos with relations + QSet mManuallyWrittenExtensionFields; // X- fields that are manually dumped +}; +//@endcond + +VCalFormat::VCalFormat() + : d(new KCalendarCore::VCalFormat::Private) +{ +} + +VCalFormat::~VCalFormat() +{ + delete d; +} + +bool VCalFormat::load(const Calendar::Ptr &calendar, const QString &fileName) +{ + d->mCalendar = calendar; + + clearException(); + + // this is not necessarily only 1 vcal. Could be many vcals, or include + // a vcard... + VObject *vcal = Parse_MIME_FromFileName(const_cast(QFile::encodeName(fileName).data())); + + if (!vcal) { + setException(new Exception(Exception::CalVersionUnknown)); + return false; + } + + // any other top-level calendar stuff should be added/initialized here + + // put all vobjects into their proper places + auto savedTimeZoneId = d->mCalendar->timeZoneId(); + populate(vcal, false, fileName); + d->mCalendar->setTimeZoneId(savedTimeZoneId); + + // clean up from vcal API stuff + cleanVObjects(vcal); + cleanStrTbl(); + + return true; +} + +bool VCalFormat::save(const Calendar::Ptr &calendar, const QString &fileName) +{ + Q_UNUSED(calendar); + Q_UNUSED(fileName); + qWarning() << "Saving VCAL is not supported"; + return false; +} + +bool VCalFormat::fromString(const Calendar::Ptr &calendar, const QString &string, bool deleted, const QString ¬ebook) +{ + return fromRawString(calendar, string.toUtf8(), deleted, notebook); +} + +bool VCalFormat::fromRawString(const Calendar::Ptr &calendar, const QByteArray &string, bool deleted, const QString ¬ebook) +{ + d->mCalendar = calendar; + + if (!string.size()) { + return false; + } + + VObject *vcal = Parse_MIME(string.data(), string.size()); + if (!vcal) { + return false; + } + + VObjectIterator i; + initPropIterator(&i, vcal); + + // put all vobjects into their proper places + auto savedTimeZoneId = d->mCalendar->timeZoneId(); + populate(vcal, deleted, notebook); + d->mCalendar->setTimeZoneId(savedTimeZoneId); + + // clean up from vcal API stuff + cleanVObjects(vcal); + cleanStrTbl(); + + return true; +} + +QString VCalFormat::toString(const Calendar::Ptr &calendar, const QString ¬ebook, bool deleted) +{ + Q_UNUSED(calendar); + Q_UNUSED(notebook); + Q_UNUSED(deleted); + + qWarning() << "Exporting into VCAL is not supported"; + return {}; +} + +Todo::Ptr VCalFormat::VTodoToEvent(VObject *vtodo) +{ + VObject *vo = nullptr; + VObjectIterator voi; + char *s = nullptr; + + Todo::Ptr anEvent(new Todo); + + // creation date + if ((vo = isAPropertyOf(vtodo, VCDCreatedProp)) != nullptr) { + anEvent->setCreated(ISOToQDateTime(QString::fromUtf8(s = fakeCString(vObjectUStringZValue(vo))))); + deleteStr(s); + } + + // unique id + vo = isAPropertyOf(vtodo, VCUniqueStringProp); + // while the UID property is preferred, it is not required. We'll use the + // default Event UID if none is given. + if (vo) { + anEvent->setUid(QString::fromUtf8(s = fakeCString(vObjectUStringZValue(vo)))); + deleteStr(s); + } + + // last modification date + if ((vo = isAPropertyOf(vtodo, VCLastModifiedProp)) != nullptr) { + anEvent->setLastModified(ISOToQDateTime(QString::fromUtf8(s = fakeCString(vObjectUStringZValue(vo))))); + deleteStr(s); + } else { + anEvent->setLastModified(QDateTime::currentDateTimeUtc()); + } + + // organizer + // if our extension property for the event's ORGANIZER exists, add it. + if ((vo = isAPropertyOf(vtodo, ICOrganizerProp)) != nullptr) { + anEvent->setOrganizer(QString::fromUtf8(s = fakeCString(vObjectUStringZValue(vo)))); + deleteStr(s); + } else { + if (d->mCalendar->owner().name() != QLatin1String("Unknown Name")) { + anEvent->setOrganizer(d->mCalendar->owner()); + } + } + + // attendees. + initPropIterator(&voi, vtodo); + while (moreIteration(&voi)) { + vo = nextVObject(&voi); + if (strcmp(vObjectName(vo), VCAttendeeProp) == 0) { + Attendee a; + VObject *vp; + s = fakeCString(vObjectUStringZValue(vo)); + QString tmpStr = QString::fromUtf8(s); + deleteStr(s); + tmpStr = tmpStr.simplified(); + int emailPos1; + if ((emailPos1 = tmpStr.indexOf(QLatin1Char('<'))) > 0) { + // both email address and name + int emailPos2 = tmpStr.lastIndexOf(QLatin1Char('>')); + a = Attendee(tmpStr.left(emailPos1 - 1), tmpStr.mid(emailPos1 + 1, emailPos2 - (emailPos1 + 1))); + } else if (tmpStr.indexOf(QLatin1Char('@')) > 0) { + // just an email address + a = Attendee(QString(), tmpStr); + } else { + // just a name + // WTF??? Replacing the spaces of a name and using this as email? + QString email = tmpStr.replace(QLatin1Char(' '), QLatin1Char('.')); + a = Attendee(tmpStr, email); + } + + // is there an RSVP property? + if ((vp = isAPropertyOf(vo, VCRSVPProp)) != nullptr) { + a.setRSVP(vObjectStringZValue(vp)); + } + // is there a status property? + if ((vp = isAPropertyOf(vo, VCStatusProp)) != nullptr) { + a.setStatus(readStatus(vObjectStringZValue(vp))); + } + // add the attendee + anEvent->addAttendee(a); + } + } + + // description for todo + if ((vo = isAPropertyOf(vtodo, VCDescriptionProp)) != nullptr) { + s = fakeCString(vObjectUStringZValue(vo)); + anEvent->setDescription(QString::fromUtf8(s), Qt::mightBeRichText(QString::fromUtf8(s))); + deleteStr(s); + } + + // summary + if ((vo = isAPropertyOf(vtodo, VCSummaryProp))) { + s = fakeCString(vObjectUStringZValue(vo)); + anEvent->setSummary(QString::fromUtf8(s), Qt::mightBeRichText(QString::fromUtf8(s))); + deleteStr(s); + } + + // location + if ((vo = isAPropertyOf(vtodo, VCLocationProp)) != nullptr) { + s = fakeCString(vObjectUStringZValue(vo)); + anEvent->setLocation(QString::fromUtf8(s), Qt::mightBeRichText(QString::fromUtf8(s))); + deleteStr(s); + } + + // completed + // was: status + if ((vo = isAPropertyOf(vtodo, VCStatusProp)) != nullptr) { + s = fakeCString(vObjectUStringZValue(vo)); + if (s && strcmp(s, "COMPLETED") == 0) { + anEvent->setCompleted(true); + } else { + anEvent->setCompleted(false); + } + deleteStr(s); + } else { + anEvent->setCompleted(false); + } + + // completion date + if ((vo = isAPropertyOf(vtodo, VCCompletedProp)) != nullptr) { + anEvent->setCompleted(ISOToQDateTime(QString::fromUtf8(s = fakeCString(vObjectUStringZValue(vo))))); + deleteStr(s); + } + + // priority + if ((vo = isAPropertyOf(vtodo, VCPriorityProp))) { + s = fakeCString(vObjectUStringZValue(vo)); + if (s) { + anEvent->setPriority(atoi(s)); + deleteStr(s); + } + } + + anEvent->setAllDay(false); + + // due date + if ((vo = isAPropertyOf(vtodo, VCDueProp)) != nullptr) { + anEvent->setDtDue(ISOToQDateTime(QString::fromUtf8(s = fakeCString(vObjectUStringZValue(vo))))); + deleteStr(s); + if (anEvent->dtDue().time().hour() == 0 && anEvent->dtDue().time().minute() == 0 && anEvent->dtDue().time().second() == 0) { + anEvent->setAllDay(true); + } + } else { + anEvent->setDtDue(QDateTime()); + } + + // start time + if ((vo = isAPropertyOf(vtodo, VCDTstartProp)) != nullptr) { + anEvent->setDtStart(ISOToQDateTime(QString::fromUtf8(s = fakeCString(vObjectUStringZValue(vo))))); + deleteStr(s); + if (anEvent->dtStart().time().hour() == 0 && anEvent->dtStart().time().minute() == 0 && anEvent->dtStart().time().second() == 0) { + anEvent->setAllDay(true); + } + } else { + anEvent->setDtStart(QDateTime()); + } + + // recurrence stuff + if ((vo = isAPropertyOf(vtodo, VCRRuleProp)) != nullptr) { + uint recurrenceType = Recurrence::rNone; + int recurrenceTypeAbbrLen = 0; + + QString tmpStr = (QString::fromUtf8(s = fakeCString(vObjectUStringZValue(vo)))); + deleteStr(s); + tmpStr = tmpStr.simplified(); + const int tmpStrLen = tmpStr.length(); + if (tmpStrLen > 0) { + tmpStr = tmpStr.toUpper(); + // first, read the type of the recurrence + recurrenceTypeAbbrLen = 1; + if (tmpStr.at(0) == QLatin1Char('D')) { + recurrenceType = Recurrence::rDaily; + } else if (tmpStr.at(0) == QLatin1Char('W')) { + recurrenceType = Recurrence::rWeekly; + } else if (tmpStrLen > 1) { + recurrenceTypeAbbrLen = 2; + if (tmpStr.leftRef(2) == QLatin1String("MP")) { + recurrenceType = Recurrence::rMonthlyPos; + } else if (tmpStr.leftRef(2) == QLatin1String("MD")) { + recurrenceType = Recurrence::rMonthlyDay; + } else if (tmpStr.leftRef(2) == QLatin1String("YM")) { + recurrenceType = Recurrence::rYearlyMonth; + } else if (tmpStr.leftRef(2) == QLatin1String("YD")) { + recurrenceType = Recurrence::rYearlyDay; + } + } + } + + if (recurrenceType != Recurrence::rNone) { + // Immediately after the type is the frequency + int index = tmpStr.indexOf(QLatin1Char(' ')); + int last = tmpStr.lastIndexOf(QLatin1Char(' ')) + 1; // find last entry + int rFreq = tmpStr.midRef(recurrenceTypeAbbrLen, (index - 1)).toInt(); + ++index; // advance to beginning of stuff after freq + + // Read the type-specific settings + switch (recurrenceType) { + case Recurrence::rDaily: + anEvent->recurrence()->setDaily(rFreq); + break; + + case Recurrence::rWeekly: { + QBitArray qba(7); + QString dayStr; + if (index == last) { + // e.g. W1 #0 + qba.setBit(anEvent->dtStart().date().dayOfWeek() - 1); + } else { + // e.g. W1 SU #0 + while (index < last) { + dayStr = tmpStr.mid(index, 3); + int dayNum = numFromDay(dayStr); + if (dayNum >= 0) { + qba.setBit(dayNum); + } + index += 3; // advance to next day, or possibly "#" + } + } + anEvent->recurrence()->setWeekly(rFreq, qba); + break; + } + + case Recurrence::rMonthlyPos: { + anEvent->recurrence()->setMonthly(rFreq); + + QBitArray qba(7); + short tmpPos; + if (index == last) { + // e.g. MP1 #0 + tmpPos = anEvent->dtStart().date().day() / 7 + 1; + if (tmpPos == 5) { + tmpPos = -1; + } + qba.setBit(anEvent->dtStart().date().dayOfWeek() - 1); + anEvent->recurrence()->addMonthlyPos(tmpPos, qba); + } else { + // e.g. MP1 1+ SU #0 + while (index < last) { + tmpPos = tmpStr.mid(index, 1).toShort(); + index += 1; + if (tmpStr.mid(index, 1) == QLatin1String("-")) { + // convert tmpPos to negative + tmpPos = 0 - tmpPos; + } + index += 2; // advance to day(s) + while (numFromDay(tmpStr.mid(index, 3)) >= 0) { + int dayNum = numFromDay(tmpStr.mid(index, 3)); + qba.setBit(dayNum); + index += 3; // advance to next day, or possibly pos or "#" + } + anEvent->recurrence()->addMonthlyPos(tmpPos, qba); + qba.detach(); + qba.fill(false); // clear out + } // while != "#" + } + break; + } + + case Recurrence::rMonthlyDay: + anEvent->recurrence()->setMonthly(rFreq); + if (index == last) { + // e.g. MD1 #0 + short tmpDay = anEvent->dtStart().date().day(); + anEvent->recurrence()->addMonthlyDate(tmpDay); + } else { + // e.g. MD1 3 #0 + while (index < last) { + int index2 = tmpStr.indexOf(QLatin1Char(' '), index); + if ((tmpStr.mid((index2 - 1), 1) == QLatin1String("-")) || (tmpStr.mid((index2 - 1), 1) == QLatin1String("+"))) { + index2 = index2 - 1; + } + short tmpDay = tmpStr.mid(index, (index2 - index)).toShort(); + index = index2; + if (tmpStr.mid(index, 1) == QLatin1String("-")) { + tmpDay = 0 - tmpDay; + } + index += 2; // advance the index; + anEvent->recurrence()->addMonthlyDate(tmpDay); + } // while != # + } + break; + + case Recurrence::rYearlyMonth: + anEvent->recurrence()->setYearly(rFreq); + + if (index == last) { + // e.g. YM1 #0 + short tmpMonth = anEvent->dtStart().date().month(); + anEvent->recurrence()->addYearlyMonth(tmpMonth); + } else { + // e.g. YM1 3 #0 + while (index < last) { + int index2 = tmpStr.indexOf(QLatin1Char(' '), index); + short tmpMonth = tmpStr.mid(index, (index2 - index)).toShort(); + index = index2 + 1; + anEvent->recurrence()->addYearlyMonth(tmpMonth); + } // while != # + } + break; + + case Recurrence::rYearlyDay: + anEvent->recurrence()->setYearly(rFreq); + + if (index == last) { + // e.g. YD1 #0 + short tmpDay = anEvent->dtStart().date().dayOfYear(); + anEvent->recurrence()->addYearlyDay(tmpDay); + } else { + // e.g. YD1 123 #0 + while (index < last) { + int index2 = tmpStr.indexOf(QLatin1Char(' '), index); + short tmpDay = tmpStr.mid(index, (index2 - index)).toShort(); + index = index2 + 1; + anEvent->recurrence()->addYearlyDay(tmpDay); + } // while != # + } + break; + + default: + break; + } + + // find the last field, which is either the duration or the end date + index = last; + if (tmpStr.mid(index, 1) == QLatin1String("#")) { + // Nr of occurrences + index++; + int rDuration = tmpStr.midRef(index, tmpStr.length() - index).toInt(); + if (rDuration > 0) { + anEvent->recurrence()->setDuration(rDuration); + } + } else if (tmpStr.indexOf(QLatin1Char('T'), index) != -1) { + QDateTime rEndDate = ISOToQDateTime(tmpStr.mid(index, tmpStr.length() - index)); + anEvent->recurrence()->setEndDateTime(rEndDate); + } + } else { + qDebug() << "we don't understand this type of recurrence!"; + } // if known recurrence type + } // repeats + + // recurrence exceptions + if ((vo = isAPropertyOf(vtodo, VCExpDateProp)) != nullptr) { + s = fakeCString(vObjectUStringZValue(vo)); + QStringList exDates = QString::fromUtf8(s).split(QLatin1Char(',')); + QStringList::ConstIterator it; + for (it = exDates.constBegin(); it != exDates.constEnd(); ++it) { + QDateTime exDate = ISOToQDateTime(*it); + if (exDate.time().hour() == 0 && exDate.time().minute() == 0 && exDate.time().second() == 0) { + anEvent->recurrence()->addExDate(ISOToQDate(*it)); + } else { + anEvent->recurrence()->addExDateTime(exDate); + } + } + deleteStr(s); + } + + // alarm stuff + if ((vo = isAPropertyOf(vtodo, VCDAlarmProp))) { + Alarm::Ptr alarm; + VObject *a = isAPropertyOf(vo, VCRunTimeProp); + VObject *b = isAPropertyOf(vo, VCDisplayStringProp); + + if (a || b) { + alarm = anEvent->newAlarm(); + if (a) { + alarm->setTime(ISOToQDateTime(QString::fromUtf8(s = fakeCString(vObjectUStringZValue(a))))); + deleteStr(s); + } + alarm->setEnabled(true); + if (b) { + s = fakeCString(vObjectUStringZValue(b)); + alarm->setDisplayAlarm(QString::fromUtf8(s)); + deleteStr(s); + } else { + alarm->setDisplayAlarm(QString()); + } + } + } + + if ((vo = isAPropertyOf(vtodo, VCAAlarmProp))) { + Alarm::Ptr alarm; + VObject *a; + VObject *b; + a = isAPropertyOf(vo, VCRunTimeProp); + b = isAPropertyOf(vo, VCAudioContentProp); + + if (a || b) { + alarm = anEvent->newAlarm(); + if (a) { + alarm->setTime(ISOToQDateTime(QString::fromUtf8(s = fakeCString(vObjectUStringZValue(a))))); + deleteStr(s); + } + alarm->setEnabled(true); + if (b) { + s = fakeCString(vObjectUStringZValue(b)); + alarm->setAudioAlarm(QFile::decodeName(s)); + deleteStr(s); + } else { + alarm->setAudioAlarm(QString()); + } + } + } + + if ((vo = isAPropertyOf(vtodo, VCPAlarmProp))) { + Alarm::Ptr alarm; + VObject *a = isAPropertyOf(vo, VCRunTimeProp); + VObject *b = isAPropertyOf(vo, VCProcedureNameProp); + + if (a || b) { + alarm = anEvent->newAlarm(); + if (a) { + alarm->setTime(ISOToQDateTime(QString::fromUtf8(s = fakeCString(vObjectUStringZValue(a))))); + deleteStr(s); + } + alarm->setEnabled(true); + + if (b) { + s = fakeCString(vObjectUStringZValue(b)); + alarm->setProcedureAlarm(QFile::decodeName(s)); + deleteStr(s); + } else { + alarm->setProcedureAlarm(QString()); + } + } + } + + // related todo + if ((vo = isAPropertyOf(vtodo, VCRelatedToProp)) != nullptr) { + anEvent->setRelatedTo(QString::fromUtf8(s = fakeCString(vObjectUStringZValue(vo)))); + deleteStr(s); + d->mTodosRelate.append(anEvent); + } + + // secrecy + Incidence::Secrecy secrecy = Incidence::SecrecyPublic; + if ((vo = isAPropertyOf(vtodo, VCClassProp)) != nullptr) { + s = fakeCString(vObjectUStringZValue(vo)); + if (s && strcmp(s, "PRIVATE") == 0) { + secrecy = Incidence::SecrecyPrivate; + } else if (s && strcmp(s, "CONFIDENTIAL") == 0) { + secrecy = Incidence::SecrecyConfidential; + } + deleteStr(s); + } + anEvent->setSecrecy(secrecy); + + // categories + if ((vo = isAPropertyOf(vtodo, VCCategoriesProp)) != nullptr) { + s = fakeCString(vObjectUStringZValue(vo)); + QString categories = QString::fromUtf8(s); + deleteStr(s); + QStringList tmpStrList = categories.split(QLatin1Char(';')); + anEvent->setCategories(tmpStrList); + } + + return anEvent; +} + +Event::Ptr VCalFormat::VEventToEvent(VObject *vevent) +{ + VObject *vo = nullptr; + VObjectIterator voi; + char *s = nullptr; + + Event::Ptr anEvent(new Event); + + // creation date + if ((vo = isAPropertyOf(vevent, VCDCreatedProp)) != nullptr) { + anEvent->setCreated(ISOToQDateTime(QString::fromUtf8(s = fakeCString(vObjectUStringZValue(vo))))); + deleteStr(s); + } + + // unique id + vo = isAPropertyOf(vevent, VCUniqueStringProp); + // while the UID property is preferred, it is not required. We'll use the + // default Event UID if none is given. + if (vo) { + anEvent->setUid(QString::fromUtf8(s = fakeCString(vObjectUStringZValue(vo)))); + deleteStr(s); + } + + // revision + // again NSCAL doesn't give us much to work with, so we improvise... + anEvent->setRevision(0); + if ((vo = isAPropertyOf(vevent, VCSequenceProp)) != nullptr) { + s = fakeCString(vObjectUStringZValue(vo)); + if (s) { + anEvent->setRevision(atoi(s)); + deleteStr(s); + } + } + + // last modification date + if ((vo = isAPropertyOf(vevent, VCLastModifiedProp)) != nullptr) { + anEvent->setLastModified(ISOToQDateTime(QString::fromUtf8(s = fakeCString(vObjectUStringZValue(vo))))); + deleteStr(s); + } else { + anEvent->setLastModified(QDateTime::currentDateTimeUtc()); + } + + // organizer + // if our extension property for the event's ORGANIZER exists, add it. + if ((vo = isAPropertyOf(vevent, ICOrganizerProp)) != nullptr) { + // FIXME: Also use the full name, not just the email address + anEvent->setOrganizer(QString::fromUtf8(s = fakeCString(vObjectUStringZValue(vo)))); + deleteStr(s); + } else { + if (d->mCalendar->owner().name() != QLatin1String("Unknown Name")) { + anEvent->setOrganizer(d->mCalendar->owner()); + } + } + + // deal with attendees. + initPropIterator(&voi, vevent); + while (moreIteration(&voi)) { + vo = nextVObject(&voi); + if (strcmp(vObjectName(vo), VCAttendeeProp) == 0) { + Attendee a; + VObject *vp = nullptr; + s = fakeCString(vObjectUStringZValue(vo)); + QString tmpStr = QString::fromUtf8(s); + deleteStr(s); + tmpStr = tmpStr.simplified(); + int emailPos1; + if ((emailPos1 = tmpStr.indexOf(QLatin1Char('<'))) > 0) { + // both email address and name + int emailPos2 = tmpStr.lastIndexOf(QLatin1Char('>')); + a = Attendee(tmpStr.left(emailPos1 - 1), tmpStr.mid(emailPos1 + 1, emailPos2 - (emailPos1 + 1))); + } else if (tmpStr.indexOf(QLatin1Char('@')) > 0) { + // just an email address + a = Attendee(QString(), tmpStr); + } else { + // just a name + QString email = tmpStr.replace(QLatin1Char(' '), QLatin1Char('.')); + a = Attendee(tmpStr, email); + } + + // is there an RSVP property? + if ((vp = isAPropertyOf(vo, VCRSVPProp)) != nullptr) { + a.setRSVP(vObjectStringZValue(vp)); + } + // is there a status property? + if ((vp = isAPropertyOf(vo, VCStatusProp)) != nullptr) { + a.setStatus(readStatus(vObjectStringZValue(vp))); + } + // add the attendee + anEvent->addAttendee(a); + } + } + + // This isn't strictly true. An event that doesn't have a start time + // or an end time isn't all-day, it has an anchor in time but it doesn't + // "take up" any time. + /*if ((isAPropertyOf(vevent, VCDTstartProp) == 0) || + (isAPropertyOf(vevent, VCDTendProp) == 0)) { + anEvent->setAllDay(true); + } else { + }*/ + + anEvent->setAllDay(false); + + // start time + if ((vo = isAPropertyOf(vevent, VCDTstartProp)) != nullptr) { + anEvent->setDtStart(ISOToQDateTime(QString::fromUtf8(s = fakeCString(vObjectUStringZValue(vo))))); + deleteStr(s); + + if (anEvent->dtStart().time().hour() == 0 && anEvent->dtStart().time().minute() == 0 && anEvent->dtStart().time().second() == 0) { + anEvent->setAllDay(true); + } + } + + // stop time + if ((vo = isAPropertyOf(vevent, VCDTendProp)) != nullptr) { + anEvent->setDtEnd(ISOToQDateTime(QString::fromUtf8(s = fakeCString(vObjectUStringZValue(vo))))); + deleteStr(s); + + if (anEvent->dtEnd().time().hour() == 0 && anEvent->dtEnd().time().minute() == 0 && anEvent->dtEnd().time().second() == 0) { + anEvent->setAllDay(true); + } + } + + // at this point, there should be at least a start or end time. + // fix up for events that take up no time but have a time associated + if (!isAPropertyOf(vevent, VCDTstartProp)) { + anEvent->setDtStart(anEvent->dtEnd()); + } + if (!isAPropertyOf(vevent, VCDTendProp)) { + anEvent->setDtEnd(anEvent->dtStart()); + } + + /////////////////////////////////////////////////////////////////////////// + + // recurrence stuff + if ((vo = isAPropertyOf(vevent, VCRRuleProp)) != nullptr) { + uint recurrenceType = Recurrence::rNone; + int recurrenceTypeAbbrLen = 0; + + QString tmpStr = (QString::fromUtf8(s = fakeCString(vObjectUStringZValue(vo)))); + deleteStr(s); + tmpStr = tmpStr.simplified(); + const int tmpStrLen = tmpStr.length(); + if (tmpStrLen > 0) { + tmpStr = tmpStr.toUpper(); + // first, read the type of the recurrence + recurrenceTypeAbbrLen = 1; + if (tmpStr.at(0) == QLatin1Char('D')) { + recurrenceType = Recurrence::rDaily; + } else if (tmpStr.at(0) == QLatin1Char('W')) { + recurrenceType = Recurrence::rWeekly; + } else if (tmpStrLen > 1) { + recurrenceTypeAbbrLen = 2; + if (tmpStr.leftRef(2) == QLatin1String("MP")) { + recurrenceType = Recurrence::rMonthlyPos; + } else if (tmpStr.leftRef(2) == QLatin1String("MD")) { + recurrenceType = Recurrence::rMonthlyDay; + } else if (tmpStr.leftRef(2) == QLatin1String("YM")) { + recurrenceType = Recurrence::rYearlyMonth; + } else if (tmpStr.leftRef(2) == QLatin1String("YD")) { + recurrenceType = Recurrence::rYearlyDay; + } + } + } + + if (recurrenceType != Recurrence::rNone) { + // Immediately after the type is the frequency + int index = tmpStr.indexOf(QLatin1Char(' ')); + int last = tmpStr.lastIndexOf(QLatin1Char(' ')) + 1; // find last entry + int rFreq = tmpStr.midRef(recurrenceTypeAbbrLen, (index - 1)).toInt(); + ++index; // advance to beginning of stuff after freq + + // Read the type-specific settings + switch (recurrenceType) { + case Recurrence::rDaily: + anEvent->recurrence()->setDaily(rFreq); + break; + + case Recurrence::rWeekly: { + QBitArray qba(7); + QString dayStr; + if (index == last) { + // e.g. W1 #0 + qba.setBit(anEvent->dtStart().date().dayOfWeek() - 1); + } else { + // e.g. W1 SU #0 + while (index < last) { + dayStr = tmpStr.mid(index, 3); + int dayNum = numFromDay(dayStr); + if (dayNum >= 0) { + qba.setBit(dayNum); + } + index += 3; // advance to next day, or possibly "#" + } + } + anEvent->recurrence()->setWeekly(rFreq, qba); + break; + } + + case Recurrence::rMonthlyPos: { + anEvent->recurrence()->setMonthly(rFreq); + + QBitArray qba(7); + short tmpPos; + if (index == last) { + // e.g. MP1 #0 + tmpPos = anEvent->dtStart().date().day() / 7 + 1; + if (tmpPos == 5) { + tmpPos = -1; + } + qba.setBit(anEvent->dtStart().date().dayOfWeek() - 1); + anEvent->recurrence()->addMonthlyPos(tmpPos, qba); + } else { + // e.g. MP1 1+ SU #0 + while (index < last) { + tmpPos = tmpStr.mid(index, 1).toShort(); + index += 1; + if (tmpStr.mid(index, 1) == QLatin1String("-")) { + // convert tmpPos to negative + tmpPos = 0 - tmpPos; + } + index += 2; // advance to day(s) + while (numFromDay(tmpStr.mid(index, 3)) >= 0) { + int dayNum = numFromDay(tmpStr.mid(index, 3)); + qba.setBit(dayNum); + index += 3; // advance to next day, or possibly pos or "#" + } + anEvent->recurrence()->addMonthlyPos(tmpPos, qba); + qba.detach(); + qba.fill(false); // clear out + } // while != "#" + } + break; + } + + case Recurrence::rMonthlyDay: + anEvent->recurrence()->setMonthly(rFreq); + if (index == last) { + // e.g. MD1 #0 + short tmpDay = anEvent->dtStart().date().day(); + anEvent->recurrence()->addMonthlyDate(tmpDay); + } else { + // e.g. MD1 3 #0 + while (index < last) { + int index2 = tmpStr.indexOf(QLatin1Char(' '), index); + if ((tmpStr.mid((index2 - 1), 1) == QLatin1String("-")) || (tmpStr.mid((index2 - 1), 1) == QLatin1String("+"))) { + index2 = index2 - 1; + } + short tmpDay = tmpStr.mid(index, (index2 - index)).toShort(); + index = index2; + if (tmpStr.mid(index, 1) == QLatin1String("-")) { + tmpDay = 0 - tmpDay; + } + index += 2; // advance the index; + anEvent->recurrence()->addMonthlyDate(tmpDay); + } // while != # + } + break; + + case Recurrence::rYearlyMonth: + anEvent->recurrence()->setYearly(rFreq); + + if (index == last) { + // e.g. YM1 #0 + short tmpMonth = anEvent->dtStart().date().month(); + anEvent->recurrence()->addYearlyMonth(tmpMonth); + } else { + // e.g. YM1 3 #0 + while (index < last) { + int index2 = tmpStr.indexOf(QLatin1Char(' '), index); + short tmpMonth = tmpStr.mid(index, (index2 - index)).toShort(); + index = index2 + 1; + anEvent->recurrence()->addYearlyMonth(tmpMonth); + } // while != # + } + break; + + case Recurrence::rYearlyDay: + anEvent->recurrence()->setYearly(rFreq); + + if (index == last) { + // e.g. YD1 #0 + const int tmpDay = anEvent->dtStart().date().dayOfYear(); + anEvent->recurrence()->addYearlyDay(tmpDay); + } else { + // e.g. YD1 123 #0 + while (index < last) { + int index2 = tmpStr.indexOf(QLatin1Char(' '), index); + short tmpDay = tmpStr.mid(index, (index2 - index)).toShort(); + index = index2 + 1; + anEvent->recurrence()->addYearlyDay(tmpDay); + } // while != # + } + break; + + default: + break; + } + + // find the last field, which is either the duration or the end date + index = last; + if (tmpStr.mid(index, 1) == QLatin1String("#")) { + // Nr of occurrences + index++; + int rDuration = tmpStr.midRef(index, tmpStr.length() - index).toInt(); + if (rDuration > 0) { + anEvent->recurrence()->setDuration(rDuration); + } + } else if (tmpStr.indexOf(QLatin1Char('T'), index) != -1) { + QDateTime rEndDate = ISOToQDateTime(tmpStr.mid(index, tmpStr.length() - index)); + anEvent->recurrence()->setEndDateTime(rEndDate); + } + // anEvent->recurrence()->dump(); + + } else { + qDebug() << "we don't understand this type of recurrence!"; + } // if known recurrence type + } // repeats + + // recurrence exceptions + if ((vo = isAPropertyOf(vevent, VCExpDateProp)) != nullptr) { + s = fakeCString(vObjectUStringZValue(vo)); + QStringList exDates = QString::fromUtf8(s).split(QLatin1Char(',')); + QStringList::ConstIterator it; + for (it = exDates.constBegin(); it != exDates.constEnd(); ++it) { + QDateTime exDate = ISOToQDateTime(*it); + if (exDate.time().hour() == 0 && exDate.time().minute() == 0 && exDate.time().second() == 0) { + anEvent->recurrence()->addExDate(ISOToQDate(*it)); + } else { + anEvent->recurrence()->addExDateTime(exDate); + } + } + deleteStr(s); + } + + // summary + if ((vo = isAPropertyOf(vevent, VCSummaryProp))) { + s = fakeCString(vObjectUStringZValue(vo)); + anEvent->setSummary(QString::fromUtf8(s), Qt::mightBeRichText(QString::fromUtf8(s))); + deleteStr(s); + } + + // description + if ((vo = isAPropertyOf(vevent, VCDescriptionProp)) != nullptr) { + s = fakeCString(vObjectUStringZValue(vo)); + bool isRich = Qt::mightBeRichText(QString::fromUtf8(s)); + if (!anEvent->description().isEmpty()) { + anEvent->setDescription(anEvent->description() + QLatin1Char('\n') + QString::fromUtf8(s), isRich); + } else { + anEvent->setDescription(QString::fromUtf8(s), isRich); + } + deleteStr(s); + } + + // location + if ((vo = isAPropertyOf(vevent, VCLocationProp)) != nullptr) { + s = fakeCString(vObjectUStringZValue(vo)); + anEvent->setLocation(QString::fromUtf8(s), Qt::mightBeRichText(QString::fromUtf8(s))); + deleteStr(s); + } + + // some stupid vCal exporters ignore the standard and use Description + // instead of Summary for the default field. Correct for this. + if (anEvent->summary().isEmpty() && !(anEvent->description().isEmpty())) { + QString tmpStr = anEvent->description().simplified(); + anEvent->setDescription(QString()); + anEvent->setSummary(tmpStr); + } + +#if 0 + // status + if ((vo = isAPropertyOf(vevent, VCStatusProp)) != 0) { + QString tmpStr(s = fakeCString(vObjectUStringZValue(vo))); + deleteStr(s); +// TODO: Define Event status +// anEvent->setStatus( tmpStr ); + } else { +// anEvent->setStatus( "NEEDS ACTION" ); + } +#endif + + // secrecy + Incidence::Secrecy secrecy = Incidence::SecrecyPublic; + if ((vo = isAPropertyOf(vevent, VCClassProp)) != nullptr) { + s = fakeCString(vObjectUStringZValue(vo)); + if (s && strcmp(s, "PRIVATE") == 0) { + secrecy = Incidence::SecrecyPrivate; + } else if (s && strcmp(s, "CONFIDENTIAL") == 0) { + secrecy = Incidence::SecrecyConfidential; + } + deleteStr(s); + } + anEvent->setSecrecy(secrecy); + + // categories + if ((vo = isAPropertyOf(vevent, VCCategoriesProp)) != nullptr) { + s = fakeCString(vObjectUStringZValue(vo)); + QString categories = QString::fromUtf8(s); + deleteStr(s); + QStringList tmpStrList = categories.split(QLatin1Char(',')); + anEvent->setCategories(tmpStrList); + } + + // attachments + initPropIterator(&voi, vevent); + while (moreIteration(&voi)) { + vo = nextVObject(&voi); + if (strcmp(vObjectName(vo), VCAttachProp) == 0) { + s = fakeCString(vObjectUStringZValue(vo)); + anEvent->addAttachment(Attachment(QString::fromUtf8(s))); + deleteStr(s); + } + } + + // resources + if ((vo = isAPropertyOf(vevent, VCResourcesProp)) != nullptr) { + QString resources = (QString::fromUtf8(s = fakeCString(vObjectUStringZValue(vo)))); + deleteStr(s); + QStringList tmpStrList = resources.split(QLatin1Char(';')); + anEvent->setResources(tmpStrList); + } + + // alarm stuff + if ((vo = isAPropertyOf(vevent, VCDAlarmProp))) { + Alarm::Ptr alarm; + VObject *a = isAPropertyOf(vo, VCRunTimeProp); + VObject *b = isAPropertyOf(vo, VCDisplayStringProp); + + if (a || b) { + alarm = anEvent->newAlarm(); + if (a) { + alarm->setTime(ISOToQDateTime(QString::fromUtf8(s = fakeCString(vObjectUStringZValue(a))))); + deleteStr(s); + } + alarm->setEnabled(true); + + if (b) { + s = fakeCString(vObjectUStringZValue(b)); + alarm->setDisplayAlarm(QString::fromUtf8(s)); + deleteStr(s); + } else { + alarm->setDisplayAlarm(QString()); + } + } + } + + if ((vo = isAPropertyOf(vevent, VCAAlarmProp))) { + Alarm::Ptr alarm; + VObject *a; + VObject *b; + a = isAPropertyOf(vo, VCRunTimeProp); + b = isAPropertyOf(vo, VCAudioContentProp); + + if (a || b) { + alarm = anEvent->newAlarm(); + if (a) { + alarm->setTime(ISOToQDateTime(QString::fromUtf8(s = fakeCString(vObjectUStringZValue(a))))); + deleteStr(s); + } + alarm->setEnabled(true); + + if (b) { + s = fakeCString(vObjectUStringZValue(b)); + alarm->setAudioAlarm(QFile::decodeName(s)); + deleteStr(s); + } else { + alarm->setAudioAlarm(QString()); + } + } + } + + if ((vo = isAPropertyOf(vevent, VCPAlarmProp))) { + Alarm::Ptr alarm; + VObject *a; + VObject *b; + a = isAPropertyOf(vo, VCRunTimeProp); + b = isAPropertyOf(vo, VCProcedureNameProp); + + if (a || b) { + alarm = anEvent->newAlarm(); + if (a) { + alarm->setTime(ISOToQDateTime(QString::fromUtf8(s = fakeCString(vObjectUStringZValue(a))))); + deleteStr(s); + } + alarm->setEnabled(true); + + if (b) { + s = fakeCString(vObjectUStringZValue(b)); + alarm->setProcedureAlarm(QFile::decodeName(s)); + deleteStr(s); + } else { + alarm->setProcedureAlarm(QString()); + } + } + } + + // priority + if ((vo = isAPropertyOf(vevent, VCPriorityProp))) { + s = fakeCString(vObjectUStringZValue(vo)); + if (s) { + anEvent->setPriority(atoi(s)); + deleteStr(s); + } + } + + // transparency + if ((vo = isAPropertyOf(vevent, VCTranspProp)) != nullptr) { + s = fakeCString(vObjectUStringZValue(vo)); + if (s) { + int i = atoi(s); + anEvent->setTransparency(i == 1 ? Event::Transparent : Event::Opaque); + deleteStr(s); + } + } + + // related event + if ((vo = isAPropertyOf(vevent, VCRelatedToProp)) != nullptr) { + anEvent->setRelatedTo(QString::fromUtf8(s = fakeCString(vObjectUStringZValue(vo)))); + deleteStr(s); + d->mEventsRelate.append(anEvent); + } + + /* Rest of the custom properties */ + readCustomProperties(vevent, anEvent); + + return anEvent; +} + +QString VCalFormat::parseTZ(const QByteArray &timezone) const +{ + // qDebug() << timezone; + QString pZone = QString::fromUtf8(timezone.mid(timezone.indexOf("TZID:VCAL") + 9)); + return pZone.mid(0, pZone.indexOf(QLatin1Char('\n'))); +} + +QString VCalFormat::parseDst(QByteArray &timezone) const +{ + if (!timezone.contains("BEGIN:DAYLIGHT")) { + return QString(); + } + + timezone = timezone.mid(timezone.indexOf("BEGIN:DAYLIGHT")); + timezone = timezone.mid(timezone.indexOf("TZNAME:") + 7); + QString sStart = QString::fromUtf8(timezone.mid(0, (timezone.indexOf("COMMENT:")))); + sStart.chop(2); + timezone = timezone.mid(timezone.indexOf("TZOFFSETTO:") + 11); + QString sOffset = QString::fromUtf8(timezone.mid(0, (timezone.indexOf("DTSTART:")))); + sOffset.chop(2); + sOffset.insert(3, QLatin1Char(':')); + timezone = timezone.mid(timezone.indexOf("TZNAME:") + 7); + QString sEnd = QString::fromUtf8(timezone.mid(0, (timezone.indexOf("COMMENT:")))); + sEnd.chop(2); + + return QStringLiteral("TRUE;") + sOffset + QLatin1Char(';') + sStart + QLatin1Char(';') + sEnd + QLatin1String(";;"); +} + +QString VCalFormat::qDateToISO(const QDate &qd) +{ + if (!qd.isValid()) { + return QString(); + } + + return QString::asprintf("%.2d%.2d%.2d", qd.year(), qd.month(), qd.day()); +} + +QString VCalFormat::qDateTimeToISO(const QDateTime &dt, bool zulu) +{ + if (!dt.isValid()) { + return QString(); + } + + QDateTime tmpDT; + if (zulu) { + tmpDT = dt.toUTC(); + } else { + tmpDT = dt.toTimeZone(d->mCalendar->timeZone()); + } + QString tmpStr = QString::asprintf("%.2d%.2d%.2dT%.2d%.2d%.2d", + tmpDT.date().year(), + tmpDT.date().month(), + tmpDT.date().day(), + tmpDT.time().hour(), + tmpDT.time().minute(), + tmpDT.time().second()); + if (zulu || dt.timeZone() == QTimeZone::utc()) { + tmpStr += QLatin1Char('Z'); + } + return tmpStr; +} + +QDateTime VCalFormat::ISOToQDateTime(const QString &dtStr) +{ + QDate tmpDate; + QTime tmpTime; + QString tmpStr; + int year, month, day, hour, minute, second; + + tmpStr = dtStr; + year = tmpStr.leftRef(4).toInt(); + month = tmpStr.midRef(4, 2).toInt(); + day = tmpStr.midRef(6, 2).toInt(); + hour = tmpStr.midRef(9, 2).toInt(); + minute = tmpStr.midRef(11, 2).toInt(); + second = tmpStr.midRef(13, 2).toInt(); + tmpDate.setDate(year, month, day); + tmpTime.setHMS(hour, minute, second); + + if (tmpDate.isValid() && tmpTime.isValid()) { + // correct for GMT if string is in Zulu format + if (dtStr.at(dtStr.length() - 1) == QLatin1Char('Z')) { + return QDateTime(tmpDate, tmpTime, Qt::UTC); + } else { + return QDateTime(tmpDate, tmpTime, d->mCalendar->timeZone()); + } + } else { + return QDateTime(); + } +} + +QDate VCalFormat::ISOToQDate(const QString &dateStr) +{ + int year, month, day; + + year = dateStr.leftRef(4).toInt(); + month = dateStr.midRef(4, 2).toInt(); + day = dateStr.midRef(6, 2).toInt(); + + return QDate(year, month, day); +} + +bool VCalFormat::parseTZOffsetISO8601(const QString &s, int &result) +{ + // ISO8601 format(s): + // +- hh : mm + // +- hh mm + // +- hh + + // We also accept broken one without + + int mod = 1; + int v = 0; + QString str = s.trimmed(); + int ofs = 0; + result = 0; + + // Check for end + if (str.size() <= ofs) { + return false; + } + if (str[ofs] == QLatin1Char('-')) { + mod = -1; + ofs++; + } else if (str[ofs] == QLatin1Char('+')) { + ofs++; + } + if (str.size() <= ofs) { + return false; + } + + // Make sure next two values are numbers + bool ok; + + if (str.size() < (ofs + 2)) { + return false; + } + + v = str.midRef(ofs, 2).toInt(&ok) * 60; + if (!ok) { + return false; + } + ofs += 2; + + if (str.size() > ofs) { + if (str[ofs] == QLatin1Char(':')) { + ofs++; + } + if (str.size() > ofs) { + if (str.size() < (ofs + 2)) { + return false; + } + v += str.midRef(ofs, 2).toInt(&ok); + if (!ok) { + return false; + } + } + } + result = v * mod * 60; + return true; +} + +// take a raw vcalendar (i.e. from a file on disk, clipboard, etc. etc. +// and break it down from it's tree-like format into the dictionary format +// that is used internally in the VCalFormat. +void VCalFormat::populate(VObject *vcal, bool deleted, const QString ¬ebook) +{ + Q_UNUSED(notebook); + // this function will populate the caldict dictionary and other event + // lists. It turns vevents into Events and then inserts them. + + VObjectIterator i; + VObject *curVO; + Event::Ptr anEvent; + bool hasTimeZone = false; // The calendar came with a TZ and not UTC + QTimeZone previousZone; // If we add a new TZ we should leave the spec as it was before + + if ((curVO = isAPropertyOf(vcal, ICMethodProp)) != nullptr) { + char *methodType = fakeCString(vObjectUStringZValue(curVO)); + // qDebug() << "This calendar is an iTIP transaction of type '" << methodType << "'"; + deleteStr(methodType); + } + + // warn the user that we might have trouble reading non-known calendar. + if ((curVO = isAPropertyOf(vcal, VCProdIdProp)) != nullptr) { + char *s = fakeCString(vObjectUStringZValue(curVO)); + if (!s || strcmp(productId().toUtf8().constData(), s) != 0) { + qDebug() << "This vCalendar file was not created by KOrganizer or" + << "any other product we support. Loading anyway..."; + } + setLoadedProductId(QString::fromUtf8(s)); + deleteStr(s); + } + + // warn the user we might have trouble reading this unknown version. + if ((curVO = isAPropertyOf(vcal, VCVersionProp)) != nullptr) { + char *s = fakeCString(vObjectUStringZValue(curVO)); + if (!s || strcmp(_VCAL_VERSION, s) != 0) { + qDebug() << "This vCalendar file has version" << s << "We only support" << _VCAL_VERSION; + } + deleteStr(s); + } + + // set the time zone (this is a property of the view, so just discard!) + if ((curVO = isAPropertyOf(vcal, VCTimeZoneProp)) != nullptr) { + char *s = fakeCString(vObjectUStringZValue(curVO)); + QString ts = QString::fromUtf8(s); + QString name = QLatin1String("VCAL") + ts; + deleteStr(s); + + // TODO: While using the timezone-offset + vcal as timezone is is + // most likely unique, we should REALLY actually create something + // like vcal-tzoffset-daylightoffsets, or better yet, + // vcal-hash + + QStringList tzList; + QString tz; + int utcOffset; + int utcOffsetDst; + if (parseTZOffsetISO8601(ts, utcOffset)) { + // qDebug() << "got standard offset" << ts << utcOffset; + // standard from tz + // starting date for now 01011900 + QDateTime dt = QDateTime(QDateTime(QDate(1900, 1, 1), QTime(0, 0, 0))); + tz = QStringLiteral("STD;%1;false;%2").arg(QString::number(utcOffset), dt.toString()); + tzList.append(tz); + + // go through all the daylight tags + initPropIterator(&i, vcal); + while (moreIteration(&i)) { + curVO = nextVObject(&i); + if (strcmp(vObjectName(curVO), VCDayLightProp) == 0) { + char *s = fakeCString(vObjectUStringZValue(curVO)); + QString dst = QLatin1String(s); + QStringList argl = dst.split(QLatin1Char(',')); + deleteStr(s); + + // Too short -> not interesting + if (argl.size() < 4) { + continue; + } + + // We don't care about the non-DST periods + if (argl[0] != QLatin1String("TRUE")) { + continue; + } + + if (parseTZOffsetISO8601(argl[1], utcOffsetDst)) { + // qDebug() << "got DST offset" << argl[1] << utcOffsetDst; + // standard + QString strEndDate = argl[3]; + QDateTime endDate = ISOToQDateTime(strEndDate); + // daylight + QString strStartDate = argl[2]; + QDateTime startDate = ISOToQDateTime(strStartDate); + + QString strRealEndDate = strEndDate; + QString strRealStartDate = strStartDate; + QDateTime realEndDate = endDate; + QDateTime realStartDate = startDate; + // if we get dates for some reason in wrong order, earlier is used for dst + if (endDate < startDate) { + strRealEndDate = strStartDate; + strRealStartDate = strEndDate; + realEndDate = startDate; + realStartDate = endDate; + } + tz = QStringLiteral("%1;%2;false;%3").arg(strRealEndDate, QString::number(utcOffset), realEndDate.toString()); + tzList.append(tz); + + tz = QStringLiteral("%1;%2;true;%3").arg(strRealStartDate, QString::number(utcOffsetDst), realStartDate.toString()); + tzList.append(tz); + } else { + qDebug() << "unable to parse dst" << argl[1]; + } + } + } + if (!QTimeZone::isTimeZoneIdAvailable(name.toLatin1())) { + qDebug() << "zone is not valid, parsing error" << tzList; + } else { + previousZone = d->mCalendar->timeZone(); + d->mCalendar->setTimeZoneId(name.toUtf8()); + hasTimeZone = true; + } + } else { + qDebug() << "unable to parse tzoffset" << ts; + } + } + + // Store all events with a relatedTo property in a list for post-processing + d->mEventsRelate.clear(); + d->mTodosRelate.clear(); + + initPropIterator(&i, vcal); + + // go through all the vobjects in the vcal + while (moreIteration(&i)) { + curVO = nextVObject(&i); + + /************************************************************************/ + + // now, check to see that the object is an event or todo. + if (strcmp(vObjectName(curVO), VCEventProp) == 0) { + if (!isAPropertyOf(curVO, VCDTstartProp) && !isAPropertyOf(curVO, VCDTendProp)) { + qDebug() << "found a VEvent with no DTSTART and no DTEND! Skipping..."; + goto SKIP; + } + + anEvent = VEventToEvent(curVO); + if (anEvent) { + if (hasTimeZone && !anEvent->allDay() && anEvent->dtStart().timeZone() == QTimeZone::utc()) { + // This sounds stupid but is how others are doing it, so here + // we go. If there is a TZ in the VCALENDAR even if the dtStart + // and dtend are in UTC, clients interpret it using also the TZ defined + // in the Calendar. I know it sounds braindead but oh well + int utcOffSet = anEvent->dtStart().offsetFromUtc(); + QDateTime dtStart(anEvent->dtStart().addSecs(utcOffSet)); + dtStart.setTimeZone(d->mCalendar->timeZone()); + QDateTime dtEnd(anEvent->dtEnd().addSecs(utcOffSet)); + dtEnd.setTimeZone(d->mCalendar->timeZone()); + anEvent->setDtStart(dtStart); + anEvent->setDtEnd(dtEnd); + } + Event::Ptr old = + !anEvent->hasRecurrenceId() ? d->mCalendar->event(anEvent->uid()) : d->mCalendar->event(anEvent->uid(), anEvent->recurrenceId()); + + if (old) { + if (deleted) { + d->mCalendar->deleteEvent(old); // move old to deleted + removeAllVCal(d->mEventsRelate, old); + } else if (anEvent->revision() > old->revision()) { + d->mCalendar->deleteEvent(old); // move old to deleted + removeAllVCal(d->mEventsRelate, old); + d->mCalendar->addEvent(anEvent); // and replace it with this one + } + } else if (deleted) { + old = !anEvent->hasRecurrenceId() ? d->mCalendar->deletedEvent(anEvent->uid()) + : d->mCalendar->deletedEvent(anEvent->uid(), anEvent->recurrenceId()); + if (!old) { + d->mCalendar->addEvent(anEvent); // add this one + d->mCalendar->deleteEvent(anEvent); // and move it to deleted + } + } else { + d->mCalendar->addEvent(anEvent); // just add this one + } + } + } else if (strcmp(vObjectName(curVO), VCTodoProp) == 0) { + Todo::Ptr aTodo = VTodoToEvent(curVO); + if (aTodo) { + if (hasTimeZone && !aTodo->allDay() && aTodo->dtStart().timeZone() == QTimeZone::utc()) { + // This sounds stupid but is how others are doing it, so here + // we go. If there is a TZ in the VCALENDAR even if the dtStart + // and dtend are in UTC, clients interpret it using also the TZ defined + // in the Calendar. I know it sounds braindead but oh well + int utcOffSet = aTodo->dtStart().offsetFromUtc(); + QDateTime dtStart(aTodo->dtStart().addSecs(utcOffSet)); + dtStart.setTimeZone(d->mCalendar->timeZone()); + aTodo->setDtStart(dtStart); + if (aTodo->hasDueDate()) { + QDateTime dtDue(aTodo->dtDue().addSecs(utcOffSet)); + dtDue.setTimeZone(d->mCalendar->timeZone()); + aTodo->setDtDue(dtDue); + } + } + Todo::Ptr old = !aTodo->hasRecurrenceId() ? d->mCalendar->todo(aTodo->uid()) : d->mCalendar->todo(aTodo->uid(), aTodo->recurrenceId()); + if (old) { + if (deleted) { + d->mCalendar->deleteTodo(old); // move old to deleted + removeAllVCal(d->mTodosRelate, old); + } else if (aTodo->revision() > old->revision()) { + d->mCalendar->deleteTodo(old); // move old to deleted + removeAllVCal(d->mTodosRelate, old); + d->mCalendar->addTodo(aTodo); // and replace it with this one + } + } else if (deleted) { + old = d->mCalendar->deletedTodo(aTodo->uid(), aTodo->recurrenceId()); + if (!old) { + d->mCalendar->addTodo(aTodo); // add this one + d->mCalendar->deleteTodo(aTodo); // and move it to deleted + } + } else { + d->mCalendar->addTodo(aTodo); // just add this one + } + } + } else if ((strcmp(vObjectName(curVO), VCVersionProp) == 0) || (strcmp(vObjectName(curVO), VCProdIdProp) == 0) + || (strcmp(vObjectName(curVO), VCTimeZoneProp) == 0)) { + // do nothing, we know these properties and we want to skip them. + // we have either already processed them or are ignoring them. + ; + } else if (strcmp(vObjectName(curVO), VCDayLightProp) == 0) { + // do nothing daylights are already processed + ; + } else { + qDebug() << "Ignoring unknown vObject \"" << vObjectName(curVO) << "\""; + } + SKIP:; + } // while + + // Post-Process list of events with relations, put Event objects in relation + Event::List::ConstIterator eIt; + for (eIt = d->mEventsRelate.constBegin(); eIt != d->mEventsRelate.constEnd(); ++eIt) { + (*eIt)->setRelatedTo((*eIt)->relatedTo()); + } + Todo::List::ConstIterator tIt; + for (tIt = d->mTodosRelate.constBegin(); tIt != d->mTodosRelate.constEnd(); ++tIt) { + (*tIt)->setRelatedTo((*tIt)->relatedTo()); + } + + // Now lets put the TZ back as it was if we have changed it. + if (hasTimeZone) { + d->mCalendar->setTimeZone(previousZone); + } +} + +int VCalFormat::numFromDay(const QString &day) +{ + if (day == QLatin1String("MO ")) { + return 0; + } + if (day == QLatin1String("TU ")) { + return 1; + } + if (day == QLatin1String("WE ")) { + return 2; + } + if (day == QLatin1String("TH ")) { + return 3; + } + if (day == QLatin1String("FR ")) { + return 4; + } + if (day == QLatin1String("SA ")) { + return 5; + } + if (day == QLatin1String("SU ")) { + return 6; + } + + return -1; // something bad happened. :) +} + +Attendee::PartStat VCalFormat::readStatus(const char *s) const +{ + QString statStr = QString::fromUtf8(s); + statStr = statStr.toUpper(); + Attendee::PartStat status; + + if (statStr == QLatin1String("X-ACTION")) { + status = Attendee::NeedsAction; + } else if (statStr == QLatin1String("NEEDS ACTION")) { + status = Attendee::NeedsAction; + } else if (statStr == QLatin1String("ACCEPTED")) { + status = Attendee::Accepted; + } else if (statStr == QLatin1String("SENT")) { + status = Attendee::NeedsAction; + } else if (statStr == QLatin1String("TENTATIVE")) { + status = Attendee::Tentative; + } else if (statStr == QLatin1String("CONFIRMED")) { + status = Attendee::Accepted; + } else if (statStr == QLatin1String("DECLINED")) { + status = Attendee::Declined; + } else if (statStr == QLatin1String("COMPLETED")) { + status = Attendee::Completed; + } else if (statStr == QLatin1String("DELEGATED")) { + status = Attendee::Delegated; + } else { + qDebug() << "error setting attendee mStatus, unknown mStatus!"; + status = Attendee::NeedsAction; + } + + return status; +} + +QByteArray VCalFormat::writeStatus(Attendee::PartStat status) const +{ + switch (status) { + default: + case Attendee::NeedsAction: + return "NEEDS ACTION"; + case Attendee::Accepted: + return "ACCEPTED"; + case Attendee::Declined: + return "DECLINED"; + case Attendee::Tentative: + return "TENTATIVE"; + case Attendee::Delegated: + return "DELEGATED"; + case Attendee::Completed: + return "COMPLETED"; + case Attendee::InProcess: + return "NEEDS ACTION"; + } +} + +void VCalFormat::readCustomProperties(VObject *o, const Incidence::Ptr &i) +{ + VObjectIterator iter; + char *s; + + initPropIterator(&iter, o); + while (moreIteration(&iter)) { + VObject *cur = nextVObject(&iter); + const char *curname = vObjectName(cur); + Q_ASSERT(curname); + if ((curname[0] == 'X' && curname[1] == '-') && strcmp(curname, ICOrganizerProp) != 0) { + // TODO - for the time being, we ignore the parameters part + // and just do the value handling here + i->setNonKDECustomProperty(curname, QString::fromUtf8(s = fakeCString(vObjectUStringZValue(cur)))); + deleteStr(s); + } + } +} + +void VCalFormat::writeCustomProperties(VObject *o, const Incidence::Ptr &i) +{ + const QMap custom = i->customProperties(); + for (QMap::ConstIterator c = custom.begin(); c != custom.end(); ++c) { + if (d->mManuallyWrittenExtensionFields.contains(c.key()) || c.key().startsWith("X-KDE-VOLATILE")) { // krazy:exclude=strings + continue; + } + + addPropValue(o, c.key().constData(), c.value().toUtf8().constData()); + } +} + +void VCalFormat::virtual_hook(int id, void *data) +{ + Q_UNUSED(id); + Q_UNUSED(data); + Q_ASSERT(false); +} diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/vcalformat.h dde-calendar-5.10.0/3rdparty/kcalendarcore/src/vcalformat.h --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/vcalformat.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/vcalformat.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,214 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 1998 Preston Brown + SPDX-FileCopyrightText: 2001-2003 Cornelius Schumacher + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +/** + @file + This file is part of the API for handling calendar data and + defines the VCalFormat base class. + 该文件是用于处理日历数据的API的一部分,并定义VCalFormat基类。 + This class implements the vCalendar format. It provides methods for + loading/saving/converting vCalendar format data into the internal + representation as Calendar and Incidences. + 此类实现vCalendar格式。它提供了将vCalendar格式数据加载/保存/转换为日历和事件等内部表示形式的方法。 + + @brief + vCalendar format implementation. + + @author Preston Brown \ + @author Cornelius Schumacher \ +*/ + +#ifndef KCALCORE_VCALFORMAT_H +#define KCALCORE_VCALFORMAT_H + +#include "attendee.h" +#include "calformat.h" +#include "event.h" +#include "journal.h" +#include "todo.h" + +struct VObject; + +class QDate; + +#define _VCAL_VERSION "1.0" + +/* extensions for iMIP / iTIP */ +#define ICOrganizerProp "X-ORGANIZER" +#define ICMethodProp "X-METHOD" +#define ICRequestStatusProp "X-REQUEST-STATUS" + +namespace KCalendarCore { +class Event; +class Todo; + +/** + @brief + vCalendar format implementation. + + This class implements the vCalendar format. It provides methods for + loading/saving/converting vCalendar format data into the internal + representation as Calendar and Incidences. +*/ +class Q_CORE_EXPORT VCalFormat : public CalFormat +{ +public: + /** + Constructor a new vCalendar Format object. + */ + VCalFormat(); + + /** + Destructor. + */ + ~VCalFormat() override; + + /** + @copydoc + CalFormat::load() + */ + bool load(const Calendar::Ptr &calendar, const QString &fileName) override; + + /** + @copydoc + CalFormat::save() + */ + bool save(const Calendar::Ptr &calendar, const QString &fileName) override; + + /** + @copydoc + CalFormat::fromString() + */ + Q_REQUIRED_RESULT bool fromString(const Calendar::Ptr &calendar, const QString &string, bool deleted = false, const QString ¬ebook = QString()) override; + + /** + @copydoc + CalFormat::toString() + */ + Q_REQUIRED_RESULT QString toString(const Calendar::Ptr &calendar, const QString ¬ebook = QString(), bool deleted = false) override; + + /** + @copydoc + CalFormat::fromRawString() + */ + Q_REQUIRED_RESULT bool + fromRawString(const Calendar::Ptr &calendar, const QByteArray &string, bool deleted = false, const QString ¬ebook = QString()) override; + +protected: + /** + Translates a VObject of the TODO type into an Event. + @param vtodo is a pointer to a valid VObject object. + */ + Todo::Ptr VTodoToEvent(VObject *vtodo); + + /** + Translates a VObject into a Event and returns a pointer to it. + @param vevent is a pointer to a valid VObject object. + */ + Event::Ptr VEventToEvent(VObject *vevent); + + /** + Parse TZ tag from vtimezone. + */ + QString parseTZ(const QByteArray &timezone) const; + + /** + Parse DAYLIGHT tag from vtimezone. + */ + QString parseDst(QByteArray &timezone) const; + + /** + Takes a QDate and returns a string in the format YYYYMMDDTHHMMSS. + @param date is the date to format. + */ + QString qDateToISO(const QDate &date); + + /** + Takes a QDateTime and returns a string in format YYYYMMDDTHHMMSS. + @param date is the date to format. + @param zulu if true, then shift the date to UTC. + */ + QString qDateTimeToISO(const QDateTime &date, bool zulu = true); + + /** + Takes a string in YYYYMMDDTHHMMSS format and returns a valid QDateTime. + @param dtStr is a QString containing the date to convert. If this value + is invalid, then QDateTime() is returned. + */ + QDateTime ISOToQDateTime(const QString &dtStr); + + /** + Takes a string in the YYYYMMDD format and returns a valid QDate. + @param dtStr is a QString containing the date to convert. If this value + is invalid, then QDateTime() is returned. + */ + QDate ISOToQDate(const QString &dtStr); + + /** + Parse one of the myriad of ISO8601 timezone offset formats, e.g. + +- hh : mm + +- hh mm + +- hh + + @param s string to be parsed. + @param result timezone offset in seconds, if parse succeeded. + @return Whether the parse succeeded or not. + */ + bool parseTZOffsetISO8601(const QString &s, int &result); + + /** + Takes a vCalendar tree of VObjects, and puts all of them that have the + "event" property into the dictionary, todos in the todo-list, etc. + */ + void populate(VObject *vcal, bool deleted = false, const QString ¬ebook = QString()); + + /** + Converts a two letter representation of the day (i.e. MO, TU, WE, etc) and + returns a number 0-6 corresponding to that ordinal day of the week. + @param day is the QString containing the two letter day representation. + */ + int numFromDay(const QString &day); + + /** + Converts a status string into an Attendee::PartStat. + @param s is a null-terminated character string containing the status to convert. + + @return a valid Attendee::PartStat. If the string provided is empty, null, + or the contents are unrecognized, then Attendee::NeedsAction is returned. + */ + Attendee::PartStat readStatus(const char *s) const; + + /** + Converts an Attendee::PartStat into a QByteArray string. + @param status is the Attendee::PartStat to convert. + + @return a QByteArray containing the status string. + */ + QByteArray writeStatus(Attendee::PartStat status) const; + + void readCustomProperties(VObject *o, const Incidence::Ptr &i); + void writeCustomProperties(VObject *o, const Incidence::Ptr &i); + +protected: + /** + @copydoc + IncidenceBase::virtual_hook() + */ + void virtual_hook(int id, void *data) override; + +private: + //@cond PRIVATE + Q_DISABLE_COPY(VCalFormat) + class Private; + Private *const d; + //@endcond +}; + +} // namespace KCalendarCore + +#endif diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/visitor.cpp dde-calendar-5.10.0/3rdparty/kcalendarcore/src/visitor.cpp --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/visitor.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/visitor.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,47 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 2001-2003 Cornelius Schumacher + SPDX-FileCopyrightText: 2003-2004 Reinhold Kainhofer + SPDX-FileCopyrightText: 2005 Rafal Rzepecki + SPDX-FileCopyrightText: 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + SPDX-FileContributor: Alvaro Manera + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ + +#include "visitor.h" + +using namespace KCalendarCore; + +Visitor::Visitor() +{ +} + +Visitor::~Visitor() +{ +} + +bool Visitor::visit(const Event::Ptr &event) +{ + Q_UNUSED(event); + return false; +} + +bool Visitor::visit(const Todo::Ptr &todo) +{ + Q_UNUSED(todo); + return false; +} + +bool Visitor::visit(const Journal::Ptr &journal) +{ + Q_UNUSED(journal); + return false; +} + +bool Visitor::visit(const FreeBusy::Ptr &freebusy) +{ + Q_UNUSED(freebusy); + return false; +} diff -Nru dde-calendar-5.9.1/3rdparty/kcalendarcore/src/visitor.h dde-calendar-5.10.0/3rdparty/kcalendarcore/src/visitor.h --- dde-calendar-5.9.1/3rdparty/kcalendarcore/src/visitor.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/3rdparty/kcalendarcore/src/visitor.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,73 @@ +/* + This file is part of the kcalcore library. + + SPDX-FileCopyrightText: 2001-2003 Cornelius Schumacher + SPDX-FileCopyrightText: 2003-2004 Reinhold Kainhofer + SPDX-FileCopyrightText: 2005 Rafal Rzepecki + SPDX-FileCopyrightText: 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + SPDX-FileContributor: Alvaro Manera + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ + +#ifndef KCALCORE_VISITOR_H +#define KCALCORE_VISITOR_H + +#include "event.h" +#include "freebusy.h" +#include "journal.h" +#include "todo.h" + +namespace KCalendarCore { +/** + This class provides the interface for a visitor of calendar components. + It serves as base class for concrete visitors, which implement certain + actions on calendar components. It allows to add functions, which operate + on the concrete types of calendar components, without changing the + calendar component classes. +*/ +class Q_CORE_EXPORT Visitor // krazy:exclude=dpointer +{ +public: + /** Destruct Incidence::Visitor */ + virtual ~Visitor(); + + /** + Reimplement this function in your concrete subclass of + IncidenceBase::Visitor to perform actions on an Event object. + @param event is a pointer to a valid Event object. + */ + virtual bool visit(const Event::Ptr &event); + + /** + Reimplement this function in your concrete subclass of + IncidenceBase::Visitor to perform actions on a Todo object. + @param todo is a pointer to a valid Todo object. + */ + virtual bool visit(const Todo::Ptr &todo); + + /** + Reimplement this function in your concrete subclass of + IncidenceBase::Visitor to perform actions on an Journal object. + @param journal is a pointer to a valid Journal object. + */ + virtual bool visit(const Journal::Ptr &journal); + + /** + Reimplement this function in your concrete subclass of + IncidenceBase::Visitor to perform actions on a FreeBusy object. + @param freebusy is a pointer to a valid FreeBusy object. + */ + virtual bool visit(const FreeBusy::Ptr &freebusy); + +protected: + /** + Constructor is protected to prevent direct creation of visitor + base class. + */ + Visitor(); +}; + +} // namespace KCalendarCore + +#endif diff -Nru dde-calendar-5.9.1/calendar-basicstruct/CMakeLists.txt dde-calendar-5.10.0/calendar-basicstruct/CMakeLists.txt --- dde-calendar-5.9.1/calendar-basicstruct/CMakeLists.txt 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-basicstruct/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,23 +0,0 @@ -cmake_minimum_required(VERSION 3.7) -project(basestruct) - -# Find the library -find_package(PkgConfig REQUIRED) -find_package(Qt5 COMPONENTS - Core - DBus -REQUIRED) - -set(CMAKE_CXX_STANDARD 11) -set(CMAKE_INCLUDE_CURRENT_DIR ON) -set(CMAKE_AUTOMOC ON) - -#安全编译参数 -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-protector-strong -D_FORTITY_SOURCE=1 -z noexecstack -pie -fPIC -z lazy") - -include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src) -file(GLOB_RECURSE BASESTRUCT_SRCS ${CMAKE_CURRENT_LIST_DIR}/src/*.cpp) -link_libraries(${Qt5CORE_LIBRARIES} ${Qt5DBus_LIBRARIES}) -add_library(${PROJECT_NAME} STATIC ${BASESTRUCT_SRCS}) - - diff -Nru dde-calendar-5.9.1/calendar-basicstruct/src/calendardatastruct.cpp dde-calendar-5.10.0/calendar-basicstruct/src/calendardatastruct.cpp --- dde-calendar-5.9.1/calendar-basicstruct/src/calendardatastruct.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-basicstruct/src/calendardatastruct.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,21 +0,0 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: kongyunzhen -* -* Maintainer: kongyunzhen -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ -#include "calendardatastruct.h" diff -Nru dde-calendar-5.9.1/calendar-basicstruct/src/calendardatastruct.h dde-calendar-5.10.0/calendar-basicstruct/src/calendardatastruct.h --- dde-calendar-5.9.1/calendar-basicstruct/src/calendardatastruct.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-basicstruct/src/calendardatastruct.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,24 +0,0 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: kongyunzhen -* -* Maintainer: kongyunzhen -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ -#ifndef CALENDARDATASTRUCT_H -#define CALENDARDATASTRUCT_H - -#endif // CALENDARDATASTRUCT_H diff -Nru dde-calendar-5.9.1/calendar-basicstruct/src/commondatastruct.cpp dde-calendar-5.10.0/calendar-basicstruct/src/commondatastruct.cpp --- dde-calendar-5.9.1/calendar-basicstruct/src/commondatastruct.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-basicstruct/src/commondatastruct.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,22 +0,0 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: kongyunzhen -* -* Maintainer: kongyunzhen -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ -#include "commondatastruct.h" - diff -Nru dde-calendar-5.9.1/calendar-basicstruct/src/commondatastruct.h dde-calendar-5.10.0/calendar-basicstruct/src/commondatastruct.h --- dde-calendar-5.9.1/calendar-basicstruct/src/commondatastruct.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-basicstruct/src/commondatastruct.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,126 +0,0 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: kongyunzhen -* -* Maintainer: kongyunzhen -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ -#ifndef COMMONDATASTRUCT_H -#define COMMONDATASTRUCT_H -#include -#include -#include -#include - -enum jobtypes { - jobTypeWork = 1, - jobTypeLife, - jobTypeOther, - JobTypeFestival, -}; - -typedef struct JobTypeJSON { - uint ID; - QString Name; - QString Color; -} stJobTypeJSON; - -//关于名字的国际化暂时不做处理,如果后期确认需要国际化的很少则通过client做适配来处理 -static QVector globalPredefinedTypes { - { - jobTypeWork, - "Work", - "#FF0000" // red - }, - { - jobTypeLife, - "Life", - "#00FF00" // green - }, - { - jobTypeOther, - "Other", - "#800080" // purple - }, - { - JobTypeFestival, - "Festival", - "#FFFF00" // yellow - }}; - -typedef struct _tagJob { - _tagJob() - : ID {0} - , Type {0} - , RecurID {0} - , RemindLaterCount {0} - , IsLunar {false} - { - } - qint64 ID; - qint64 Type; - qint64 RecurID; - QString Title {}; - QString Description {}; - bool AllDay {false}; - QDateTime Start; - QDateTime End; - QString RRule {};//重复规则,如:工作日起床闹钟 - QString Remind {};//提前提醒,如:提前几天或几分钟 - QString Ignore {};//如:工作日起床闹钟,除了周五 - QString Title_pinyin {}; - QDateTime RemidTime; //提醒时间 - qint32 RemindLaterCount; //执行稍后提醒次数 - bool IsLunar; -} Job; - -typedef struct JobArr { - QDate date; - QList jobs {}; - QList extends {}; -} stJobArr; - -typedef struct JobTime { - QDateTime start; - QDateTime end; - qint64 recurID = 0; -} stJobTime; - -enum RepeatType { - RepeatNone = 0, - RepeatDaily, - RepeatWorkDay, - RepeatWeekly, - RepeatMonthly, - RepeatYearly, -}; - -enum RepeatOverCondition { - RepeatOverNever = 0, - RepeatOverCount, - RepeatOverUntil, -}; - -typedef struct RRuleOptions { - //初始化 - RepeatType rpeat {RepeatType::RepeatNone}; //重复规则 0 无 1 每天 2 每个工作日 3 每周 4每月 5每年 - RepeatOverCondition type {RepeatOverCondition::RepeatOverNever}; //结束重复 0 永不 1 多少次结束 2 结束日期 - int tcount {}; //多少次结束只有当type=1才会生效 - QDateTime overdate; //type=2时才有效 -} stRRuleOptions; - -Q_DECLARE_METATYPE(Job) -#endif // COMMONDATASTRUCT_H diff -Nru dde-calendar-5.9.1/calendar-basicstruct/src/commondef.h dde-calendar-5.10.0/calendar-basicstruct/src/commondef.h --- dde-calendar-5.9.1/calendar-basicstruct/src/commondef.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-basicstruct/src/commondef.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,30 +0,0 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: kongyunzhen -* -* Maintainer: kongyunzhen -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ -#ifndef COMMONDEF_H -#define COMMONDEF_H - -#include -#include - -const QString CalendarServiceName = "com.deepin.dataserver.Calendar"; -const QString CalendarPath = "/com/deepin/dataserver/Calendar"; - -#endif // COMMONDEF_H diff -Nru dde-calendar-5.9.1/calendar-basicstruct/src/dbusdatastruct.cpp dde-calendar-5.10.0/calendar-basicstruct/src/dbusdatastruct.cpp --- dde-calendar-5.9.1/calendar-basicstruct/src/dbusdatastruct.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-basicstruct/src/dbusdatastruct.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,333 +0,0 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: kongyunzhen -* -* Maintainer: kongyunzhen -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ -#include "dbusdatastruct.h" - -#include -#include -#include - -void CaLunarDayInfo::registerMetaType() -{ - qRegisterMetaType(); - qDBusRegisterMetaType(); -} - -QDebug operator<<(QDebug argument, const CaLunarDayInfo &what) -{ - argument << what.mGanZhiYear << what.mGanZhiMonth << what.mGanZhiDay; - argument << what.mLunarMonthName << what.mLunarDayName; - argument << what.mLunarLeapMonth; - argument << what.mZodiac << what.mTerm; - argument << what.mSolarFestival << what.mLunarFestival; - argument << what.mWorktime; - - return argument; -} - -QDBusArgument &operator<<(QDBusArgument &argument, const CaLunarDayInfo &what) -{ - argument.beginStructure(); - argument << what.mGanZhiYear << what.mGanZhiMonth << what.mGanZhiDay; - argument << what.mLunarMonthName << what.mLunarDayName; - argument << what.mLunarLeapMonth; - argument << what.mZodiac << what.mTerm; - argument << what.mSolarFestival << what.mLunarFestival; - argument << what.mWorktime; - argument.endStructure(); - - return argument; -} - -const QDBusArgument &operator>>(const QDBusArgument &argument, CaLunarDayInfo &what) -{ - argument.beginStructure(); - argument >> what.mGanZhiYear >> what.mGanZhiMonth >> what.mGanZhiDay; - argument >> what.mLunarMonthName >> what.mLunarDayName; - argument >> what.mLunarLeapMonth; - argument >> what.mZodiac >> what.mTerm; - argument >> what.mSolarFestival >> what.mLunarFestival; - argument >> what.mWorktime; - argument.endStructure(); - - return argument; -} - -void CaLunarMonthInfo::registerMetaType() -{ - qRegisterMetaType(); - qDBusRegisterMetaType(); -} - -QDebug operator<<(QDebug argument, const CaLunarMonthInfo &what) -{ - argument << what.mFirstDayWeek << what.mDays; - argument << what.mCaLunarDayInfo; - - return argument; -} - -QDBusArgument &operator<<(QDBusArgument &argument, const CaLunarMonthInfo &what) -{ - argument.beginStructure(); - argument << what.mFirstDayWeek << what.mDays; - argument << what.mCaLunarDayInfo; - argument.endStructure(); - - return argument; -} - -const QDBusArgument &operator>>(const QDBusArgument &argument, CaLunarMonthInfo &what) -{ - argument.beginStructure(); - argument >> what.mFirstDayWeek >> what.mDays; - argument >> what.mCaLunarDayInfo; - argument.endStructure(); - - return argument; -} - -void CaHuangLiDayInfo::registerMetaType() -{ - qRegisterMetaType(); - qDBusRegisterMetaType(); -} - -QString CaHuangLiDayInfo::toJson() -{ - QJsonDocument doc; - QJsonObject obj; - - obj.insert("Suit", mSuit); - obj.insert("Avoid", mAvoid); - obj.insert("Worktime", mWorktime); - obj.insert("LunarFestival", mLunarFestival); - obj.insert("SolarFestival", mSolarFestival); - obj.insert("Term", mTerm); - obj.insert("Zodiac", mZodiac); - obj.insert("LunarLeapMonth", mLunarLeapMonth); - obj.insert("LunarDayName", mLunarDayName); - obj.insert("LunarMonthName", mLunarMonthName); - obj.insert("GanZhiDay", mGanZhiDay); - obj.insert("GanZhiMonth", mGanZhiMonth); - obj.insert("GanZhiYear", mGanZhiYear); - - doc.setObject(obj); - QString strJson = QString::fromUtf8(doc.toJson(QJsonDocument::Compact)); - return strJson; -} - -void CaHuangLiDayInfo::strJsonToInfo(const QString &strJson, bool &isVaild) -{ - isVaild = true; - QJsonParseError json_error; - QJsonDocument jsonDoc(QJsonDocument::fromJson(strJson.toLocal8Bit(), &json_error)); - if (json_error.error != QJsonParseError::NoError) { - isVaild = false; - return ; - } - QJsonObject rootObj = jsonDoc.object(); - jsonObjectToInfo(rootObj); -} - -void CaHuangLiDayInfo::jsonObjectToInfo(const QJsonObject &jsonObject) -{ - //因为是预先定义好的JSON数据格式,所以这里可以这样读取int - if (jsonObject.contains("Suit")) { - this->mSuit = jsonObject.value("Suit").toString(); - } - if (jsonObject.contains("Avoid")) { - this->mAvoid = jsonObject.value("Avoid").toString(); - } - if (jsonObject.contains("Worktime")) { - this->mWorktime = jsonObject.value("Worktime").toInt(); - } - if (jsonObject.contains("LunarFestival")) { - this->mLunarFestival = jsonObject.value("LunarFestival").toString(); - } - if (jsonObject.contains("SolarFestival")) { - this->mSolarFestival = jsonObject.value("SolarFestival").toString(); - } - if (jsonObject.contains("Term")) { - this->mTerm = jsonObject.value("Term").toString(); - } - if (jsonObject.contains("Zodiac")) { - this->mZodiac = jsonObject.value("Zodiac").toString(); - } - if (jsonObject.contains("LunarLeapMonth")) { - this->mLunarLeapMonth = jsonObject.value("LunarLeapMonth").toInt(); - } - if (jsonObject.contains("LunarDayName")) { - this->mLunarDayName = jsonObject.value("LunarDayName").toString(); - } - if (jsonObject.contains("LunarMonthName")) { - this->mLunarMonthName = jsonObject.value("LunarMonthName").toString(); - } - if (jsonObject.contains("GanZhiDay")) { - this->mGanZhiDay = jsonObject.value("GanZhiDay").toString(); - } - if (jsonObject.contains("GanZhiMonth")) { - this->mGanZhiMonth = jsonObject.value("GanZhiMonth").toString(); - } - if (jsonObject.contains("GanZhiYear")) { - this->mGanZhiYear = jsonObject.value("GanZhiYear").toString(); - } -} - -QDebug operator<<(QDebug argument, const CaHuangLiDayInfo &what) -{ - argument << what.mSuit << what.mAvoid; - argument << what.mWorktime; - argument << what.mLunarFestival << what.mSolarFestival; - argument << what.mTerm << what.mZodiac; - argument << what.mLunarLeapMonth; - argument << what.mLunarDayName << what.mLunarMonthName; - argument << what.mGanZhiDay << what.mGanZhiMonth << what.mGanZhiYear; - return argument; -} - -QDBusArgument &operator<<(QDBusArgument &argument, const CaHuangLiDayInfo &what) -{ - argument.beginStructure(); - argument << what.mSuit << what.mAvoid; - argument << what.mWorktime; - argument << what.mLunarFestival << what.mSolarFestival; - argument << what.mTerm << what.mZodiac; - argument << what.mLunarLeapMonth; - argument << what.mLunarDayName << what.mLunarMonthName; - argument << what.mGanZhiDay << what.mGanZhiMonth << what.mGanZhiYear; - argument.endStructure(); - return argument; -} - -const QDBusArgument &operator>>(const QDBusArgument &argument, CaHuangLiDayInfo &what) -{ - argument.beginStructure(); - argument >> what.mSuit >> what.mAvoid; - argument >> what.mWorktime; - argument >> what.mLunarFestival >> what.mSolarFestival; - argument >> what.mTerm >> what.mZodiac; - argument >> what.mLunarLeapMonth; - argument >> what.mLunarDayName >> what.mLunarMonthName; - argument >> what.mGanZhiDay >> what.mGanZhiMonth >> what.mGanZhiYear; - argument.endStructure(); - return argument; -} - -void CaHuangLiMonthInfo::registerMetaType() -{ - qRegisterMetaType(); - qDBusRegisterMetaType(); -} - -QString CaHuangLiMonthInfo::toJson() -{ - QJsonArray daysarr; - QJsonDocument doc; - QJsonObject obj; - obj.insert("Days", mDays); - obj.insert("FirstDayWeek", mFirstDayWeek); - foreach (CaHuangLiDayInfo dayinfo, mCaLunarDayInfo) { - QJsonObject dayobj; - dayobj.insert("Suit", dayinfo.mSuit); - dayobj.insert("Avoid", dayinfo.mAvoid); - dayobj.insert("Worktime", dayinfo.mWorktime); - dayobj.insert("LunarFestival", dayinfo.mLunarFestival); - dayobj.insert("SolarFestival", dayinfo.mSolarFestival); - dayobj.insert("Term", dayinfo.mTerm); - dayobj.insert("Zodiac", dayinfo.mZodiac); - dayobj.insert("LunarLeapMonth", dayinfo.mLunarLeapMonth); - dayobj.insert("LunarDayName", dayinfo.mLunarDayName); - dayobj.insert("LunarMonthName", dayinfo.mLunarMonthName); - dayobj.insert("GanZhiDay", dayinfo.mGanZhiDay); - dayobj.insert("GanZhiMonth", dayinfo.mGanZhiMonth); - dayobj.insert("GanZhiYear", dayinfo.mGanZhiYear); - daysarr.append(dayobj); - } - obj.insert("Datas", daysarr); - doc.setObject(obj); - QString strJson = QString::fromUtf8(doc.toJson(QJsonDocument::Compact)); - return strJson; -} - -void CaHuangLiMonthInfo::strJsonToInfo(const QString &strJson, bool &isVaild) -{ - isVaild = true; - QJsonParseError json_error; - QJsonDocument jsonDoc(QJsonDocument::fromJson(strJson.toLocal8Bit(), &json_error)); - - if (json_error.error != QJsonParseError::NoError) { - isVaild = false; - return; - } - - QJsonObject rootObj = jsonDoc.object(); - - //因为是预先定义好的JSON数据格式,所以这里可以这样读取 - if (rootObj.contains("Days")) { - this->mDays = rootObj.value("Days").toInt(); - } - if (rootObj.contains("FirstDayWeek")) { - this->mFirstDayWeek = rootObj.value("FirstDayWeek").toInt(); - } - if (rootObj.contains("Datas")) { - QJsonArray subArray = rootObj.value("Datas").toArray(); - for (int i = 0; i < subArray.size(); i++) { - QJsonObject subObj = subArray.at(i).toObject(); - CaHuangLiDayInfo huangliday; - huangliday.jsonObjectToInfo(subObj); - this->mCaLunarDayInfo.append(huangliday); - } - } -} - -void CaHuangLiMonthInfo::clear() -{ - this->mDays = 0; - this->mCaLunarDayInfo.clear(); -} - -QDebug operator<<(QDebug argument, const CaHuangLiMonthInfo &what) -{ - argument << what.mDays << what.mFirstDayWeek; - argument << what.mCaLunarDayInfo; - - return argument; -} - -QDBusArgument &operator<<(QDBusArgument &argument, const CaHuangLiMonthInfo &what) -{ - argument.beginStructure(); - argument << what.mDays << what.mFirstDayWeek; - argument << what.mCaLunarDayInfo; - argument.endStructure(); - - return argument; -} - -const QDBusArgument &operator>>(const QDBusArgument &argument, CaHuangLiMonthInfo &what) -{ - argument.beginStructure(); - argument >> what.mDays >> what.mFirstDayWeek; - argument >> what.mCaLunarDayInfo; - argument.endStructure(); - - return argument; -} diff -Nru dde-calendar-5.9.1/calendar-basicstruct/src/dbusdatastruct.h dde-calendar-5.10.0/calendar-basicstruct/src/dbusdatastruct.h --- dde-calendar-5.9.1/calendar-basicstruct/src/dbusdatastruct.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-basicstruct/src/dbusdatastruct.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,123 +0,0 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: kongyunzhen -* -* Maintainer: kongyunzhen -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ -#ifndef DBUSDATASTRUCT_H -#define DBUSDATASTRUCT_H - -#include -#include - -class CaLunarDayInfo -{ -public: - CaLunarDayInfo() {} - - static void registerMetaType(); - - friend QDebug operator<<(QDebug argument, const CaLunarDayInfo &what); - friend QDBusArgument &operator<<(QDBusArgument &argument, const CaLunarDayInfo &what); - friend const QDBusArgument &operator>>(const QDBusArgument &argument, CaLunarDayInfo &what); - -public: - QString mGanZhiYear; // 农历年的干支 - QString mGanZhiMonth; // 农历月的干支 - QString mGanZhiDay; // 农历日的干支 - QString mLunarMonthName; // 农历月名 - QString mLunarDayName; // 农历日名 - qint32 mLunarLeapMonth; // 未使用 - QString mZodiac; // 农历年的生肖 - QString mTerm; // 农历节气 - QString mSolarFestival; // 公历节日 - QString mLunarFestival; // 农历节日 - qint32 mWorktime; // 未使用 -}; - -class CaLunarMonthInfo -{ -public: - CaLunarMonthInfo() {} - - static void registerMetaType(); - - friend QDebug operator<<(QDebug argument, const CaLunarMonthInfo &what); - friend QDBusArgument &operator<<(QDBusArgument &argument, const CaLunarMonthInfo &what); - friend const QDBusArgument &operator>>(const QDBusArgument &argument, CaLunarMonthInfo &what); - -public: - qint32 mFirstDayWeek; - qint32 mDays; - QList mCaLunarDayInfo; -}; - -class CaHuangLiDayInfo -{ -public: - CaHuangLiDayInfo() - : mLunarLeapMonth(0) - , mWorktime(0) - { - } - static void registerMetaType(); - friend QDebug operator<<(QDebug argument, const CaHuangLiDayInfo &what); - friend QDBusArgument &operator<<(QDBusArgument &argument, const CaHuangLiDayInfo &what); - friend const QDBusArgument &operator>>(const QDBusArgument &argument, CaHuangLiDayInfo &what); - QString toJson(); - void strJsonToInfo(const QString &strJson, bool &isVaild); - void jsonObjectToInfo(const QJsonObject &jsonObject); -public: - QString mGanZhiYear; //年干支 - QString mGanZhiMonth; //月干支 - QString mGanZhiDay; //日干支 - QString mLunarMonthName; //农历月名称 - QString mLunarDayName; //农历日名称 - qint32 mLunarLeapMonth; //闰月 - QString mZodiac; //生肖 - QString mTerm; //农历节气 - QString mSolarFestival; //阳历节日 - QString mLunarFestival; //农历节日 - qint32 mWorktime; //未使用 - QString mSuit; //黄历宜 - QString mAvoid; //黄历忌 -}; - -class CaHuangLiMonthInfo -{ -public: - CaHuangLiMonthInfo() {} - static void registerMetaType(); - - friend QDebug operator<<(QDebug argument, const CaHuangLiMonthInfo &what); - friend QDBusArgument &operator<<(QDBusArgument &argument, const CaHuangLiMonthInfo &what); - friend const QDBusArgument &operator>>(const QDBusArgument &argument, CaHuangLiMonthInfo &what); - QString toJson(); - void strJsonToInfo(const QString &strJson, bool &isVaild); - void clear(); -public: - qint32 mFirstDayWeek; //第一天所在周 - qint32 mDays; //每月天数 - QVector mCaLunarDayInfo; -}; - -Q_DECLARE_METATYPE(CaLunarDayInfo) -Q_DECLARE_METATYPE(CaLunarMonthInfo) -Q_DECLARE_METATYPE(CaHuangLiDayInfo) -Q_DECLARE_METATYPE(CaHuangLiMonthInfo) - -#endif // DBUSDATASTRUCT_H diff -Nru dde-calendar-5.9.1/calendar-basicstruct/src/DebugTimeManager.cpp dde-calendar-5.10.0/calendar-basicstruct/src/DebugTimeManager.cpp --- dde-calendar-5.9.1/calendar-basicstruct/src/DebugTimeManager.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-basicstruct/src/DebugTimeManager.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,72 +0,0 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: Jun.Liu -* Maintainer: xxx.xx -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ - -#include "DebugTimeManager.h" -#include -#include - -#include - -DebugTimeManager *DebugTimeManager::s_Instance = nullptr; - -DebugTimeManager::DebugTimeManager() -{ - -} - -void DebugTimeManager::clear() -{ - m_MapPoint.clear(); -} - -void DebugTimeManager::beginPointQt(const QString &point, const QString &status) -{ - PointInfo info; - info.desc = status; - info.time = QDateTime::currentMSecsSinceEpoch(); - m_MapPoint.insert(point, info); -} -void DebugTimeManager::endPointQt(const QString &point) -{ - if (m_MapPoint.find(point) != m_MapPoint.end()) { - m_MapPoint[point].time = QDateTime::currentMSecsSinceEpoch() - m_MapPoint[point].time; - qInfo() << QString("[GRABPOINT] %1 %2 time=%3ms").arg(point).arg(m_MapPoint[point].desc).arg(m_MapPoint[point].time); - } -} - -void DebugTimeManager::beginPointLinux(const QString &point, const QString &status) -{ - struct timeval tv; - gettimeofday(&tv, nullptr); - - PointInfo info; - info.desc = status; - info.time = tv.tv_sec * 1000 + tv.tv_usec / 1000; - m_MapPoint.insert(point, info); -} -void DebugTimeManager::endPointLinux(const QString &point) -{ - if (m_MapPoint.find(point) != m_MapPoint.end()) { - struct timeval tv; - gettimeofday(&tv, nullptr); - m_MapPoint[point].time = tv.tv_sec * 1000 + tv.tv_usec / 1000 - m_MapPoint[point].time; - qInfo() << QString("[GRABPOINT] %1 %2 time=%3ms").arg(point).arg(m_MapPoint[point].desc).arg(m_MapPoint[point].time); - } -} diff -Nru dde-calendar-5.9.1/calendar-basicstruct/src/DebugTimeManager.h dde-calendar-5.10.0/calendar-basicstruct/src/DebugTimeManager.h --- dde-calendar-5.9.1/calendar-basicstruct/src/DebugTimeManager.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-basicstruct/src/DebugTimeManager.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,104 +0,0 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: Jun.Liu -* Maintainer: xxx.xx -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ - -#ifndef DEBUGTIMEMANAGER_H -#define DEBUGTIMEMANAGER_H -#include -#include -#include - -/** - * @brief The PointInfo struct - */ -struct PointInfo { - QString desc; - qint64 time; -}; - -class DebugTimeManager -{ -public: - /** - * @brief getInstance : get signal instance - * @return : the signal instance - */ - static DebugTimeManager *getInstance() - { - if (!s_Instance) { - s_Instance = new DebugTimeManager(); - } - return s_Instance; - } - - /** - * @brief clear : clear data - */ - void clear(); - - /** - * @brief beginPointQt : 打点开始,Qt - * @param point : 所打的点的名称,固定格式,在打点文档中查看 -- POINT-XX POINT-01 - * @param status : 性能测试的状态,比如测试时文件的大小 - */ - void beginPointQt(const QString &point, const QString &status = ""); - - /** - * @brief endPointQt : 结束打点,Qt - * @param point : 需要结束的点 - */ - void endPointQt(const QString &point); - - - /** - * @brief beginPointLinux : 打点开始,Linux - * @param point : 所打的点的名称,固定格式,在打点文档中查看 -- POINT-XX POINT-01 - * @param status : 性能测试的状态,比如测试时文件的大小 - */ - void beginPointLinux(const QString &point, const QString &status = ""); - - /** - * @brief endPointLinux : 结束打点,Linux - * @param point : 需要结束的点 - */ - void endPointLinux(const QString &point); - -protected: - DebugTimeManager(); - - -private: - static DebugTimeManager *s_Instance; // m_MapPoint; //beginPointLinux(printStr,Description) -#define PERF_PRINT_END(printStr) \ - DebugTimeManager::getInstance()->endPointLinux(printStr) -#else -#define PERF_PRINT_BEGIN(printStr, Description) -#define PERF_PRINT_END(printStr) -#endif - -#endif // DEBUGTIMEMANAGER_H diff -Nru dde-calendar-5.9.1/calendar-basicstruct/src/lunardatastruct.cpp dde-calendar-5.10.0/calendar-basicstruct/src/lunardatastruct.cpp --- dde-calendar-5.9.1/calendar-basicstruct/src/lunardatastruct.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-basicstruct/src/lunardatastruct.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,21 +0,0 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: kongyunzhen -* -* Maintainer: kongyunzhen -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ -#include "lunardatastruct.h" diff -Nru dde-calendar-5.9.1/calendar-basicstruct/src/lunardatastruct.h dde-calendar-5.10.0/calendar-basicstruct/src/lunardatastruct.h --- dde-calendar-5.9.1/calendar-basicstruct/src/lunardatastruct.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-basicstruct/src/lunardatastruct.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,48 +0,0 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: kongyunzhen -* -* Maintainer: kongyunzhen -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ -#ifndef LUNARDATASTRUCT_H -#define LUNARDATASTRUCT_H -#include -#include -#include - -typedef struct HuangLi { - qint64 ID = 0; // `json:"id"` // format: ("%s%02s%02s", year, month, day) - QString Avoid {}; // `json:"avoid"` - QString Suit {}; //`json:"suit"` -} stHuangLi; - -typedef struct _tagHolidayInfo { - QDate date; - char status {}; -} HolidayInfo; - -typedef struct _tagFestivalInfo { - QString ID = 0; - QString FestivalName {}; - QString description {}; - QString Rest {}; - int month = 0; - int year = 0; - QVector listHoliday {}; -} FestivalInfo; - -#endif // LUNARDATASTRUCT_H diff -Nru dde-calendar-5.9.1/calendar-basicstruct/src/reminddata.cpp dde-calendar-5.10.0/calendar-basicstruct/src/reminddata.cpp --- dde-calendar-5.9.1/calendar-basicstruct/src/reminddata.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-basicstruct/src/reminddata.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,107 +0,0 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ -#include "reminddata.h" - -RemindData::RemindData() - : m_RemindNum(-1) - , m_RemindTime(9, 0, 0) -{ - -} - -RemindData::RemindData(const int remindNum, const QTime &remindTime) - : m_RemindNum(remindNum) - , m_RemindTime(remindTime) -{ - -} - -/** - * @brief setRemindNum 设置提前多久提醒 - * @param num - */ -void RemindData::setRemindNum(const int num) -{ - m_RemindNum = num; -} - -/** - * @brief getRemindNum 获取提前多久提醒 - * @return - */ -int RemindData::getRemindNum() const -{ - return m_RemindNum; -} - -/** - * @brief setRemindTime 设置提醒时间 - * @param remindTime - */ -void RemindData::setRemindTime(const QTime &remindTime) -{ - m_RemindTime = remindTime; -} - -/** - * @brief getRemindTime 获取提醒时间 - * @return - */ -QTime RemindData::getRemindTime() const -{ - return m_RemindTime; -} - -/** - * @brief RemindStringToRemindData 将sting转换为提醒数据 - * @param remindStr 提醒的string数据 - * @return - */ -RemindData RemindData::RemindStringToRemindData(const QString &remindStr) -{ - RemindData _resultRemindData; - if (!remindStr.isEmpty()) { - QStringList liststr = remindStr.split(";", QString::SkipEmptyParts); - _resultRemindData.setRemindNum(liststr.at(0).toInt()); - if (liststr.size() > 1) { - _resultRemindData.setRemindTime(QTime::fromString(liststr.at(1), "hh:mm")); - } - } - return _resultRemindData; -} - -/** - * @brief RemindDataToRemindString 将提醒数据转换为string - * @param remindData 提醒数据 - * @param isAllDay 是否为全天 - * @return - */ -QString RemindData::RemindDataToRemindString(const RemindData &remindData, const bool isAllDay) -{ - QString _resultStr {""}; - if (remindData.getRemindNum() != -1) { - _resultStr += QString::number(remindData.getRemindNum()); - if (isAllDay) { - _resultStr += QString(";%1").arg(remindData.getRemindTime().toString("hh:mm")); - } - } - return _resultStr; -} diff -Nru dde-calendar-5.9.1/calendar-basicstruct/src/reminddata.h dde-calendar-5.10.0/calendar-basicstruct/src/reminddata.h --- dde-calendar-5.9.1/calendar-basicstruct/src/reminddata.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-basicstruct/src/reminddata.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,61 +0,0 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ -#ifndef REMINDDATA_H -#define REMINDDATA_H - -#include -/** - * @brief The RemindData class - * 提醒规则 - */ -class RemindData -{ -public: - explicit RemindData(); - RemindData(const int remindNum, const QTime &remindTime); - //设置提前多久提醒 - void setRemindNum(const int num); - //获取提前多久提醒 - int getRemindNum() const; - //设置提醒时间 - void setRemindTime(const QTime &remindTime); - //获取提醒时间 - QTime getRemindTime() const; - //将sting转换为提醒数据 - static RemindData RemindStringToRemindData(const QString &remindStr); - //将提醒数据转换为string - static QString RemindDataToRemindString(const RemindData &remindData, const bool isAllDay); -private: - /** - * @brief m_RemindNum 提前多久提醒 - * -1 永不提醒 - * 若日程为全天 0~N 表示提前多少天提醒 - * 若日程为非全天 0~N 表示提前多少分钟提醒 - */ - int m_RemindNum; - /** - * @brief m_RemindTime 提醒时间 - * 只有日程为全天 才有效 - */ - QTime m_RemindTime; -}; - -#endif // REMINDDATA_H diff -Nru dde-calendar-5.9.1/calendar-basicstruct/src/repetitionrule.cpp dde-calendar-5.10.0/calendar-basicstruct/src/repetitionrule.cpp --- dde-calendar-5.9.1/calendar-basicstruct/src/repetitionrule.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-basicstruct/src/repetitionrule.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,224 +0,0 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ -#include "repetitionrule.h" - -#include - -RepetitionRule::RepetitionRule() - : m_ruleID(RRule_NONE) - , m_ruleEndType(RRuleType_NEVER) - , m_endDateTime() - , m_endCount(0) -{ - -} - -/** - * @brief getRuleId 获取重复规则id - * @return - */ -RepetitionRule::RRuleID RepetitionRule::getRuleId() const -{ - return m_ruleID; -} - -/** - * @brief setRuleId 设置重复规则id - * @param ruleId - */ -void RepetitionRule::setRuleId(const RepetitionRule::RRuleID ruleId) -{ - m_ruleID = ruleId; -} - -/** - * @brief setRuleType 设置重复结束类型 - * @param endType - */ -void RepetitionRule::setRuleType(const RepetitionRule::RRuleEndType &endType) -{ - m_ruleEndType = endType; -} - -/** - * @brief getRuleType 获取重复结束类型 - * @return - */ -RepetitionRule::RRuleEndType RepetitionRule::getRuleType() const -{ - return m_ruleEndType; -} - -/** - * @brief getEndDate 获取结束时间 - * @return - */ -QDateTime RepetitionRule::getEndDate() const -{ - return m_endDateTime; -} - -/** - * @brief setEndDate 设置结束时间 - * @param endDate 结束时间 - */ -void RepetitionRule::setEndDate(const QDateTime &endDate) -{ - m_endDateTime = endDate; -} - -/** - * @brief getEndCount 获取结束次数 - * @return - */ -int RepetitionRule::getEndCount() const -{ - return m_endCount; -} - -/** - * @brief setEndCount 设置结束次数 - * @param endCount 结束次数 - */ -void RepetitionRule::setEndCount(const int endCount) -{ - m_endCount = endCount; -} - -void RepetitionRule::clear() -{ - m_ruleID = RRule_NONE; - m_ruleEndType = RRuleType_NEVER; -} - -/** - * @brief RuleStringToRuleData 解析重复规则 - * @param ruleStr - * @return - */ -RepetitionRule RepetitionRule::RuleStringToRuleData(const QString &ruleStr) -{ - RepetitionRule _resultRule{}; - - if (ruleStr.isEmpty()) { - return _resultRule; - } - QStringList rruleslist = ruleStr.split(";", QString::SkipEmptyParts); - - if (rruleslist.count() > 0) { - if (rruleslist.contains("FREQ=DAILY") && rruleslist.contains("BYDAY=MO,TU,WE,TH,FR")) { - _resultRule.setRuleId(RRule_WORKDAY); - } else if (rruleslist.contains("FREQ=DAILY")) { - _resultRule.setRuleId(RRule_EVEDAY); - } else if (rruleslist.contains("FREQ=WEEKLY")) { - _resultRule.setRuleId(RRule_EVEWEEK); - } else if (rruleslist.contains("FREQ=MONTHLY")) { - _resultRule.setRuleId(RRule_EVEMONTH); - } else if (rruleslist.contains("FREQ=YEARLY")) { - _resultRule.setRuleId(RRule_EVEYEAR); - } - - for (int i = 0; i < rruleslist.count(); i++) { - if (rruleslist.at(i).contains("COUNT=")) { - QStringList liststr = rruleslist.at(i).split("=", QString::SkipEmptyParts); - _resultRule.setRuleType(RRuleType_FREQ); - _resultRule.setEndCount(liststr.at(1).toInt() - 1); - } - if (rruleslist.at(i).contains("UNTIL=")) { - QStringList liststr = rruleslist.at(i).split("=", QString::SkipEmptyParts); - if (liststr.size() > 1) { - _resultRule.setRuleType(RRuleType_DATE); - QDateTime _endDate = resolutionEndDate(liststr.at(1)); - _resultRule.setEndDate(_endDate); - } else { - qWarning() << "Recurrence Rule Err," << ruleStr; - } - - } - } - } - return _resultRule; -} - -/** - * @brief RuleDataToRuleString 将重复数据转换为string类型 - * @param rule 重复规则 - * @return - */ -QString RepetitionRule::RuleDataToRuleString(const RepetitionRule &rule) -{ - QString _resultStr {""}; - switch (rule.getRuleId()) { - case RRule_NONE: - _resultStr += ""; - break; - case RRule_EVEDAY: - _resultStr += "FREQ=DAILY"; - break; - case RRule_WORKDAY: - _resultStr += "FREQ=DAILY;BYDAY=MO,TU,WE,TH,FR"; - break; - case RRule_EVEWEEK: - _resultStr += "FREQ=WEEKLY"; - break; - case RRule_EVEMONTH: - _resultStr += "FREQ=MONTHLY"; - break; - case RRule_EVEYEAR: - _resultStr += "FREQ=YEARLY"; - break; - case RRule_CUSTOM: - - break; - } - switch (rule.getRuleType()) { - case RRuleType_NEVER: - - break; - case RRuleType_FREQ: - _resultStr += QString(";COUNT=%1").arg(rule.getEndCount() + 1); - break; - case RRuleType_DATE: - _resultStr += ";UNTIL=" + endDateToString(rule.getEndDate()); - break; - } - return _resultStr; -} - -/** - * @brief RepetitionRule::resolutionEndDate 解析结束时间 - * @param endDateStr - * @return - */ -QDateTime RepetitionRule::resolutionEndDate(const QString &endDateStr) -{ - return QDateTime::fromString(endDateStr.left(endDateStr.count() - 1), "yyyyMMddThhmmss"); -} - -/** - * @brief RepetitionRule::endDateToString 结束时间转换为string - * @param endDate - * @return - */ -QString RepetitionRule::endDateToString(const QDateTime &endDate) -{ - return endDate.toString("yyyyMMddThhmmss") + "Z"; -} diff -Nru dde-calendar-5.9.1/calendar-basicstruct/src/repetitionrule.h dde-calendar-5.10.0/calendar-basicstruct/src/repetitionrule.h --- dde-calendar-5.9.1/calendar-basicstruct/src/repetitionrule.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-basicstruct/src/repetitionrule.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,99 +0,0 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ -#ifndef REPETITIONRULE_H -#define REPETITIONRULE_H - -#include -#include -/** - * @brief The RepetitionRule class - * 重复规则 - */ - -class RepetitionRule -{ -public: - enum RRuleID { - RRule_NONE = 0, //不重复 - RRule_EVEDAY, //每天 - RRule_WORKDAY, //每个工作日 - RRule_EVEWEEK, //每周 - RRule_EVEMONTH, //每月 - RRule_EVEYEAR, //每年 - RRule_CUSTOM //用户自定义 - }; - enum RRuleEndType { - RRuleType_NEVER = 0, //永不 - RRuleType_FREQ, //结束于次数 - RRuleType_DATE //结束与日期 - }; -public: - explicit RepetitionRule(); - //获取重复规则id - RRuleID getRuleId() const; - //设置重复规则id - void setRuleId(const RRuleID ruleId); - //设置重复结束类型 - void setRuleType(const RRuleEndType &endType); - //获取重复结束类型 - RRuleEndType getRuleType() const; - //获取结束时间 - QDateTime getEndDate() const; - //设置结束时间 - void setEndDate(const QDateTime &endDate); - //获取结束次数 - int getEndCount() const; - //设置结束次数 - void setEndCount(const int endCount); - void clear(); - //解析重复规则 - static RepetitionRule RuleStringToRuleData(const QString &ruleStr); - //将重复数据转换为string类型 - static QString RuleDataToRuleString(const RepetitionRule &rule); -private: - //解析结束时间 - static QDateTime resolutionEndDate(const QString &endDateStr); - //结束时间转换为string - static QString endDateToString(const QDateTime &endDate); -private: - /** - * @brief m_ruleID - * 重复规则编号 - */ - RRuleID m_ruleID; - /** - * @brief m_endType - * 结束类型 - */ - RRuleEndType m_ruleEndType; - /** - * @brief m_endDateTime - * 重复结束时间 - */ - QDateTime m_endDateTime; - /** - * @brief m_endCount - * 重复结束次数 - */ - int m_endCount; -}; - -#endif // REPETITIONRULE_H diff -Nru dde-calendar-5.9.1/calendar-basicstruct/src/scheduledatainfo.cpp dde-calendar-5.10.0/calendar-basicstruct/src/scheduledatainfo.cpp --- dde-calendar-5.9.1/calendar-basicstruct/src/scheduledatainfo.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-basicstruct/src/scheduledatainfo.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,887 +0,0 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ -#include "scheduledatainfo.h" -#include "utils.h" -#include -#include -#include -#include - -ScheduleDataInfo::ScheduleDataInfo() - : m_ScheduleID(0) - , m_ScheduleBeginDateTime() - , m_ScheduleEndDateTime() - , m_IgnoreVectorTime() - , m_ScheduleTitleName("") - , m_ScheduleDescription("") - , m_ScheduleIsAllDay(true) - , m_ScheduleType(1) - , m_ScheduleRecurID(0) - , m_ScheduleRRule() -{ - -} - -/** - * @brief ScheduleID 获取日程ID - * @return 日程ID - */ -int ScheduleDataInfo::getID() const -{ - return m_ScheduleID; -} - -/** - * @brief setScheduleID 设置日程ID - * @param scheduleID 日程id - */ -void ScheduleDataInfo::setID(int scheduleID) -{ - m_ScheduleID = scheduleID; -} - -/** - * @brief ScheduleBeginDateTime 获取日程开始时间 - * @return 日程开始时间 - */ -QDateTime &ScheduleDataInfo::getBeginDateTime() -{ - return m_ScheduleBeginDateTime; -} - -QDateTime ScheduleDataInfo::getBeginDateTime() const -{ - return m_ScheduleBeginDateTime; -} - -/** - * @brief setScheduleBeginDateTime 设置日程开始时间 - * @param ScheduleBeginDateTime 日程开始时间 - */ -void ScheduleDataInfo::setBeginDateTime(const QDateTime &beginDateTime) -{ - m_ScheduleBeginDateTime = beginDateTime; -} - -/** - * @brief ScheduleEndDateTime 获取日程结束时间 - * @return 日程结束时间 - */ -QDateTime &ScheduleDataInfo::getEndDateTime() -{ - return m_ScheduleEndDateTime; -} - -QDateTime ScheduleDataInfo::getEndDateTime() const -{ - return m_ScheduleEndDateTime; -} - -/** - * @brief setScheduleEndDateTime 设置日程结束时间 - * @param ScheduleEndDateTime 日程结束时间 - */ -void ScheduleDataInfo::setEndDateTime(const QDateTime &endDateTime) -{ - m_ScheduleEndDateTime = endDateTime; -} - -QVector &ScheduleDataInfo::getIgnoreTime() -{ - return m_IgnoreVectorTime; -} - -/** - * @brief IgnoreVectorTime 获取日程重复忽略时间集 - * @return 日程重复忽略时间集 - */ -QVector ScheduleDataInfo::getIgnoreTime() const -{ - return m_IgnoreVectorTime; -} - -/** - * @brief setIgnoreVectorTime 设置日程重复忽略时间集 - * @param IgnoreVectorTime 日程重复忽略时间集 - */ -void ScheduleDataInfo::setIgnoreTime(const QVector &ignoreVectorTime) -{ - m_IgnoreVectorTime = ignoreVectorTime; -} - -/** - * @brief ScheduleTitleName 获取日程标题 - * @return 日程标题 - */ -QString ScheduleDataInfo::getTitleName() const -{ - return m_ScheduleTitleName; -} - -/** - * @brief setScheduleTitleName 设置日程标题 - * @param ScheduleTitleName 日程标题 - */ -void ScheduleDataInfo::setTitleName(const QString &titleName) -{ - m_ScheduleTitleName = titleName; -} - -/** - * @brief ScheduleDescription 获取日程描述信息 - * @return 日程描述信息 - */ -QString ScheduleDataInfo::getDescription() const -{ - return m_ScheduleDescription; -} - -/** - * @brief setScheduleDescription 设置日程描述信息 - * @param ScheduleDescription 日程描述信息 - */ -void ScheduleDataInfo::setDescription(const QString &description) -{ - m_ScheduleDescription = description; -} - -/** - * @brief ScheduleIsAllDay 获取日程是否为全天 - * @return 是否为全天 - */ -bool ScheduleDataInfo::getAllDay() const -{ - return m_ScheduleIsAllDay; -} - -/** - * @brief setScheduleIsAllDay 设置日程是否为全天 - * @param ScheduleIsAllDay 是否为全天 - */ -void ScheduleDataInfo::setAllDay(const bool isAllDay) -{ - m_ScheduleIsAllDay = isAllDay; -} - -/** - * @brief ScheduleType 获取日程类型 - * @return 日程类型 - */ -int ScheduleDataInfo::getType() const -{ - return m_ScheduleType; -} - -/** - * @brief setScheduleType 设置日程类型 - * @param ScheduleType 日程类型 - */ -void ScheduleDataInfo::setType(int scheduleType) -{ - m_ScheduleType = scheduleType; -} - -/** - * @brief ScheduleRecurID 获取日程重复id类型 - * @return 重复id类型 - */ -int ScheduleDataInfo::getRecurID() const -{ - return m_ScheduleRecurID; -} - -/** - * @brief setRecurID 设置日程重复id类型 - * @param ScheduleRecurID 重复id类型 - */ -void ScheduleDataInfo::setRecurID(int recurID) -{ - m_ScheduleRecurID = recurID; -} - -/** - * @brief setScheduleRemindData 设置日程提醒规则 - * @param remindData 提醒规则 - */ -void ScheduleDataInfo::setRemindData(const RemindData &remindData) -{ - m_ScheduleRemind = remindData; -} - -/** - * @brief getScheduleRemindData 获取提醒规则 - * @return - */ -RemindData ScheduleDataInfo::getRemindData() const -{ - return m_ScheduleRemind; -} - -/** - * @brief ScheduleRemind 设置日程提醒规则 - * @return 提醒规则 - */ -QString ScheduleDataInfo::getScheduleRemind() const -{ - return RemindData::RemindDataToRemindString(m_ScheduleRemind, this->getAllDay()); -} - -/** - * @brief setScheduleRemind 设置日程提醒规则 - * @param ScheduleRemind 提醒规则 - */ -void ScheduleDataInfo::setScheduleRemind(const QString &scheduleRemind) -{ - m_ScheduleRemind = RemindData::RemindStringToRemindData(scheduleRemind); -} - -/** - * @brief ScheduleRRule 获取日程重复规则 - * @return 日程重复规则 - */ -QString ScheduleDataInfo::getScheduleRRule() const -{ - return m_ScheduleRRule.RuleDataToRuleString(m_ScheduleRRule);; -} - -/** - * @brief setScheduleRRule 设置日程重复规则 - * @param ScheduleRRule 日程重复规则 - */ -void ScheduleDataInfo::setScheduleRRule(const QString &scheduleRRule) -{ - m_ScheduleRRule = RepetitionRule::RuleStringToRuleData(scheduleRRule); -} - -void ScheduleDataInfo::registerMetaType() -{ - qRegisterMetaType("ScheduleDataInfo"); -} - -bool ScheduleDataInfo::getIsLunar() const -{ - return m_isLunar; -} - -void ScheduleDataInfo::setIsLunar(bool isLunar) -{ - m_isLunar = isLunar; -} - -/** - * @brief setRepetitionRule 设置重复规则 - * @param rule - */ -void ScheduleDataInfo::setRepetitionRule(const RepetitionRule &rule) -{ - m_ScheduleRRule = rule; -} - -/** - * @brief ScheduleDataInfo::getRepetitionRule 获取重复规则 - * @return - */ -RepetitionRule &ScheduleDataInfo::getRepetitionRule() -{ - return m_ScheduleRRule; -} - -/** - * @brief getRepetitionRule 获取重复规则 - * @return - */ -RepetitionRule ScheduleDataInfo::getRepetitionRule() const -{ - return m_ScheduleRRule; -} - -/** - * @brief ScheduleDataInfo::isValid 日程是否有效 - * @return - */ -bool ScheduleDataInfo::isValid() const -{ - if (!getBeginDateTime().isValid()) { - return false; - } - if (!getEndDateTime().isValid()) { - return false; - } - if (getType() < 1) { - return false; - } - return true; -} - -/** - * @brief ScheduleDataInfo::setIsMoveInfo 设置是否为拖拽移动日程 - * @param isMoveInfo - */ -void ScheduleDataInfo::setIsMoveInfo(const bool &isMoveInfo) -{ - m_moveInfo = isMoveInfo; -} - -/** - * @brief ScheduleDataInfo::getIsMoveInfo 获取是否为拖拽移动日程 - * @return - */ -bool ScheduleDataInfo::getIsMoveInfo() const -{ - return m_moveInfo; -} - -/** - * @brief ScheduleToJson 日程数据转换为json形式的字符串 - * @param scheduleJsonData 日程数据 - * @return json形式的字符串 - */ -QString ScheduleDataInfo::ScheduleToJsonStr(const ScheduleDataInfo &scheduleJsonData) -{ - QJsonObject _scheduleJsonObject; - _scheduleJsonObject.insert("ID", scheduleJsonData.getID()); - _scheduleJsonObject.insert("AllDay", scheduleJsonData.getAllDay()); - _scheduleJsonObject.insert("Remind", scheduleJsonData.getScheduleRemind()); - _scheduleJsonObject.insert("RRule", scheduleJsonData.getScheduleRRule()); - _scheduleJsonObject.insert("Title", scheduleJsonData.getTitleName()); - _scheduleJsonObject.insert("Description", scheduleJsonData.getDescription()); - _scheduleJsonObject.insert("Type", scheduleJsonData.getType()); - _scheduleJsonObject.insert("Start", DateTimeToStringDate(scheduleJsonData.getBeginDateTime())); - _scheduleJsonObject.insert("End", DateTimeToStringDate(scheduleJsonData.getEndDateTime())); - _scheduleJsonObject.insert("RecurID", scheduleJsonData.getRecurID()); - QJsonArray _ignoreJsonArray; - for (int i = 0; i < scheduleJsonData.getIgnoreTime().count(); i++) { - _ignoreJsonArray.append(DateTimeToStringDate(scheduleJsonData.getIgnoreTime().at(i))); - } - _scheduleJsonObject.insert("Ignore", _ignoreJsonArray); - _scheduleJsonObject.insert("IsLunar", scheduleJsonData.getIsLunar()); - // 构建 JSON 文档 - QJsonDocument _scheduleJsonDocument; - _scheduleJsonDocument.setObject(_scheduleJsonObject); - QByteArray _scheduleByteArray = _scheduleJsonDocument.toJson(QJsonDocument::Compact); - QString _resultJsonStr(_scheduleByteArray); - return _resultJsonStr; -} - -/** - * @brief JsonToSchedule Json对象转换到日程数据 - * @param ScheduleJsonObject json对象 - * @return 日程数据 - */ -ScheduleDataInfo ScheduleDataInfo::JsonToSchedule(const QJsonObject &scheduleJsonObject) -{ - ScheduleDataInfo _resultSchedule; - //因为是预先定义好的JSON数据格式,所以这里可以这样读取 - //日程id - if (scheduleJsonObject.contains("ID")) { - _resultSchedule.setID(scheduleJsonObject.value("ID").toInt()); - } - //日程是否为全天 - if (scheduleJsonObject.contains("AllDay")) { - _resultSchedule.setAllDay(scheduleJsonObject.value("AllDay").toBool()); - } - //日程提醒规则 - if (scheduleJsonObject.contains("Remind")) { - _resultSchedule.setScheduleRemind(scheduleJsonObject.value("Remind").toString()); - } - //日程标题 - if (scheduleJsonObject.contains("Title")) { - _resultSchedule.setTitleName(scheduleJsonObject.value("Title").toString()); - } - //日程描述 - if (scheduleJsonObject.contains("Description")) { - _resultSchedule.setDescription(scheduleJsonObject.value("Description").toString()); - } - //日程类型 - if (scheduleJsonObject.contains("Type")) { - _resultSchedule.setType(scheduleJsonObject.value("Type").toInt()); - } - //日程开始时间 - if (scheduleJsonObject.contains("Start")) { - _resultSchedule.setBeginDateTime(StringDateToDateTime(scheduleJsonObject.value("Start").toString())); - } - //日程结束时间 - if (scheduleJsonObject.contains("End")) { - _resultSchedule.setEndDateTime(StringDateToDateTime(scheduleJsonObject.value("End").toString())); - } - //日程重复ID - if (scheduleJsonObject.contains("RecurID")) { - _resultSchedule.setRecurID(scheduleJsonObject.value("RecurID").toInt()); - } - //日程重复规则 - if (scheduleJsonObject.contains("RRule")) { - _resultSchedule.setScheduleRRule(scheduleJsonObject.value("RRule").toString()); - } - //重复日程忽略日期集 - if (scheduleJsonObject.contains("Ignore")) { - QJsonArray subArray = scheduleJsonObject.value("Ignore").toArray(); - QVector _ignoreDateVector; - for (int i = 0; i < subArray.size(); i++) { - QString subObj = subArray.at(i).toString(); - _ignoreDateVector.append(StringDateToDateTime(subObj)); - } - _resultSchedule.setIgnoreTime(_ignoreDateVector); - } - //是否为农历日程 - if (scheduleJsonObject.contains("IsLunar")) { - _resultSchedule.setIsLunar(scheduleJsonObject.value("IsLunar").toBool()); - } - return _resultSchedule; -} - -/** - * @brief ScheduleDataInfo::JsonStrToSchedule 将json转换为日程 - * @param jsonStr json数据 - * @return - */ -ScheduleDataInfo ScheduleDataInfo::JsonStrToSchedule(const QString &jsonStr) -{ - QJsonParseError json_error; - QJsonDocument jsonDoc(QJsonDocument::fromJson(jsonStr.toLocal8Bit(), &json_error)); - - if (json_error.error != QJsonParseError::NoError) { - qWarning() << json_error.errorString(); - } - QJsonObject ssubObj = jsonDoc.object(); - return ScheduleDataInfo::JsonToSchedule(ssubObj); -} - -/** - * @brief StringDateToDateTime string类型的datetime数据转换为QDateTime - * @param dateStr string类型的datetime数据 - * @return QDateTime - */ -QDateTime ScheduleDataInfo::StringDateToDateTime(const QString &dateStr) -{ - return QDateTime::fromString(dateStr, Qt::ISODate); -} - -/** - * @brief DateTimeToStringDate QDateTime转换为string类型的datetime数据 - * @param dateTime 需要转换的时间 - * @return string类型的datetime数据 - */ -QString ScheduleDataInfo::DateTimeToStringDate(const QDateTime &dateTime) -{ - QTime _offsetTime = QTime(0, 0).addSecs(dateTime.timeZone().offsetFromUtc(dateTime)); - return QString("%1+%2").arg(dateTime.toString("yyyy-MM-ddThh:mm:ss")).arg(_offsetTime.toString("hh:mm")); -} - -/** - * @brief JsonArrayDataToScheduleMapData 将JsonArray数据转换为QMap存储Schedule数据 - * @param jsonArrData JsonArray数据 - * @return QMap存储Schedule数据 - */ -QMap > ScheduleDataInfo::JsonArrayDataToScheduleMapData(const QJsonArray &jsonArrData) -{ - QMap > _resultMap; - QJsonObject _jsonObjScheduleVector; - QVector _scheduleVector; - QDate _date; - for (int i = 0; i < jsonArrData.size(); i++) { - _jsonObjScheduleVector = jsonArrData.at(i).toObject(); - _scheduleVector.clear(); - //因为是预先定义好的JSON数据格式,所以这里可以这样读取 - if (_jsonObjScheduleVector.contains("Date")) { - _date = QDate::fromString(_jsonObjScheduleVector.value("Date").toString(), "yyyy-MM-dd"); - } - if (_jsonObjScheduleVector.contains("Jobs")) { - QJsonArray subArray = _jsonObjScheduleVector.value("Jobs").toArray(); - for (int j = 0; j < subArray.size(); j++) { - QJsonObject _jsonObjectSchedule = subArray.at(j).toObject(); - _scheduleVector.append(JsonToSchedule(_jsonObjectSchedule)); - } - } - _resultMap[_date] = _scheduleVector; - } - return _resultMap; -} - -QMap > ScheduleDataInfo::StrJsonToRangeInfo(const QString &jsonStr) -{ - QMap >_resultInfo {}; - QVector _scheduleVector; - QJsonParseError json_error; - QJsonDocument jsonDoc(QJsonDocument::fromJson(jsonStr.toLocal8Bit(), &json_error)); - if (json_error.error != QJsonParseError::NoError) { - qWarning() << json_error.errorString(); - return _resultInfo; - } - QJsonArray rootarry = jsonDoc.array(); - _resultInfo = JsonArrayDataToScheduleMapData(rootarry); - return _resultInfo; -} - -/** - * @brief ScheduleDataInfo::operator == 判断日程是否相等 - * @param info - * @return - */ -bool ScheduleDataInfo::operator ==(const ScheduleDataInfo &info) const -{ - if (info.getType() == 4) { - //由于后端每次启动设置的节日日程id不一定相同,所以不比较日程id - return this->getTitleName() == info.getTitleName() && - this->getBeginDateTime() == info.getBeginDateTime(); - } else { - return this->getID() == info.getID() && this->getRecurID() == info.getRecurID() && - this->getTitleName() == info.getTitleName() /*&& this->getEndDateTime() == info.getEndDateTime() - && this->getBeginDateTime() == info.getBeginDateTime()*/; - } -} - -/** - * @brief ScheduleDataInfo::operator < 对比日程大小 - * @param info - * @return - */ -bool ScheduleDataInfo::operator <(const ScheduleDataInfo &info) const -{ - if (getBeginDateTime().date() != getEndDateTime().date() && - info.getBeginDateTime().date() == info.getEndDateTime().date()) { - return true; - } else if (getBeginDateTime().date() == getEndDateTime().date() && - info.getBeginDateTime().date() != info.getEndDateTime().date()) { - return false; - } else if (getBeginDateTime().date() != getEndDateTime().date() && - info.getBeginDateTime().date() != info.getEndDateTime().date()) { - if (getBeginDateTime().date() == info.getBeginDateTime().date()) { - return getBeginDateTime().daysTo(getEndDateTime()) > info.getBeginDateTime().daysTo(info.getEndDateTime()); - } - return getBeginDateTime().date() < info.getBeginDateTime().date(); - } else { - if (getType() == 4) return true; - if (info.getType() == 4) return false; - if (getBeginDateTime() == info.getBeginDateTime()) { - if (getTitleName() == info.getTitleName()) { - return getID() < info.getID(); - } - return getTitleName() < info.getTitleName(); - } else { - return getBeginDateTime() < info.getBeginDateTime(); - } - } -} - -/** - * @brief operator << 日程信息调试打印 - * @param debug - * @param scheduleJsonData - * @return - */ -QDebug operator<<(QDebug debug, const ScheduleDataInfo &scheduleJsonData) -{ - debug << "(" - << QString("ID:") << scheduleJsonData.getID() << QString(",") - << QString("IsAllDay:") << scheduleJsonData.getAllDay() << QString(",") - << QString("TitleName:") << scheduleJsonData.getTitleName() << QString(",") - << QString("BeginDateTime:") << scheduleJsonData.getBeginDateTime() << QString(",") - << QString("EndDateTime:") << scheduleJsonData.getEndDateTime() << QString(",") - << QString("Description:") << scheduleJsonData.getDescription() << QString(",") - << QString("Type:") << scheduleJsonData.getType() << QString(",") - << QString("RRule:") << scheduleJsonData.getScheduleRRule() << QString(",") - << QString("Remind:") << scheduleJsonData.getScheduleRemind() << QString(",") - << QString("RecurID:") << scheduleJsonData.getRecurID() - << QString("IsLunar:") << scheduleJsonData.getIsLunar() - << ")"; - return debug; -} -/** - * @brief JobTypeInfo 构造函数 - */ -JobTypeInfo::JobTypeInfo(int typeNo, QString typeName, int colorTypeNo, QString colorHex, int authority) - : iJobTypeNo(typeNo) - , strJobTypeName(typeName) - , m_ColorInfo(colorTypeNo, colorHex) - , iAuthority(authority) -{ -} - -JobTypeInfo::JobTypeInfo(int typeNo, QString typeName, const JobTypeColorInfo &colorInfo) - : iJobTypeNo(typeNo) - , strJobTypeName(typeName) - , m_ColorInfo(colorInfo) - , iAuthority(colorInfo.getAuthority()) -{ -} - -/** - * @brief JobTypeInfo 构造函数 - */ -JobTypeInfo::JobTypeInfo(const JobTypeInfo &_other) -{ - iJobTypeNo = _other.getJobTypeNo(); - strJobTypeName = _other.getJobTypeName(); - m_ColorInfo = _other.getColorInfo(); - iAuthority = _other.getAuthority(); -} - -JobTypeColorInfo::JobTypeColorInfo(int typeNo, QString colorHex, int authority) - : iTypeNo(typeNo) - , strColorHex(colorHex) - , iAuthority(authority) -{ - -} - -/** - * @brief JsonStrToTypeInfo 从json串解析出日程类型列表 - * @param jsonStr json串 - * @param QList 日程类型列表 - */ -bool JobTypeInfo::jsonStrToJobTypeInfoList(const QString &strJson, QList &lstJobType) -{ - QJsonArray ja; - Utils::StringToObject(strJson, ja); - - lstJobType.clear(); - QJsonObject _jsonObj; - for (int i = 0; i < ja.size(); i++) { - _jsonObj = ja.at(i).toObject(); - JobTypeInfo _jobtype; - //因为是预先定义好的JSON数据格式,所以这里可以这样读取 - //日程类型编号 - if (_jsonObj.contains("JobTypeNo")) { - _jobtype.setJobTypeNo(_jsonObj.value("JobTypeNo").toInt()); - } - //日程类型名称 - if (_jsonObj.contains("JobTypeName")) { - _jobtype.setJobTypeName(_jsonObj.value("JobTypeName").toString()); - } - //日程类型颜色编号 - if (_jsonObj.contains("ColorTypeNo")) { - _jobtype.setColorTypeNo(_jsonObj.value("ColorTypeNo").toInt()); - } - //日程类型颜色16进制编码 - if (_jsonObj.contains("ColorHex")) { - _jobtype.setColorHex(_jsonObj.value("ColorHex").toString()); - } - //日程类型权限 - if (_jsonObj.contains("Authority")) { - _jobtype.setAuthority(_jsonObj.value("Authority").toInt()); - } - - lstJobType.push_back(_jobtype); - } - - return true; -} - -/** - * @brief JsonStrToJobTypeInfo 从json串解析出一条日程类型记录 - * @param jsonStr json串 - * @param lstJobType 一条日程类型记录 - */ -bool JobTypeInfo::jsonStrToJobTypeInfo(const QString &strJson, JobTypeInfo &jobType) -{ - QJsonArray ja; - Utils::StringToObject(strJson, ja); - if (ja.size() < 1) { - return false; - } - - QJsonObject _jsonObj = ja.at(0).toObject(); - //因为是预先定义好的JSON数据格式,所以这里可以这样读取 - //日程类型编号 - if (_jsonObj.contains("JobTypeNo")) { - jobType.setJobTypeNo(_jsonObj.value("JobTypeNo").toInt()); - } - //日程类型名称 - if (_jsonObj.contains("JobTypeName")) { - jobType.setJobTypeName(_jsonObj.value("JobTypeName").toString()); - } - //日程类型颜色编号 - if (_jsonObj.contains("ColorTypeNo")) { - jobType.setColorTypeNo(_jsonObj.value("ColorTypeNo").toInt()); - } - //日程类型颜色16进制编码 - if (_jsonObj.contains("ColorHex")) { - jobType.setColorHex(_jsonObj.value("ColorHex").toString()); - } - //日程类型权限 - if (_jsonObj.contains("Authority")) { - jobType.setAuthority(_jsonObj.value("Authority").toInt()); - } - return true; -} - -//将一条日程记录转换为json -bool JobTypeInfo::jobTypeInfoToJsonStr(const JobTypeInfo &jobType, QString &strJson) -{ - QJsonArray jsonArray; - QJsonDocument doc; - QJsonObject obj; - obj.insert("JobTypeNo", jobType.getJobTypeNo()); - obj.insert("JobTypeName", jobType.getJobTypeName()); - obj.insert("ColorTypeNo", jobType.getColorTypeNo()); - obj.insert("ColorHex", jobType.getColorHex()); - obj.insert("Authority", jobType.getAuthority()); - jsonArray.append(obj); - doc.setArray(jsonArray); - strJson = QString::fromUtf8(doc.toJson(QJsonDocument::Compact)); - return true; -} - -/** -* @brief jobTypeInfoListToJosnString 日程列表转Json串 -* param lstJobType JobType日程类型信息列表 -* param strJson json格式的日程类型信息 -* return bool 返回操作结果 -*/ -bool JobTypeInfo::jobTypeInfoListToJosnString(const QList &lstJobType, QString &strJson) -{ - QJsonArray jsonArray; - QJsonDocument doc; - foreach (JobTypeInfo _jobType, lstJobType) { - QJsonObject obj; - obj.insert("JobTypeNo", _jobType.getJobTypeNo()); - obj.insert("JobTypeName", _jobType.getJobTypeName()); - obj.insert("ColorTypeNo", _jobType.getColorTypeNo()); - obj.insert("ColorHex", _jobType.getColorHex()); - obj.insert("Authority", _jobType.getAuthority()); - jsonArray.append(obj); - } - doc.setArray(jsonArray); - strJson = QString::fromUtf8(doc.toJson(QJsonDocument::Compact)); - return true; -} - - -/** - * @brief JsonStrToTypeInfo 从json串解析出颜色列表 - * @param jsonStr json串 - * @param QList 颜色列表 - */ -bool JobTypeInfo::jsonStrToColorTypeInfoList(const QString &strJson, QList &lstColorType) -{ - QJsonArray ja; - Utils::StringToObject(strJson, ja); - - lstColorType.clear(); - QJsonObject _jsonObj; - for (int i = 0; i < ja.size(); i++) { - _jsonObj = ja.at(i).toObject(); - JobTypeColorInfo _colortype; - //因为是预先定义好的JSON数据格式,所以这里可以这样读取 - //颜色类型编号 - if (_jsonObj.contains("ColorTypeNo")) { - _colortype.setTypeNo(_jsonObj.value("ColorTypeNo").toInt()); - } - //颜色16进制编码 - if (_jsonObj.contains("ColorHex")) { - _colortype.setColorHex(_jsonObj.value("ColorHex").toString()); - } - //颜色类型权限 - if (_jsonObj.contains("Authority")) { - _colortype.setAuthority(_jsonObj.value("Authority").toInt()); - } - - lstColorType.push_back(_colortype); - } - - return true; -} - -/** - * @brief JsonStrToTypeInfo 从json串解析出颜色信息 - * @param jsonStr json串 - * @param colorTypeInfo 颜色信息 - */ -bool JobTypeInfo::jsonStrToColorTypeInfo(const QString &strJson, JobTypeColorInfo &colorTypeInfo) -{ - QJsonArray ja; - Utils::StringToObject(strJson, ja); - if (ja.size() < 1) { - return false; - } - - QJsonObject _jsonObj = ja.at(0).toObject(); - //因为是预先定义好的JSON数据格式,所以这里可以这样读取 - //颜色类型编号 - if (_jsonObj.contains("ColorTypeNo")) { - colorTypeInfo.setTypeNo(_jsonObj.value("ColorTypeNo").toInt()); - } - //颜色16进制编码 - if (_jsonObj.contains("ColorHex")) { - colorTypeInfo.setColorHex(_jsonObj.value("ColorHex").toString()); - } - //颜色类型权限 - if (_jsonObj.contains("Authority")) { - colorTypeInfo.setAuthority(_jsonObj.value("Authority").toInt()); - } - - return true; -} - -/** - * @brief colorTypeInfoToJsonStr 将一条颜色记录转换为json - * @param jsonStr json串 - * @param colorTypeInfo 颜色信息 - */ -bool JobTypeInfo::colorTypeInfoToJsonStr(const JobTypeColorInfo &colorType, QString &strJson) -{ - QJsonArray jsonArray; - QJsonDocument doc; - QJsonObject obj; - obj.insert("ColorTypeNo", colorType.getTypeNo()); - obj.insert("ColorHex", colorType.getColorHex()); - obj.insert("Authority", colorType.getAuthority()); - jsonArray.append(obj); - doc.setArray(jsonArray); - strJson = QString::fromUtf8(doc.toJson(QJsonDocument::Compact)); - return true; -} -/** - * @brief colorTypeToJosnString 颜色列表转Json串 - * param lstColorType JobType日程类型信息列表 - * param strJson json格式的日程类型信息 - * return bool 返回操作结果 - */ -bool JobTypeInfo::colorTypeInfoListToJosnString(const QList &lstColorType, QString &strJson) -{ - QJsonArray jsonArray; - QJsonDocument doc; - foreach (JobTypeColorInfo var, lstColorType) { - QJsonObject obj; - obj.insert("ColorTypeNo", var.getTypeNo()); - obj.insert("ColorHex", var.getColorHex()); - obj.insert("Authority", var.getAuthority()); - jsonArray.append(obj); - } - doc.setArray(jsonArray); - strJson = QString::fromUtf8(doc.toJson(QJsonDocument::Compact)); - return true; -} - -JobTypeColorInfo JobTypeInfo::getColorInfo() const -{ - return m_ColorInfo; -} - -JobTypeColorInfo &JobTypeInfo::getColorInfo() -{ - return m_ColorInfo; -} - -void JobTypeInfo::setColorInfo(const JobTypeColorInfo &ColorInfo) -{ - m_ColorInfo = ColorInfo; -} diff -Nru dde-calendar-5.9.1/calendar-basicstruct/src/scheduledatainfo.h dde-calendar-5.10.0/calendar-basicstruct/src/scheduledatainfo.h --- dde-calendar-5.9.1/calendar-basicstruct/src/scheduledatainfo.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-basicstruct/src/scheduledatainfo.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,393 +0,0 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ -#ifndef SCHEDULEJSONDATA_H -#define SCHEDULEJSONDATA_H - -#include "repetitionrule.h" -#include "reminddata.h" -#include "utils.h" - -#include -#include -#include -#include -#include - - -class QDebug; -/** - * @brief The ScheduleJsonData class - * 日程数据结构与Json对应 - */ -class ScheduleDataInfo -{ -public: - explicit ScheduleDataInfo(); - //获取日程ID - int getID() const; - //设置日程ID - void setID(int scheduleID); - //获取开始时间 - QDateTime &getBeginDateTime(); - QDateTime getBeginDateTime() const; - //设置开始时间 - void setBeginDateTime(const QDateTime &beginDateTime); - //获取结束时间 - QDateTime &getEndDateTime(); - QDateTime getEndDateTime() const; - //设置结束时间 - void setEndDateTime(const QDateTime &endDateTime); - //获取日程忽略时间集 - QVector &getIgnoreTime(); - QVector getIgnoreTime() const; - //获取日程忽略时间集 - void setIgnoreTime(const QVector &ignoreVectorTime); - //获取日程标题 - QString getTitleName() const; - //设置日程标题 - void setTitleName(const QString &titleName); - //获取日程描述信息 - QString getDescription() const; - //设置日程描述信息 - void setDescription(const QString &description); - //获取日程是否为全天 - bool getAllDay() const; - //设置日程是否为全天 - void setAllDay(const bool isAllDay); - //获取日程类型 - int getType() const; - //设置日程类型 - void setType(int scheduleType); - //获取日程重复id类型 - int getRecurID() const; - //设置日程重复id类型 - void setRecurID(int recurID); - //设置日程提醒规则 - void setRemindData(const RemindData &remindData); - //获取提醒规则 - RemindData getRemindData() const; - //设置重复规则 - void setRepetitionRule(const RepetitionRule &rule); - //获取重复规则 - RepetitionRule &getRepetitionRule(); - //获取重复规则 - RepetitionRule getRepetitionRule() const; - //该日程是否有效 - bool isValid() const; - //设置是否为拖拽移动日程 - void setIsMoveInfo(const bool &isMoveInfo); - //获取是否为拖拽移动日程 - bool getIsMoveInfo()const; - //日程数据转换为json形式的字符串 - static QString ScheduleToJsonStr(const ScheduleDataInfo &scheduleJsonData); - //Json对象转换到日程数据 - static ScheduleDataInfo JsonToSchedule(const QJsonObject &scheduleJsonObject); - //将json转换为日程 - static ScheduleDataInfo JsonStrToSchedule(const QString &jsonStr); - //string类型的datetime数据转换为QDateTime - static QDateTime StringDateToDateTime(const QString &dateStr); - //QDateTime转换为string类型的datetime数据 - static QString DateTimeToStringDate(const QDateTime &dateTime); - //将JsonArray数据转换为QMap存储Schedule数据 - static QMap > JsonArrayDataToScheduleMapData(const QJsonArray &jsonArrData); - static QMap > StrJsonToRangeInfo(const QString &jsonStr); - //判断日程是否相等 - bool operator ==(const ScheduleDataInfo &info) const; - //判断日程大小 - bool operator <(const ScheduleDataInfo &info) const; - /** - * @brief getIsLunar 返回是否为农历日程 - * @return - */ - bool getIsLunar() const; - - /** - * @brief setIsLunar 设置是否为农历日程 - * @param isLunar - */ - void setIsLunar(bool isLunar); - -private: - //获取日程提醒规则 - QString getScheduleRemind() const; - //设置日程提醒规则 - void setScheduleRemind(const QString &scheduleRemind); - //获取日程重复规则 - QString getScheduleRRule() const; - //设置日程重复规则 - void setScheduleRRule(const QString &scheduleRRule); -public: - static void registerMetaType(); - //日程信息调试打印 - friend QDebug operator<<(QDebug debug, const ScheduleDataInfo &scheduleJsonData); -private: - /** - * @brief m_ScheduleID 日程ID - */ - int m_ScheduleID; - /** - * @brief m_ScheduleBeginDateTime 日常开始时间 - */ - QDateTime m_ScheduleBeginDateTime; - /** - * @brief m_ScheduleEndDateTime 日程结束时间 - */ - QDateTime m_ScheduleEndDateTime; - /** - * @brief m_Ignore_VectorTime 重复日程忽略时间集 - */ - QVector m_IgnoreVectorTime; - /** - * @brief m_ScheduleTitleName 日程标题 - */ - QString m_ScheduleTitleName; - /** - * @brief m_ScheduleDescription 日程描述 - */ - QString m_ScheduleDescription; - /** - *@brief m_ScheduleIsAllDay 是否为全天日程 - * true 表示全天 - * false 表示非全天 - */ - bool m_ScheduleIsAllDay; //1全天 - /** - * @brief m_ScheduleType 日程类型 - * 1 工作 - * 2 生活 - * 3 其他 - * 4 节日信息 - */ - int m_ScheduleType; //1工作 2 生活 3其他 - /** - * @brief m_ScheduleRecurID 日程重复id类型 - * 0 原始数据 - * >0 克隆数据 - */ - int m_ScheduleRecurID; - /** - * @brief m_ScheduleRemind 提醒规则 - */ - RemindData m_ScheduleRemind; - /** - * 日程重复规则 - * 具体规则可参考资料 https://www.rfc-editor.org/rfc/rfc5545.html#page-38 - * 3.3.10. Recurrence Rule - * @brief m_Rule 重复规则 - */ - RepetitionRule m_ScheduleRRule; - - bool m_isLunar = false; //是否为农历日程 - //客户端使用判断是否为拖拽移动日程 - bool m_moveInfo{false}; -}; -Q_DECLARE_METATYPE(ScheduleDataInfo); - -class JobTypeColorInfo -{ - /* - *功能: - * 1.保存日程颜色信息,包括TypeNo、ColorHex、Authority - * 2.提供查、增、删、改接口 - */ -public: - explicit JobTypeColorInfo(int typeNo = 0, QString colorHex = "", int authority = 0); - - void setTypeNo(int typeNo) - { - iTypeNo = typeNo; - return; - } - int getTypeNo() const - { - return iTypeNo; - } - void setColorHex(QString colorHex) - { - strColorHex = colorHex; - return; - } - QString getColorHex() const - { - return strColorHex; - } - void setAuthority(int authority) - { - iAuthority = authority; - return; - } - int getAuthority() const - { - return iAuthority;//系统默认颜色设置权限为1,用户自定义为7.1:2:4分别对应——展示:改:删除 - } - - //颜色是否为系统默认颜色 - bool isSysColorInfo() const - { - return (iTypeNo > 0 && iTypeNo < 10); - } - - JobTypeColorInfo &operator=(const JobTypeColorInfo *info) - { - iTypeNo = info->getTypeNo(); - strColorHex = info->getColorHex(); - iAuthority = info->getAuthority(); - - return *this; - } - bool operator==(const JobTypeColorInfo &info) - { - return iTypeNo == info.iTypeNo && strColorHex == info.strColorHex - && iAuthority == info.iAuthority; - } - bool operator!=(const JobTypeColorInfo &info) - { - return !(*this == info); - } - -private: - int iTypeNo; - QString strColorHex; - int iAuthority; -}; - -class JobTypeInfo -{ - /*功能: - * 1.保存日程类型信息,包括JobTypeNo、JobTypeName、ColorTypeNo、ColorHex、Authority - * 2.提供查、增、删、改接口 - */ -public: - JobTypeInfo(int typeNo = 0, QString typeName = "", int colorTypeNo = 0, QString colorHex = "", int authority = 0); - JobTypeInfo(int typeNo, QString typeName, const JobTypeColorInfo &colorInfo = JobTypeColorInfo()); - JobTypeInfo(const JobTypeInfo &); - JobTypeInfo &operator=(const JobTypeInfo *info) - { - iJobTypeNo = info->getJobTypeNo(); - strJobTypeName = info->getJobTypeName(); - m_ColorInfo = info->m_ColorInfo; - iAuthority = info->getAuthority(); - - return *this; - } - - bool operator==(const JobTypeInfo &info) - { - return this->iJobTypeNo == info.iJobTypeNo - && this->strJobTypeName == info.strJobTypeName - && this->m_ColorInfo == info.m_ColorInfo - && this->iAuthority == info.iAuthority; - } - - bool operator!=(const JobTypeInfo &info) - { - return !(*this == info); - } - - void setJobTypeNo(int typeNo) - { - iJobTypeNo = typeNo; - return; - } - int getJobTypeNo() const - { - return iJobTypeNo; - } - - void setJobTypeName(QString typeName) - { - strJobTypeName = typeName; - return; - } - QString getJobTypeName() const - { - return strJobTypeName; - } - - //设置颜色编码,默认为0。新建日程类型时,如果是选择自定义颜色,请不设置,或设置为0。 - void setColorTypeNo(int typeNo) - { - m_ColorInfo.setTypeNo(typeNo); - } - int getColorTypeNo() const - { - return m_ColorInfo.getTypeNo(); - } - - void setColorHex(const QString &colorHex) - { - m_ColorInfo.setColorHex(colorHex); - } - QString getColorHex() const - { - return m_ColorInfo.getColorHex(); - } - - void setAuthority(int authority) - { - iAuthority = authority; - return; - } - int getAuthority() const - { - return iAuthority;//系统默认日程类型设置权限为1,用户自定义为7.1:2:4分别对应——展示:改:删除 - } - - //将json转换为日程列表 - static bool jsonStrToJobTypeInfoList(const QString &strJson, QList &lstJobType); - - //将json转换为一条日程记录 - static bool jsonStrToJobTypeInfo(const QString &strJson, JobTypeInfo &jobType); - - //将一条日程记录转换为json - static bool jobTypeInfoToJsonStr(const JobTypeInfo &jobType, QString &strJson); - - //日程列表转Json串 - static bool jobTypeInfoListToJosnString(const QList &lstJobType, QString &strJson); - - //将json转换为颜色列表 - static bool jsonStrToColorTypeInfoList(const QString &strJson, QList &lstJobType); - - //将json转换为一条颜色记录 - static bool jsonStrToColorTypeInfo(const QString &strJson, JobTypeColorInfo &colorType); - - //将一条颜色记录转换为json - static bool colorTypeInfoToJsonStr(const JobTypeColorInfo &colorType, QString &strJson); - /** - * @brief colorTypeToJosnString 颜色列表转Json串 - * param lstColorType JobType日程类型信息列表 - * param strJson json格式的日程类型信息 - * return bool 返回操作结果 - */ - static bool colorTypeInfoListToJosnString(const QList &lstColorType, QString &strJson); - - JobTypeColorInfo getColorInfo() const; - JobTypeColorInfo &getColorInfo(); - void setColorInfo(const JobTypeColorInfo &ColorInfo); - -private: - int iJobTypeNo; //日程类型编号 - QString strJobTypeName; //日程类型名称 - JobTypeColorInfo m_ColorInfo; //日程颜色信息 - int iAuthority; //权限 -}; - -#endif // SCHEDULEJSONDATA_H diff -Nru dde-calendar-5.9.1/calendar-basicstruct/src/utils.cpp dde-calendar-5.10.0/calendar-basicstruct/src/utils.cpp --- dde-calendar-5.9.1/calendar-basicstruct/src/utils.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-basicstruct/src/utils.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,91 +0,0 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: kongyunzhen -* -* Maintainer: kongyunzhen -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ -#include "utils.h" - -#include -#include - -Utils::Utils() -{ -} - -QString Utils::toconvertData(QDateTime date) -{ - QDateTime datetimeutc = QDateTime::fromTime_t(0); - QString str = date.toString("yyyy-MM-ddThh:mm:ss") + "+" + datetimeutc.toString("hh:mm"); - return str; -} - -QDateTime Utils::fromconvertData(QString str) -{ - QStringList liststr = str.split("+", QString::SkipEmptyParts); - - return QDateTime::fromString(liststr.at(0), "yyyy-MM-ddThh:mm:ss"); -} - -QDateTime Utils::fromconvertiIGData(QString str) -{ - QStringList liststr = str.split("Z", QString::SkipEmptyParts); - return QDateTime::fromString(liststr.at(0), "yyyy-MM-ddThh:mm:ss"); -} - -/** - * @brief JobToObject 将Job转换成QJsonObject - * @param job Job结构体 - * @return QJsonObject - */ -QJsonObject Utils::JobToObject(const Job &job) -{ - QJsonObject obj; - obj.insert("ID", job.ID); - obj.insert("Type", job.Type); - obj.insert("Title", job.Title); - obj.insert("Description", job.Description); - obj.insert("AllDay", job.AllDay); - obj.insert("Start", Utils::toconvertData(job.Start)); - obj.insert("End", Utils::toconvertData(job.End)); - obj.insert("RRule", job.RRule); - obj.insert("Remind", job.Remind); - //将QString类型转换为QJsonArray类型,方便前端解析 - obj.insert("Ignore", QJsonDocument::fromJson(job.Ignore.toUtf8()).array()); - obj.insert("RecurID", job.RecurID); - obj.insert("IsLunar", job.IsLunar); - - return obj; -} -/** - * @brief StringToObject 将JSON格式字符串转换成QJsonObject - * @param str JSON格式字符 - * @param ssubObj 出参,QJsonObject - * @return 是否正确 - */ -bool Utils::StringToObject(const QString &jsonStr, QJsonArray &ja) -{ - QJsonParseError json_error; - QJsonDocument jsonDoc(QJsonDocument::fromJson(jsonStr.toLocal8Bit(), &json_error)); - - if (json_error.error != QJsonParseError::NoError) { - return false; - } - ja = jsonDoc.array(); - return true; -} - diff -Nru dde-calendar-5.9.1/calendar-basicstruct/src/utils.h dde-calendar-5.10.0/calendar-basicstruct/src/utils.h --- dde-calendar-5.9.1/calendar-basicstruct/src/utils.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-basicstruct/src/utils.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,39 +0,0 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: kongyunzhen -* -* Maintainer: kongyunzhen -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ -#ifndef UTILS_H -#define UTILS_H -#include "commondatastruct.h" - -#include -#include - -class Utils -{ -public: - Utils(); - static QString toconvertData(QDateTime date); - static QDateTime fromconvertData(QString str); - static QDateTime fromconvertiIGData(QString str); - static QJsonObject JobToObject(const Job &job); - static bool StringToObject(const QString &jsonStr, QJsonArray &); -}; - -#endif // UTILS_H diff -Nru dde-calendar-5.9.1/calendar-client/assets/builtin/dark/icons/dde_calendar_account_32px.svg dde-calendar-5.10.0/calendar-client/assets/builtin/dark/icons/dde_calendar_account_32px.svg --- dde-calendar-5.9.1/calendar-client/assets/builtin/dark/icons/dde_calendar_account_32px.svg 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/builtin/dark/icons/dde_calendar_account_32px.svg 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,10 @@ + + + 账户- dark + + + + + + + \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/builtin/dark/icons/dde_calendar_create_32px.svg dde-calendar-5.10.0/calendar-client/assets/builtin/dark/icons/dde_calendar_create_32px.svg --- dde-calendar-5.9.1/calendar-client/assets/builtin/dark/icons/dde_calendar_create_32px.svg 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/builtin/dark/icons/dde_calendar_create_32px.svg 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,16 @@ + + + 编组 21 + + + + + + + + + + + + + \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/builtin/dark/icons/dde_calendar_sidebar_32px.svg dde-calendar-5.10.0/calendar-client/assets/builtin/dark/icons/dde_calendar_sidebar_32px.svg --- dde-calendar-5.9.1/calendar-client/assets/builtin/dark/icons/dde_calendar_sidebar_32px.svg 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/builtin/dark/icons/dde_calendar_sidebar_32px.svg 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,11 @@ + + + 视图切换 + + + + + + + + \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/builtin/icons/dde_calendar_ban_32px.svg dde-calendar-5.10.0/calendar-client/assets/builtin/icons/dde_calendar_ban_32px.svg --- dde-calendar-5.9.1/calendar-client/assets/builtin/icons/dde_calendar_ban_32px.svg 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/builtin/icons/dde_calendar_ban_32px.svg 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,16 @@ + + + + 类型 + Created with Sketch. + + + + + + + + + + + \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/builtin/icons/dde_calendar_delete_32px.svg dde-calendar-5.10.0/calendar-client/assets/builtin/icons/dde_calendar_delete_32px.svg --- dde-calendar-5.9.1/calendar-client/assets/builtin/icons/dde_calendar_delete_32px.svg 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/builtin/icons/dde_calendar_delete_32px.svg 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,20 @@ + + + icon/schedule/delete + + + + + + + + + + + + + + + + + \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/builtin/icons/dde_calendar_edit_32px.svg dde-calendar-5.10.0/calendar-client/assets/builtin/icons/dde_calendar_edit_32px.svg --- dde-calendar-5.9.1/calendar-client/assets/builtin/icons/dde_calendar_edit_32px.svg 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/builtin/icons/dde_calendar_edit_32px.svg 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,21 @@ + + + 编组 18 + + + + + + + + + + + + + + + + + + \ No newline at end of file Binary files /tmp/tmpsgbh6un_/K5SEN4W3x8/dde-calendar-5.9.1/calendar-client/assets/builtin/icons/dde_calendar_fail_200px.png and /tmp/tmpsgbh6un_/_fqUKjDi_9/dde-calendar-5.10.0/calendar-client/assets/builtin/icons/dde_calendar_fail_200px.png differ diff -Nru dde-calendar-5.9.1/calendar-client/assets/builtin/icons/dde_calendar_ji_32px.svg dde-calendar-5.10.0/calendar-client/assets/builtin/icons/dde_calendar_ji_32px.svg --- dde-calendar-5.9.1/calendar-client/assets/builtin/icons/dde_calendar_ji_32px.svg 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/builtin/icons/dde_calendar_ji_32px.svg 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,24 @@ + + + + icon_ji + Created with Sketch. + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/builtin/icons/dde_calendar_spinner_32px.svg dde-calendar-5.10.0/calendar-client/assets/builtin/icons/dde_calendar_spinner_32px.svg --- dde-calendar-5.9.1/calendar-client/assets/builtin/icons/dde_calendar_spinner_32px.svg 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/builtin/icons/dde_calendar_spinner_32px.svg 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,42 @@ + + + -mockplus- + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file Binary files /tmp/tmpsgbh6un_/K5SEN4W3x8/dde-calendar-5.9.1/calendar-client/assets/builtin/icons/dde_calendar_success_200px.png and /tmp/tmpsgbh6un_/_fqUKjDi_9/dde-calendar-5.10.0/calendar-client/assets/builtin/icons/dde_calendar_success_200px.png differ diff -Nru dde-calendar-5.9.1/calendar-client/assets/builtin/icons/dde_calendar_sync_schedule_32px.svg dde-calendar-5.10.0/calendar-client/assets/builtin/icons/dde_calendar_sync_schedule_32px.svg --- dde-calendar-5.9.1/calendar-client/assets/builtin/icons/dde_calendar_sync_schedule_32px.svg 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/builtin/icons/dde_calendar_sync_schedule_32px.svg 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,29 @@ + + + icon/unionID/日程类型 + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/builtin/icons/dde_calendar_sync_setting_32px.svg dde-calendar-5.10.0/calendar-client/assets/builtin/icons/dde_calendar_sync_setting_32px.svg --- dde-calendar-5.9.1/calendar-client/assets/builtin/icons/dde_calendar_sync_setting_32px.svg 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/builtin/icons/dde_calendar_sync_setting_32px.svg 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,18 @@ + + + icon/unionID/设置 + + + + + + + + + + + + + + + \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/builtin/icons/dde_calendar_warning_light_32px.svg dde-calendar-5.10.0/calendar-client/assets/builtin/icons/dde_calendar_warning_light_32px.svg --- dde-calendar-5.9.1/calendar-client/assets/builtin/icons/dde_calendar_warning_light_32px.svg 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/builtin/icons/dde_calendar_warning_light_32px.svg 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,17 @@ + + + 形状结合 + + + + + + + + + + + + + + \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/builtin/icons/dde_calendar_warning.svg dde-calendar-5.10.0/calendar-client/assets/builtin/icons/dde_calendar_warning.svg --- dde-calendar-5.9.1/calendar-client/assets/builtin/icons/dde_calendar_warning.svg 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/builtin/icons/dde_calendar_warning.svg 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,32 @@ + + + + deepin-cloudprint-config-helper + Created with Sketch. + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/builtin/icons/dde_calendar_xiu.svg dde-calendar-5.10.0/calendar-client/assets/builtin/icons/dde_calendar_xiu.svg --- dde-calendar-5.9.1/calendar-client/assets/builtin/icons/dde_calendar_xiu.svg 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/builtin/icons/dde_calendar_xiu.svg 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,16 @@ + + + + 类型 + Created with Sketch. + + + + + + + + + + + \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/builtin/icons/dde_calendar_yi_32px.svg dde-calendar-5.10.0/calendar-client/assets/builtin/icons/dde_calendar_yi_32px.svg --- dde-calendar-5.9.1/calendar-client/assets/builtin/icons/dde_calendar_yi_32px.svg 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/builtin/icons/dde_calendar_yi_32px.svg 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,24 @@ + + + + icon_yi + Created with Sketch. + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/builtin/icons/icon_refresh.svg dde-calendar-5.10.0/calendar-client/assets/builtin/icons/icon_refresh.svg --- dde-calendar-5.9.1/calendar-client/assets/builtin/icons/icon_refresh.svg 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/builtin/icons/icon_refresh.svg 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,17 @@ + + + 路径 + + + + + + + + + + + + + + \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/builtin/light/icons/dde_calendar_account_32px.svg dde-calendar-5.10.0/calendar-client/assets/builtin/light/icons/dde_calendar_account_32px.svg --- dde-calendar-5.9.1/calendar-client/assets/builtin/light/icons/dde_calendar_account_32px.svg 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/builtin/light/icons/dde_calendar_account_32px.svg 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,10 @@ + + + 账户- light + + + + + + + \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/builtin/light/icons/dde_calendar_create_32px.svg dde-calendar-5.10.0/calendar-client/assets/builtin/light/icons/dde_calendar_create_32px.svg --- dde-calendar-5.9.1/calendar-client/assets/builtin/light/icons/dde_calendar_create_32px.svg 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/builtin/light/icons/dde_calendar_create_32px.svg 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,16 @@ + + + 编组 21 + + + + + + + + + + + + + \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/builtin/light/icons/dde_calendar_sidebar_32px.svg dde-calendar-5.10.0/calendar-client/assets/builtin/light/icons/dde_calendar_sidebar_32px.svg --- dde-calendar-5.9.1/calendar-client/assets/builtin/light/icons/dde_calendar_sidebar_32px.svg 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/builtin/light/icons/dde_calendar_sidebar_32px.svg 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,11 @@ + + + 视图切换 + + + + + + + + \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/dde-calendar/calendar/common/side_menu.svg dde-calendar-5.10.0/calendar-client/assets/dde-calendar/calendar/common/side_menu.svg --- dde-calendar-5.9.1/calendar-client/assets/dde-calendar/calendar/common/side_menu.svg 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/dde-calendar/calendar/common/side_menu.svg 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,11 @@ + + + 视图切换 + + + + + + + + \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/dde-calendar/calendar/en_US/calendar.md dde-calendar-5.10.0/calendar-client/assets/dde-calendar/calendar/en_US/calendar.md --- dde-calendar-5.9.1/calendar-client/assets/dde-calendar/calendar/en_US/calendar.md 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/dde-calendar/calendar/en_US/calendar.md 2023-04-07 06:02:09.000000000 +0000 @@ -2,24 +2,24 @@ ## Overview -Calendar is a useful tool to manage your personal life. By relating events with specific time, it allows you to keep records and make plans for your schedule. +Calendar is a helpful tool to view dates and manage your personal life. By creating events with specific time, you can make your schedule easily. ![0|main](fig/main.png) ## Guide -You can run, close or create a desktop shortcut for Calendar by the following ways. +You can run, exit or create a desktop shortcut of Calendar as follows. ### Run Calender -1. Click the Launcher icon ![deepin_launcher](../common/deepin_launcher.svg) in the Dock to enter the Launcher interface. -2. Locate Calendar ![draw](../common/dde_calendar.svg) by scrolling the mouse wheel or searching "calendar" in the Launcher interface and click it to run. -3. Right-click ![draw](../common/dde_calendar.svg) and you can: +1. Click ![deepin_launcher](../common/deepin_launcher.svg) in the Dock to enter the Launcher interface. +2. Locate ![draw](../common/dde_calendar.svg) by scrolling the mouse wheel or searching for "Calendar" on the Launcher interface and click it to run. +3. Right-click ![draw](../common/dde_calendar.svg), you can: - Click **Send to desktop** to create a desktop shortcut. - Click **Send to dock** to fix it in the Dock. - - Click **Add to startup** to add the application to startup and it will automatically run when the system starts up. + - Click **Add to startup** to add it to startup and it will automatically run when the system starts up. ### Exit Calendar @@ -40,18 +40,22 @@ Calendar can be divided into yearly view, monthly view, weekly view and daily view. -Monthly view is defaulted and you can click to switch between different views. +Monthly view is the default one and you can click to switch between different views. - Lunar calendar dates will only be displayed in the Chinese system in paring with the solar calendar dates. -- The date starts from the year **1900** and you cannot view dates earlier than that year during date switching. +- The dates start from the year **1900** and you cannot view dates earlier than that year. - In the monthly and weekly view, the display of Saturday and Sunday is different from that of days between Monday to Friday. -> ![notes](../common/notes.svg) Notes: Monday is displayed as the first day of a week by default and you can change the display order of a week as needed in **Control Center** > **Date and Time** > **Time Format**. +On the Calendar interface, click ![side_menu](../common/side_menu.svg) to show or hide the side pane, which shows the event types of different accounts and a small calendar. + +1. By checking or unchecking the event types, the events of the types under that account show or hide on the right. + +2. Click the date on the small calendar at the bottom, the calendar on the right changes accordingly. - - + + @@ -59,24 +63,28 @@ - + - + - +
VIEWDESCRIPTIONViewDescription
Yearly View
Monthly ViewDisplay the days and schedule of the month.Display the days and events of the month.
Weekly ViewDisplay the days and schedule of the week.Display the days and events of the week.
Daily ViewDisplay the detailed schedule arrangements.Display the detailed events.
+ + ### Create Events 1. You can create events in one of the following ways: + - Click the ![add](../common/add.svg) icon in the menu bar on the calendar interface. - - Double-click, or right-click to select **New event** in the blank area in the monthly, weekly or daily view. - - Click and drag the mouse in the monthly, weekly or daily view. + - Double-click, or right-click to select **New event** in the blank area in the monthly, weekly or daily view. + - Click and drag the mouse in the monthly, weekly or daily view. + 2. Set the event type, description, time, reminder, etc. in the pop-up **New Event** dialogue. ![0|create](fig/create.png) @@ -84,22 +92,26 @@ - + + + + + +
  • The Type field becomes editable. Input the type name and select the color.
  • + You can add, edit or delete the custom type by the Manage option in the main menu. Please refer to the Manage section in Main Menu for details. - + +Options for Repeat with Solar checked: Never, Daily, Weekdays, Weekly, Monthly, and Yealy.
    +Options for Repeat with Lunar checked: Never, Monthly, and Yearly. - +
    ParameterField Description
    Calendar AccountYou can create events under a local account or network accounts, such as UOS ID. Local account is selected by default.
    Type There are three event types, namely "Work", "Life" and "Other" by default. You can also customize your event type.
    1. Select New event type from the Type dropdown list.
    2. -
    3. The Type field become editable. Input the type name and set the color.
    - You can add, edit or delete the custome type by the Manage option in the main menu. Please refer to the Manage section in Main Menu for details.
    Description Input the description information of the event.
    Event timeEvent Time Set the time properties for the event.
    • All day
      • Check All Day: Only dates can be selected as starts and ends.
      • @@ -121,45 +133,41 @@
    Repeat -Options for Repeat with Solar checked: Never, Daily, Weekdays, Weekly, Monthly, Yealy.
    -Options for Repeat with Lunar checked: Never, Monthly, Yearly.
    End RepeatOnly when you enable the Repeat feature, can End Repeat be displayed. The options for End Repeat are Never, after n time(s) or on the date selected. Only when the Repeat feature is enabled, can End Repeat be displayed. The options for End Repeat are Never, after n time(s) and on the date selected.
    - - - - 3. Click **Save** to create the event. ### Edit Events -1. Double-click or right-click a date with schedule in the monthly, weekly or daily view. -2. Select **Edit** and the **Edit Event** dialogue will pop up. -3. Set properties for the event under editing.   -4. Click **Save**. -5. If it is set as an all-day event or a repeated event, a prompt box will pop up for you to confirm information and then complete editing. +1. Double-click or right-click a date with events in the monthly, weekly or daily view. +2. Select **Edit** and the **Edit Event** dialogue will pop up. +3. Set properties for the event.   +4. Click **Save**. +5. If it is set as an all-day event or a repeated event, a prompt box will pop up for you to confirm information. -> ![notes](../common/notes.svg)Notes: You can drag the event label created to a specified time or date to change its starts and ends. +> ![notes](../common/notes.svg) Notes: You can drag the event label created to a specified time or date to change its starts and ends. -During event editing, different prompt information will be displayed according to the changes of content. Description of icons contained in the prompt information is listed as below. +During event editing, different prompts will be displayed according to the changes of content. Descriptions of buttons in the prompts are listed as below. - + - + - + @@ -171,14 +179,16 @@
    ICONButton Description
    AllOnly effective for the changes of relevant repeating events. Effective for all relevant repeating events.
    Only This EventOnly effective for the current event modification. Only effective for the current event.
    All Future Events
    + + ### Set All-day or Multiple-day Events Set the **Starts** and **Ends** and you are able to set an all-day or consecutive multiple-day events when creating or editing an event. ### Set Repeating Events -1. Click the drop-down list on the right of **Repeat** and select an option as needed when creating or editing an event. -2. Click the drop-down list on the right of **End Repeat** and select the end time of the schedule. +1. Click the dropdown list on the right of **Repeat** and select an option as needed when creating or editing an event. +2. Click the dropdown list on the right of **End Repeat** and select the end time of the event. ![pic](fig/repeat.png) @@ -194,83 +204,116 @@ Double-click an event title in the monthly, weekly or daily view and the **My Event** window will pop up. You can view events, [Edit Events](#Edit Events) or [Delete Events](#Delete Events). -### View Schedule Reminder Details +### View Schedule Details -Click the notification prompt box to view the schedule reminder details after the system sends out a notification. +Click the message to view the schedule details when the system sends out a notification. -Description of icons contained in the prompt information is listed as below. +Descriptions of buttons in the prompts are listed as below. - - + + - + - + - + - +
    ICONDESCRIPTIONButtonDescription
    Remind me laterThe reminder is set on the current day. After the first reminder is given, click Remind me later and you will be reminded 10 minutes later. The following reminder intervals will be increased by 5 minutes each time on the basis of the last reminder internal when you click Remind me later.
    You can also choose 15mins later, 1 hour later, 4 hours later or Tomorrow from the Remind me later dropdown list.
    If the reminder is set on the current day, when you click Remind me later on the first reminder, you will be reminded again 10 minutes later. The following reminder intervals will be increased by 5 minutes each time you click Remind me later.
    You can also choose 15 mins later, 1 hour later, 4 hours later or Tomorrow from the Remind me later dropdown list.
    Remind me tomorrowThe reminder is set to one day or two days ahead of the schedule. It is shown when the reminder is set to one day or two days ahead of the event.
    One day before start The reminder is set to one week ahead of the schedule.It is shown when the reminder is set to one week ahead of the event.
    CloseTurn off the prompt information.Close the prompt.
    ### Delete Events -1. Double-click or right-click a date with event in the monthly, weekly or daily view. +1. Double-click or right-click a date with event in the monthly, weekly or daily view. 2. Click **Delete** and a **You are deleting an event** prompt box will pop up. -3. Confirm the prompt information and delete the event. +3. Confirm and delete the event. -Description of icons contained in the prompt information for repeating and non-repeating events when you are deleting an event is listed as below. +Descriptions of icons in the deletion prompts for repeating and non-repeating events are listed as below. -
    ICON DESCRIPTION
    Delete Delete non-repeating events.
    Delete All Delete all occurrences of this event.
    Delete Only This Event Delete only the selected occurrence of the event. This is only applicable to the repeating events.
    Delete All Future Events Delete this occurences and all future occurrences of the event but the occurrences of the event before the selected date will be retained. This is only applicable to the repeating events.
    +
    Button Description
    Delete Delete non-repeating events.
    Delete All Delete all occurrences of this event.
    Delete Only This Event Delete only the selected occurrence of the event. This is only applicable to repeating events.
    Delete All Future Events Delete this occurences and all future occurrences of the event but the occurrences of the event before the selected date will be retained. This is only applicable to repeating events.
    ## Main Menu -On the main menu, you can manage the event type, switch window themes, view the help manual and get more information about Calendar. +On the main menu, you can manage settings, view the privacy policy, switch window themes, view the help manual and get more information about Calendar. ### Manage -#### Manage Event Types -Click ![icon_menu](../common/icon_menu.svg) > **Manage** on the Calendar interface to enter the Manage Calendar interface. You can add, edite or delete the custom event type. +Click ![icon_menu](../common/icon_menu.svg) > **Manage** to open the manage window, where you can sign in UOS ID to sync events and settings to the cloud, manage event types, and make general settings. + +![manage](fig/manage.png) -![pig](fig/manage.png) +#### Manage Accounts and Sync + +Calendar supports sync events and settings to the cloud by UOS ID. + +> ![notes](../common/notes.svg) Notes: It is not available in old system versions and deepin system at present. + +**UOS ID Sign In and Sign Out** + +1. On the Account Settings interface, click **Sign In**. +2. In the pop-up window, sign into your UOS ID by entering your account and password, or SMS verification code, or scanning QR code with WeChat. +3. When signed in, your avatar, account info and related items are shown. Click **Sign Out** if you want. + +**Sync Settings** + +1. When signed in, Check **Events** and **General settings** to sync them to the cloud. +2. In the dropdown list of **Sync interval**, select the time interval for auto sync, or choose **Manual**. +2. Click **Sync Now** to start syncing immediately. + +> ![notes](../common/notes.svg) Notes: To make sync settings available, you should turn on **UOS Cloud sync** in Control Center first. + +#### Manage Event Types + +Click ![icon_menu](../common/icon_menu.svg) > **Manage** on the Calendar interface to enter the Manage Calendar interface. You can add, edit or delete custom event types. **Add An Event Type** 1. Click ![icon_menu](../common/add1.svg) on the Manage Calendar interface. -2. Input the name and set the color for the event type in the pop-up **New event type** dialogue. +2. Input the name and set the color for the event type in the **New event type** dialogue. 3. Click **Save**. **Edit An Event Type** -1. Select a custom event type on the on the Manage Calendar interface. -1. Click ![icon_menu](../common/edit.svg). -2. Input the name and set the color for the event type in the pop-up **New event type** dialogue. -3. Click **Save**. +1. Select a custom event type on the Manage Calendar interface. +2. Click ![icon_menu](../common/edit.svg). +3. Input the name and set the color for the event type in the **Edit event type** dialogue. +4. Click **Save**. **Delete An Event Type** -1. Select a custom event type on the on the Manage Calendar interface. +1. Select a custom event type on the Manage Calendar interface. + 2. Click ![icon_menu](../common/delete.svg)to delete the event type. +#### General Settings + +**First day of week** + +In the dropdown list of **First day of week**, select **Sunday** or **Monday** as the first day of a week displayed in Calendar. + +**Time format** + +In the dropdown list of **Time**, select **24-hour clock** or **12-hour clock** as the time format shown in Calendar. + ### Theme There are three window themes, namely Light Theme, Dark Theme and System Theme. 1. Click ![icon_menu](../common/icon_menu.svg) on the Calendar interface. - 2. Click **Theme** to select one theme. ### Help Binary files /tmp/tmpsgbh6un_/K5SEN4W3x8/dde-calendar-5.9.1/calendar-client/assets/dde-calendar/calendar/en_US/fig/create.png and /tmp/tmpsgbh6un_/_fqUKjDi_9/dde-calendar-5.10.0/calendar-client/assets/dde-calendar/calendar/en_US/fig/create.png differ Binary files /tmp/tmpsgbh6un_/K5SEN4W3x8/dde-calendar-5.9.1/calendar-client/assets/dde-calendar/calendar/en_US/fig/main.png and /tmp/tmpsgbh6un_/_fqUKjDi_9/dde-calendar-5.10.0/calendar-client/assets/dde-calendar/calendar/en_US/fig/main.png differ Binary files /tmp/tmpsgbh6un_/K5SEN4W3x8/dde-calendar-5.9.1/calendar-client/assets/dde-calendar/calendar/en_US/fig/manage.png and /tmp/tmpsgbh6un_/_fqUKjDi_9/dde-calendar-5.10.0/calendar-client/assets/dde-calendar/calendar/en_US/fig/manage.png differ Binary files /tmp/tmpsgbh6un_/K5SEN4W3x8/dde-calendar-5.9.1/calendar-client/assets/dde-calendar/calendar/en_US/fig/repeat.png and /tmp/tmpsgbh6un_/_fqUKjDi_9/dde-calendar-5.10.0/calendar-client/assets/dde-calendar/calendar/en_US/fig/repeat.png differ diff -Nru dde-calendar-5.9.1/calendar-client/assets/dde-calendar/calendar/zh_CN/calendar.md dde-calendar-5.10.0/calendar-client/assets/dde-calendar/calendar/zh_CN/calendar.md --- dde-calendar-5.9.1/calendar-client/assets/dde-calendar/calendar/zh_CN/calendar.md 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/dde-calendar/calendar/zh_CN/calendar.md 2023-04-07 06:02:09.000000000 +0000 @@ -1,330 +1,366 @@ -# 日历|dde-calendar| - -## 概述 - -日历是一款查看日期、管理日程的小工具,支持查看农历、黄历、节气和常见的节日信息等,内置日程提醒功能帮您更好地规划时间。 - -![0|main](fig/main.png) - - - -## 使用入门 - -通过以下方式运行或关闭日历,或者创建日历的快捷方式。 - -### 运行日历 - -1. 单击任务栏上的启动器图标 ![deepin_launcher](../common/deepin_launcher.svg) ,进入启动器界面。 -2. 上下滚动鼠标滚轮浏览或通过搜索,找到日历图标 ![draw](../common/dde_calendar.svg),单击运行。 -3. 右键单击 ![draw](../common/dde_calendar.svg) ,您可以: - - - 单击 **发送到桌面**,在桌面创建快捷方式。 - - 单击 **发送到任务栏**,将应用程序固定到任务栏。 - - 单击 **开机自动启动**,将应用程序添加到开机启动项,在电脑开机时自动运行该应用。 - - -### 关闭日历 - -- 在日历界面单击 ![close_icon](../common/close_icon.svg) ,退出日历。 -- 在任务栏右键单击 ![draw](../common/dde_calendar.svg) ,选择 **关闭所有**,退出日历。 -- 在日历界面单击 ![icon_menu](../common/icon_menu.svg) ,选择 **退出** ,退出日历。 - -### 查看快捷键 - -在日历界面,使用快捷键 **Ctrl + Shift + ?** 打开快捷键预览界面。熟练地使用快捷键,将大大提升您的操作效率。 - -![0|view](fig/hotkey.png) - - - -## 操作介绍 - -日历分为年、月、周、日视图,通过不同的视图方式展示日期属性。 - -系统默认显示月视图,可以通过鼠标点击切换年、月、周、日视图。 - -- 仅在中文系统中,日历会显示日期所对应的农历日期、黄历和节日信息。 -- 日期以 **1900** 年为起点,在日期切换时,不能查看早于 **1900** 年的日期。 -- 在月视图、周视图中,周六、周日的日期显示会区别于周一至周五。 - -> ![notes](../common/notes.svg) 说明:系统默认一周首日为星期一,您可以在 **控制中心 > 时间日期 > 格式设置** 中调整一周首日的设置,更改周日期的展现效果。 - - - - - - - - - - - - - - - - - - - - - - - - -
    视图说明
    显示全年的月份、天数。
    显示节日信息、日程安排。
    显示这一周每天的日程安排。
    显示节日信息、详细的日程安排和黄历。
    - - -### 新建日程 - -1. 通过以下方法之一新建日程。 - - 在日历界面,单击菜单栏上的添加按钮 ![plus](../common/add.svg)。 - - 在月、周或日视图中,双击日期空白处或单击鼠标右键选择 **新建日程**。 - - 在月、周或日视图中,单击鼠标拖拽新建日程。 - -2. 弹出“新建日程”窗口,设置日程类型、内容、时间、提醒等信息。 - -![pic](fig/create.png) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    参数说明
    类型系统默认提供“工作”、“生活”、“其他”三种日程类型,您也可以自定义日程类型。 -
    1. 在类型下拉列表中,选择 新增日程类型
    2. -
    3. 类型框呈可编辑状态,输入类型名称,设置颜色。
    - 您也可以通过主菜单中的管理功能新增、编辑或删除日程类型,具体操作步骤请参考“管理”章节。
    内容日程的描述信息。
    日程时间设置全天或非全天、公历或农历日程的日期和时间。 -
      -
    • 全天 -
      • 勾选全天:开始时间和结束时间只能设置日期。
      • -
      • 取消勾选全天:开始时间和结束时间既能设置日期、也能设置小时和分钟。
      -
    • -
    -
      -
    • 时间 -
      • 公历:开始时间和结束时间仅显示公历日期。
      • -
      • 农历:开始时间和结束时间显示公历和农历日期。
      -
    • -
    提醒 -勾选全天,则提醒设置的选项包含:从不、日程发生当天(上午9点)、1天前、 2天前或1周前。
    -取消勾选全天,则提醒设置的选项包含:从不、日程开始时、15分钟前、30分钟前、1小时前、1天前、 2天前或1周前。
    重复 -选择公历日程,则重复设置的选项包含:从不、每天、工作日、每周、每月或每年。
    -选择农历日程,则重复设置的选项包含:从不、每月或每年。
    结束重复只有设置了重复功能,结束重复 才会出现。结束重复的选项包含:从不、于n次后或于日期。
    - - - - - -3. 单击 **保存**,创建日程。日程创建完成后,会以标签形式呈现在日历视图中。 - - - -### 编辑日程 - -1. 在月、周或日视图中,双击或右键单击日程标签。 -2. 选择 **编辑**。 -3. 弹出“编辑日程”窗口,设置编辑日程的相关属性,单击 **保存**。 -4. 如果设置了全天或重复,则弹出提示框,确认提示信息后,完成日程编辑。 - -> ![notes](../common/notes.svg) 说明:已创建的日程可以通过拖拽日程标签来修改日程的开始时间和结束时间。 - -编辑日程时,系统会根据所更改内容的不同显示不同的提示信息。提示信息中按钮说明如下表。 - - - - - - - - - - - - - - - - - - - - - - -
    按钮说明
    全部日程修改所有与此相关的重复日程。
    仅此日程只修改当前日程。
    所有将来日程修改选中日期及以后日期的日程,选中的日期之前的日程仍然保留。
    全部更改 修改所有重复日程。
    - - - -### 设置全天或多天日程 - -在创建或编辑日程时,设置 **开始时间**、**结束时间**,可以设置全天或多天持续的日程。 - -### 设置重复日程 - -1. 在创建或编辑日程时,在 **重复** 的下拉列表中选择重复提醒日程的周期,例如,每月。 -2. 在 **结束重复** 的下拉列表中设置结束重复的次数或停止日期。 - -![pic](fig/repeat.png) - -### 搜索日程 - -1. 在日历界面顶部搜索框中,单击 ![search](../common/search.svg),输入关键字。 -2. 按下键盘上的 **Enter** 键进行搜索。 -3. 在搜索框中单击 ![0|close](../common/close_icon.svg) 或删除输入的信息,清除当前输入的关键字或取消搜索。 - -### 查看日程 - -在月、周或日视图中,双击日程标签,弹出“我的日程”窗口,此时既可以查看日程,也可以 [编辑日程](#编辑日程) 或 [删除日程](#删除日程)。 - -### 查看日程提醒详情 - -当系统发出通知后,单击通知提示框,查看日程详情。 - -日程提醒时,提示信息按钮说明如下表。 - - - - - - - - - - - - - - - - - - - - - - -
    按钮说明
    稍后提醒提醒设置为当天,首次提醒后,单击 稍后提醒,10分钟后再次提醒,此后每次单击“稍后提醒”增加5分钟的时间间隔。
    您也可以在"稍后提醒"下拉列表中,选择15分钟后、1小时后、4小时后或明天。
    明天提醒当提醒设置为1天前或2天前时,出现该按钮。
    提前1天提醒 当提醒设置为1周前时,出现该按钮。
    关闭关闭提示信息。
    - - - - - -### 删除日程 - -1. 在月、周或日视图中,双击或右键单击日程标签。 -2. 选择 **删除**。 -3. 弹出“您正在删除日程”提示框,单击 **删除**,删除该日程。 - -删除日程时,重复与非重复日程提示信息中的按钮说明如下表。 - - - - - - - - - - - - - - - - - - - - - - -
    按钮说明
    删除日程删除非重复日程。
    全部删除删除所有重复日程。
    仅删除此日程 针对重复日程,仅删除当前所选的日程。
    删除所有将来日程 针对重复日程,删除当前选中日期及以后日期的日程,选中的日期之前的日程仍然保留。
    - - - - -## 主菜单 - -在主菜单中,您可以管理日程类型、切换窗口主题、查看帮助手册、了解日历的更多信息。 - -### 管理 - -#### 管理日程类型 - -单击 ![icon_menu](../common/icon_menu.svg) > **管理**,进入日历管理界面,您可以新增、编辑或删除日程类型。 - -![type](fig/type.png) - -**新增日程类型** - -1. 在日历管理界面,单击添加按钮 ![icon](../common/add1.svg)。 -2. 弹出“新增日程类型”窗口,输入类型名称,设置颜色。 -3. 单击 **保存**。 - -**编辑日程类型** - -1. 在日历管理界面,选择某一个自定义类型。 -2. 单击编辑按钮 ![icon](../common/edit.svg)。 -3. 弹出“编辑日程类型”窗口,输入类型名称,设置颜色。 -4. 单击 **保存**。 - -**删除日程类型** - -1. 在日历管理界面,选择某一个自定义类型。 -2. 单击删除按钮 ![icon](../common/delete.svg),删除该日程类型。 - -### 主题 - -窗口主题包含浅色主题、深色主题和系统主题。 - -1. 在日历界面,单击 ![icon_menu](../common/icon_menu.svg)。 -2. 选择 **主题**,选择一个主题颜色。 - -### 帮助 - -查看帮助手册,进一步了解和使用日历。 - -1. 在日历界面,单击 ![icon_menu](../common/icon_menu.svg)。 -2. 选择 **帮助**。 -3. 查看日历的帮助手册。 - - -### 关于 - -1. 在日历界面,单击 ![icon_menu](../common/icon_menu.svg)。 -2. 选择 **关于**。 -3. 查看日历的版本和介绍。 - - -### 退出 - -1. 在日历界面,单击 ![icon_menu](../common/icon_menu.svg)。 -2. 选择 **退出**。 - +# 日历|dde-calendar| + +## 概述 + +日历是一款查看日期、管理日程的小工具,支持查看农历、黄历、节气和常见的节日信息等,内置日程提醒功能帮您更好地规划时间。 + +![0|main](fig/main.png) + + + +## 使用入门 + +通过以下方式运行或关闭日历,或者创建日历的快捷方式。 + +### 运行日历 + +1. 单击任务栏上的启动器图标 ![deepin_launcher](../common/deepin_launcher.svg) ,进入启动器界面。 +2. 上下滚动鼠标滚轮浏览或通过搜索,找到日历图标 ![draw](../common/dde_calendar.svg),单击运行。 +3. 右键单击 ![draw](../common/dde_calendar.svg) ,您可以: + + - 单击 **发送到桌面**,在桌面创建快捷方式。 + - 单击 **发送到任务栏**,将应用程序固定到任务栏。 + - 单击 **开机自动启动**,将应用程序添加到开机启动项,在电脑开机时自动运行该应用。 + + +### 关闭日历 + +- 在日历界面单击 ![close_icon](../common/close_icon.svg) ,退出日历。 +- 在任务栏右键单击 ![draw](../common/dde_calendar.svg) ,选择 **关闭所有**,退出日历。 +- 在日历界面单击 ![icon_menu](../common/icon_menu.svg) ,选择 **退出** ,退出日历。 + +### 查看快捷键 + +在日历界面,使用快捷键 **Ctrl + Shift + ?** 打开快捷键预览界面。熟练地使用快捷键,将大大提升您的操作效率。 + +![0|view](fig/hotkey.png) + + + +## 操作介绍 + +日历分为年、月、周、日视图,通过不同的视图方式展示日期属性。 + +系统默认显示月视图,可以通过鼠标点击切换年、月、周、日视图。 + +- 仅在中文系统中,日历会显示日期所对应的农历日期、黄历和节日信息。 +- 日期以 **1900** 年为起点,在日期切换时,不能查看早于 **1900** 年的日期。 +- 在月视图、周视图中,周六、周日的日期显示会区别于周一至周五。 + +日历视图中的侧边栏展示日历帐户以及小日历视图。 + +1. 单击 ![side_menu](../common/side_menu.svg)可切换窗口中侧边栏的展示和隐藏。 +2. 在日历帐户中勾选相应的日历类型,则该类型下的日程在日历视图中展示;若取消勾选,则在视图中隐藏。 +3. 在侧边栏下方的小日历中点选日期,可联动控制右侧大日历视图的日期展示。 + + + + + + + + + + + + + + + + + + + + + + + + +
    视图说明
    显示全年的月份、天数。
    显示节日信息、日程安排。
    显示这一周每天的日程安排。
    显示节日信息、详细的日程安排和黄历。
    + + +### 新建日程 + +1. 通过以下方法之一新建日程。 + - 在日历界面,单击菜单栏上的添加按钮 ![plus](../common/add.svg)。 + - 在月、周或日视图中,双击日期空白处或单击鼠标右键选择 **新建日程**。 + - 在月、周或日视图中,单击鼠标拖拽新建日程。 + +2. 弹出“新建日程”窗口,选择日历帐户、设置日程类型、内容、时间、提醒等信息。 + +![pic](fig/create.png) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    参数说明
    日历帐户默认本地帐户,可选UOS ID等网络账户。
    类型系统默认提供“工作”、“生活”、“其他”三种日程类型,您也可以自定义日程类型。 +
    1. 在类型下拉列表中,选择 新增日程类型
    2. +
    3. 类型框呈可编辑状态,输入类型名称,设置颜色。
    + 您也可以通过主菜单中的管理功能新增、编辑或删除日程类型,具体操作步骤请参考“管理”章节。
    内容日程的描述信息。
    日程时间设置全天或非全天、公历或农历日程的日期和时间。 +
      +
    • 全天 +
      • 勾选全天:开始时间和结束时间只能设置日期。
      • +
      • 取消勾选全天:开始时间和结束时间既能设置日期、也能设置小时和分钟。
      +
    • +
    +
      +
    • 时间 +
      • 公历:开始时间和结束时间仅显示公历日期。
      • +
      • 农历:开始时间和结束时间显示公历和农历日期。
      +
    • +
    提醒 +勾选全天,则提醒设置的选项包含:从不、日程发生当天(上午9点)、1天前、 2天前或1周前。
    +取消勾选全天,则提醒设置的选项包含:从不、日程开始时、15分钟前、30分钟前、1小时前、1天前、 2天前或1周前。
    重复 +选择公历日程,则重复设置的选项包含:从不、每天、工作日、每周、每月或每年。
    +选择农历日程,则重复设置的选项包含:从不、每月或每年。
    结束重复只有设置了重复功能,结束重复 才会出现。结束重复的选项包含:从不、于n次后或于日期。
    + + +3. 单击 **保存**,创建日程。日程创建完成后,会以标签形式呈现在日历视图中。 + + + +### 编辑日程 + +1. 在月、周或日视图中,双击或右键单击日程标签。 +2. 选择 **编辑**。 +3. 弹出“编辑日程”窗口,设置编辑日程的相关属性,单击 **保存**。 +4. 如果设置了全天或重复,则弹出提示框,确认提示信息后,完成日程编辑。 + +> ![notes](../common/notes.svg) 说明:已创建的日程可以通过拖拽日程标签来修改日程的开始时间和结束时间。 + +编辑日程时,系统会根据所更改内容的不同显示不同的提示信息。提示信息中按钮说明如下表。 + + + + + + + + + + + + + + + + + + + + + + +
    按钮说明
    全部日程修改所有与此相关的重复日程。
    仅此日程只修改当前日程。
    所有将来日程修改选中日期及以后日期的日程,选中的日期之前的日程仍然保留。
    全部更改 修改所有重复日程。
    + + + +### 设置全天或多天日程 + +在创建或编辑日程时,设置 **开始时间**、**结束时间**,可以设置全天或多天持续的日程。 + +### 设置重复日程 + +1. 在创建或编辑日程时,在 **重复** 的下拉列表中选择重复提醒日程的周期,例如,每月。 +2. 在 **结束重复** 的下拉列表中设置结束重复的次数或停止日期。 + +![pic](fig/repeat.png) + +### 搜索日程 + +1. 在日历界面顶部搜索框中,单击 ![search](../common/search.svg),输入关键字。 +2. 按下键盘上的 **Enter** 键进行搜索。 +3. 在搜索框中单击 ![0|close](../common/close_icon.svg) 或删除输入的信息,清除当前输入的关键字或取消搜索。 + +### 查看日程 + +在月、周或日视图中,双击日程标签,弹出“我的日程”窗口,此时既可以查看日程,也可以 [编辑日程](#编辑日程) 或 [删除日程](#删除日程)。 + +### 查看日程提醒详情 + +当系统发出通知后,单击通知提示框,查看日程详情。 + +日程提醒时,提示信息按钮说明如下表。 + + + + + + + + + + + + + + + + + + + + + + +
    按钮说明
    稍后提醒提醒设置为当天,首次提醒后,单击 稍后提醒,10分钟后再次提醒,此后每次单击“稍后提醒”增加5分钟的时间间隔。
    您也可以在"稍后提醒"下拉列表中,选择15分钟后、1小时后、4小时后或明天。
    明天提醒当提醒设置为1天前或2天前时,出现该按钮。
    提前1天提醒 当提醒设置为1周前时,出现该按钮。
    关闭关闭提示信息。
    + + + + + +### 删除日程 + +1. 在月、周或日视图中,双击或右键单击日程标签。 +2. 选择 **删除**。 +3. 弹出“您正在删除日程”提示框,单击 **删除**,删除该日程。 + +删除日程时,重复与非重复日程提示信息中的按钮说明如下表。 + + + + + + + + + + + + + + + + + + + + + + +
    按钮说明
    删除日程删除非重复日程。
    全部删除删除所有重复日程。
    仅删除此日程 针对重复日程,仅删除当前所选的日程。
    删除所有将来日程 针对重复日程,删除当前选中日期及以后日期的日程,选中的日期之前的日程仍然保留。
    + + + + +## 主菜单 + +在主菜单中,您可以打开管理设置、查看隐私政策、切换窗口主题、查看帮助手册、了解日历的更多信息。 + +### 管理 + +单击 ![icon_menu](../common/icon_menu.svg) > **管理**,进入日历管理界面,您可以管理日历帐户的日程类型、登录UOS ID将日程数据和日历配置同步至云端,同时也可以对通用配置进行设置。 + +![type](fig/type.png) + +#### 日历云同步 + +日历支持通过UOS ID将日程数据及设置同步至云端。 + +> ![notes](../common/notes.svg) 说明:该功能暂不对老版本UOS系统和deepin系统开放。 + +**登录和登出UOS ID** + +1. 在帐户设置界面,点击 **登录** 按钮。 +2. 弹出UOS ID登录弹窗,在弹窗中通过账号密码、手机验证码或微信扫码等方式完成UOS ID登录。 +3. 登录后显示账户名、头像和相关同步设置,点击 **退出登录** 按钮可将UOS ID账号登出。 + +**日历同步设置** + +1. UOS ID登录状态下,点击 **日程** 、 **通用设置** 后的复选框,设置是否同步至云端。 + +2. 点击 **同步频率** 后的下拉框,可选择系统自动同步的频率,您也可以选中 **手动同步** ,关闭自动同步模式。 + +3. 点击 **立即同步** 按钮,立即和云端数据进行同步。 + +> ![notes](../common/notes.svg) 说明:需在控制中心开启 **UOS Cloud同步**,才能使用云同步功能。 + +#### 管理日程类型 + +**新增日程类型** + +1. 在日历管理界面,单击添加按钮 ![icon](../common/add1.svg)。 +2. 弹出“新增日程类型”窗口,输入类型名称,设置颜色。 +3. 单击 **保存**。 + +**编辑日程类型** + +1. 在日历管理界面,选择某一个自定义类型。 +2. 单击编辑按钮 ![icon](../common/edit.svg)。 +3. 弹出“编辑日程类型”窗口,输入类型名称,设置颜色。 +4. 单击 **保存**。 + +**删除日程类型** + +1. 在帐户设置界面,选择某一个自定义类型。 +2. 单击删除按钮 ![icon](../common/delete.svg),删除该日程类型。 + +#### 通用设置 + +**一周首日** + +点击 **每星期开始于** 后的下拉框,可选中 **周日** 或 **周一** 设置为每周的第一天。 + +**时间格式** + +点击 **时间** 后的下拉框,选中 **24小时制** 或 **12小时制** ,则日历中的时间格式将按选中项进行展示。 + +### 主题 + +窗口主题包含浅色主题、深色主题和系统主题。 + +1. 在日历界面,单击 ![icon_menu](../common/icon_menu.svg)。 +2. 选择 **主题**,选择一个主题颜色。 + +### 帮助 + +查看帮助手册,进一步了解和使用日历。 + +1. 在日历界面,单击 ![icon_menu](../common/icon_menu.svg)。 +2. 选择 **帮助**。 +3. 查看日历的帮助手册。 + + +### 关于 + +1. 在日历界面,单击 ![icon_menu](../common/icon_menu.svg)。 +2. 选择 **关于**。 +3. 查看日历的版本和介绍。 + + +### 退出 + +1. 在日历界面,单击 ![icon_menu](../common/icon_menu.svg)。 +2. 选择 **退出**。 + Binary files /tmp/tmpsgbh6un_/K5SEN4W3x8/dde-calendar-5.9.1/calendar-client/assets/dde-calendar/calendar/zh_CN/fig/create.png and /tmp/tmpsgbh6un_/_fqUKjDi_9/dde-calendar-5.10.0/calendar-client/assets/dde-calendar/calendar/zh_CN/fig/create.png differ Binary files /tmp/tmpsgbh6un_/K5SEN4W3x8/dde-calendar-5.9.1/calendar-client/assets/dde-calendar/calendar/zh_CN/fig/main.png and /tmp/tmpsgbh6un_/_fqUKjDi_9/dde-calendar-5.10.0/calendar-client/assets/dde-calendar/calendar/zh_CN/fig/main.png differ Binary files /tmp/tmpsgbh6un_/K5SEN4W3x8/dde-calendar-5.9.1/calendar-client/assets/dde-calendar/calendar/zh_CN/fig/repeat.png and /tmp/tmpsgbh6un_/_fqUKjDi_9/dde-calendar-5.10.0/calendar-client/assets/dde-calendar/calendar/zh_CN/fig/repeat.png differ Binary files /tmp/tmpsgbh6un_/K5SEN4W3x8/dde-calendar-5.9.1/calendar-client/assets/dde-calendar/calendar/zh_CN/fig/type.png and /tmp/tmpsgbh6un_/_fqUKjDi_9/dde-calendar-5.10.0/calendar-client/assets/dde-calendar/calendar/zh_CN/fig/type.png differ diff -Nru dde-calendar-5.9.1/calendar-client/assets/dde-calendar/calendar/zh_HK/calendar.md dde-calendar-5.10.0/calendar-client/assets/dde-calendar/calendar/zh_HK/calendar.md --- dde-calendar-5.9.1/calendar-client/assets/dde-calendar/calendar/zh_HK/calendar.md 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/dde-calendar/calendar/zh_HK/calendar.md 2023-04-07 06:02:09.000000000 +0000 @@ -1,325 +1,361 @@ -# 日曆|dde-calendar| - -## 概述 - -日曆是一款查看日期、管理日程的小工具,支持查看農曆、黃曆、節氣和常見的節日訊息等,內置日程提醒功能幫您更好地規劃時間。 - -![0|main](fig/main.png) - - -## 使用入門 - -通過以下方式運行或關閉日曆,或者創建日曆的快捷方式。 - -### 運行日曆 - -1. 單擊任務欄上的啟動器圖標 ![deepin_launcher](../common/deepin_launcher.svg),進入啟動器界面。 -2. 上下滾動鼠標滾輪瀏覽或通過搜索,找到日曆圖標 ![draw](../common/dde_calendar.svg),單擊運行。 -3. 右鍵單擊 ![draw](../common/dde_calendar.svg),您可以: - - - 單擊 **傳送到桌面**,在桌面創建快捷方式。 - - 單擊 **傳送到任務欄**,將應用程序固定到任務欄。 - - 單擊 **加至開機啟動**,將應用程序添加到開機啟動項,在電腦開機時自動運行該應用。 - - -### 關閉日曆 - -- 在日曆界面單擊 ![close_icon](../common/close_icon.svg),關閉日曆。 -- 在任務欄右鍵單擊 ![draw](../common/dde_calendar.svg),選擇 **關閉所有**,關閉日曆。 -- 在日曆界面單擊 ![icon_menu](../common/icon_menu.svg),選擇 **退出**,關閉日曆。 - -### 查看快捷鍵 - -在日曆界面,使用快捷鍵 **Ctrl + Shift + ?** 打開快捷鍵預覽界面。熟練地使用快捷鍵,將大大提升您的操作效率。 - - -![0|view](fig/hotkey.png) - - - -## 操作介紹 - -日曆分為年、月、周、日視圖,通過不同的視圖方式展示日期屬性。 - -系統默認顯示月視圖,可以通過鼠標單擊切換年、月、周、日視圖。 - -- 僅在中文系統中,日曆會顯示日期所對應的農曆日期、黃曆和節日訊息。 -- 日期以 **1900** 年為起點,在日期切換時,不能查看早於 **1900** 年的日期。 -- 在月視圖、周視圖中,週六、週日的日期顯示會區別於週一至週五。 - -> ![notes](../common/notes.svg)說明:系統默認一週首日為星期一,您可以在 **控制中心 > 日期與時刻 > 格式設置** 中調整一週首日的設置,更改週日期的展現效果。 - - - - - - - - - - - - - - - - - - - - - - -
    視圖說明
    顯示全年的月份、天數。
    顯示節日訊息、日程安排。
    顯示這一週每天的日程安排。
    顯示節日訊息、詳細的日程安排和黃曆。
    - - -### 新建日程 - -1. 通過以下方法之一新建日程。 - - 在日曆界面,單擊菜單欄上的添加按鈕 ![plus](../common/add.svg)。 - - 在月、周或日視圖中,雙擊日期空白處或單擊鼠標右鍵選擇 **新建日程**。 - - 在月、周或日視圖中,單擊鼠標拖拽新建日程。 - -2. 彈出「新建日程」窗口,設置日程類型、內容、時間、提醒等訊息。 - -![pic](fig/create.png) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    參數說明
    類型系統默認提供「工作」、「生活」、「其他」三種日程類型,您也可以自定義日程類型。 -
    1. 在類型下拉列表中,選擇 新增日程類型
    2. -
    3. 類型框呈可編輯狀態,輸入類型名稱,設置顏色。
    - 您也可以通過主菜單中的管理功能新增、編輯或刪除日程類型,具體操作步驟請參考「管理」章節。
    內容日程的描述訊息。
    日程時間設置全天或非全天、公曆或農曆日程的日期和時間。 -
      -
    • 全天 -
      • 勾選全天:開始時間和結束時間只能設置日期。
      • -
      • 取消勾選全天:開始時間和結束時間既能設置日期、也能設置小時和分鐘。
      -
    • -
    -
      -
    • 時間 -
      • 公曆:開始時間和結束時間僅顯示公曆日期。
      • -
      • 農曆:開始時間和結束時間顯示公曆和農曆日期。
      -
    • -
    提醒 -勾選全天,則提醒設置的選項包含:永不、日程發生當天(上午9點)、1天前、 2天前或1週前。
    -取消勾選全天,則提醒設置的選項包含:永不、日程開始時、15分鐘前、30分鐘前、1小時前、1天前、 2天前或1週前。
    重複 -選擇公曆日程,則重複設置的選項包含:永不、每天、工作日、每週、每月或每年。
    -選擇農曆日程,則重複設置的選項包含:永不、每月或每年。
    結束重複只有設置了重複功能,結束重複 才會出現。結束重複的選項包含:永不、於n次後或於日期。
    - - - -3. 單擊 **保存**,創建日程。日程創建完成後,會以標籤形式呈現在日曆視圖中。 - - - -### 編輯日程 - -1. 在月、周或日視圖中,雙擊或右鍵單擊日程標籤。 -2. 選擇 **編輯**。 -3. 彈出「編輯日程」窗口,設置編輯日程的相關屬性,單擊 **保存**。 -4. 如果設置了全天或重複,則彈出提示框,確認提示訊息後,完成日程編輯。 - -> ![notes](../common/notes.svg) 說明:已創建的日程可以通過拖拽日程標籤來修改日程的開始時間和結束時間。 - -編輯日程時,系統會根據所更改內容的不同顯示不同的提示訊息。提示訊息中按鈕說明如下表。 - - - - - - - - - - - - - - - - - - - - - - -
    按鈕說明
    全部日程修改所有與此相關的重複日程。
    僅此日程只修改當前日程。
    所有將來日程修改選中日期及以後日期的日程,選中的日期之前的日程仍然保留。
    全部更改 修改所有重複日程。
    - - - -### 設置全天或多天日程 - -在創建或編輯日程時,設置 **開始時間**、**結束時間**,可以設置全天或多天持續的日程。 - -### 設置重複日程 - -1. 在創建或編輯日程時,在 **重複** 的下拉列表中選擇重複提醒日程的週期,例如,每月。 -2. 在 **結束重複** 的下拉列表中設置結束重複的次數或停止日期。 - -![pic](fig/repeat.png) - -### 搜索日程 - -1. 在日曆界面頂部搜索框中,單擊 ![search](../common/search.svg),輸入關鍵字。 -2. 按下鍵盤上的 **Enter** 鍵進行搜索。 -3. 在搜索框中單擊 ![0|close](../common/close_icon.svg) 或刪除輸入的訊息,清除當前輸入的關鍵字或取消搜索。 - -### 查看日程 - -在月、周或日視圖中,雙擊日程標籤,彈出「我的日程」窗口,此時既可以查看日程,也可以 [編輯日程](#編輯日程) 或 [刪除日程](#刪除日程)。 - -### 查看日程提醒詳情 - -當系統發出通知後,單擊通知提示框,查看日程詳情。 - -日程提醒時,提示訊息按鈕說明如下表。 - - - - - - - - - - - - - - - - - - - - - - -
    按鈕說明
    稍後提醒提醒設置為當天,首次提醒後,單擊 稍後提醒,10分鐘後再次提醒,此後每次單擊「稍後提醒」增加5分鐘的時間間隔。
    您也可以在「稍後提醒」下拉列表中,選擇15分鐘後、1小時後、4小時後或明天。
    明天提醒當提醒設置為1天前或2天前時,出現該按鈕。
    提前1天提醒 當提醒設置為1週前時,出現該按鈕。
    關閉關閉提示訊息。
    - - - - - -### 刪除日程 - -1. 在月、周或日視圖中,雙擊或右鍵單擊日程標籤。 -2. 選擇 **刪除**。 -3. 彈出「您正在刪除日程」提示框,單擊 **刪除**,刪除該日程。 - -刪除日程時,重複與非重複日程提示訊息中的按鈕說明如下表。 - - - - - - - - - - - - - - - - - - - - - - -
    按鈕說明
    刪除日程刪除非重複日程。
    全部刪除刪除所有重複日程。
    僅刪除此日程 針對重複日程,僅刪除當前所選的日程。
    刪除所有將來日程 針對重複日程,刪除當前選中日期及以後日期的日程,選中的日期之前的日程仍然保留。
    - - - - -## 主菜單 - -在主菜單中,您可以管理日程類型、切換窗口主題、查看幫助手冊、了解日曆的更多訊息。 - -### 管理 - -#### 管理日程類型 - -單擊 ![icon_menu](../common/icon_menu.svg) > **管理**,進入日曆管理界面,您可以新增、編輯或刪除日程類型。 - -![pic](fig/type.png) - -**新增日程類型** - -1. 在日曆管理界面,單擊添加按鈕 ![icon](../common/add1.svg)。 -2. 彈出「新增日程類型」窗口,輸入類型名稱,設置顏色。 -3. 單擊 **保存**。 - -**編輯日程類型** - -1. 在日曆管理界面,選擇某一個自定義類型。 -2. 單擊編輯按鈕 ![icon](../common/edit.svg)。 -3. 彈出「編輯日程類型」窗口,輸入類型名稱,設置顏色。 -4. 單擊 **保存**。 - -**刪除日程類型** - -1. 在日曆管理界面,選擇某一個自定義類型。 -2. 單擊刪除按鈕 ![icon](../common/delete.svg),刪除該日程類型。 - -### 主題 - -窗口主題包含淺色主題、深色主題和系統主題。 - -1. 在日曆界面,單擊 ![icon_menu](../common/icon_menu.svg)。 -2. 選擇 **主題**,選擇一個主題顏色。 - -### 幫助 - -查看幫助手冊,進一步了解和使用日曆。 - -1. 在日曆界面,單擊 ![icon_menu](../common/icon_menu.svg)。 -2. 選擇 **幫助**。 -3. 查看日曆的幫助手冊。 - - -### 關於 - -1. 在日曆界面,單擊 ![icon_menu](../common/icon_menu.svg)。 -2. 選擇 **關於**。 -3. 查看日曆的版本和介紹。 - - -### 退出 - -1. 在日曆界面,單擊 ![icon_menu](../common/icon_menu.svg)。 +# 日曆|dde-calendar| + +## 概述 + +日曆是一款查看日期、管理日程的小工具,支持查看農曆、黃曆、節氣和常見的節日訊息等,內置日程提醒功能幫您更好地規劃時間。 + +![0|main](fig/main.png) + + +## 使用入門 + +通過以下方式運行或關閉日曆,或者創建日曆的快捷方式。 + +### 運行日曆 + +1. 單擊任務欄上的啟動器圖標 ![deepin_launcher](../common/deepin_launcher.svg),進入啟動器界面。 +2. 上下滾動鼠標滾輪瀏覽或通過搜索,找到日曆圖標 ![draw](../common/dde_calendar.svg),單擊運行。 +3. 右鍵單擊 ![draw](../common/dde_calendar.svg),您可以: + + - 單擊 **傳送到桌面**,在桌面創建快捷方式。 + - 單擊 **傳送到任務欄**,將應用程序固定到任務欄。 + - 單擊 **加至開機啟動**,將應用程序添加到開機啟動項,在電腦開機時自動運行該應用。 + + +### 關閉日曆 + +- 在日曆界面單擊 ![close_icon](../common/close_icon.svg),關閉日曆。 +- 在任務欄右鍵單擊 ![draw](../common/dde_calendar.svg),選擇 **關閉所有**,關閉日曆。 +- 在日曆界面單擊 ![icon_menu](../common/icon_menu.svg),選擇 **退出**,關閉日曆。 + +### 查看快捷鍵 + +在日曆界面,使用快捷鍵 **Ctrl + Shift + ?** 打開快捷鍵預覽界面。熟練地使用快捷鍵,將大大提升您的操作效率。 + + +![0|view](fig/hotkey.png) + + + +## 操作介紹 + +日曆分為年、月、周、日視圖,通過不同的視圖方式展示日期屬性。 + +系統默認顯示月視圖,可以通過鼠標單擊切換年、月、周、日視圖。 + +- 僅在中文系統中,日曆會顯示日期所對應的農曆日期、黃曆和節日訊息。 +- 日期以 **1900** 年為起點,在日期切換時,不能查看早於 **1900** 年的日期。 +- 在月視圖、周視圖中,週六、週日的日期顯示會區別於週一至週五。 + +日歷視圖中的側邊欄展示日歷帳戶以及小日歷視圖。 + +1. 單擊 ![side_menu](../common/side_menu.svg)可切換窗口中側邊欄的展示和隱藏。 +2. 在日歷帳戶中勾選相應的日歷類型,則該類型下的日程在日歷視圖中展示;若取消勾選,則在視圖中隱藏。 +3. 在側邊欄下方的小日歷中點選日期,可聯動控製右側大日歷視圖的日期展示。 + + + + + + + + + + + + + + + + + + + + + + +
    視圖說明
    顯示全年的月份、天數。
    顯示節日訊息、日程安排。
    顯示這一週每天的日程安排。
    顯示節日訊息、詳細的日程安排和黃曆。
    + + +### 新建日程 + +1. 通過以下方法之一新建日程。 + - 在日曆界面,單擊菜單欄上的添加按鈕 ![plus](../common/add.svg)。 + - 在月、周或日視圖中,雙擊日期空白處或單擊鼠標右鍵選擇 **新建日程**。 + - 在月、周或日視圖中,單擊鼠標拖拽新建日程。 + +2. 彈出「新建日程」窗口,選擇日歷帳戶、設置日程類型、內容、時間、提醒等訊息。 + +![pic](fig/create.png) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    參數說明
    日歷帳戶默認本地帳戶,可選UOS ID等網絡賬戶。
    類型系統默認提供「工作」、「生活」、「其他」三種日程類型,您也可以自定義日程類型。 +
    1. 在類型下拉列表中,選擇 新增日程類型
    2. +
    3. 類型框呈可編輯狀態,輸入類型名稱,設置顏色。
    + 您也可以通過主菜單中的管理功能新增、編輯或刪除日程類型,具體操作步驟請參考「管理」章節。
    內容日程的描述訊息。
    日程時間設置全天或非全天、公曆或農曆日程的日期和時間。 +
      +
    • 全天 +
      • 勾選全天:開始時間和結束時間只能設置日期。
      • +
      • 取消勾選全天:開始時間和結束時間既能設置日期、也能設置小時和分鐘。
      +
    • +
    +
      +
    • 時間 +
      • 公曆:開始時間和結束時間僅顯示公曆日期。
      • +
      • 農曆:開始時間和結束時間顯示公曆和農曆日期。
      +
    • +
    提醒 +勾選全天,則提醒設置的選項包含:永不、日程發生當天(上午9點)、1天前、 2天前或1週前。
    +取消勾選全天,則提醒設置的選項包含:永不、日程開始時、15分鐘前、30分鐘前、1小時前、1天前、 2天前或1週前。
    重複 +選擇公曆日程,則重複設置的選項包含:永不、每天、工作日、每週、每月或每年。
    +選擇農曆日程,則重複設置的選項包含:永不、每月或每年。
    結束重複只有設置了重複功能,結束重複 才會出現。結束重複的選項包含:永不、於n次後或於日期。
    + + + +3. 單擊 **保存**,創建日程。日程創建完成後,會以標籤形式呈現在日曆視圖中。 + + + +### 編輯日程 + +1. 在月、周或日視圖中,雙擊或右鍵單擊日程標籤。 +2. 選擇 **編輯**。 +3. 彈出「編輯日程」窗口,設置編輯日程的相關屬性,單擊 **保存**。 +4. 如果設置了全天或重複,則彈出提示框,確認提示訊息後,完成日程編輯。 + +> ![notes](../common/notes.svg) 說明:已創建的日程可以通過拖拽日程標籤來修改日程的開始時間和結束時間。 + +編輯日程時,系統會根據所更改內容的不同顯示不同的提示訊息。提示訊息中按鈕說明如下表。 + + + + + + + + + + + + + + + + + + + + + + +
    按鈕說明
    全部日程修改所有與此相關的重複日程。
    僅此日程只修改當前日程。
    所有將來日程修改選中日期及以後日期的日程,選中的日期之前的日程仍然保留。
    全部更改 修改所有重複日程。
    + + + +### 設置全天或多天日程 + +在創建或編輯日程時,設置 **開始時間**、**結束時間**,可以設置全天或多天持續的日程。 + +### 設置重複日程 + +1. 在創建或編輯日程時,在 **重複** 的下拉列表中選擇重複提醒日程的週期,例如,每月。 +2. 在 **結束重複** 的下拉列表中設置結束重複的次數或停止日期。 + +![pic](fig/repeat.png) + +### 搜索日程 + +1. 在日曆界面頂部搜索框中,單擊 ![search](../common/search.svg),輸入關鍵字。 +2. 按下鍵盤上的 **Enter** 鍵進行搜索。 +3. 在搜索框中單擊 ![0|close](../common/close_icon.svg) 或刪除輸入的訊息,清除當前輸入的關鍵字或取消搜索。 + +### 查看日程 + +在月、周或日視圖中,雙擊日程標籤,彈出「我的日程」窗口,此時既可以查看日程,也可以 [編輯日程](#編輯日程) 或 [刪除日程](#刪除日程)。 + +### 查看日程提醒詳情 + +當系統發出通知後,單擊通知提示框,查看日程詳情。 + +日程提醒時,提示訊息按鈕說明如下表。 + + + + + + + + + + + + + + + + + + + + + + +
    按鈕說明
    稍後提醒提醒設置為當天,首次提醒後,單擊 稍後提醒,10分鐘後再次提醒,此後每次單擊「稍後提醒」增加5分鐘的時間間隔。
    您也可以在「稍後提醒」下拉列表中,選擇15分鐘後、1小時後、4小時後或明天。
    明天提醒當提醒設置為1天前或2天前時,出現該按鈕。
    提前1天提醒 當提醒設置為1週前時,出現該按鈕。
    關閉關閉提示訊息。
    + + + +### 刪除日程 + +1. 在月、周或日視圖中,雙擊或右鍵單擊日程標籤。 +2. 選擇 **刪除**。 +3. 彈出「您正在刪除日程」提示框,單擊 **刪除**,刪除該日程。 + +刪除日程時,重複與非重複日程提示訊息中的按鈕說明如下表。 + + + + + + + + + + + + + + + + + + + + + + +
    按鈕說明
    刪除日程刪除非重複日程。
    全部刪除刪除所有重複日程。
    僅刪除此日程 針對重複日程,僅刪除當前所選的日程。
    刪除所有將來日程 針對重複日程,刪除當前選中日期及以後日期的日程,選中的日期之前的日程仍然保留。
    + + + + +## 主菜單 + +在主菜單中,您可以打開管理設置、查看隱私政策、切換窗口主題、查看幫助手冊、了解日歷的更多訊息。 + +### 管理 + +單擊 ![icon_menu](../common/icon_menu.svg) > **管理**,進入日歷管理界面,您可以管理日歷帳戶的日程類型、登錄UOS ID將日程數據和日歷配置同步至雲端,同時也可以對通用配置進行設置。 + +![type](fig/type.png) + +#### 日历云同步 + +日歷支持通過UOS ID將日程數據及設置同步至雲端。 + +> ![notes](../common/notes.svg) 說明:該功能暫不對老版本系統和deepin系統開放。 + +**登錄和登出UOS ID** + +1. 在帳戶設置界面,點擊 **登錄** 按鈕。 +2. 彈出UOS ID登錄彈窗,在彈窗中通過賬號密碼、手機驗證碼或微信掃碼等方式完成UOS ID登錄。 +3. 登錄後顯示賬戶名、頭像和相關同步設置,點擊 **退出登錄** 按鈕可將UOS ID賬號登出。 + +**日歷同步設置** + +1. UOS ID登錄狀態下,點擊 **日程** 、 **通用設置** 後的復選框,設置是否同步至雲端。 +2. 點擊 **同步頻率** 後的下拉框,可選擇系統自動同步的頻率,您也可以選中 **手動同步** ,關閉自動同步模式。 +3. 點擊 **立即同步** 按鈕,立即和雲端數據進行同步。 + +> ![notes](../common/notes.svg) 說明:需在控制中心開啟 **UOS Cloud同步**,才能使用雲同步功能。 + +#### 管理日程類型 + +**新增日程類型** + +1. 在日曆管理界面,單擊添加按鈕 ![icon](../common/add1.svg)。 +2. 彈出「新增日程類型」窗口,輸入類型名稱,設置顏色。 +3. 單擊 **保存**。 + +**編輯日程類型** + +1. 在日曆管理界面,選擇某一個自定義類型。 +2. 單擊編輯按鈕 ![icon](../common/edit.svg)。 +3. 彈出「編輯日程類型」窗口,輸入類型名稱,設置顏色。 +4. 單擊 **保存**。 + +**刪除日程類型** + +1. 在日曆管理界面,選擇某一個自定義類型。 +2. 單擊刪除按鈕 ![icon](../common/delete.svg),刪除該日程類型。 + +#### 通用設置 + +**一周首日** + +點擊 **每星期開始於** 後的下拉框,可選中 **周日** 或 **周一** 設置為每周的第一天。 + +**時間格式** + +點擊 **時間** 後的下拉框,選中 **24小時製** 或 **12小時製** ,則日歷中的時間格式將按選中項進行展示。 + +### 主題 + +窗口主題包含淺色主題、深色主題和系統主題。 + +1. 在日曆界面,單擊 ![icon_menu](../common/icon_menu.svg)。 +2. 選擇 **主題**,選擇一個主題顏色。 + +### 幫助 + +查看幫助手冊,進一步了解和使用日曆。 + +1. 在日曆界面,單擊 ![icon_menu](../common/icon_menu.svg)。 +2. 選擇 **幫助**。 +3. 查看日曆的幫助手冊。 + + +### 關於 + +1. 在日曆界面,單擊 ![icon_menu](../common/icon_menu.svg)。 +2. 選擇 **關於**。 +3. 查看日曆的版本和介紹。 + + +### 退出 + +1. 在日曆界面,單擊 ![icon_menu](../common/icon_menu.svg)。 2. 選擇 **退出**。 \ No newline at end of file Binary files /tmp/tmpsgbh6un_/K5SEN4W3x8/dde-calendar-5.9.1/calendar-client/assets/dde-calendar/calendar/zh_HK/fig/create.png and /tmp/tmpsgbh6un_/_fqUKjDi_9/dde-calendar-5.10.0/calendar-client/assets/dde-calendar/calendar/zh_HK/fig/create.png differ Binary files /tmp/tmpsgbh6un_/K5SEN4W3x8/dde-calendar-5.9.1/calendar-client/assets/dde-calendar/calendar/zh_HK/fig/main.png and /tmp/tmpsgbh6un_/_fqUKjDi_9/dde-calendar-5.10.0/calendar-client/assets/dde-calendar/calendar/zh_HK/fig/main.png differ Binary files /tmp/tmpsgbh6un_/K5SEN4W3x8/dde-calendar-5.9.1/calendar-client/assets/dde-calendar/calendar/zh_HK/fig/repeat.png and /tmp/tmpsgbh6un_/_fqUKjDi_9/dde-calendar-5.10.0/calendar-client/assets/dde-calendar/calendar/zh_HK/fig/repeat.png differ Binary files /tmp/tmpsgbh6un_/K5SEN4W3x8/dde-calendar-5.9.1/calendar-client/assets/dde-calendar/calendar/zh_HK/fig/type.png and /tmp/tmpsgbh6un_/_fqUKjDi_9/dde-calendar-5.10.0/calendar-client/assets/dde-calendar/calendar/zh_HK/fig/type.png differ diff -Nru dde-calendar-5.9.1/calendar-client/assets/dde-calendar/calendar/zh_TW/calendar.md dde-calendar-5.10.0/calendar-client/assets/dde-calendar/calendar/zh_TW/calendar.md --- dde-calendar-5.9.1/calendar-client/assets/dde-calendar/calendar/zh_TW/calendar.md 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/dde-calendar/calendar/zh_TW/calendar.md 2023-04-07 06:02:09.000000000 +0000 @@ -1,309 +1,350 @@ -# 日曆|dde-calendar| - -## 概述 - -日曆是一款查看日期、管理日程的小工具,支援查看農曆、黃曆、節氣和常見的節日訊息等,內建日程提醒功能幫您更好地規劃時間。 - -![0|main](fig/main.png) - - -## 使用入門 - -透過以下方式執行或關閉日曆,或者建立日曆的捷徑。 - -### 執行日曆 - -1. 單擊任務欄上的啟動器圖示 ![deepin_launcher](../common/deepin_launcher.svg) ,進入啟動器介面。 -2. 上下滾動滑鼠滾輪瀏覽或透過搜尋,找到日曆圖示 ![draw](../common/dde_calendar.svg) ,單擊執行。 -3. 右鍵單擊 ![draw](../common/dde_calendar.svg),您可以: - - - 單擊 **建立桌面捷徑**,在桌面建立捷徑。 - - 單擊 **釘選到Dock**,將應用程式固定到Dock。 - - 單擊 **開機啟動**,將應用程式添加到開機啟動項,在電腦開機時自動執行該應用。 - - -### 關閉日曆 - -- 在日曆介面單擊 ![close_icon](../common/close_icon.svg),關閉日曆。 -- 在任務欄右鍵單擊 ![draw](../common/dde_calendar.svg),選擇 **全部關閉**,關閉日曆。 -- 在日曆介面單擊 ![icon_menu](../common/icon_menu.svg),選擇 **退出**,關閉日曆。 - -### 查看快捷鍵 - -在日曆介面上,使用快捷鍵 **Ctrl + Shift + ?** 打開快捷鍵預覽介面。熟練地使用快捷鍵,將大大提升您的操作效率。 - -![0|view](fig/hotkey.png) - - - -## 操作介紹 - -日曆分為年、月、周、日檢視,透過不同的檢視方式展示日期屬性。 - -系統預設顯示月檢視,可以透過滑鼠單擊切換年、月、周、日檢視。 - -- 僅在中文系統中,日曆會顯示日期所對應的農曆日期、黃曆和節日訊息。 -- 日期以 **1900** 年為起點,在日期切換時,不能查看早於 **1900** 年的日期。 -- 在月檢視、周檢視中,週六、週日的日期顯示會區別於週一至週五。 - -> ![notes](../common/notes.svg) 說明: 系統預設一週起始日為星期一,您可以在**控制中心** > **時間日期** > **格式設定** 中調整一週首日的設定,更改週日期的展現效果。 - - - - - - - - - - - - - - - - - - - - - - -
    檢視說明
    顯示全年的月份、天數。
    顯示節日訊息、日程安排。
    顯示這一週每天的日程安排。
    顯示節日訊息、詳細的日程安排和黃曆。
    - -### 建立日程 - -1. 透過以下方法之一建立日程。 - - 在日曆介面,單擊選單欄上的添加按鈕 ![plus](../common/add.svg)。 - - 在月、周或日檢視中,雙擊日期空白處或者單擊滑鼠右鍵選擇 **建立日程**。 - - 在月、周或日檢視中,單擊滑鼠拖曳建立日程。 -2. 彈出「建立日程」視窗,設定日程類型、內容、時間、提醒等訊息。 - - ![0|create](fig/create.png) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    參數說明
    類型系統預設提供「工作」、「生活」、「其他」三種日程類型,您也可以自訂日程類型。 -
    1. 在類型下拉選單選項中,選擇 新增日程類型
    2. -
    3. 類型框呈可編輯狀態,輸入類型名稱,設定顏色。
    - 您也可以透過主選單中的管理功能新增、編輯或刪除日程類型,具體操作步驟請參考「管理」章節。
    內容日程的描述訊息
    日程時間設定全天或非全天、公曆或農曆日程的日期和時間。 -
      -
    • 全天
      • 勾選全天:開始時間和結束時間只能設定日期。
      • -
      • 取消勾選全天:開始時間和結束時間既能設定日期,也能設定小時和分鐘。
      • -
    • -
    -
      -
    • 時間
      • 公曆:開始時間和結束時間僅顯示公曆日期。
      • -
      • 農曆:開始時間和結束時間顯示公曆和農曆日期。
      • -
    • -
    提醒 -勾選全天,則提醒設置的選項包含:從不、日程發生當天(上午9點)、1天前、 2天前或1週前。
    -取消勾選全天,則提醒設置的選項包含:從不、日程開始時、15分鐘前、30分鐘前、1小時前、1天前、 2天前或1週前。
    重複 -選擇公曆日程,則重複設置的選項包含:從不、每天、工作日、每週、每月或每年。
    -選擇農曆日程,則重複設置的選項包含:從不、每月或每年。
    結束重複只有設定了重複功能,結束重複 才會出現。結束重複的選項包含:從不、於n次後或於日期。
    - -3. 單擊 **儲存**,建立日程。日程建立完成後,會以標籤形式呈現在日曆檢視中。 - -### 編輯日程 - -1. 在月、周或日檢視中,雙擊或右鍵單擊日程標籤。 -2. 選擇 **編輯**,彈出 **編輯日程** 視窗。 -3. 設定編輯日程的相關屬性,單擊 **儲存**。   -4. 如果有設定全天或者重複,則彈出提示框,確認提示訊息後,完成日程編輯。 - -> ![notes](../common/notes.svg) 說明:已建立的日程可以透過拖曳日程標籤來修改日程的開始時間和結束時間。 - -編輯日程時,系統會根據所更改內容,顯示不同的提示訊息。提示訊息中按鈕說明如下表。 - - - - - - - - - - - - - - - - - - - - - - -
    按鈕說明
    全部日程修改所有與此相關的重複日程。
    僅此日程只修改目前日程。
    所有將來日程修改選中日期及以後日期的日程,選中的日期之前的日程仍然保留。
    全部更改 修改所有重複日程。
    - - -### 設定全天或多天日程 - -在建立或編輯日程時,設定 **開始時間**、**結束時間**,可以設定全天或多天持續的日程。 - -### 設定重複日程 - -1. 在建立或編輯日程時,在 **重複** 的下拉選單中選擇重複提醒日程的週期,例如,每月。 -2. 在 **結束重複** 的下拉選單中設定結束重複的次數或停止日期。 - -![pic](fig/repeat.png) - -### 搜尋日程 - -1. 在日曆介面頂部搜尋框中,單擊 ![search](../common/search.svg) ,輸入關鍵字。 -2. 按下鍵盤上的 **Enter** 鍵進行搜尋。 -3. 在搜尋框中單擊 ![0|close](../common/close_icon.svg) 或刪除輸入的訊息,即可清除目前輸入的關鍵字或取消搜尋。 - - -### 查看日程 - -在月、周或日檢視中,雙擊日程標題,彈出「我的日程」視窗,此時既可以查看日程也可以 [編輯日程](#編輯日程) 或 [刪除日程](#刪除日程)。 - -### 查看日程提醒詳情 - -當系統發出通知後,可以單擊通知提示框,查看日程提醒詳情。 - -日程提醒時,提示訊息按鈕說明如下表。 - - - - - - - - - - - - - - - - - - - - - - -
    按鈕說明
    稍後提醒提醒設定為當天,首次提醒後,單擊「稍後提醒」,10分鐘後再次提醒,此後每次單擊「稍後提醒」增加5分鐘的時間間隔。
    您也可以在「稍後提醒」下拉選單中,選擇15分鐘後、1小時後、4小時後、明天。
    明天提醒當提醒設定為1天前或2天前時,出現該按鈕。
    提前1天提醒 當提醒設定為1週前時,出現該按鈕。
    關閉關閉提示訊息。
    - - -### 刪除日程 - -1. 在月、周或日檢視中,雙擊或右鍵單擊日程標籤。 -2. 選擇 **刪除**,彈出 **您正在刪除日程** 提示框。 -3. 單擊 **刪除**,刪除該日程。 - -刪除日程時,重複與非重複日程提示訊息中按鈕說明如下表。 - - - - - - - - - - - - - - - - - - - - - - -
    按鈕說明
    刪除日程刪除非重複日程。
    全部刪除刪除所有重複日程。
    僅刪除此日程 針對重複日程,僅刪除目前所選的日程。
    刪除所有將來日程 針對重複日程,刪除目前選中日期及以後日期的日程,選中的日期之前的日程仍然保留。
    - -## 主選單 - -在主選單中,您可以切換视窗主題、查看說明手冊,了解日曆的更多訊息。 - -### 管理 - -#### 管理日程類型 - -單擊 ![icon_menu](../common/icon_menu.svg) > **管理**,進入日曆管理介面,您可以建立、編輯或刪除日程類型。 - -![pig](fig/manage.png) - -**新增日程類型** - -1. 在日曆管理介面,單擊添加按鈕 ![icon](../common/add1.svg)。 -2. 彈出「新增日程類型」視窗,輸入類型名稱,設定顏色。 -3. 單擊 **儲存**。 - -**編輯日程類型** - -1. 在日曆管理介面,選擇某一個自訂類型。 -2. 單擊編輯按鈕 ![icon](../common/edit.svg)。 -3. 彈出「編輯日程類型」視窗,輸入類型名稱,設定顏色。 -4. 單擊 **儲存**。 - -**刪除日程類型** - -1. 在日曆管理介面,選擇某一個自訂類型。 -2. 單擊刪除按鈕 ![icon](../common/delete.svg),刪除該日程類型。 - -### 主題 - -视窗主題包含亮色主題、暗色主題和系統主題。 - -1. 在日曆界面,單擊 ![icon_menu](../common/icon_menu.svg) 。 -2. 單擊 **主題**,選擇一個主題顏色。 - -### 說明 - -查看說明手冊,進一步了解和使用日曆。 - -1. 在日曆界面,單擊 ![icon_menu](../common/icon_menu.svg) 。 -2. 單擊 **說明**。 -3. 查看日曆的說明手冊。 - - -### 關於 - -1. 在日曆界面,單擊 ![icon_menu](../common/icon_menu.svg) 。 -2. 單擊 **關於**。 -3. 查看日曆的版本和介紹。 - - -### 退出 - -1. 在日曆界面,單擊 ![icon_menu](../common/icon_menu.svg) 。 -2. 單擊 **退出**。 - +# 日曆|dde-calendar| + +## 概述 + +日曆是一款查看日期、管理日程的小工具,支援查看農曆、黃曆、節氣和常見的節日訊息等,內建日程提醒功能幫您更好地規劃時間。 + +![0|main](fig/main.png) + + +## 使用入門 + +透過以下方式執行或關閉日曆,或者建立日曆的捷徑。 + +### 執行日曆 + +1. 單擊任務欄上的啟動器圖示 ![deepin_launcher](../common/deepin_launcher.svg) ,進入啟動器介面。 +2. 上下滾動滑鼠滾輪瀏覽或透過搜尋,找到「日曆」圖示 ![draw](../common/dde_calendar.svg) ,單擊執行。 +3. 右鍵單擊 ![draw](../common/dde_calendar.svg),您可以: + + - 單擊 **建立桌面捷徑**,在桌面建立捷徑。 + - 單擊 **釘選到Dock**,將應用程式固定到Dock。 + - 單擊 **開機啟動**,將應用程式添加到開機啟動項,在電腦開機時自動執行該應用程式。 + + +### 關閉日曆 + +- 在日曆介面單擊 ![close_icon](../common/close_icon.svg),關閉日曆。 +- 在任務欄右鍵單擊 ![draw](../common/dde_calendar.svg),選擇 **全部關閉**,關閉日曆。 +- 在日曆介面單擊 ![icon_menu](../common/icon_menu.svg),選擇 **退出**,關閉日曆。 + +### 查看快捷鍵 + +在日曆介面上,使用快捷鍵 **Ctrl + Shift + ?** 打開快捷鍵預覽介面。熟練地使用快捷鍵,將大大提升您的操作效率。 + +![0|view](fig/hotkey.png) + + + +## 操作介紹 + +日曆分為年、月、周、日檢視,透過不同的檢視方式展示日期屬性。 + +系統預設顯示月檢視,可以透過滑鼠單擊切換年、月、周、日檢視。 + +- 僅在中文系統中,日曆會顯示日期所對應的農曆日期、黃曆和節日訊息。 +- 日期以 **1900** 年為起點,在日期切換時,不能查看早於 **1900** 年的日期。 +- 在月檢視、周檢視中,週六、週日的日期顯示會區別於週一至週五。 + +日歷視圖中的側邊欄展示日歷帳戶以及小日歷視圖。 + +1. 單擊 ![side_menu](../common/side_menu.svg)可切換窗口中側邊欄的展示和隱藏。 +2. 在日歷帳戶中勾選相應的日歷類型,則該類型下的日程在日歷視圖中展示;若取消勾選,則在視圖中隱藏。 +3. 在側邊欄下方的小日歷中點選日期,可聯動控製右側大日歷視圖的日期展示。 + + + + + + + + + + + + + + + + + + + + + + +
    檢視說明
    顯示全年的月份、天數。
    顯示節日訊息、日程安排。
    顯示這一週每天的日程安排。
    顯示節日訊息、詳細的日程安排和黃曆。
    + +### 建立日程 + +1. 透過以下方法之一建立日程。 + + - 在日曆介面,單擊選單欄上的添加按鈕 ![plus](../common/add.svg)。 + - 在月、周或日檢視中,雙擊日期空白處或者單擊滑鼠右鍵選擇 **建立日程**。 + - 在月、周或日檢視中,單擊滑鼠拖曳建立日程。 + +2. 彈出「建立日程」視窗,選擇日歷帳戶、設定日程類型、內容、時間、提醒等訊息。 + + ![0|create](fig/create.png) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    參數說明
    日歷帳戶默認本地帳戶,可選UOS ID等網絡賬戶。
    類型系統預設提供「工作」、「生活」、「其他」三種日程類型,您也可以自訂日程類型。 +
    1. 在類型下拉選單選項中,選擇 新增日程類型
    2. +
    3. 類型框呈可編輯狀態,輸入類型名稱,設定顏色。
    + 您也可以透過主選單中的管理功能新增、編輯或刪除日程類型,具體操作步驟請參考「管理」章節。
    內容日程的描述訊息
    日程時間設定全天或非全天、公曆或農曆日程的日期和時間。 +
      +
    • 全天
      • 勾選全天:開始時間和結束時間只能設定日期。
      • +
      • 取消勾選全天:開始時間和結束時間既能設定日期,也能設定小時和分鐘。
      • +
    • +
    +
      +
    • 時間
      • 公曆:開始時間和結束時間僅顯示公曆日期。
      • +
      • 農曆:開始時間和結束時間顯示公曆和農曆日期。
      • +
    • +
    提醒 +勾選全天,則提醒設置的選項包含:從不、日程發生當天(上午9點)、1天前、 2天前或1週前。
    +取消勾選全天,則提醒設置的選項包含:從不、日程開始時、15分鐘前、30分鐘前、1小時前、1天前、 2天前或1週前。
    重複 +選擇公曆日程,則重複設置的選項包含:從不、每天、工作日、每週、每月或每年。
    +選擇農曆日程,則重複設置的選項包含:從不、每月或每年。
    結束重複只有設定了重複功能,結束重複 才會出現。結束重複的選項包含:從不、於n次後或於日期。
    + +3. 單擊 **儲存**,建立日程。日程建立完成後,會以標籤形式呈現在日曆檢視中。 + +### 編輯日程 + +1. 在月、周或日檢視中,雙擊或右鍵單擊日程標籤。 +2. 選擇 **編輯**,彈出 **編輯日程** 視窗。 +3. 設定編輯日程的相關屬性,單擊 **儲存**。   +4. 如果有設定全天或者重複,則彈出提示框,確認提示訊息後,完成日程編輯。 + +> ![notes](../common/notes.svg) 說明:已建立的日程可以透過拖曳日程標籤來修改日程的開始時間和結束時間。 + +編輯日程時,系統會根據所更改內容,顯示不同的提示訊息。提示訊息中按鈕說明如下表。 + + + + + + + + + + + + + + + + + + + + + + +
    按鈕說明
    全部日程修改所有與此相關的重複日程。
    僅此日程只修改目前日程。
    所有將來日程修改選中日期及以後日期的日程,選中的日期之前的日程仍然保留。
    全部更改 修改所有重複日程。
    + + +### 設定全天或多天日程 + +在建立或編輯日程時,設定 **開始時間**、**結束時間**,可以設定全天或多天持續的日程。 + +### 設定重複日程 + +1. 在建立或編輯日程時,在 **重複** 的下拉選單中選擇重複提醒日程的週期,例如,每月。 +2. 在 **結束重複** 的下拉選單中設定結束重複的次數或停止日期。 + +![pic](fig/repeat.png) + +### 搜尋日程 + +1. 在日曆介面頂部搜尋框中,單擊 ![search](../common/search.svg) ,輸入關鍵字。 +2. 按下鍵盤上的 **Enter** 鍵進行搜尋。 +3. 在搜尋框中單擊 ![0|close](../common/close_icon.svg) 或刪除輸入的訊息,即可清除目前輸入的關鍵字或取消搜尋。 + + +### 查看日程 + +在月、周或日檢視中,雙擊日程標題,彈出「我的日程」視窗,此時既可以查看日程也可以 [編輯日程](#編輯日程) 或 [刪除日程](#刪除日程)。 + +### 查看日程提醒詳情 + +當系統發出通知後,可以單擊通知提示框,查看日程提醒詳情。 + +日程提醒時,提示訊息按鈕說明如下表。 + + + + + + + + + + + + + + + + + + + + + + +
    按鈕說明
    稍後提醒提醒設定為當天,首次提醒後,單擊「稍後提醒」,10分鐘後再次提醒,此後每次單擊「稍後提醒」增加5分鐘的時間間隔。
    您也可以在「稍後提醒」下拉選單中,選擇15分鐘後、1小時後、4小時後、明天。
    明天提醒當提醒設定為1天前或2天前時,出現該按鈕。
    提前1天提醒 當提醒設定為1週前時,出現該按鈕。
    關閉關閉提示訊息。
    + + +### 刪除日程 + +1. 在月、周或日檢視中,雙擊或右鍵單擊日程標籤。 +2. 選擇 **刪除**,彈出 **您正在刪除日程** 提示框。 +3. 單擊 **刪除**,刪除該日程。 + +刪除日程時,重複與非重複日程提示訊息中按鈕說明如下表。 + + + + + + + + + + + + + + + + + + + + + + +
    按鈕說明
    刪除日程刪除非重複日程。
    全部刪除刪除所有重複日程。
    僅刪除此日程 針對重複日程,僅刪除目前所選的日程。
    刪除所有將來日程 針對重複日程,刪除目前選中日期及以後日期的日程,選中的日期之前的日程仍然保留。
    + + +## 主選單 + +在主選單中,您可以打開管理設置、查看隱私政策、切換窗口主題、查看幫助手冊、了解日歷的更多訊息。 + +### 管理 + +單擊 ![icon_menu](../common/icon_menu.svg) > **管理**,進入日歷管理界面,您可以管理日歷帳戶的日程類型、登錄UOS ID將日程數據和日歷配置同步至雲端,同時也可以對通用配置進行設置。 + +![type](fig/type.png) + +#### 日历云同步 + +日歷支持通過UOS ID將日程數據及設置同步至雲端。 + +> ![notes](../common/notes.svg) 說明:該功能暫不對老版本系統和deepin系統開放。 + +**登錄和登出UOS ID** + +1. 在帳戶設置界面,點擊 **登錄** 按鈕。 +2. 彈出UOS ID登錄彈窗,在彈窗中通過賬號密碼、手機驗證碼或微信掃碼等方式完成UOS ID登錄。 +3. 登錄後顯示賬戶名、頭像和相關同步設置,點擊 **退出登錄** 按鈕可將UOS ID賬號登出。 + +**日歷同步設置** + +1. UOS ID登錄狀態下,點擊 **日程** 、 **通用設置** 後的復選框,設置是否同步至雲端。 +2. 點擊 **同步頻率** 後的下拉框,可選擇系統自動同步的頻率,您也可以選中 **手動同步** ,關閉自動同步模式。 +3. 點擊 **立即同步** 按鈕,立即和雲端數據進行同步。 + +> ![notes](../common/notes.svg) 說明:需在控制中心開啟 **UOS Cloud同步**,才能使用雲同步功能。 + +#### 管理日程類型 + +**新增日程類型** + +1. 在日曆管理介面,單擊添加按鈕 ![icon](../common/add1.svg)。 +2. 彈出「新增日程類型」視窗,輸入類型名稱,設定顏色。 +3. 單擊 **儲存**。 + +**編輯日程類型** + +1. 在日曆管理介面,選擇某一個自訂類型。 +2. 單擊編輯按鈕 ![icon](../common/edit.svg)。 +3. 彈出「編輯日程類型」視窗,輸入類型名稱,設定顏色。 +4. 單擊 **儲存**。 + +**刪除日程類型** + +1. 在日曆管理介面,選擇某一個自訂類型。 +2. 單擊刪除按鈕 ![icon](../common/delete.svg),刪除該日程類型。 + +#### 通用設置 + +**一周首日** + +點擊 **每星期開始於** 後的下拉框,可選中 **周日** 或 **周一** 設置為每周的第一天。 + +**時間格式** + +點擊 **時間** 後的下拉框,選中 **24小時製** 或 **12小時製** ,則日歷中的時間格式將按選中項進行展示。 + +### 主題 + +视窗主題包含亮色主題、暗色主題和系統主題。 + +1. 在日曆界面,單擊 ![icon_menu](../common/icon_menu.svg) 。 +2. 單擊 **主題**,選擇一個主題顏色。 + +### 說明 + +查看說明手冊,進一步了解和使用日曆。 + +1. 在日曆界面,單擊 ![icon_menu](../common/icon_menu.svg) 。 +2. 單擊 **說明**。 +3. 查看日曆的說明手冊。 + + +### 關於 + +1. 在日曆界面,單擊 ![icon_menu](../common/icon_menu.svg) 。 +2. 單擊 **關於**。 +3. 查看日曆的版本和介紹。 + + +### 退出 + +1. 在日曆界面,單擊 ![icon_menu](../common/icon_menu.svg) 。 +2. 單擊 **退出**。 + Binary files /tmp/tmpsgbh6un_/K5SEN4W3x8/dde-calendar-5.9.1/calendar-client/assets/dde-calendar/calendar/zh_TW/fig/create.png and /tmp/tmpsgbh6un_/_fqUKjDi_9/dde-calendar-5.10.0/calendar-client/assets/dde-calendar/calendar/zh_TW/fig/create.png differ Binary files /tmp/tmpsgbh6un_/K5SEN4W3x8/dde-calendar-5.9.1/calendar-client/assets/dde-calendar/calendar/zh_TW/fig/main.png and /tmp/tmpsgbh6un_/_fqUKjDi_9/dde-calendar-5.10.0/calendar-client/assets/dde-calendar/calendar/zh_TW/fig/main.png differ Binary files /tmp/tmpsgbh6un_/K5SEN4W3x8/dde-calendar-5.9.1/calendar-client/assets/dde-calendar/calendar/zh_TW/fig/manage.png and /tmp/tmpsgbh6un_/_fqUKjDi_9/dde-calendar-5.10.0/calendar-client/assets/dde-calendar/calendar/zh_TW/fig/manage.png differ Binary files /tmp/tmpsgbh6un_/K5SEN4W3x8/dde-calendar-5.9.1/calendar-client/assets/dde-calendar/calendar/zh_TW/fig/repeat.png and /tmp/tmpsgbh6un_/_fqUKjDi_9/dde-calendar-5.10.0/calendar-client/assets/dde-calendar/calendar/zh_TW/fig/repeat.png differ Binary files /tmp/tmpsgbh6un_/K5SEN4W3x8/dde-calendar-5.9.1/calendar-client/assets/dde-calendar/calendar/zh_TW/fig/type.png and /tmp/tmpsgbh6un_/_fqUKjDi_9/dde-calendar-5.10.0/calendar-client/assets/dde-calendar/calendar/zh_TW/fig/type.png differ diff -Nru dde-calendar-5.9.1/calendar-client/assets/dde-calendar.desktop dde-calendar-5.10.0/calendar-client/assets/dde-calendar.desktop --- dde-calendar-5.9.1/calendar-client/assets/dde-calendar.desktop 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/dde-calendar.desktop 2023-04-07 06:02:09.000000000 +0000 @@ -9,7 +9,7 @@ StartupNotify=false Terminal=false Type=Application -X-Deepin-TurboType=dtkwidget +#X-Deepin-TurboType=dtkwidget X-Deepin-Vendor=deepin X-MultipleArgs=false diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/builtin/dark/account_dark.svg dde-calendar-5.10.0/calendar-client/assets/resources/builtin/dark/account_dark.svg --- dde-calendar-5.9.1/calendar-client/assets/resources/builtin/dark/account_dark.svg 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/builtin/dark/account_dark.svg 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,10 @@ + + + 账户- dark + + + + + + + \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/builtin/dark/create_white.svg dde-calendar-5.10.0/calendar-client/assets/resources/builtin/dark/create_white.svg --- dde-calendar-5.9.1/calendar-client/assets/resources/builtin/dark/create_white.svg 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/builtin/dark/create_white.svg 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,16 @@ + + + 编组 21 + + + + + + + + + + + + + \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/builtin/icons/dde_calendar_ban_32px.svg dde-calendar-5.10.0/calendar-client/assets/resources/builtin/icons/dde_calendar_ban_32px.svg --- dde-calendar-5.9.1/calendar-client/assets/resources/builtin/icons/dde_calendar_ban_32px.svg 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/builtin/icons/dde_calendar_ban_32px.svg 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,16 @@ + + + + 类型 + Created with Sketch. + + + + + + + + + + + \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/builtin/icons/dde_calendar_delete_32px.svg dde-calendar-5.10.0/calendar-client/assets/resources/builtin/icons/dde_calendar_delete_32px.svg --- dde-calendar-5.9.1/calendar-client/assets/resources/builtin/icons/dde_calendar_delete_32px.svg 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/builtin/icons/dde_calendar_delete_32px.svg 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,20 @@ + + + icon/schedule/delete + + + + + + + + + + + + + + + + + \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/builtin/icons/dde_calendar_edit_32px.svg dde-calendar-5.10.0/calendar-client/assets/resources/builtin/icons/dde_calendar_edit_32px.svg --- dde-calendar-5.9.1/calendar-client/assets/resources/builtin/icons/dde_calendar_edit_32px.svg 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/builtin/icons/dde_calendar_edit_32px.svg 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,21 @@ + + + 编组 18 + + + + + + + + + + + + + + + + + + \ No newline at end of file Binary files /tmp/tmpsgbh6un_/K5SEN4W3x8/dde-calendar-5.9.1/calendar-client/assets/resources/builtin/icons/dde_calendar_fail_200px.png and /tmp/tmpsgbh6un_/_fqUKjDi_9/dde-calendar-5.10.0/calendar-client/assets/resources/builtin/icons/dde_calendar_fail_200px.png differ diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/builtin/icons/dde_calendar_ji_32px.svg dde-calendar-5.10.0/calendar-client/assets/resources/builtin/icons/dde_calendar_ji_32px.svg --- dde-calendar-5.9.1/calendar-client/assets/resources/builtin/icons/dde_calendar_ji_32px.svg 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/builtin/icons/dde_calendar_ji_32px.svg 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,24 @@ + + + + icon_ji + Created with Sketch. + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/builtin/icons/dde_calendar_spinner_32px.svg dde-calendar-5.10.0/calendar-client/assets/resources/builtin/icons/dde_calendar_spinner_32px.svg --- dde-calendar-5.9.1/calendar-client/assets/resources/builtin/icons/dde_calendar_spinner_32px.svg 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/builtin/icons/dde_calendar_spinner_32px.svg 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,42 @@ + + + -mockplus- + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/builtin/icons/dde_calendar_spinner_32.svg dde-calendar-5.10.0/calendar-client/assets/resources/builtin/icons/dde_calendar_spinner_32.svg --- dde-calendar-5.9.1/calendar-client/assets/resources/builtin/icons/dde_calendar_spinner_32.svg 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/builtin/icons/dde_calendar_spinner_32.svg 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,42 @@ + + + -mockplus- + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file Binary files /tmp/tmpsgbh6un_/K5SEN4W3x8/dde-calendar-5.9.1/calendar-client/assets/resources/builtin/icons/dde_calendar_success_200px.png and /tmp/tmpsgbh6un_/_fqUKjDi_9/dde-calendar-5.10.0/calendar-client/assets/resources/builtin/icons/dde_calendar_success_200px.png differ diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/builtin/icons/dde_calendar_sync_schedule_32px.svg dde-calendar-5.10.0/calendar-client/assets/resources/builtin/icons/dde_calendar_sync_schedule_32px.svg --- dde-calendar-5.9.1/calendar-client/assets/resources/builtin/icons/dde_calendar_sync_schedule_32px.svg 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/builtin/icons/dde_calendar_sync_schedule_32px.svg 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,29 @@ + + + icon/unionID/日程类型 + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/builtin/icons/dde_calendar_sync_setting_32px.svg dde-calendar-5.10.0/calendar-client/assets/resources/builtin/icons/dde_calendar_sync_setting_32px.svg --- dde-calendar-5.9.1/calendar-client/assets/resources/builtin/icons/dde_calendar_sync_setting_32px.svg 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/builtin/icons/dde_calendar_sync_setting_32px.svg 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,18 @@ + + + icon/unionID/设置 + + + + + + + + + + + + + + + \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/builtin/icons/dde_calendar_warning_light_32px.svg dde-calendar-5.10.0/calendar-client/assets/resources/builtin/icons/dde_calendar_warning_light_32px.svg --- dde-calendar-5.9.1/calendar-client/assets/resources/builtin/icons/dde_calendar_warning_light_32px.svg 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/builtin/icons/dde_calendar_warning_light_32px.svg 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,17 @@ + + + 形状结合 + + + + + + + + + + + + + + \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/builtin/icons/dde_calendar_warning.svg dde-calendar-5.10.0/calendar-client/assets/resources/builtin/icons/dde_calendar_warning.svg --- dde-calendar-5.9.1/calendar-client/assets/resources/builtin/icons/dde_calendar_warning.svg 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/builtin/icons/dde_calendar_warning.svg 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,32 @@ + + + + deepin-cloudprint-config-helper + Created with Sketch. + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/builtin/icons/dde_calendar_xiu.svg dde-calendar-5.10.0/calendar-client/assets/resources/builtin/icons/dde_calendar_xiu.svg --- dde-calendar-5.9.1/calendar-client/assets/resources/builtin/icons/dde_calendar_xiu.svg 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/builtin/icons/dde_calendar_xiu.svg 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,16 @@ + + + + 类型 + Created with Sketch. + + + + + + + + + + + \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/builtin/icons/dde_calendar_yi_32px.svg dde-calendar-5.10.0/calendar-client/assets/resources/builtin/icons/dde_calendar_yi_32px.svg --- dde-calendar-5.9.1/calendar-client/assets/resources/builtin/icons/dde_calendar_yi_32px.svg 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/builtin/icons/dde_calendar_yi_32px.svg 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,24 @@ + + + + icon_yi + Created with Sketch. + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/builtin/icons/icon_refresh.svg dde-calendar-5.10.0/calendar-client/assets/resources/builtin/icons/icon_refresh.svg --- dde-calendar-5.9.1/calendar-client/assets/resources/builtin/icons/icon_refresh.svg 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/builtin/icons/icon_refresh.svg 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,17 @@ + + + 路径 + + + + + + + + + + + + + + \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/builtin/light/create_black.svg dde-calendar-5.10.0/calendar-client/assets/resources/builtin/light/create_black.svg --- dde-calendar-5.9.1/calendar-client/assets/resources/builtin/light/create_black.svg 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/builtin/light/create_black.svg 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,16 @@ + + + 编组 21 + + + + + + + + + + + + + \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/builtin/light/dde_calaendar_sidebar_32px.svg dde-calendar-5.10.0/calendar-client/assets/resources/builtin/light/dde_calaendar_sidebar_32px.svg --- dde-calendar-5.9.1/calendar-client/assets/resources/builtin/light/dde_calaendar_sidebar_32px.svg 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/builtin/light/dde_calaendar_sidebar_32px.svg 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,16 @@ + + + 日历 + + + + + + + + + + + + + \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/builtin/light/dde_calendar_account_32px.svg dde-calendar-5.10.0/calendar-client/assets/resources/builtin/light/dde_calendar_account_32px.svg --- dde-calendar-5.9.1/calendar-client/assets/resources/builtin/light/dde_calendar_account_32px.svg 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/builtin/light/dde_calendar_account_32px.svg 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,10 @@ + + + 账户- light + + + + + + + \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/dde-calendar.qss dde-calendar-5.10.0/calendar-client/assets/resources/dde-calendar.qss --- dde-calendar-5.9.1/calendar-client/assets/resources/dde-calendar.qss 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/dde-calendar.qss 1970-01-01 00:00:00.000000000 +0000 @@ -1,14 +0,0 @@ -QFrame#CalendarBackground { - background-color: rgba(220, 220, 220, 200) -} - -QLabel#CalendarHeaderWeekday { - font-size: 14px; - color: #696969; -} - -QLabel#CalendarHeaderWeekend { - font-size: 14px; - color: #ff5b38; -} - diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/deepin-calendar.qss dde-calendar-5.10.0/calendar-client/assets/resources/deepin-calendar.qss --- dde-calendar-5.9.1/calendar-client/assets/resources/deepin-calendar.qss 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/deepin-calendar.qss 1970-01-01 00:00:00.000000000 +0000 @@ -1,14 +0,0 @@ -QFrame#CalendarBackground { - background-color: rgba(220, 220, 220, 200) -} - -QLabel#CalendarHeaderWeekday { - font-size: 14px; - color: #696969; -} - -QLabel#CalendarHeaderWeekend { - font-size: 14px; - color: #ff5b38; -} - diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/icon/account_dark.svg dde-calendar-5.10.0/calendar-client/assets/resources/icon/account_dark.svg --- dde-calendar-5.9.1/calendar-client/assets/resources/icon/account_dark.svg 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/icon/account_dark.svg 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,10 @@ + + + 账户- dark + + + + + + + \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/icon/ban.svg dde-calendar-5.10.0/calendar-client/assets/resources/icon/ban.svg --- dde-calendar-5.9.1/calendar-client/assets/resources/icon/ban.svg 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/icon/ban.svg 1970-01-01 00:00:00.000000000 +0000 @@ -1,16 +0,0 @@ - - - - 类型 - Created with Sketch. - - - - - - - - - - - \ No newline at end of file diff -Nru "/tmp/tmpsgbh6un_/K5SEN4W3x8/dde-calendar-5.9.1/calendar-client/assets/resources/icon/checkbox_checked .svg" "/tmp/tmpsgbh6un_/_fqUKjDi_9/dde-calendar-5.10.0/calendar-client/assets/resources/icon/checkbox_checked .svg" --- "/tmp/tmpsgbh6un_/K5SEN4W3x8/dde-calendar-5.9.1/calendar-client/assets/resources/icon/checkbox_checked .svg" 2022-04-29 02:06:06.000000000 +0000 +++ "/tmp/tmpsgbh6un_/_fqUKjDi_9/dde-calendar-5.10.0/calendar-client/assets/resources/icon/checkbox_checked .svg" 1970-01-01 00:00:00.000000000 +0000 @@ -1,44 +0,0 @@ - - - - checkbox_checked 2 - Created with Sketch. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff -Nru "/tmp/tmpsgbh6un_/K5SEN4W3x8/dde-calendar-5.9.1/calendar-client/assets/resources/icon/checkbox_unchecked .svg" "/tmp/tmpsgbh6un_/_fqUKjDi_9/dde-calendar-5.10.0/calendar-client/assets/resources/icon/checkbox_unchecked .svg" --- "/tmp/tmpsgbh6un_/K5SEN4W3x8/dde-calendar-5.9.1/calendar-client/assets/resources/icon/checkbox_unchecked .svg" 2022-04-29 02:06:06.000000000 +0000 +++ "/tmp/tmpsgbh6un_/_fqUKjDi_9/dde-calendar-5.10.0/calendar-client/assets/resources/icon/checkbox_unchecked .svg" 1970-01-01 00:00:00.000000000 +0000 @@ -1,17 +0,0 @@ - - - - checkbox_unchecked 2 - Created with Sketch. - - - - - - - - - - - - \ No newline at end of file diff -Nru "/tmp/tmpsgbh6un_/K5SEN4W3x8/dde-calendar-5.9.1/calendar-client/assets/resources/icon/choose20X20_checked .svg" "/tmp/tmpsgbh6un_/_fqUKjDi_9/dde-calendar-5.10.0/calendar-client/assets/resources/icon/choose20X20_checked .svg" --- "/tmp/tmpsgbh6un_/K5SEN4W3x8/dde-calendar-5.9.1/calendar-client/assets/resources/icon/choose20X20_checked .svg" 2022-04-29 02:06:06.000000000 +0000 +++ "/tmp/tmpsgbh6un_/_fqUKjDi_9/dde-calendar-5.10.0/calendar-client/assets/resources/icon/choose20X20_checked .svg" 1970-01-01 00:00:00.000000000 +0000 @@ -1,28 +0,0 @@ - - - - 椭圆形 2 - Created with Sketch. - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff -Nru "/tmp/tmpsgbh6un_/K5SEN4W3x8/dde-calendar-5.9.1/calendar-client/assets/resources/icon/choose30X30_checked .svg" "/tmp/tmpsgbh6un_/_fqUKjDi_9/dde-calendar-5.10.0/calendar-client/assets/resources/icon/choose30X30_checked .svg" --- "/tmp/tmpsgbh6un_/K5SEN4W3x8/dde-calendar-5.9.1/calendar-client/assets/resources/icon/choose30X30_checked .svg" 2022-04-29 02:06:06.000000000 +0000 +++ "/tmp/tmpsgbh6un_/_fqUKjDi_9/dde-calendar-5.10.0/calendar-client/assets/resources/icon/choose30X30_checked .svg" 1970-01-01 00:00:00.000000000 +0000 @@ -1,28 +0,0 @@ - - - - choose_checked - Created with Sketch. - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/icon/create_black.svg dde-calendar-5.10.0/calendar-client/assets/resources/icon/create_black.svg --- dde-calendar-5.9.1/calendar-client/assets/resources/icon/create_black.svg 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/icon/create_black.svg 1970-01-01 00:00:00.000000000 +0000 @@ -1,16 +0,0 @@ - - - 编组 21 - - - - - - - - - - - - - \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/icon/create_white.svg dde-calendar-5.10.0/calendar-client/assets/resources/icon/create_white.svg --- dde-calendar-5.9.1/calendar-client/assets/resources/icon/create_white.svg 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/icon/create_white.svg 1970-01-01 00:00:00.000000000 +0000 @@ -1,16 +0,0 @@ - - - 编组 21 - - - - - - - - - - - - - \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/icon/dark_ban_bg.svg dde-calendar-5.10.0/calendar-client/assets/resources/icon/dark_ban_bg.svg --- dde-calendar-5.9.1/calendar-client/assets/resources/icon/dark_ban_bg.svg 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/icon/dark_ban_bg.svg 1970-01-01 00:00:00.000000000 +0000 @@ -1,21 +0,0 @@ - - - - 类型 3 - Created with Sketch. - - - - - - - - - - - - - - - - \ No newline at end of file diff -Nru "/tmp/tmpsgbh6un_/K5SEN4W3x8/dde-calendar-5.9.1/calendar-client/assets/resources/icon/darkchoose20X20_checked .svg" "/tmp/tmpsgbh6un_/_fqUKjDi_9/dde-calendar-5.10.0/calendar-client/assets/resources/icon/darkchoose20X20_checked .svg" --- "/tmp/tmpsgbh6un_/K5SEN4W3x8/dde-calendar-5.9.1/calendar-client/assets/resources/icon/darkchoose20X20_checked .svg" 2022-04-29 02:06:06.000000000 +0000 +++ "/tmp/tmpsgbh6un_/_fqUKjDi_9/dde-calendar-5.10.0/calendar-client/assets/resources/icon/darkchoose20X20_checked .svg" 1970-01-01 00:00:00.000000000 +0000 @@ -1,30 +0,0 @@ - - - - checkbox_checked - Created with Sketch. - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff -Nru "/tmp/tmpsgbh6un_/K5SEN4W3x8/dde-calendar-5.9.1/calendar-client/assets/resources/icon/darkchoose30X30_checked .svg" "/tmp/tmpsgbh6un_/_fqUKjDi_9/dde-calendar-5.10.0/calendar-client/assets/resources/icon/darkchoose30X30_checked .svg" --- "/tmp/tmpsgbh6un_/K5SEN4W3x8/dde-calendar-5.9.1/calendar-client/assets/resources/icon/darkchoose30X30_checked .svg" 2022-04-29 02:06:06.000000000 +0000 +++ "/tmp/tmpsgbh6un_/_fqUKjDi_9/dde-calendar-5.10.0/calendar-client/assets/resources/icon/darkchoose30X30_checked .svg" 1970-01-01 00:00:00.000000000 +0000 @@ -1,28 +0,0 @@ - - - - choose30X30_checked - Created with Sketch. - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/icon/dark_xiu_bg.svg dde-calendar-5.10.0/calendar-client/assets/resources/icon/dark_xiu_bg.svg --- dde-calendar-5.9.1/calendar-client/assets/resources/icon/dark_xiu_bg.svg 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/icon/dark_xiu_bg.svg 1970-01-01 00:00:00.000000000 +0000 @@ -1,21 +0,0 @@ - - - - 类型 2 - Created with Sketch. - - - - - - - - - - - - - - - - \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/icon/data_day_line.svg dde-calendar-5.10.0/calendar-client/assets/resources/icon/data_day_line.svg --- dde-calendar-5.9.1/calendar-client/assets/resources/icon/data_day_line.svg 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/icon/data_day_line.svg 1970-01-01 00:00:00.000000000 +0000 @@ -1,13 +0,0 @@ - - - - Line Copy 2 - Created with Sketch. - - - - - - - - \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/icon/data_line_checked.svg dde-calendar-5.10.0/calendar-client/assets/resources/icon/data_line_checked.svg --- dde-calendar-5.9.1/calendar-client/assets/resources/icon/data_line_checked.svg 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/icon/data_line_checked.svg 1970-01-01 00:00:00.000000000 +0000 @@ -1,32 +0,0 @@ - - - - Rectangle 75 - Created with Sketch. - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/icon/dde-ban.svg dde-calendar-5.10.0/calendar-client/assets/resources/icon/dde-ban.svg --- dde-calendar-5.9.1/calendar-client/assets/resources/icon/dde-ban.svg 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/icon/dde-ban.svg 1970-01-01 00:00:00.000000000 +0000 @@ -1,17 +0,0 @@ - - - - 类型-班 - Created with Sketch. - - - - - - - - - - - - \ No newline at end of file Binary files /tmp/tmpsgbh6un_/K5SEN4W3x8/dde-calendar-5.9.1/calendar-client/assets/resources/icon/dde-calendar_48.png and /tmp/tmpsgbh6un_/_fqUKjDi_9/dde-calendar-5.10.0/calendar-client/assets/resources/icon/dde-calendar_48.png differ Binary files /tmp/tmpsgbh6un_/K5SEN4W3x8/dde-calendar-5.9.1/calendar-client/assets/resources/icon/dde-calendar_96.png and /tmp/tmpsgbh6un_/_fqUKjDi_9/dde-calendar-5.10.0/calendar-client/assets/resources/icon/dde-calendar_96.png differ diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/icon/dde-calendar.svg dde-calendar-5.10.0/calendar-client/assets/resources/icon/dde-calendar.svg --- dde-calendar-5.9.1/calendar-client/assets/resources/icon/dde-calendar.svg 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/icon/dde-calendar.svg 1970-01-01 00:00:00.000000000 +0000 @@ -1,43 +0,0 @@ - - - - logo - Created with Sketch. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/icon/dde-choose24.svg dde-calendar-5.10.0/calendar-client/assets/resources/icon/dde-choose24.svg --- dde-calendar-5.9.1/calendar-client/assets/resources/icon/dde-choose24.svg 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/icon/dde-choose24.svg 1970-01-01 00:00:00.000000000 +0000 @@ -1,34 +0,0 @@ - - - - choose24X24_checked - Created with Sketch. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/icon/dde-choose30.svg dde-calendar-5.10.0/calendar-client/assets/resources/icon/dde-choose30.svg --- dde-calendar-5.9.1/calendar-client/assets/resources/icon/dde-choose30.svg 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/icon/dde-choose30.svg 1970-01-01 00:00:00.000000000 +0000 @@ -1,28 +0,0 @@ - - - - choose_checked - Created with Sketch. - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/icon/dde-ji.svg dde-calendar-5.10.0/calendar-client/assets/resources/icon/dde-ji.svg --- dde-calendar-5.9.1/calendar-client/assets/resources/icon/dde-ji.svg 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/icon/dde-ji.svg 1970-01-01 00:00:00.000000000 +0000 @@ -1,24 +0,0 @@ - - - - icon_ji - Created with Sketch. - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/icon/dde-logo.svg dde-calendar-5.10.0/calendar-client/assets/resources/icon/dde-logo.svg --- dde-calendar-5.9.1/calendar-client/assets/resources/icon/dde-logo.svg 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/icon/dde-logo.svg 1970-01-01 00:00:00.000000000 +0000 @@ -1,43 +0,0 @@ - - - - logo - Created with Sketch. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/icon/dde-xiu.svg dde-calendar-5.10.0/calendar-client/assets/resources/icon/dde-xiu.svg --- dde-calendar-5.9.1/calendar-client/assets/resources/icon/dde-xiu.svg 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/icon/dde-xiu.svg 1970-01-01 00:00:00.000000000 +0000 @@ -1,17 +0,0 @@ - - - - 类型-休 - Created with Sketch. - - - - - - - - - - - - \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/icon/dde-yi.svg dde-calendar-5.10.0/calendar-client/assets/resources/icon/dde-yi.svg --- dde-calendar-5.9.1/calendar-client/assets/resources/icon/dde-yi.svg 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/icon/dde-yi.svg 1970-01-01 00:00:00.000000000 +0000 @@ -1,24 +0,0 @@ - - - - icon_yi - Created with Sketch. - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/icon/delete.svg dde-calendar-5.10.0/calendar-client/assets/resources/icon/delete.svg --- dde-calendar-5.9.1/calendar-client/assets/resources/icon/delete.svg 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/icon/delete.svg 1970-01-01 00:00:00.000000000 +0000 @@ -1,20 +0,0 @@ - - - icon/schedule/delete - - - - - - - - - - - - - - - - - \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/icon/edit.svg dde-calendar-5.10.0/calendar-client/assets/resources/icon/edit.svg --- dde-calendar-5.9.1/calendar-client/assets/resources/icon/edit.svg 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/icon/edit.svg 1970-01-01 00:00:00.000000000 +0000 @@ -1,21 +0,0 @@ - - - 编组 18 - - - - - - - - - - - - - - - - - - \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/icon/icon_ji.svg dde-calendar-5.10.0/calendar-client/assets/resources/icon/icon_ji.svg --- dde-calendar-5.9.1/calendar-client/assets/resources/icon/icon_ji.svg 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/icon/icon_ji.svg 1970-01-01 00:00:00.000000000 +0000 @@ -1,24 +0,0 @@ - - - - icon_ji - Created with Sketch. - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/icon/icon_type_life.svg dde-calendar-5.10.0/calendar-client/assets/resources/icon/icon_type_life.svg --- dde-calendar-5.9.1/calendar-client/assets/resources/icon/icon_type_life.svg 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/icon/icon_type_life.svg 1970-01-01 00:00:00.000000000 +0000 @@ -1,24 +0,0 @@ - - - - icon_type_life - Created with Sketch. - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/icon/icon_type_other.svg dde-calendar-5.10.0/calendar-client/assets/resources/icon/icon_type_other.svg --- dde-calendar-5.9.1/calendar-client/assets/resources/icon/icon_type_other.svg 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/icon/icon_type_other.svg 1970-01-01 00:00:00.000000000 +0000 @@ -1,24 +0,0 @@ - - - - icon_type_other - Created with Sketch. - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/icon/icon_type_work.svg dde-calendar-5.10.0/calendar-client/assets/resources/icon/icon_type_work.svg --- dde-calendar-5.9.1/calendar-client/assets/resources/icon/icon_type_work.svg 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/icon/icon_type_work.svg 1970-01-01 00:00:00.000000000 +0000 @@ -1,24 +0,0 @@ - - - - 编组 5 - Created with Sketch. - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/icon/icon_yi.svg dde-calendar-5.10.0/calendar-client/assets/resources/icon/icon_yi.svg --- dde-calendar-5.9.1/calendar-client/assets/resources/icon/icon_yi.svg 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/icon/icon_yi.svg 1970-01-01 00:00:00.000000000 +0000 @@ -1,24 +0,0 @@ - - - - icon_yi - Created with Sketch. - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/icon/next_disabled.svg dde-calendar-5.10.0/calendar-client/assets/resources/icon/next_disabled.svg --- dde-calendar-5.9.1/calendar-client/assets/resources/icon/next_disabled.svg 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/icon/next_disabled.svg 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ - - - - next_disabled - Created with Sketch. - - - - - - - \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/icon/next_hover.svg dde-calendar-5.10.0/calendar-client/assets/resources/icon/next_hover.svg --- dde-calendar-5.9.1/calendar-client/assets/resources/icon/next_hover.svg 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/icon/next_hover.svg 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ - - - - next_hover - Created with Sketch. - - - - - - - \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/icon/next_normal.svg dde-calendar-5.10.0/calendar-client/assets/resources/icon/next_normal.svg --- dde-calendar-5.9.1/calendar-client/assets/resources/icon/next_normal.svg 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/icon/next_normal.svg 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ - - - - next_normal - Created with Sketch. - - - - - - - \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/icon/next_press.svg dde-calendar-5.10.0/calendar-client/assets/resources/icon/next_press.svg --- dde-calendar-5.9.1/calendar-client/assets/resources/icon/next_press.svg 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/icon/next_press.svg 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ - - - - next_press - Created with Sketch. - - - - - - - \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/icon/oval.svg dde-calendar-5.10.0/calendar-client/assets/resources/icon/oval.svg --- dde-calendar-5.9.1/calendar-client/assets/resources/icon/oval.svg 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/icon/oval.svg 1970-01-01 00:00:00.000000000 +0000 @@ -1,24 +0,0 @@ - - - - 椭圆形 2 - Created with Sketch. - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/icon/previous_disabled.svg dde-calendar-5.10.0/calendar-client/assets/resources/icon/previous_disabled.svg --- dde-calendar-5.9.1/calendar-client/assets/resources/icon/previous_disabled.svg 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/icon/previous_disabled.svg 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ - - - - previous_disabled - Created with Sketch. - - - - - - - \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/icon/previous_hover.svg dde-calendar-5.10.0/calendar-client/assets/resources/icon/previous_hover.svg --- dde-calendar-5.9.1/calendar-client/assets/resources/icon/previous_hover.svg 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/icon/previous_hover.svg 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ - - - - previous_hover - Created with Sketch. - - - - - - - \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/icon/previous_normal.svg dde-calendar-5.10.0/calendar-client/assets/resources/icon/previous_normal.svg --- dde-calendar-5.9.1/calendar-client/assets/resources/icon/previous_normal.svg 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/icon/previous_normal.svg 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ - - - - previous_normal - Created with Sketch. - - - - - - - \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/icon/previous_press.svg dde-calendar-5.10.0/calendar-client/assets/resources/icon/previous_press.svg --- dde-calendar-5.9.1/calendar-client/assets/resources/icon/previous_press.svg 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/icon/previous_press.svg 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ - - - - previous_press - Created with Sketch. - - - - - - - \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/icon/search_type_life.svg dde-calendar-5.10.0/calendar-client/assets/resources/icon/search_type_life.svg --- dde-calendar-5.9.1/calendar-client/assets/resources/icon/search_type_life.svg 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/icon/search_type_life.svg 1970-01-01 00:00:00.000000000 +0000 @@ -1,13 +0,0 @@ - - - - 矩形 3 - Created with Sketch. - - - - - - - - \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/icon/search_type_other.svg dde-calendar-5.10.0/calendar-client/assets/resources/icon/search_type_other.svg --- dde-calendar-5.9.1/calendar-client/assets/resources/icon/search_type_other.svg 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/icon/search_type_other.svg 1970-01-01 00:00:00.000000000 +0000 @@ -1,13 +0,0 @@ - - - - 矩形 4 - Created with Sketch. - - - - - - - - \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/icon/search_type_work.svg dde-calendar-5.10.0/calendar-client/assets/resources/icon/search_type_work.svg --- dde-calendar-5.9.1/calendar-client/assets/resources/icon/search_type_work.svg 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/icon/search_type_work.svg 1970-01-01 00:00:00.000000000 +0000 @@ -1,13 +0,0 @@ - - - - 矩形 2 - Created with Sketch. - - - - - - - - \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/icon/today_hover.svg dde-calendar-5.10.0/calendar-client/assets/resources/icon/today_hover.svg --- dde-calendar-5.9.1/calendar-client/assets/resources/icon/today_hover.svg 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/icon/today_hover.svg 1970-01-01 00:00:00.000000000 +0000 @@ -1,18 +0,0 @@ - - - - today_hover - Created with Sketch. - - - - - - - - - - - - - \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/icon/today_normal.svg dde-calendar-5.10.0/calendar-client/assets/resources/icon/today_normal.svg --- dde-calendar-5.9.1/calendar-client/assets/resources/icon/today_normal.svg 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/icon/today_normal.svg 1970-01-01 00:00:00.000000000 +0000 @@ -1,18 +0,0 @@ - - - - today_normal - Created with Sketch. - - - - - - - - - - - - - \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/icon/today_press.svg dde-calendar-5.10.0/calendar-client/assets/resources/icon/today_press.svg --- dde-calendar-5.9.1/calendar-client/assets/resources/icon/today_press.svg 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/icon/today_press.svg 1970-01-01 00:00:00.000000000 +0000 @@ -1,18 +0,0 @@ - - - - today_press - Created with Sketch. - - - - - - - - - - - - - \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/icon/type_ban_bg.svg dde-calendar-5.10.0/calendar-client/assets/resources/icon/type_ban_bg.svg --- dde-calendar-5.9.1/calendar-client/assets/resources/icon/type_ban_bg.svg 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/icon/type_ban_bg.svg 1970-01-01 00:00:00.000000000 +0000 @@ -1,21 +0,0 @@ - - - - 类型 3 - Created with Sketch. - - - - - - - - - - - - - - - - \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/icon/type_ban.svg dde-calendar-5.10.0/calendar-client/assets/resources/icon/type_ban.svg --- dde-calendar-5.9.1/calendar-client/assets/resources/icon/type_ban.svg 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/icon/type_ban.svg 1970-01-01 00:00:00.000000000 +0000 @@ -1,17 +0,0 @@ - - - - 类型-班 - Created with Sketch. - - - - - - - - - - - - \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/icon/type_xiu_bg.svg dde-calendar-5.10.0/calendar-client/assets/resources/icon/type_xiu_bg.svg --- dde-calendar-5.9.1/calendar-client/assets/resources/icon/type_xiu_bg.svg 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/icon/type_xiu_bg.svg 1970-01-01 00:00:00.000000000 +0000 @@ -1,21 +0,0 @@ - - - - 类型 2 - Created with Sketch. - - - - - - - - - - - - - - - - \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/icon/type_xiu.svg dde-calendar-5.10.0/calendar-client/assets/resources/icon/type_xiu.svg --- dde-calendar-5.9.1/calendar-client/assets/resources/icon/type_xiu.svg 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/icon/type_xiu.svg 1970-01-01 00:00:00.000000000 +0000 @@ -1,17 +0,0 @@ - - - - 类型-休 - Created with Sketch. - - - - - - - - - - - - \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/icon/uos_logo.svg dde-calendar-5.10.0/calendar-client/assets/resources/icon/uos_logo.svg --- dde-calendar-5.9.1/calendar-client/assets/resources/icon/uos_logo.svg 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/icon/uos_logo.svg 1970-01-01 00:00:00.000000000 +0000 @@ -1,28 +0,0 @@ - - - - uos_logo - Created with Sketch. - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/icon/warning.svg dde-calendar-5.10.0/calendar-client/assets/resources/icon/warning.svg --- dde-calendar-5.9.1/calendar-client/assets/resources/icon/warning.svg 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/icon/warning.svg 1970-01-01 00:00:00.000000000 +0000 @@ -1,32 +0,0 @@ - - - - deepin-cloudprint-config-helper - Created with Sketch. - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources/icon/xiu.svg dde-calendar-5.10.0/calendar-client/assets/resources/icon/xiu.svg --- dde-calendar-5.9.1/calendar-client/assets/resources/icon/xiu.svg 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources/icon/xiu.svg 1970-01-01 00:00:00.000000000 +0000 @@ -1,16 +0,0 @@ - - - - 类型 - Created with Sketch. - - - - - - - - - - - \ No newline at end of file diff -Nru dde-calendar-5.9.1/calendar-client/assets/resources.qrc dde-calendar-5.10.0/calendar-client/assets/resources.qrc --- dde-calendar-5.9.1/calendar-client/assets/resources.qrc 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/assets/resources.qrc 2023-04-07 06:02:09.000000000 +0000 @@ -1,54 +1,5 @@ - resources/dde-calendar.qss - resources/icon/dde-calendar.svg - resources/icon/dde-calendar_96.png - resources/icon/dde-calendar_48.png - resources/icon/next_disabled.svg - resources/icon/next_hover.svg - resources/icon/next_normal.svg - resources/icon/next_press.svg - resources/icon/previous_disabled.svg - resources/icon/previous_hover.svg - resources/icon/previous_normal.svg - resources/icon/previous_press.svg - resources/icon/today_hover.svg - resources/icon/today_normal.svg - resources/icon/today_press.svg - resources/icon/dde-ji.svg - resources/icon/dde-ban.svg - resources/icon/dde-logo.svg - resources/icon/dde-xiu.svg - resources/icon/dde-yi.svg - resources/icon/dde-choose24.svg - resources/icon/dde-choose30.svg - resources/icon/choose20X20_checked .svg - resources/icon/icon_ji.svg - resources/icon/icon_type_life.svg - resources/icon/type_xiu.svg - resources/icon/search_type_work.svg - resources/icon/icon_type_other.svg - resources/icon/choose30X30_checked .svg - resources/icon/icon_yi.svg - resources/icon/search_type_life.svg - resources/icon/search_type_other.svg - resources/icon/type_ban_bg.svg - resources/icon/type_ban.svg - resources/icon/icon_type_work.svg - resources/icon/data_line_checked.svg - resources/icon/type_xiu_bg.svg - resources/icon/data_day_line.svg - resources/icon/checkbox_checked .svg - resources/icon/checkbox_unchecked .svg - resources/icon/uos_logo.svg - resources/icon/oval.svg - resources/icon/darkchoose30X30_checked .svg - resources/icon/darkchoose20X20_checked .svg - resources/icon/dark_ban_bg.svg - resources/icon/dark_xiu_bg.svg - resources/icon/ban.svg - resources/icon/xiu.svg - resources/icon/warning.svg resources/DynamicIcon/day5.svg resources/DynamicIcon/calendar_bg.svg resources/DynamicIcon/day1.svg @@ -100,9 +51,27 @@ resources/DynamicIcon/week5.svg resources/DynamicIcon/week6.svg resources/DynamicIcon/week7.svg - resources/icon/delete.svg - resources/icon/edit.svg - resources/icon/create_black.svg - resources/icon/create_white.svg + + + builtin/icons/dde_calendar_ban_32px.svg + builtin/icons/dde_calendar_delete_32px.svg + builtin/icons/dde_calendar_edit_32px.svg + builtin/icons/dde_calendar_fail_200px.png + builtin/icons/dde_calendar_ji_32px.svg + builtin/icons/dde_calendar_spinner_32px.svg + builtin/icons/dde_calendar_success_200px.png + builtin/icons/dde_calendar_sync_schedule_32px.svg + builtin/icons/dde_calendar_sync_setting_32px.svg + builtin/icons/dde_calendar_warning_light_32px.svg + builtin/icons/dde_calendar_warning.svg + builtin/icons/dde_calendar_xiu.svg + builtin/icons/dde_calendar_yi_32px.svg + builtin/icons/icon_refresh.svg + builtin/dark/icons/dde_calendar_account_32px.svg + builtin/dark/icons/dde_calendar_create_32px.svg + builtin/dark/icons/dde_calendar_sidebar_32px.svg + builtin/light/icons/dde_calendar_account_32px.svg + builtin/light/icons/dde_calendar_create_32px.svg + builtin/light/icons/dde_calendar_sidebar_32px.svg diff -Nru dde-calendar-5.9.1/calendar-client/CMakeLists.txt dde-calendar-5.10.0/calendar-client/CMakeLists.txt --- dde-calendar-5.9.1/calendar-client/CMakeLists.txt 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/CMakeLists.txt 2023-04-07 06:02:09.000000000 +0000 @@ -52,7 +52,7 @@ SUBDIRLIST(all_src ${CMAKE_CURRENT_SOURCE_DIR}/src) -#Include all app own subdirectorys +#Include all app own subdirectories foreach(subdir ${all_src}) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/${subdir}) endforeach() @@ -69,13 +69,13 @@ find_package(DtkWidget REQUIRED) find_package(DtkGui REQUIRED) find_package(DFrameworkdbus REQUIRED) +find_package(Qt5Network REQUIRED) include_directories(${Qt5Gui_PRIVATE_INCLUDE_DIRS}) -include_directories(../calendar-basicstruct/) # Tell CMake to create the executable add_executable(${PROJECT_NAME} ${Calendar_SRC} ${APP_QRC}) -target_include_directories(${PROJECT_NAME} PUBLIC ${DtkWidget_INCLUDE_DIRS} ${OBJECT_BINARY_DIR}) +target_include_directories(${PROJECT_NAME} PUBLIC ${DtkWidget_INCLUDE_DIRS} ${OBJECT_BINARY_DIR} ../calendar-common/src) target_link_libraries(${PROJECT_NAME} ${DtkWidget_LIBRARIES} ${DtkCore_LIBRARIES} @@ -84,15 +84,27 @@ ${Qt5Svg_LIBRARIES} ${Qt5DBus_LIBRARIES} ${DFrameworkdbus_LIBRARIES} - basestruct + ${Qt5Network_LIBRARIES} + commondata ) -set(CMAKE_INSTALL_PREFIX /usr) +#根据环境修改dbus服务文件 +if(DEFINED ENV{PREFIX}) + set(APP_DBUS_SERVICE "[D-BUS Service] +Name=com.deepin.Calendar +Exec=/usr/bin/ll-cli run org.dde.calendar --exec dde-calendar") + file(WRITE ${APP_SERVICE} "${APP_DBUS_SERVICE}") + + set(CMAKE_INSTALL_PREFIX $ENV{PREFIX}) +else() + set(CMAKE_INSTALL_PREFIX /usr) +endif() + # Install files -install(TARGETS dde-calendar DESTINATION bin) +install(TARGETS dde-calendar DESTINATION ${CMAKE_INSTALL_BINDIR}) install(DIRECTORY ${APP_RES_DIR}/dde-calendar - DESTINATION /usr/share/deepin-manual/manual-assets/application/) -install(FILES ${APP_DESKTOP} DESTINATION share/applications) -install(FILES ${APP_SERVICE} DESTINATION share/dbus-1/services) + DESTINATION ${CMAKE_INSTALL_DATADIR}/deepin-manual/manual-assets/application/) +install(FILES ${APP_DESKTOP} DESTINATION ${CMAKE_INSTALL_DATADIR}/applications) +install(FILES ${APP_SERVICE} DESTINATION ${CMAKE_INSTALL_DATADIR}/dbus-1/services) diff -Nru dde-calendar-5.9.1/calendar-client/README.md dde-calendar-5.10.0/calendar-client/README.md --- dde-calendar-5.9.1/calendar-client/README.md 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/README.md 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1 @@ +# calendar-client diff -Nru dde-calendar-5.9.1/calendar-client/src/accessible/accessibledefine.h dde-calendar-5.10.0/calendar-client/src/accessible/accessibledefine.h --- dde-calendar-5.9.1/calendar-client/src/accessible/accessibledefine.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/accessible/accessibledefine.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef ACCESSIBLEDEFINE_H #define ACCESSIBLEDEFINE_H diff -Nru dde-calendar-5.9.1/calendar-client/src/accessible/accessible.h dde-calendar-5.10.0/calendar-client/src/accessible/accessible.h --- dde-calendar-5.9.1/calendar-client/src/accessible/accessible.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/accessible/accessible.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef ACCESSIBLE_H #define ACCESSIBLE_H diff -Nru dde-calendar-5.9.1/calendar-client/src/calendarglobalenv.cpp dde-calendar-5.10.0/calendar-client/src/calendarglobalenv.cpp --- dde-calendar-5.9.1/calendar-client/src/calendarglobalenv.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/calendarglobalenv.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "calendarglobalenv.h" CalendarGlobalEnv *CalendarGlobalEnv::getGlobalEnv() diff -Nru dde-calendar-5.9.1/calendar-client/src/calendarglobalenv.h dde-calendar-5.10.0/calendar-client/src/calendarglobalenv.h --- dde-calendar-5.9.1/calendar-client/src/calendarglobalenv.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/calendarglobalenv.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef CALENDARGLOBALENV_H #define CALENDARGLOBALENV_H diff -Nru dde-calendar-5.9.1/calendar-client/src/configsettings.cpp dde-calendar-5.10.0/calendar-client/src/configsettings.cpp --- dde-calendar-5.9.1/calendar-client/src/configsettings.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/configsettings.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,27 +1,11 @@ -/* - * Copyright (C) 2017 ~ 2018 Wuhan Deepin Technology Co., Ltd. - * - * Author: Iceyer - * - * Maintainer: Iceyer - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later #include "configsettings.h" #include +#include DCORE_USE_NAMESPACE; @@ -42,6 +26,12 @@ auto configFilepath = DStandardPaths::standardLocations(QStandardPaths::AppConfigLocation).value(0) + "/config.ini"; m_settings = new QSettings(configFilepath, QSettings::IniFormat); } + initSetting(); +} + +void CConfigSettings::initSetting() +{ + m_userSidebarStatus = value("userSidebarStatus", true).toBool(); } /** @@ -91,3 +81,14 @@ { return getInstance(); } + +bool CConfigSettings::getUserSidebarStatus() +{ + return m_userSidebarStatus; +} + +void CConfigSettings::setUserSidebarStatus(bool status) +{ + m_userSidebarStatus = status; + setOption("userSidebarStatus", m_userSidebarStatus); +} diff -Nru dde-calendar-5.9.1/calendar-client/src/configsettings.h dde-calendar-5.10.0/calendar-client/src/configsettings.h --- dde-calendar-5.9.1/calendar-client/src/configsettings.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/configsettings.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,6 @@ -/* - * Copyright (C) 2016 ~ 2018 Wuhan Deepin Technology Co., Ltd. - * - * Author: Iceyer - * - * Maintainer: Iceyer - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2016 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later #ifndef CCONFIGSETTINGS_H #define CCONFIGSETTINGS_H @@ -25,8 +8,9 @@ #include #include -class CConfigSettings +class CConfigSettings : QObject { + Q_OBJECT public: static CConfigSettings *getInstance(); void sync(); @@ -54,6 +38,18 @@ */ bool contains(const QString &key) const; CConfigSettings *operator->() const ; + + void initSetting(); + + //帐户侧边栏显示状态 + bool getUserSidebarStatus(); + void setUserSidebarStatus(bool); + +signals: + void signalFirstDayOfWeekChange(); + +public slots: + protected: CConfigSettings(); ~CConfigSettings(); @@ -62,6 +58,9 @@ void releaseInstance(); private: QPointer m_settings; + bool m_userSidebarStatus = true; //帐户侧边栏显示状态 }; +#define gSetting CConfigSettings::getInstance() + #endif // CCONFIGSETTINGS_H diff -Nru dde-calendar-5.9.1/calendar-client/src/constants.h dde-calendar-5.10.0/calendar-client/src/constants.h --- dde-calendar-5.9.1/calendar-client/src/constants.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/constants.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,21 +1,6 @@ -/* - * Copyright (C) 2017 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: kirigaya - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later #ifndef CONSTANTS_H #define CONSTANTS_H @@ -35,7 +20,7 @@ static const int CellHighlightHeight = 70; static const int QueryEarliestYear = 1900; -static const int QueryLatestYear = 9999; +static const int QueryLatestYear = 2100; static const int FestivalTypeID = 4; @@ -115,7 +100,7 @@ static const int MDayCellWidth = 36; static const int MDayCellHeight = 36; -static const int M_YTopHeight = 76; +static const int M_YTopHeight = 66; static const int M_YLabelHeight = 36; static const int M_YLunaLabelWindth = 66; static const int M_YLunaLabelHeight = 20; @@ -167,6 +152,7 @@ static const int DWLabelHeight = 22; static const int DHuangLiInfoLabelHeight = 17; static const int DHuangLiLabelHeight = 56; +static const int DHuangLiLabelMaxHeight = 96; static const int DHuangLiLabelWidth = 330; static const int D_MWindowWidth = 350; static const int D_MWindowHeight = 564; diff -Nru dde-calendar-5.9.1/calendar-client/src/customWidget/animationstackedwidget.cpp dde-calendar-5.10.0/calendar-client/src/customWidget/animationstackedwidget.cpp --- dde-calendar-5.9.1/calendar-client/src/customWidget/animationstackedwidget.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/customWidget/animationstackedwidget.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "animationstackedwidget.h" #include diff -Nru dde-calendar-5.9.1/calendar-client/src/customWidget/animationstackedwidget.h dde-calendar-5.10.0/calendar-client/src/customWidget/animationstackedwidget.h --- dde-calendar-5.9.1/calendar-client/src/customWidget/animationstackedwidget.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/customWidget/animationstackedwidget.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef AnimationStackedWidget_H #define AnimationStackedWidget_H diff -Nru dde-calendar-5.9.1/calendar-client/src/customWidget/cbuttonbox.cpp dde-calendar-5.10.0/calendar-client/src/customWidget/cbuttonbox.cpp --- dde-calendar-5.9.1/calendar-client/src/customWidget/cbuttonbox.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/customWidget/cbuttonbox.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "cbuttonbox.h" #include @@ -25,6 +9,8 @@ CButtonBox::CButtonBox(QWidget *parent) : DButtonBox(parent) { + //设置接受tab焦点切换 + this->setFocusPolicy(Qt::TabFocus); } void CButtonBox::focusInEvent(QFocusEvent *event) diff -Nru dde-calendar-5.9.1/calendar-client/src/customWidget/cbuttonbox.h dde-calendar-5.10.0/calendar-client/src/customWidget/cbuttonbox.h --- dde-calendar-5.9.1/calendar-client/src/customWidget/cbuttonbox.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/customWidget/cbuttonbox.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef CBUTTONBOX_H #define CBUTTONBOX_H diff -Nru dde-calendar-5.9.1/calendar-client/src/customWidget/ccustomtimeedit.cpp dde-calendar-5.10.0/calendar-client/src/customWidget/ccustomtimeedit.cpp --- dde-calendar-5.9.1/calendar-client/src/customWidget/ccustomtimeedit.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/customWidget/ccustomtimeedit.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "ccustomtimeedit.h" #include diff -Nru dde-calendar-5.9.1/calendar-client/src/customWidget/ccustomtimeedit.h dde-calendar-5.10.0/calendar-client/src/customWidget/ccustomtimeedit.h --- dde-calendar-5.9.1/calendar-client/src/customWidget/ccustomtimeedit.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/customWidget/ccustomtimeedit.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef CCUSTOMTIMEEDIT_H #define CCUSTOMTIMEEDIT_H diff -Nru dde-calendar-5.9.1/calendar-client/src/customWidget/cdateedit.cpp dde-calendar-5.10.0/calendar-client/src/customWidget/cdateedit.cpp --- dde-calendar-5.9.1/calendar-client/src/customWidget/cdateedit.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/customWidget/cdateedit.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,25 +1,10 @@ -/* -* Copyright (C) 2019 ~ 2019 UnionTech Software Technology Co.,Ltd. -* -* Author: leilong -* -* Maintainer: leilong -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "cdateedit.h" #include "lunarcalendarwidget.h" +#include "lunarmanager.h" #include #include @@ -41,6 +26,9 @@ void CDateEdit::setDate(QDate date) { QDateEdit::setDate(date); + //只有在农历日程时,才需要获取农历信息 + QString dtFormat = m_showLunarCalendar ? m_format + getLunarName(date) : m_format; + m_strCurrrentDate = date.toString(dtFormat); } void CDateEdit::setDisplayFormat(QString format) @@ -87,7 +75,11 @@ { QString format = m_format; + if (m_showLunarCalendar) { + if (!showGongli()) { + format = "yyyy/"; + } m_lunarName = getLunarName(date); format += m_lunarName; } @@ -195,9 +187,7 @@ QString CDateEdit::getLunarName(const QDate &date) { - CaHuangLiDayInfo info; - CScheduleDBus::getInstance()->GetHuangLiDay(date, info); - return info.mLunarMonthName + info.mLunarDayName; + return gLunarManager->getHuangLiShortName(date); } void CDateEdit::setLineEditTextFormat(QLineEdit *lineEdit, const QList &formats) @@ -222,6 +212,24 @@ QCoreApplication::sendEvent(lineEdit, &event); } +void CDateEdit::changeEvent(QEvent *e) +{ + QDateEdit::changeEvent(e); + if (e->type() == QEvent::FontChange && m_showLunarCalendar) { + slotDateEidtInfo(date()); + } +} + +bool CDateEdit::showGongli() +{ + QString str = m_strCurrrentDate; + QFontMetrics fontMetrice(lineEdit()->font()); + if (fontMetrice.width(str) > lineEdit()->width() - 20) { + return false; + } + return true; +} + void CDateEdit::updateCalendarWidget() { if (calendarPopup()) { @@ -235,4 +243,11 @@ } } +void CDateEdit::setEditCursorPos(int pos) +{ + QLineEdit *edit = lineEdit(); + if (nullptr != edit) { + edit->setCursorPosition(pos); + } +} diff -Nru dde-calendar-5.9.1/calendar-client/src/customWidget/cdateedit.h dde-calendar-5.10.0/calendar-client/src/customWidget/cdateedit.h --- dde-calendar-5.9.1/calendar-client/src/customWidget/cdateedit.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/customWidget/cdateedit.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,28 +1,10 @@ -/* -* Copyright (C) 2019 ~ 2019 UnionTech Software Technology Co.,Ltd. -* -* Author: leilong -* -* Maintainer: leilong -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef CDATEEDIT_H #define CDATEEDIT_H -#include "cscheduledbus.h" - #include #include @@ -73,14 +55,19 @@ */ void setCalendarPopup(bool enable); + void setEditCursorPos(int pos); + signals: +protected: + + void changeEvent(QEvent *e) override; private slots: //连接时间改变信号,填充农历信息 void slotDateEidtInfo(const QDate &date); //连接输入框文本改变信号,刷新文本样式 - void slotRefreshLineEditTextFormat(const QString&); + void slotRefreshLineEditTextFormat(const QString &); //连接光标位置改变信号,限制光标位置 void slotCursorPositionChanged(int, int); //连接文本选择改变信号,处理键盘全选时情况 @@ -88,16 +75,18 @@ private: //获取农历信息 - QString getLunarName(const QDate&); + QString getLunarName(const QDate &); //设置文本样式 - void setLineEditTextFormat(QLineEdit* lineEdit, const QList& formats); + void setLineEditTextFormat(QLineEdit *lineEdit, const QList &formats); //更新日历显示类型 void updateCalendarWidget(); + bool showGongli(); private: QString m_format = ""; //时间格式化格式 bool m_showLunarCalendar = false; //农历显示状态 true:显示 false:不显示 QString m_lunarName = ""; //农历字符串 QTextCharFormat m_lunarTextFormat; //农历文本样式 + QString m_strCurrrentDate = ""; }; #endif // CDATEEDIT_H diff -Nru dde-calendar-5.9.1/calendar-client/src/customWidget/cdialogiconbutton.cpp dde-calendar-5.10.0/calendar-client/src/customWidget/cdialogiconbutton.cpp --- dde-calendar-5.9.1/calendar-client/src/customWidget/cdialogiconbutton.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/customWidget/cdialogiconbutton.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,25 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "cdialogiconbutton.h" +#include "cschedulebasewidget.h" + +CDialogIconButton::CDialogIconButton(QWidget *parent) : DIconButton(parent) +{ + initView(); + connect(this, &DIconButton::clicked, this, &CDialogIconButton::slotIconClicked); +} + +void CDialogIconButton::initView() +{ + setIcon(DStyle::SP_ArrowDown); + m_dialog = new TimeJumpDialog(DArrowRectangle::ArrowTop, this); + setFlat(true); +} + +void CDialogIconButton::slotIconClicked() +{ + //获取全局时间并显示弹窗 + m_dialog->showPopup(CScheduleBaseWidget::getSelectDate(), mapToGlobal(QPoint(width()/2, height()))); +} diff -Nru dde-calendar-5.9.1/calendar-client/src/customWidget/cdialogiconbutton.h dde-calendar-5.10.0/calendar-client/src/customWidget/cdialogiconbutton.h --- dde-calendar-5.9.1/calendar-client/src/customWidget/cdialogiconbutton.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/customWidget/cdialogiconbutton.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,33 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef CDIALOGICON_H +#define CDIALOGICON_H + +#include "timejumpdialog.h" +#include + +DWIDGET_USE_NAMESPACE + +//时间跳转控件 +class CDialogIconButton : public DIconButton +{ + Q_OBJECT +public: + explicit CDialogIconButton(QWidget *parent = nullptr); + +signals: + +public slots: + //点击事件 + void slotIconClicked(); + +private: + void initView(); + +private: + TimeJumpDialog *m_dialog = nullptr; //时间跳转弹窗 +}; + +#endif // CDIALOGICON_H diff -Nru dde-calendar-5.9.1/calendar-client/src/customWidget/cdynamicicon.cpp dde-calendar-5.10.0/calendar-client/src/customWidget/cdynamicicon.cpp --- dde-calendar-5.9.1/calendar-client/src/customWidget/cdynamicicon.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/customWidget/cdynamicicon.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "cdynamicicon.h" #include @@ -120,6 +104,7 @@ { QIcon icon(this->getPixmap()); qApp->setProductIcon(icon); + qApp->setWindowIcon(icon); if (qApp->aboutDialog() != nullptr) qApp->aboutDialog()->setProductIcon(icon); diff -Nru dde-calendar-5.9.1/calendar-client/src/customWidget/cdynamicicon.h dde-calendar-5.10.0/calendar-client/src/customWidget/cdynamicicon.h --- dde-calendar-5.9.1/calendar-client/src/customWidget/cdynamicicon.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/customWidget/cdynamicicon.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef CDYNAMICICON_H #define CDYNAMICICON_H diff -Nru dde-calendar-5.9.1/calendar-client/src/customWidget/colorseletorwidget.cpp dde-calendar-5.10.0/calendar-client/src/customWidget/colorseletorwidget.cpp --- dde-calendar-5.9.1/calendar-client/src/customWidget/colorseletorwidget.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/customWidget/colorseletorwidget.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,24 +1,11 @@ -/* -* Copyright (C) 2019 ~ 2019 UnionTech Software Technology Co.,Ltd. -* -* Author: leilong -* -* Maintainer: leilong -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "colorseletorwidget.h" +#include "configsettings.h" +#include "units.h" + #include ColorSeletorWidget::ColorSeletorWidget(QWidget *parent) : QWidget(parent) @@ -32,22 +19,31 @@ m_colorGroup = new QButtonGroup(this); m_colorGroup->setExclusive(true); connect(m_colorGroup, QOverload::of(&QButtonGroup::buttonClicked), this, &ColorSeletorWidget::slotButtonClicked); - //默认选中第一个 - initColorButton(0); + + m_colorInfo.reset(new DTypeColor()); } -void ColorSeletorWidget::initColorButton(int index) +void ColorSeletorWidget::resetColorButton(const AccountItem::Ptr &account) { reset(); - QList lstColorInfo = JobTypeInfoManager::instance()->getJobTypeColorList(); - for (JobTypeColorInfo &var : lstColorInfo) { - if (TypeSystem == var.getAuthority()) { + if (nullptr == account) { + return; + } + + DTypeColor::List colorList = account->getColorTypeList(); + //添加默认颜色控件 + for (DTypeColor::Ptr &var : colorList) { + if (DTypeColor::PriSystem == var->privilege()) { addColor(var); } } - if (index >= 0 && index < m_colorGroup->buttons().size()) { - m_colorGroup->buttons().at(index)->click(); + //自定义控件单独添加 + m_colorGroup->addButton(m_userColorBtn, m_userColorBtnId); + m_colorLayout->addWidget(m_userColorBtn); + + if (m_colorGroup->buttons().size() > 0) { + m_colorGroup->buttons().at(0)->click(); } } @@ -59,33 +55,41 @@ for (QAbstractButton *btn : buttons) { m_colorGroup->removeButton(btn); m_colorLayout->removeWidget(btn); + //自定义控件内存不释放 + if (btn == m_userColorBtn) { + continue; + } delete btn; + btn = nullptr; } - if (m_userColorBtn) { - delete m_userColorBtn; + if (nullptr == m_userColorBtn) { + m_userColorBtn = new CRadioButton(this); + m_userColorBtn->setFixedSize(18, 18); + } - m_userColorBtn = nullptr; - m_userColorBtnId = -1; + m_userColorBtn->hide(); } -void ColorSeletorWidget::addColor(const JobTypeColorInfo &cInfo) +void ColorSeletorWidget::addColor(const DTypeColor::Ptr &cInfo) { static int count = 0; //静态变量,充当色彩控件id count++; - m_colorEntityMap.insert(count, cInfo); //映射id与控件 + m_colorEntityMap.insert(count, cInfo); //映射id与控件,从1开始 CRadioButton *radio = new CRadioButton(this); - radio->setColor(QColor(cInfo.getColorHex())); //设置控件颜色 + radio->setColor(QColor(cInfo->colorCode())); //设置控件颜色 radio->setFixedSize(18, 18); m_colorGroup->addButton(radio, count); m_colorLayout->addWidget(radio); - if (TypeUser == cInfo.getAuthority()) { - m_userColorBtn = radio; //记录用户色彩指针 - m_userColorBtnId = count; - } } -JobTypeColorInfo ColorSeletorWidget::getSelectedColorInfo() +DTypeColor::Ptr ColorSeletorWidget::getSelectedColorInfo() { + if ( m_colorInfo->privilege() == DTypeColor::PriSystem) { + CConfigSettings::getInstance()->setOption("LastSysColorTypeNo", m_colorInfo->colorID()); + } else if (!m_colorInfo->colorCode().isEmpty() ){ + CConfigSettings::getInstance()->setOption("LastUserColor", m_colorInfo->colorCode()); + CConfigSettings::getInstance()->setOption("LastSysColorTypeNo", ""); + } return m_colorInfo; } @@ -101,48 +105,47 @@ void ColorSeletorWidget::setSelectedColorById(int colorId) { - //如果是用户自定义颜色则直接选中 - if ((colorId > 9 || colorId < 1) && m_userColorBtn) { + //默认选择第一个 + if( colorId < 0 ) { + if (m_colorGroup->buttons().size() > 0) { + m_colorGroup->buttons().at(0)->click(); + } + return; + } else if ( colorId == 9 ) { m_userColorBtn->click(); return; } //系统颜色则向后移一位 + if (colorId == 8) { + colorId = 0; + } else { + ++colorId; + } + if (m_colorGroup->buttons().size() > 0) { + m_colorGroup->buttons().at(colorId)->click(); + } +} + +void ColorSeletorWidget::setSelectedColor(const DTypeColor &colorInfo) +{ + bool finding = false; auto iterator = m_colorEntityMap.begin(); while (iterator != m_colorEntityMap.end()) { - if (iterator.value().getTypeNo() == colorId) { - //向后移一位 - iterator++; - if (iterator == m_colorEntityMap.end() || iterator.key() == m_userColorBtnId) { - iterator = m_colorEntityMap.begin(); - } + if (iterator.value()->colorID() == colorInfo.colorID()) { QAbstractButton *btn = m_colorGroup->button(iterator.key()); if (btn) { btn->click(); + finding = true; } break; } iterator++; } -} - -void ColorSeletorWidget::setSelectedColor(const JobTypeColorInfo &colorInfo) -{ - if (TypeUser == colorInfo.getAuthority()) { - setUserColor(colorInfo); - } - - bool isFind = false; - //遍历所有控件 - for (QAbstractButton *but : m_colorGroup->buttons()) { - if (nullptr != but && qobject_cast(but)->getColor().name() == colorInfo.getColorHex()) { - but->click(); - isFind = true; - break; - } - } - if (!isFind) { - setUserColor(JobTypeColorInfo(0, colorInfo.getColorHex(), TypeUser)); + if (!finding) { + DTypeColor::Ptr ptr; + ptr.reset(new DTypeColor(colorInfo)); + setUserColor(ptr); } } @@ -175,8 +178,8 @@ if (m_colorEntityMap.end() == it) { return; } - JobTypeColorInfo info = it.value(); - if (info.getColorHex() != m_colorInfo.getColorHex()) { + DTypeColor::Ptr info = it.value(); + if (info->colorCode() != m_colorInfo->colorCode()) { m_colorInfo = info; emit signalColorChange(info); } @@ -184,25 +187,27 @@ void ColorSeletorWidget::slotAddColorButClicked() { - CColorPickerWidget *colorPicker = new CColorPickerWidget(this); + CColorPickerWidget colorPicker; - if (colorPicker->exec()) { - //设置用户自定义控件颜色 - setUserColor(JobTypeColorInfo(0, colorPicker->getSelectedColor().name(), TypeUser)); + if (colorPicker.exec()) { + DTypeColor::Ptr typeColor; + typeColor.reset(new DTypeColor()); + typeColor->setColorCode(colorPicker.getSelectedColor().name()); + typeColor->setPrivilege(DTypeColor::PriUser); + setUserColor(typeColor); m_userColorBtn->click(); } - delete colorPicker; } -void ColorSeletorWidget::setUserColor(const JobTypeColorInfo &colorInfo) +void ColorSeletorWidget::setUserColor(const DTypeColor::Ptr &colorInfo) { - if (TypeUser != colorInfo.getAuthority()) { + if (nullptr == m_userColorBtn || DTypeColor::PriUser != colorInfo->privilege()) { return; } - if (nullptr == m_userColorBtn) { - addColor(colorInfo); + if (!m_userColorBtn->isVisible()) { + m_userColorBtn->show(); } - m_userColorBtn->setColor(colorInfo.getColorHex()); + m_userColorBtn->setColor(colorInfo->colorCode()); m_colorEntityMap[m_userColorBtnId] = colorInfo; m_userColorBtn->click(); } diff -Nru dde-calendar-5.9.1/calendar-client/src/customWidget/colorseletorwidget.h dde-calendar-5.10.0/calendar-client/src/customWidget/colorseletorwidget.h --- dde-calendar-5.9.1/calendar-client/src/customWidget/colorseletorwidget.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/customWidget/colorseletorwidget.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,30 +1,17 @@ -/* -* Copyright (C) 2019 ~ 2019 UnionTech Software Technology Co.,Ltd. -* -* Author: leilong -* -* Maintainer: leilong -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef COLORSELETOR_H #define COLORSELETOR_H #include "cradiobutton.h" #include "colorWidget/colorpickerWidget.h" #include "scheduledatamanage.h" -#include "src/scheduledatainfo.h" +#include "dschedule.h" +#include "dtypecolor.h" +#include "accountmanager.h" + #include #include #include @@ -38,12 +25,6 @@ public: explicit ColorSeletorWidget(QWidget *parent = nullptr); - //色彩类别 - enum ColorType{ - TypeSystem = 1, //系统默认 - TypeUser = 7 //用户自定义 - }; - /** * @brief reset * 重置 @@ -53,11 +34,11 @@ * @brief getSelectColor * @return 当前已选在的色彩 */ - JobTypeColorInfo getSelectedColorInfo(); + DTypeColor::Ptr getSelectedColorInfo(); /** * @brief setUserColor 设置用户自定义的色彩 */ - void setUserColor(const JobTypeColorInfo&); + void setUserColor(const DTypeColor::Ptr &); /** * @brief setSelectedColorByIndex 设置选择的色彩控件 * @param index 色彩控件位置 @@ -69,20 +50,20 @@ */ void setSelectedColorById(int colorId); /** - * @brief selectColor 设置选择的色彩控件 - * @param color 色彩 + * @brief setSelectedColor 设置选择的色彩控件 + * @param color 色彩实例 */ - void setSelectedColor(const JobTypeColorInfo& color); + void setSelectedColor(const DTypeColor&); /** - * @brief initColorButton - * 初始化色彩控件 - * @param index 初始选择的色彩下标 + * @brief resetColorButton + * 重置色彩控件 + * @param account 帐户 */ - void initColorButton(int index = -1); + void resetColorButton(const AccountItem::Ptr& account); signals: //选择的色彩改变信号 - void signalColorChange(JobTypeColorInfo); + void signalColorChange(DTypeColor::Ptr); public slots: //色彩控件点击信号 @@ -95,15 +76,15 @@ void initView(); //添加色彩控件 - void addColor(const JobTypeColorInfo&); + void addColor(const DTypeColor::Ptr &); private: - QMap m_colorEntityMap; //所有色彩实体 + QMap m_colorEntityMap; //所有色彩实体 QHBoxLayout *m_colorLayout = nullptr; //色彩控件布局类 QButtonGroup *m_colorGroup = nullptr; //所有色彩控件 - JobTypeColorInfo m_colorInfo; //当前已选择的色彩 + DTypeColor::Ptr m_colorInfo; //当前已选择的色彩 CRadioButton *m_userColorBtn = nullptr; //用户自定义的色彩控件 - int m_userColorBtnId = -1; //用户自定义的色彩控件id + const int m_userColorBtnId = 999; //用户自定义的色彩控件id }; #endif // COLORSELETOR_H diff -Nru dde-calendar-5.9.1/calendar-client/src/customWidget/colorWidget/colorlabel.cpp dde-calendar-5.10.0/calendar-client/src/customWidget/colorWidget/colorlabel.cpp --- dde-calendar-5.9.1/calendar-client/src/customWidget/colorWidget/colorlabel.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/customWidget/colorWidget/colorlabel.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2020 ~ 2021 Uniontech Software Technology Co.,Ltd. - * - * Author: Ji XiangLong - * - * Maintainer: WangYu - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2020 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "colorlabel.h" #include diff -Nru dde-calendar-5.9.1/calendar-client/src/customWidget/colorWidget/colorlabel.h dde-calendar-5.10.0/calendar-client/src/customWidget/colorWidget/colorlabel.h --- dde-calendar-5.9.1/calendar-client/src/customWidget/colorWidget/colorlabel.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/customWidget/colorWidget/colorlabel.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2020 ~ 2021 Uniontech Software Technology Co.,Ltd. - * - * Author: Ji XiangLong - * - * Maintainer: WangYu - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2020 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef COLORLABEL_H #define COLORLABEL_H diff -Nru dde-calendar-5.9.1/calendar-client/src/customWidget/colorWidget/colorpickerWidget.cpp dde-calendar-5.10.0/calendar-client/src/customWidget/colorWidget/colorpickerWidget.cpp --- dde-calendar-5.9.1/calendar-client/src/customWidget/colorWidget/colorpickerWidget.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/customWidget/colorWidget/colorpickerWidget.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,21 +1,7 @@ -/* - * Copyright (C) 2017 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: liulibang - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "colorpickerWidget.h" #include "tabletconfig.h" @@ -89,6 +75,7 @@ mLayout->addWidget(m_colorSlider); m_wordLabel->setText(tr("Color")); + m_strColorLabel = m_wordLabel->text(); m_wordLabel->setFixedWidth(40); m_wordLabel->setAlignment(Qt::AlignVCenter | Qt::AlignLeft); m_colHexLineEdit->setClearButtonEnabled(false); //不显示清空按钮 @@ -116,13 +103,32 @@ btnLayout->addWidget(m_enterBtn); mLayout->addLayout(btnLayout); this->setLayout(mLayout); - + setLabelText(); this->setFocusPolicy(Qt::TabFocus); setTabOrder(m_colHexLineEdit, m_cancelBtn); setTabOrder(m_cancelBtn, m_enterBtn); setTabOrder(m_enterBtn, m_colorSlider); } +void CColorPickerWidget::setLabelText() { + QLocale local; + if(local.language() == QLocale::Chinese) { + return; + } + QString str = m_strColorLabel; + QFontMetrics fontMetrice(m_wordLabel->font()); + if(fontMetrice.width(str) > (m_wordLabel->width()+4)) { + str = fontMetrice.elidedText(str,Qt::ElideRight,m_wordLabel->width()); + } + m_wordLabel->setText(str); +} + +void CColorPickerWidget::changeEvent(QEvent *e) { + QWidget::changeEvent(e); + if(e->type() == QEvent::FontChange) { + setLabelText(); + } +} void CColorPickerWidget::slotHexLineEditChange(const QString &text) { QString lowerText = text.toLower(); @@ -168,4 +174,4 @@ } else { DAbstractDialog::keyPressEvent(e); } -} \ No newline at end of file +} diff -Nru dde-calendar-5.9.1/calendar-client/src/customWidget/colorWidget/colorpickerWidget.h dde-calendar-5.10.0/calendar-client/src/customWidget/colorWidget/colorpickerWidget.h --- dde-calendar-5.9.1/calendar-client/src/customWidget/colorWidget/colorpickerWidget.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/customWidget/colorWidget/colorpickerWidget.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,21 +1,7 @@ -/* - * Copyright (C) 2017 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: kirigaya - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef COLORPICKERWIDGET_H #define COLORPICKERWIDGET_H @@ -40,6 +26,7 @@ private: void initUI(); void setColorHexLineEdit(); + void setLabelText(); public slots: @@ -59,7 +46,7 @@ protected: void keyPressEvent(QKeyEvent *e) override; - + void changeEvent(QEvent *e) override; private: ColorLabel *m_colorLabel; ColorSlider *m_colorSlider; @@ -68,7 +55,7 @@ DLabel *m_wordLabel; DPushButton *m_cancelBtn; DPushButton *m_enterBtn; - + QString m_strColorLabel; QColor curColor; }; diff -Nru dde-calendar-5.9.1/calendar-client/src/customWidget/colorWidget/colorslider.cpp dde-calendar-5.10.0/calendar-client/src/customWidget/colorWidget/colorslider.cpp --- dde-calendar-5.9.1/calendar-client/src/customWidget/colorWidget/colorslider.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/customWidget/colorWidget/colorslider.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2020 ~ 2021 Uniontech Software Technology Co.,Ltd. - * - * Author: Ji XiangLong - * - * Maintainer: WangYu - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2020 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "colorslider.h" #include diff -Nru dde-calendar-5.9.1/calendar-client/src/customWidget/colorWidget/colorslider.h dde-calendar-5.10.0/calendar-client/src/customWidget/colorWidget/colorslider.h --- dde-calendar-5.9.1/calendar-client/src/customWidget/colorWidget/colorslider.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/customWidget/colorWidget/colorslider.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2020 ~ 2021 Uniontech Software Technology Co.,Ltd. - * - * Author: Ji XiangLong - * - * Maintainer: WangYu - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2020 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef COLORSLIDER_H #define COLORSLIDER_H diff -Nru dde-calendar-5.9.1/calendar-client/src/customWidget/cpushbutton.cpp dde-calendar-5.10.0/calendar-client/src/customWidget/cpushbutton.cpp --- dde-calendar-5.9.1/calendar-client/src/customWidget/cpushbutton.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/customWidget/cpushbutton.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,25 +1,9 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: leilong -* -* Maintainer: leilong -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "cpushbutton.h" -#include +#include #include #include #include @@ -44,7 +28,7 @@ m_iconButton->setFixedSize(16, 16); m_iconButton->setFlat(true); - DPalette palette = DPaletteHelper::instance()->palette(this); + DPalette palette = DApplicationHelper::instance()->palette(this); QPalette pa = m_textLabel->palette(); //设置深浅色主题下正常状态时的文本颜色,与下拉框颜色对其 @@ -94,28 +78,23 @@ void CPushButton::paintEvent(QPaintEvent *event) { QWidget::paintEvent(event); - DPalette palette = DPaletteHelper::instance()->palette(this); + DPalette palette = DApplicationHelper::instance()->palette(this); QPainter painter(this); // 反走样 painter.setRenderHint(QPainter::Antialiasing); painter.setPen(Qt::NoPen); + m_iconButton->setIcon(QIcon::fromTheme("dde_calendar_create")); if (m_Highlighted) { //背景设置为高亮色 + m_iconButton->setIcon(QIcon(":/icons/deepin/builtin/dark/icons/dde_calendar_create_32px.svg")); painter.setBrush(palette.highlight()); - m_textLabel->setBackgroundRole(QPalette::Highlight); - //高亮状态显示白色图片 - m_iconButton->setIcon(QIcon(DHiDPIHelper::loadNxPixmap(":/resources/icon/create_white.svg"))); + m_textLabel->setBackgroundRole(QPalette::Highlight); } else { //背景透明 painter.setBrush(QBrush("#00000000")); m_textLabel->setBackgroundRole(QPalette::Window); - //深色主题下只能是白色图片,浅色主题下显示黑色图片 - if (DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::DarkType) { - m_iconButton->setIcon(QIcon(DHiDPIHelper::loadNxPixmap(":/resources/icon/create_white.svg"))); - } else { - m_iconButton->setIcon(QIcon(DHiDPIHelper::loadNxPixmap(":/resources/icon/create_black.svg"))); - } + } //绘制背景 painter.drawRect(this->rect()); diff -Nru dde-calendar-5.9.1/calendar-client/src/customWidget/cpushbutton.h dde-calendar-5.10.0/calendar-client/src/customWidget/cpushbutton.h --- dde-calendar-5.9.1/calendar-client/src/customWidget/cpushbutton.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/customWidget/cpushbutton.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: leilong -* -* Maintainer: leilong -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef CPUSHBUTTON_H #define CPUSHBUTTON_H diff -Nru dde-calendar-5.9.1/calendar-client/src/customWidget/cradiobutton.cpp dde-calendar-5.10.0/calendar-client/src/customWidget/cradiobutton.cpp --- dde-calendar-5.9.1/calendar-client/src/customWidget/cradiobutton.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/customWidget/cradiobutton.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,25 +1,9 @@ -/* -* Copyright (C) 2019 ~ 2019 UnionTech Software Technology Co.,Ltd. -* -* Author: leilong -* -* Maintainer: leilong -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "cradiobutton.h" -#include +#include #include #include @@ -65,7 +49,7 @@ painter.setBrush(c); painter.drawPath(path); } else { - DPalette palette = DPaletteHelper::instance()->palette(this); + DPalette palette = DApplicationHelper::instance()->palette(this); QPainterPath path; path.addEllipse(0, 0, w, h); path.addEllipse(2, 2, w - 4, h - 4); diff -Nru dde-calendar-5.9.1/calendar-client/src/customWidget/cradiobutton.h dde-calendar-5.10.0/calendar-client/src/customWidget/cradiobutton.h --- dde-calendar-5.9.1/calendar-client/src/customWidget/cradiobutton.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/customWidget/cradiobutton.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2019 UnionTech Software Technology Co.,Ltd. -* -* Author: leilong -* -* Maintainer: leilong -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef CRADIOBUTTON_H #define CRADIOBUTTON_H diff -Nru dde-calendar-5.9.1/calendar-client/src/customWidget/ctimelineedit.cpp dde-calendar-5.10.0/calendar-client/src/customWidget/ctimelineedit.cpp --- dde-calendar-5.9.1/calendar-client/src/customWidget/ctimelineedit.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/customWidget/ctimelineedit.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,132 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "ctimelineedit.h" +#include +#include + +CTimeLineEdit::CTimeLineEdit(int id, QWidget *parent) : DSpinBox(parent) + , m_id(id) +{ + initView(); + connect(this, &CTimeLineEdit::editingFinished, this, &CTimeLineEdit::slotEditingFinished); + connect(this->lineEdit(), &QLineEdit::textEdited, this, &CTimeLineEdit::slotTextEdited); +} + +void CTimeLineEdit::initView() +{ + //启用嵌入式的样式 + setEnabledEmbedStyle(true); + // QString str = this->styleSheet(); + // this->setStyleSheet("QSpinBox:{background:transpaarent} QSpinBox::up-button{width:35px;}QSpinBox::down-button{width:35px;}"); + // this->setAlignment(Qt::AlignLeft); + // this->setFocusPolicy(Qt::FocusPolicy::NoFocus); + // this->lineEdit()->setStyleSheet("border:none;border-style:outset"); +} + +/** + * @brief CTimeLineEdit::setNumberRange + * 设置数字显示范围 + * @param min 最小大小 + * @param max 最大大小 + */ +void CTimeLineEdit::setRange(int min, int max) +{ + DSpinBox::setRange(min, max); +} + +/** + * @brief CTimeLineEdit::setStepEnabled + * 设置步状态 + * @param enable 状态 + */ +void CTimeLineEdit::setStepEnabled(CTimeLineEdit::StepEnabled enable) +{ + m_stepEnable = enable; +} + +/** + * @brief CTimeLineEdit::setNum + * 设置显示的值 + * @param num 带显示的值 + */ +void CTimeLineEdit::setNum(int num) +{ + m_num = num; + m_num = m_num > minimum()? m_num:minimum(); + m_num = m_num < maximum()? m_num:maximum(); + setValue(num); + emit signalNumChange(m_id, m_num); +} + +/** + * @brief CTimeLineEdit::setNum + * 设置显示的值 + * @param num 带显示的数字 + * @param canCarry true: 可以跳转, false: 不可以跳转 + */ +void CTimeLineEdit::setNum(int num, bool canCarry) +{ + if (!canCarry) { + setNum(num); + return; + } + + //若没有超过限制范围则不必发送时间跳转事件 + if (num >= minimum() && num <= maximum()) { + m_num = num; + setValue(m_num); + emit signalNumChange(m_id, m_num); + return; + } + + //发送时间跳转信号, num-m_num: 时间差 + emit signalDateJump(m_id, num - m_num); +} + +void CTimeLineEdit::slotEditingFinished() +{ + setNum(value()); +} + +void CTimeLineEdit::slotTextEdited(const QString &text) +{ + //过滤掉非数字字符 + QString value = ""; + for (QChar c : text) { + if ('0' <= c && c <= '9') { + value.append(c); + } + } + //借用字符串转整数策略使其剩余字符都符合数字规范,包括无前置0等 + int v = value.toInt(); + + //保存光标位置,因为存在删减字符,且被删减的字符只能是在首位,因此不直接记录光标绝对位置,而是保存当前光标位置与最后位置的相对位置 + int len = text.length() - lineEdit()->cursorPosition(); + lineEdit()->setText(v == 0 ? "" : QString::number(v)); + //恢复光标位置 + lineEdit()->setCursorPosition(lineEdit()->text().length() - len); +} + +/** + * @brief CTimeLineEdit::stepEnabled + * 因考虑到数字可以进位和退位,不存在真实的数字变化限制,因此返回up和down状态都可用 + * @return + */ +CTimeLineEdit::StepEnabled CTimeLineEdit::stepEnabled() const +{ + return m_stepEnable; +} + +/** + * @brief CTimeLineEdit::stepBy + * 捕捉步长跳转事件,进行对数字变化的自定义 + * @param steps 步长(数字变化后应为的值与变化前的值的差值) + */ +void CTimeLineEdit::stepBy(int steps) +{ + setNum(value() + steps, true); + //因为已自定义处理步长,因此再次调用父类的方法实现默认效果,并将其步长传入0 + DSpinBox::stepBy(0); +} diff -Nru dde-calendar-5.9.1/calendar-client/src/customWidget/ctimelineedit.h dde-calendar-5.10.0/calendar-client/src/customWidget/ctimelineedit.h --- dde-calendar-5.9.1/calendar-client/src/customWidget/ctimelineedit.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/customWidget/ctimelineedit.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,55 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef CTIMELINEEDIT_H +#define CTIMELINEEDIT_H + +#include + +DWIDGET_USE_NAMESPACE + +//时间数字编辑器 +class CTimeLineEdit : public DSpinBox +{ + Q_OBJECT +public: + explicit CTimeLineEdit(int id = 0, QWidget *parent = nullptr); + + //设置控件数字,值将被限制在临界值范围内 + void setNum(int num); + //设置控件数字,如果canCaryy为true且超过临界值将进行自动跳转时间 + void setNum(int num, bool canCarry); + //设置数字显示范围 + void setRange(int min, int max); + //设置步状态 + void setStepEnabled(CTimeLineEdit::StepEnabled); + +signals: + //数字改变信号 + void signalNumChange(int id, int num); + //时间跳转信号 + void signalDateJump(int id, int num); + +public slots: + //编辑完成事件 + void slotEditingFinished(); + //编辑框编辑事件 + void slotTextEdited(const QString &value); + +protected: + //重写步状态 + StepEnabled stepEnabled() const override; + //重写步事件 + void stepBy(int steps) override; + +private: + void initView(); + +private: + int m_num = 0; //当前显示的数字 + const int m_id = 0; //控件id + CTimeLineEdit::StepEnabled m_stepEnable = CTimeLineEdit::StepUpEnabled|CTimeLineEdit::StepDownEnabled; +}; + +#endif // CTIMELINEEDIT_H diff -Nru dde-calendar-5.9.1/calendar-client/src/customWidget/ctitlewidget.cpp dde-calendar-5.10.0/calendar-client/src/customWidget/ctitlewidget.cpp --- dde-calendar-5.9.1/calendar-client/src/customWidget/ctitlewidget.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/customWidget/ctitlewidget.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,26 +1,11 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "ctitlewidget.h" #include "constants.h" +#include "configsettings.h" #include @@ -32,6 +17,11 @@ CTitleWidget::CTitleWidget(QWidget *parent) : QWidget(parent) { + m_sidebarIcon = new DIconButton(this); + m_sidebarIcon->setFixedSize(QSize(36, 36)); + m_sidebarIcon->setIconSize(QSize(19, 15)); + connect(m_sidebarIcon, &DIconButton::clicked, this, &CTitleWidget::slotSidebarIconClicked); + m_buttonBox = new CButtonBox(this); m_buttonBox->setObjectName("ButtonBox"); m_buttonBox->setAccessibleName("ButtonBox"); @@ -99,6 +89,10 @@ m_searchEdit->setFixedHeight(36); m_searchEdit->setFont(viewfont); m_searchEdit->lineEdit()->installEventFilter(this); + m_searchEdit->setPlaceHolder(tr("Search events and festivals")); + m_searchEdit->setPlaceholderText(tr("Search events and festivals")); + + m_strPlaceHolder = m_searchEdit->placeholderText(); connect(m_searchEdit, &DSearchEdit::searchAborted, [&] { //搜索框关闭按钮,清空数据 slotSearchEditFocusChanged(false); @@ -122,6 +116,8 @@ { QHBoxLayout *layout = new QHBoxLayout; layout->setContentsMargins(0, 0, 0, 0); + layout->addWidget(m_sidebarIcon, Qt::AlignLeft); + layout->addSpacing(4); layout->addWidget(m_buttonBox, Qt::AlignLeft); layout->addStretch(); layout->addWidget(m_searchEdit, Qt::AlignCenter); @@ -135,8 +131,8 @@ layout->addWidget(leftWidget); layout->addWidget(m_newScheduleBtn, Qt::AlignRight); this->setLayout(layout); - //设置焦点代理为buttonBox - setFocusProxy(m_buttonBox); + //设置焦点代理为m_sidebarIcon + setFocusProxy(m_sidebarIcon); } void CTitleWidget::setShowState(CTitleWidget::Title_State state) @@ -145,6 +141,26 @@ stateUpdate(); } +void CTitleWidget::setSidebarStatus(bool status) +{ + m_sidebarstatus = status; + updateSidebarIconStatus(); + m_clickShowLeft = status; + emit signalSidebarStatusChange(m_sidebarstatus & m_sidebarCanDisplay); + //将状态保存在配置文件中 + gSetting->setUserSidebarStatus(status); +} + +void CTitleWidget::setSidebarCanDisplay(bool can) +{ + m_sidebarCanDisplay = can; +} + +bool CTitleWidget::getSidevarStatus() +{ + return m_sidebarstatus; +} + DButtonBox *CTitleWidget::buttonBox() const { return m_buttonBox; @@ -180,7 +196,6 @@ m_buttonBox->show(); m_searchPush->hide(); normalStateUpdateSearchEditWidth(); - setFocusProxy(m_buttonBox); } break; } } @@ -191,8 +206,9 @@ m_searchPush->hide(); m_searchEdit->setMaximumWidth(width()); m_searchEdit->show(); - //取消焦点代理 - setFocusProxy(nullptr); + + m_searchEdit->setPlaceHolder(m_strPlaceHolder); + m_searchEdit->setPlaceholderText(m_strPlaceHolder); } void CTitleWidget::normalStateUpdateSearchEditWidth() @@ -207,6 +223,13 @@ searchWidth = 354; } m_searchEdit->setMaximumWidth(searchWidth); + m_searchEdit->setPlaceHolder(m_strPlaceHolder); + m_searchEdit->setPlaceholderText(m_strPlaceHolder); +} + +void CTitleWidget::updateSidebarIconStatus() +{ + m_sidebarIcon->setIcon(QIcon::fromTheme("dde_calendar_sidebar")); } void CTitleWidget::resizeEvent(QResizeEvent *event) @@ -215,6 +238,39 @@ if (m_showState == Title_State_Normal) { normalStateUpdateSearchEditWidth(); } + QString str = m_strPlaceHolder; + QFontMetrics fontMetrice(m_searchEdit->font()); + if (fontMetrice.width(str) > (m_searchEdit->width() - 30) && m_clickShowLeft == false && !m_buttonBox->isHidden()) { + str = fontMetrice.elidedText(str, Qt::ElideRight, m_searchEdit->width() - 30); + m_searchEdit->setPlaceHolder(str); + m_searchEdit->setPlaceholderText(str); + } else { + m_searchEdit->setPlaceHolder(m_strPlaceHolder); + m_searchEdit->setPlaceholderText(m_strPlaceHolder); + m_clickShowLeft = false; + } +} + +void CTitleWidget::changeEvent(QEvent *e) +{ + QWidget::changeEvent(e); + if (e->type() == QEvent::FontChange) { + updateSearchEditPlaceHolder(); + } +} + +void CTitleWidget::updateSearchEditPlaceHolder() +{ + QString str = m_strPlaceHolder; + QFontMetrics fontMetrice(m_searchEdit->font()); + if (fontMetrice.width(str) > (m_searchEdit->width() - 30)) { + str = fontMetrice.elidedText(str, Qt::ElideRight, m_searchEdit->width() - 30); + m_searchEdit->setPlaceHolder(str); + m_searchEdit->setPlaceholderText(str); + } else { + m_searchEdit->setPlaceHolder(m_strPlaceHolder); + m_searchEdit->setPlaceholderText(m_strPlaceHolder); + } } bool CTitleWidget::eventFilter(QObject *o, QEvent *e) @@ -236,7 +292,7 @@ } //根据焦点离开原因,决定是否隐藏搜索框 if (focusOutEvent->reason() == Qt::TabFocusReason - || focusOutEvent->reason() == Qt::MouseFocusReason) { + || focusOutEvent->reason() == Qt::MouseFocusReason) { slotSearchEditFocusChanged(false); } } @@ -248,6 +304,7 @@ { miniStateShowSearchEdit(); m_searchEdit->setFocus(); + } void CTitleWidget::slotSearchEditFocusChanged(bool onFocus) @@ -261,6 +318,14 @@ m_buttonBox->show(); m_searchEdit->hide(); m_searchPush->show(); - setFocusProxy(m_buttonBox); } } + +void CTitleWidget::slotSidebarIconClicked() +{ + //获取当前侧边栏显示状态 + bool display = m_sidebarCanDisplay & m_sidebarstatus; + //点击按钮后侧边栏状态重新恢复为可显示状态 + m_sidebarCanDisplay = true; + setSidebarStatus(!display); //切换显示状态 +} diff -Nru dde-calendar-5.9.1/calendar-client/src/customWidget/ctitlewidget.h dde-calendar-5.10.0/calendar-client/src/customWidget/ctitlewidget.h --- dde-calendar-5.9.1/calendar-client/src/customWidget/ctitlewidget.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/customWidget/ctitlewidget.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef CTITLEWIDGET_H #define CTITLEWIDGET_H @@ -44,6 +28,11 @@ * @param state */ void setShowState(Title_State state); + //设置侧边栏状态,status:显示状态 + void setSidebarStatus(bool status); + void setSidebarCanDisplay(bool can); + + bool getSidevarStatus(); DButtonBox *buttonBox() const; @@ -67,12 +56,22 @@ */ void normalStateUpdateSearchEditWidth(); + /** + * @brief updateSidebarIconStatus + * 更新侧边栏控制图标按钮的状态 + */ + void updateSidebarIconStatus(); + void updateSearchEditPlaceHolder(); + protected: void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE; bool eventFilter(QObject *o, QEvent *e) override; + void changeEvent(QEvent *e) override; signals: void signalSetButtonFocus(); void signalSearchFocusSwitch(); + //侧边栏状态发生改变 + void signalSidebarStatusChange(bool); public slots: /** * @brief slotShowSearchEdit 搜索按钮点击下切换搜索框 @@ -84,12 +83,20 @@ */ void slotSearchEditFocusChanged(bool onFocus); + void slotSidebarIconClicked(); + private: + bool m_sidebarstatus = true; //侧边栏状态 + bool m_sidebarCanDisplay = true; //侧边栏状态 + + DIconButton *m_sidebarIcon {nullptr}; //侧边栏状态控制按钮 CButtonBox *m_buttonBox {nullptr}; DSearchEdit *m_searchEdit {nullptr}; DIconButton *m_newScheduleBtn {nullptr}; //全局的新建日程按钮 DIconButton *m_searchPush {nullptr}; + QString m_strPlaceHolder; Title_State m_showState {Title_State_Normal}; + bool m_clickShowLeft = false; }; #endif // CTITLEWIDGET_H diff -Nru dde-calendar-5.9.1/calendar-client/src/customWidget/customframe.cpp dde-calendar-5.10.0/calendar-client/src/customWidget/customframe.cpp --- dde-calendar-5.9.1/calendar-client/src/customWidget/customframe.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/customWidget/customframe.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "customframe.h" #include "constants.h" diff -Nru dde-calendar-5.9.1/calendar-client/src/customWidget/customframe.h dde-calendar-5.10.0/calendar-client/src/customWidget/customframe.h --- dde-calendar-5.9.1/calendar-client/src/customWidget/customframe.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/customWidget/customframe.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef CustomFrame_H #define CustomFrame_H diff -Nru dde-calendar-5.9.1/calendar-client/src/customWidget/cweekwidget.cpp dde-calendar-5.10.0/calendar-client/src/customWidget/cweekwidget.cpp --- dde-calendar-5.9.1/calendar-client/src/customWidget/cweekwidget.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/customWidget/cweekwidget.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,82 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "cweekwidget.h" +#include "calendarmanage.h" +#include "constants.h" +#include +#include + +CWeekWidget::CWeekWidget(QWidget *parent) : QPushButton(parent) + , m_firstDay(CalendarManager::getInstance()->getFirstDayOfWeek()) +{ + setMinimumHeight(10); + setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); + setFocusPolicy(Qt::NoFocus); +} + +void CWeekWidget::setFirstDay(Qt::DayOfWeek first) +{ + m_firstDay = first; + setAutoFirstDay(true); +} + +void CWeekWidget::setAutoFirstDay(bool is) +{ + m_autoFirstDay = is; +} + +void CWeekWidget::setAutoFontSizeByWindow(bool is) +{ + m_autoFontSizeByWindow = is; +} + +void CWeekWidget::paintEvent(QPaintEvent *event) +{ + QWidget::paintEvent(event); + QPainter painter(this); + painter.setRenderHint(QPainter::Antialiasing); + + QFont font; + + if (m_autoFontSizeByWindow) { + //字体跟随界面大小 + qreal w = this->width() / 7; + qreal h = this->height(); + qreal r = w > h ? h : w ; + + if (QLocale::system().language() == QLocale::English) { + r*=0.8; + } + + //根据高度和宽度设置时间字体的大小 + + font.setPixelSize(int(r/20.0*12)); + + } else { + font.setPixelSize(DDECalendar::FontSizeTwelve); + } + + painter.setFont(font); + + QLocale locale; + qreal setp = (width())/7.0; + //获取一周首日 + int firstDay = m_firstDay; + if (m_autoFirstDay) { + firstDay = CalendarManager::getInstance()->getFirstDayOfWeek(); + } + + QStringList weekStr; + weekStr << tr("Sun") << tr("Mon") << tr("Tue") << tr("Wed") << tr("Thu") << tr("Fri") << tr("Sat"); + + //绘制周一到周日 + for (int i = Qt::Monday; i <= Qt::Sunday; ++i) { + int index = (firstDay + i - Qt::Monday) % Qt::Sunday; + + QString text = weekStr[index]; + QRectF rect((i-Qt::Monday)*setp, 0, setp, height()); + painter.drawText(rect, Qt::AlignCenter, text); + } +} diff -Nru dde-calendar-5.9.1/calendar-client/src/customWidget/cweekwidget.h dde-calendar-5.10.0/calendar-client/src/customWidget/cweekwidget.h --- dde-calendar-5.9.1/calendar-client/src/customWidget/cweekwidget.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/customWidget/cweekwidget.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,37 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef CWEEKWIDGET_H +#define CWEEKWIDGET_H + +#include + +class CWeekWidget : public QPushButton +{ + Q_OBJECT +public: + explicit CWeekWidget(QWidget *parent = nullptr); + + //设置一周首日 + void setFirstDay(Qt::DayOfWeek); + //设置是否根据配置自动设置 + void setAutoFirstDay(bool); + //设置字体大小是否跟随界面大小 + void setAutoFontSizeByWindow(bool); + +signals: + +public slots: + +protected: + void paintEvent(QPaintEvent *event) override; + +private: + bool m_autoFirstDay = true; //是否根据配置自动设置 + bool m_autoFontSizeByWindow = true; //字体大小是否跟随界面大小 + + Qt::DayOfWeek m_firstDay = Qt::Monday; //一周首日 +}; + +#endif // CWEEKWIDGET_H diff -Nru dde-calendar-5.9.1/calendar-client/src/customWidget/jobtypecombobox.cpp dde-calendar-5.10.0/calendar-client/src/customWidget/jobtypecombobox.cpp --- dde-calendar-5.9.1/calendar-client/src/customWidget/jobtypecombobox.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/customWidget/jobtypecombobox.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,27 +1,10 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: leilong -* -* Maintainer: leilong -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "jobtypecombobox.h" #include -#include #include #include @@ -39,6 +22,7 @@ setAutoCompletion(false); //设置不接受回车键插入 setInsertPolicy(QComboBox::NoInsert); + this->view()->setTextElideMode(Qt::ElideRight); connect(this, QOverload::of(&QComboBox::highlighted), [this](int index) { view()->setFocus(); m_hoverSelectedIndex = index; @@ -50,18 +34,18 @@ return; } -int JobTypeComboBox::getCurrentJobTypeNo() +QString JobTypeComboBox::getCurrentJobTypeNo() { if (this->currentIndex() < 0 || this->currentIndex() >= m_lstJobType.size()) { - return -1; + return QString(); } - return m_lstJobType[this->currentIndex()].getJobTypeNo(); + return m_lstJobType[this->currentIndex()]->typeID(); } -void JobTypeComboBox::setCurrentJobTypeNo(int strJobTypeNo) +void JobTypeComboBox::setCurrentJobTypeNo(const QString &strJobTypeNo) { for (int i = 0; i < m_lstJobType.size(); i++) { - if (strJobTypeNo == m_lstJobType[i].getJobTypeNo()) { + if (strJobTypeNo == m_lstJobType[i]->typeID()) { this->setCurrentIndex(i); break; } @@ -116,26 +100,42 @@ return m_newPos; } -bool JobTypeComboBox::updateJobType() +void JobTypeComboBox::updateJobType(const AccountItem::Ptr& account) { - QString strColorHex; - QString strJobType; + if (nullptr == account) { + return; + } - m_lstJobType = JobTypeInfoManager::instance()->getJobTypeList(); + //将自定义控件内存是否并置空,保存初始展示时能够进入高度调整 + if (m_customWidget) { + m_addBtn->deleteLater(); + m_customWidget->deleteLater(); + m_addBtn = nullptr; + m_customWidget = nullptr; + } + //切换账号重置选项后需重置view的高度限制和大小策略,使其在初次显示时能跟随列表项数量动态调整高度 + QFrame *viewContainer = findChild(); + if (viewContainer) { + viewContainer->setMinimumHeight(0); + viewContainer->setMaximumHeight(16777215); + viewContainer->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); + } + + //保存现场 + bool isEnit = isEditable(); + QString text = currentText(); + m_lstJobType = account->getScheduleTypeList(); clear(); //更新前先清空原有列表 for (m_itemNumIndex = 0; m_itemNumIndex < m_lstJobType.size(); m_itemNumIndex++) { - strColorHex = m_lstJobType[m_itemNumIndex].getColorHex(); - strJobType = m_lstJobType[m_itemNumIndex].getJobTypeName(); - - if (strColorHex.isEmpty() || strJobType.isEmpty()) { - m_lstJobType.removeAt(m_itemNumIndex); - m_itemNumIndex--; - continue; - } - addJobTypeItem(m_itemNumIndex, m_lstJobType[m_itemNumIndex].getColorHex(), m_lstJobType[m_itemNumIndex].getJobTypeName()); + addJobTypeItem(m_itemNumIndex, m_lstJobType[m_itemNumIndex]->getColorCode(), m_lstJobType[m_itemNumIndex]->displayName()); } - return true; + //数据重置后hover标识重置为-1 + m_hoverSelectedIndex = -1; + //恢复原状 + setEditable(isEnit); + setCurrentText(text); + } void JobTypeComboBox::addJobTypeItem(int idx, QString strColorHex, QString strJobType) @@ -235,6 +235,7 @@ //获取下拉视图容器 QFrame *viewContainer = findChild(); + if (nullptr == m_customWidget) { //添加自定义布局 addCustomWidget(viewContainer); @@ -277,6 +278,7 @@ //列表框到达最后一项时的下方向按键按下事件 //将焦点转移到“添加按键”控件上 m_addBtn->setFocus(); + } } else if (m_addBtn == obj && kEvent->key() == Qt::Key_Up) { //焦点在m_addBtn时的上方向按键按下事件 diff -Nru dde-calendar-5.9.1/calendar-client/src/customWidget/jobtypecombobox.h dde-calendar-5.10.0/calendar-client/src/customWidget/jobtypecombobox.h --- dde-calendar-5.9.1/calendar-client/src/customWidget/jobtypecombobox.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/customWidget/jobtypecombobox.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,29 +1,14 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: leilong -* -* Maintainer: leilong -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef JOBTYPECOMBOBOX_H #define JOBTYPECOMBOBOX_H -#include "src/scheduledatainfo.h" +#include "dschedule.h" #include "scheduledatamanage.h" #include "cpushbutton.h" +#include "accountmanager.h" #include #include @@ -36,9 +21,9 @@ public: explicit JobTypeComboBox(QWidget *parent = nullptr); ~JobTypeComboBox() override; - bool updateJobType(); - int getCurrentJobTypeNo(); - void setCurrentJobTypeNo(int strJobTypeNo); + void updateJobType(const AccountItem::Ptr&); + QString getCurrentJobTypeNo(); + void setCurrentJobTypeNo(const QString &strJobTypeNo); void setAlert(bool isAlert); bool isAlert() const; @@ -73,7 +58,7 @@ private: QWidget *m_customWidget {nullptr}; CPushButton *m_addBtn {nullptr}; - QList m_lstJobType; + DScheduleType::List m_lstJobType; int m_hoverSelectedIndex = -1; //鼠标悬停的选项下标 int m_itemNumIndex = 0; //item数量 DAlertControl *m_control {nullptr}; diff -Nru dde-calendar-5.9.1/calendar-client/src/customWidget/jobtypelistview.cpp dde-calendar-5.10.0/calendar-client/src/customWidget/jobtypelistview.cpp --- dde-calendar-5.9.1/calendar-client/src/customWidget/jobtypelistview.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/customWidget/jobtypelistview.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,16 +1,20 @@ +// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "jobtypelistview.h" #include "cscheduleoperation.h" #include "scheduletypeeditdlg.h" #include "schedulectrldlg.h" +#include "accountmanager.h" #include #include #include - +#include #include #include -Q_DECLARE_METATYPE(JobTypeInfo) //Qt::UserRole + 1,会影响item的高度 static const int RoleJobTypeInfo = Qt::UserRole + 2; static const int RoleJobTypeEditable = Qt::UserRole + 3; @@ -23,7 +27,7 @@ JobTypeListView::~JobTypeListView() { - JobTypeInfoManager::instance()->removeFromNoticeBill(this); +// JobTypeInfoManager::instance()->removeFromNoticeBill(this); } void JobTypeListView::initUI() @@ -36,7 +40,7 @@ setFocusPolicy(Qt::NoFocus); setItemDelegate(new JobTypeListViewStyle(this)); setShowGrid(false); - + setMouseTracking(true); verticalHeader()->setMinimumSectionSize(0); horizontalHeader()->setStretchLastSection(true); horizontalHeader()->hide(); @@ -44,8 +48,15 @@ // updateJobType(); - //添加到通知单列表 - JobTypeInfoManager::instance()->addToNoticeBill(this, "updateJobType"); + connect(gAccountManager, &AccountManager::signalScheduleTypeUpdate, this, &JobTypeListView::updateJobType); + connect(this, &QTableView::entered, this, [&](const QModelIndex & index) { + if (!index.isValid()) return; + DScheduleType info = index.data(RoleJobTypeInfo).value(); + QString displayName = info.displayName(); + if (!displayName.isEmpty()) { + QToolTip::showText(QCursor::pos(), info.displayName()); + } + }); } bool JobTypeListView::viewportEvent(QEvent *event) @@ -69,8 +80,13 @@ a->setVisible(false); } m_iIndexCurrentHover = -1; - } else if (QEvent::HoverMove == event->type()) { + } else if (QEvent::HoverEnter == event->type() || QEvent::HoverMove == event->type()) { + QStandardItemModel *itemModel = qobject_cast(model()); + if (nullptr == itemModel) { + return true; + } indexCurrentHover = indexAt(static_cast(event)->pos()).row(); + if (indexCurrentHover != m_iIndexCurrentHover) { DStandardItem *itemJobType; @@ -106,12 +122,12 @@ if (!itemJobType->data(RoleJobTypeEditable).toBool()) return true; auto actionEdit = new DViewItemAction(Qt::AlignVCenter, QSize(20, 20), QSize(20, 20), true); - actionEdit->setIcon(DHiDPIHelper::loadNxPixmap(":/resources/icon/edit.svg")); + actionEdit->setIcon(DHiDPIHelper::loadNxPixmap(":/icons/deepin/builtin/icons/dde_calendar_edit_32px.svg")); actionEdit->setParent(this); connect(actionEdit, &QAction::triggered, this, &JobTypeListView::slotUpdateJobType); auto actionDelete = new DViewItemAction(Qt::AlignVCenter, QSize(20, 20), QSize(20, 20), true); - actionDelete->setIcon(DHiDPIHelper::loadNxPixmap(":/resources/icon/delete.svg")); + actionDelete->setIcon(DHiDPIHelper::loadNxPixmap(":/icons/deepin/builtin/icons/dde_calendar_delete_32px.svg")); actionDelete->setParent(this); connect(actionDelete, &QAction::triggered, this, &JobTypeListView::slotDeleteJobType); @@ -124,12 +140,16 @@ } bool JobTypeListView::updateJobType() { + AccountItem::Ptr account = gAccountManager->getAccountItemByAccountId(m_account_id); + if (!account) + return false; m_modelJobType->removeRows(0, m_modelJobType->rowCount());//先清理 m_iIndexCurrentHover = -1; - QList lstJobType = JobTypeInfoManager::instance()->getJobTypeList(); + + DScheduleType::List lstJobType = account->getScheduleTypeList(); int viewHeight = 0; for (int i = 0; i < lstJobType.size(); i++) { - viewHeight += addJobTypeItem(lstJobType[i]); + viewHeight += addJobTypeItem(*lstJobType[i]); } setFixedHeight(viewHeight); @@ -137,24 +157,60 @@ return true; } +void JobTypeListView::updateCalendarAccount(QString account_id) +{ + m_account_id = account_id; + updateJobType(); +} + +void JobTypeListView::slotAddScheduleType() +{ + AccountItem::Ptr account = gAccountManager->getAccountItemByAccountId(m_account_id); + if (!account) + return; + + ScheduleTypeEditDlg dialog(this); + dialog.setAccount(account); + //按保存键退出则触发保存数据 + if (QDialog::Accepted == dialog.exec()) { + DScheduleType::Ptr type(new DScheduleType(dialog.newJsonType())); + account->createJobType(type); + } +} + bool JobTypeListView::canAdd() { + AccountItem::Ptr account = gAccountManager->getAccountItemByAccountId(m_account_id); + if (!account) + return false; + //最多20个类型 - return JobTypeInfoManager::instance()->getJobTypeList().count() < 20; + return account->getScheduleTypeList().count() < 20; } -int JobTypeListView::addJobTypeItem(const JobTypeInfo &info) +void JobTypeListView::setItemEnabled(bool b) +{ + if (!m_modelJobType) return; + + for (int i = 0; i < m_modelJobType->rowCount(); ++i) { + QStandardItem *item = m_modelJobType->item(i); + item->setEnabled(b); + } +} + +int JobTypeListView::addJobTypeItem(const DScheduleType &info) { int itemHeight = 0; DStandardItem *item = new DStandardItem; item->setData(QVariant::fromValue(info), RoleJobTypeInfo); - item->setData(info.getAuthority() > 1, RoleJobTypeEditable); + //根据日程类型权限设置显示数据 + item->setData(info.privilege() > 1, RoleJobTypeEditable); item->setData(false, RoleJobTypeLine); //首个 非默认日程类型,前面 添加分割线 if (m_modelJobType->rowCount() > 1 - && !m_modelJobType->item(m_modelJobType->rowCount() - 1)->data(RoleJobTypeEditable).toBool() - && item->data(RoleJobTypeEditable).toBool()) { + && !m_modelJobType->item(m_modelJobType->rowCount() - 1)->data(RoleJobTypeEditable).toBool() + && item->data(RoleJobTypeEditable).toBool()) { DStandardItem *itemLine = new DStandardItem; itemLine->setData(QVariant(), RoleJobTypeInfo); itemLine->setData(false, RoleJobTypeEditable); @@ -178,12 +234,21 @@ QStandardItem *item = m_modelJobType->item(index); if (!item) return; + AccountItem::Ptr account = gAccountManager->getAccountItemByAccountId(m_account_id); + if (!account) + return; - JobTypeInfo info = item->data(RoleJobTypeInfo).value(); - ScheduleTypeEditDlg a(info, this); - a.exec(); - updateJobType();//更新item - return; + DScheduleType info = item->data(RoleJobTypeInfo).value(); + ScheduleTypeEditDlg dialog(info, this); + dialog.setAccount(account); + if (QDialog::Accepted == dialog.exec()) { + DScheduleType::Ptr type(new DScheduleType(dialog.newJsonType())); + if (type->typeID() == "0") { + account->createJobType(type); + } else { + account->updateScheduleType(type); + } + } } void JobTypeListView::slotDeleteJobType() @@ -191,12 +256,16 @@ DStandardItem *item = dynamic_cast(m_modelJobType->item(m_iIndexCurrentHover)); if (!item) return; + AccountItem::Ptr account = gAccountManager->getAccountItemByAccountId(m_account_id); + if (!account) + return; - JobTypeInfo info = item->data(RoleJobTypeInfo).value(); - int typeNo = info.getJobTypeNo(); + DScheduleType info = item->data(RoleJobTypeInfo).value(); + //TODO:获取日程编号 + QString typeNo = info.typeID(); - CScheduleOperation so; - if (so.isJobTypeUsed(typeNo)) { + //TODO:根据帐户获取对应信息 + if (account->scheduleTypeIsUsed(typeNo)) { CScheduleCtrlDlg msgBox(this); msgBox.setText(tr("You are deleting an event type.")); msgBox.setInformativeText(tr("All events under this type will be deleted and cannot be recovered.")); @@ -206,10 +275,11 @@ if (msgBox.clickButton() == 0) { return; } else if (msgBox.clickButton() == 1) { - so.deleteJobType(typeNo); //删除日程类型时,后端会删除关联日程 + //删除日程类型时,后端会删除关联日程 + account->deleteScheduleTypeByID(typeNo); } } else { - so.deleteJobType(typeNo); + account->deleteScheduleTypeByID(typeNo); } } @@ -229,25 +299,39 @@ } opt.rect.adjust(0, 5, 0, -5); DStyledItemDelegate::paint(painter, opt, index); - JobTypeInfo info = index.data(RoleJobTypeInfo).value(); + DScheduleType info = index.data(RoleJobTypeInfo).value(); //draw icon painter->save(); painter->setPen(QPen(QColor(0, 0, 0, int(255 * 0.1)), 2)); - painter->setBrush(QColor(info.getColorHex())); + painter->setBrush(QColor(info.typeColor().colorCode())); painter->drawEllipse(QRect(opt.rect.x() + 12, opt.rect.y() + 10, 16, 16)); //draw text + painter->setPen(qApp->palette().color(QPalette::Text)); QFontMetrics fontMetr(painter->font()); - const int &typeNameWidth = fontMetr.width(info.getJobTypeName()); - //绘制类型名称区域 - QRect textRect = opt.rect.adjusted(38, 0, 0, 0); //如果为焦点,且不为系统自带颜色 - if (opt.state & QStyle::State_HasFocus && !info.getColorInfo().isSysColorInfo()) { + if (opt.state & QStyle::State_HasFocus && !info.typeColor().isSysColorInfo()) { + } + + JobTypeListView *view = qobject_cast(parent()); + //如果当前的index为hover状态则空出图标位置 + QString displayName = info.displayName(); + // 获取当前字体的信息 + QFontMetrics fontMetrics(opt.font); + // 当前文字长度是否大于显示框长度 + if (fontMetrics.width(displayName) > (opt.rect.width() - 90)) { + displayName = fontMetrics.elidedText(displayName, Qt::ElideRight, opt.rect.width() - 90); // 截取字符串长度用...代替 } - painter->drawText(opt.rect.adjusted(38, 0, 0, 0), Qt::AlignVCenter | Qt::AlignLeft, info.getJobTypeName()); + if (view && view->m_iIndexCurrentHover == index.row()) { + painter->drawText(opt.rect.adjusted(38, 0, -10, 0), Qt::AlignVCenter | Qt::AlignLeft, displayName); + } else { + painter->drawText(opt.rect.adjusted(38, 0, -10, 0), Qt::AlignVCenter | Qt::AlignLeft, displayName); + } + painter->restore(); } + diff -Nru dde-calendar-5.9.1/calendar-client/src/customWidget/jobtypelistview.h dde-calendar-5.10.0/calendar-client/src/customWidget/jobtypelistview.h --- dde-calendar-5.9.1/calendar-client/src/customWidget/jobtypelistview.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/customWidget/jobtypelistview.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,7 +1,13 @@ -#ifndef JOBTYPELISTVIEW_H +// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef JOBTYPELISTVIEW_H #define JOBTYPELISTVIEW_H #include "scheduledatamanage.h" +#include "daccount.h" +#include "accountitem.h" #include #include @@ -12,6 +18,7 @@ DWIDGET_USE_NAMESPACE +class JobTypeListViewStyle; class JobTypeListView : public QTableView { Q_OBJECT @@ -23,15 +30,19 @@ * @brief canAdd 是否可以继续新增类型 */ bool canAdd(); + + void setItemEnabled(bool b); + protected: bool viewportEvent(QEvent *event) override; + private: void initUI();//初始化 /** * @brief addJobTypeItem 添加item * @return 返回item的高度 */ - int addJobTypeItem(const JobTypeInfo &info);//新增一行【日程类型】数据 + int addJobTypeItem(const DScheduleType &info); //新增一行【日程类型】数据 signals: /** @@ -41,11 +52,18 @@ public slots: void slotUpdateJobType(); void slotDeleteJobType(); + void slotAddScheduleType(); + bool updateJobType(); + void updateCalendarAccount(QString account_id); private: QStandardItemModel *m_modelJobType {nullptr}; int m_iIndexCurrentHover = -1; + + friend JobTypeListViewStyle; + + QString m_account_id; }; class JobTypeListViewStyle : public DStyledItemDelegate diff -Nru dde-calendar-5.9.1/calendar-client/src/customWidget/labelwidget.cpp dde-calendar-5.10.0/calendar-client/src/customWidget/labelwidget.cpp --- dde-calendar-5.9.1/calendar-client/src/customWidget/labelwidget.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/customWidget/labelwidget.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "labelwidget.h" #include #include diff -Nru dde-calendar-5.9.1/calendar-client/src/customWidget/labelwidget.h dde-calendar-5.10.0/calendar-client/src/customWidget/labelwidget.h --- dde-calendar-5.9.1/calendar-client/src/customWidget/labelwidget.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/customWidget/labelwidget.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef LABELWIDGET_H #define LABELWIDGET_H diff -Nru dde-calendar-5.9.1/calendar-client/src/customWidget/lunarcalendarwidget.cpp dde-calendar-5.10.0/calendar-client/src/customWidget/lunarcalendarwidget.cpp --- dde-calendar-5.9.1/calendar-client/src/customWidget/lunarcalendarwidget.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/customWidget/lunarcalendarwidget.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,29 +1,13 @@ -/* -* Copyright (C) 2019 ~ 2019 UnionTech Software Technology Co.,Ltd. -* -* Author: changze -* -* Maintainer: changze -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "lunarcalendarwidget.h" -#include "cscheduledbus.h" +#include "lunarmanager.h" #include #include -#include +#include #include #include @@ -109,7 +93,7 @@ QColor CalenderStyle::getColor(const QStyleOption *option, DPalette::ColorType type, const QWidget *widget) const { - const DPalette &pa = DPaletteHelper::instance()->palette(widget, option->palette); + const DPalette &pa = DApplicationHelper::instance()->palette(widget, option->palette); return pa.brush(type).color(); } @@ -209,8 +193,7 @@ m_caHuangLiDayMap.clear(); if (!m_caHuangLiDayMap.contains(date)) { - CaHuangLiDayInfo info; - CScheduleDBus::getInstance()->GetHuangLiDay(date, info); + CaHuangLiDayInfo info = gLunarManager->getHuangLiDay(date); m_caHuangLiDayMap[date] = info; } } @@ -244,7 +227,8 @@ //如果是第一行会显示上个月的日期 if (vopt->index.row() < 2 && day > 20) { curDate = curDate.addMonths(-1); - } else if (vopt->index.row() == model->rowCount() - 1 && day < 10) { + } else if (vopt->index.row() > 3 && day < 15) { + //如果显示行数大于3且显示的天小于15则表示是下个月 curDate = curDate.addMonths(1); } curDate.setDate(curDate.year(), curDate.month(), day); diff -Nru dde-calendar-5.9.1/calendar-client/src/customWidget/lunarcalendarwidget.h dde-calendar-5.10.0/calendar-client/src/customWidget/lunarcalendarwidget.h --- dde-calendar-5.9.1/calendar-client/src/customWidget/lunarcalendarwidget.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/customWidget/lunarcalendarwidget.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2019 UnionTech Software Technology Co.,Ltd. -* -* Author: changze -* -* Maintainer: changze -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef LUNARCALENDARWIDGET_H #define LUNARCALENDARWIDGET_H diff -Nru dde-calendar-5.9.1/calendar-client/src/customWidget/monthbrefwidget.cpp dde-calendar-5.10.0/calendar-client/src/customWidget/monthbrefwidget.cpp --- dde-calendar-5.9.1/calendar-client/src/customWidget/monthbrefwidget.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/customWidget/monthbrefwidget.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,165 +1,111 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "monthbrefwidget.h" #include "constants.h" #include "scheduledatamanage.h" #include "calendarglobalenv.h" +#include #include #include +#include +#include #include -CMonthDayRect *CMonthDayRect::m_CurrentRect = nullptr; -qreal CMonthDayRect::m_DevicePixelRatio = 0; -QColor CMonthDayRect::m_ceventColor("#FF5D00"); -QColor CMonthDayRect::m_notCurrentTextColor = "#b2b2b2"; -CMonthDayRect::CellColor CMonthDayRect::m_currentColor; -QColor CMonthDayRect::m_defaultTextColor; -QColor CMonthDayRect::m_selectedTextColor; - - +QDate MonthBrefWidget::GlobalData::m_selectedMonth = QDate(); +QDate MonthBrefWidget::GlobalData::m_selectedDate = QDate(); MonthBrefWidget::MonthBrefWidget(QWidget *parent) : QWidget(parent) + , m_globalData(new GlobalData) { + QGridLayout *gridLayout = new QGridLayout(this); + gridLayout->setSpacing(0); + gridLayout->setMargin(0); + for (int i = 0; i < DDEYearCalendar::RectSizeOfEveryMonth; ++i) { - CMonthDayRect *item = new CMonthDayRect(); + CMonthDayRectWidget *item = new CMonthDayRectWidget(m_globalData, this); m_DayItem.append(item); + gridLayout->addWidget(item, i/7, i%7, 1, 1, Qt::AlignCenter); + + connect(item, &CMonthDayRectWidget::signalClicked, this, &MonthBrefWidget::signalPressDate); + connect(item, &CMonthDayRectWidget::signalDoubleClick, this, &MonthBrefWidget::signalDoubleClickDate); } - setMouseTracking(true); - CMonthDayRect::setDevicePixelRatio(devicePixelRatioF()); + + this->setLayout(gridLayout); } MonthBrefWidget::~MonthBrefWidget() { - for (int i = 0; i < m_DayItem.size(); ++i) { - delete m_DayItem[i]; - } - m_DayItem.clear(); + delete m_globalData; } /** - * @brief setDate 设置每个月的日期 - * @param date 日期 + * @brief MonthBrefWidget::setDate + * 设置显示的月 + * @param monthDate 待显示的月日期 */ -void MonthBrefWidget::setDate(const int showMonth, const QVector &showDate) +void MonthBrefWidget::setShowMonthDate(const QDate& monthDate) { - Q_ASSERT(showDate.size() == m_DayItem.size()); - m_currentMonth = showMonth; + //获取当月第一天 + QDate date = QDate(monthDate.year(), monthDate.month(), 1); + int firstday = CalendarManager::getInstance()->getFirstDayOfWeek(); + int day = date.dayOfWeek(); + //计算当前月日历第一天该显示的时间 + date = date.addDays(-(day-firstday+7)%7); for (int i = 0; i < m_DayItem.size(); ++i) { - m_DayItem.at(i)->setDate(showDate[i]); - m_DayItem.at(i)->setIsCurrentMonth(showDate[i].month() == m_currentMonth); + m_DayItem.at(i)->setDate(date); + date = date.addDays(1); } + //设置显示的月 + m_globalData->m_showMonthDate = monthDate; update(); } /** - * @brief setTheMe 根据系统主题设置颜色 - * @param type 系统主题 - */ -void MonthBrefWidget::setTheMe(int type) -{ - CMonthDayRect::setTheMe(type); -} - -/** - * @brief setLintFlag 设置是否有日程的标志 - * @param lineFlag 是否有日程的标志 - */ -void MonthBrefWidget::setLintFlag(const QVector &lineFlag) -{ - if (lineFlag.size() == DDEYearCalendar::RectSizeOfEveryMonth) { - for (int i = 0; i < DDEYearCalendar::RectSizeOfEveryMonth; ++i) { - m_DayItem.at(i)->setLineFlag(lineFlag.at(i)); + * @brief MonthBrefWidget::setHasScheduleDateSet + * 设置含有日程的日期集合 + * @param hasScheduleSet + */ +void MonthBrefWidget::setHasScheduleDateSet(const QSet &hasScheduleSet) +{ + //清空原有标识 + for (int i = 0; i < 32; ++i) { + m_globalData->m_scheduleDateFlag[i] = false; + } + //根据日程所在天设置标识 + for (QDate date:hasScheduleSet) { + if (m_globalData->isBelongMonth(date)) { + m_globalData->m_scheduleDateFlag[date.day()] = true; } } update(); } /** - * @brief MonthBrefWidget::setSearchScheduleFlag 设置搜索日程标志 - * @param searchFlag - */ -void MonthBrefWidget::setSearchScheduleFlag(const QVector &searchFlag) -{ - if (searchFlag.size() == DDEYearCalendar::RectSizeOfEveryMonth) { - for (int i = 0; i < DDEYearCalendar::RectSizeOfEveryMonth; ++i) { - m_DayItem.at(i)->setSearchScheduleFlag(searchFlag.at(i)); + * @brief MonthBrefWidget::setHasSearchScheduleSet + * 设置含有搜索日程的日期集合 + * @param hasScheduleSet + */ +void MonthBrefWidget::setHasSearchScheduleSet(const QSet &hasScheduleSet) +{ + //清空原有标识 + for (int i = 0; i < 32; ++i) { + m_globalData->m_searchedDateFlag[i] = false; + } + //根据日程所在天设置标识 + for (QDate date:hasScheduleSet) { + if (m_globalData->isBelongMonth(date)) { + m_globalData->m_searchedDateFlag[date.day()] = true; } } update(); } /** - * @brief MonthBrefWidget::updateSize 设置每天的日期所在矩形框的大小 - */ -void MonthBrefWidget::updateSize() -{ - qreal w = width() / 7; - qreal h = height() / 6; - QRectF rect ; - int w_offset = 0; - int h_offset = 0; - - for (int i = 0 ; i < m_DayItem.size(); ++i) { - h_offset = i / 7; - w_offset = i % 7; - rect.setRect(w * w_offset, - h * h_offset, - w, - h); - m_DayItem.at(i)->setRect(rect); - } - update(); -} - -/** - * @brief MonthBrefWidget::getMousePosItem 获取点击日期的索引 - * @param pos - * @return - */ -int MonthBrefWidget::getMousePosItem(const QPointF &pos) -{ - int res = -1; - - for (int i = 0 ; i < m_DayItem.size(); ++i) { - if (m_DayItem.at(i)->rect().contains(pos)) { - res = i; - break; - } - } - return res; -} - -/** - * @brief MonthBrefWidget::resizeEvent 设置每天的日期所在矩形框的大小 - * @param event - */ -void MonthBrefWidget::resizeEvent(QResizeEvent *event) -{ - Q_UNUSED(event); - updateSize(); -} - -/** - * @brief MonthBrefWidget::mousePressEvent 鼠标单击事件,单击日期显示当天的日程和节日。 + * @brief MonthBrefWidget::mousePressEvent + * 鼠标按下事件 * @param event */ void MonthBrefWidget::mousePressEvent(QMouseEvent *event) @@ -169,28 +115,6 @@ m_touchState = 1; m_touchBeginPoint = event->pos(); QWidget::mousePressEvent(event); - } else { - if (event->button() == Qt::LeftButton) - mousePress(event->pos()); - } -} - -/** - * @brief MonthBrefWidget::mouseDoubleClickEvent 鼠标双击事件,双击跳转到上次打开的视图 - * @param event - */ -void MonthBrefWidget::mouseDoubleClickEvent(QMouseEvent *event) -{ - int itemindex = getMousePosItem(event->pos()); - - if (!(itemindex < 0)) { - if (m_pressIndex == itemindex) { - m_DayItem.at(itemindex)->setCellEvent(CMonthDayRect::CellPress); - m_press = true; - if (event->button() == Qt::LeftButton) { - emit signalDoubleClickDate(m_DayItem.at(itemindex)->getDate()); - } - } } } @@ -201,15 +125,9 @@ void MonthBrefWidget::mouseReleaseEvent(QMouseEvent *event) { if (event->source() == Qt::MouseEventSynthesizedByQt) { - if (m_touchState == 1) { - //如果为触摸且状态为点击则为触摸点击 - mousePress(event->pos()); - m_touchState = 0; - } + m_touchState = 0; QWidget::mouseReleaseEvent(event); } - - m_press = false; mouseMoveEvent(event); } @@ -227,315 +145,213 @@ } QWidget::mouseMoveEvent(event); } - - if (!m_press) { - int itemindex = getMousePosItem(event->pos()); - if (!(itemindex < 0)) { - m_DayItem.at(itemindex)->setCellEvent(CMonthDayRect::Cellhover); - } - update(); - } } -/** - * @brief MonthBrefWidget::paintEvent 绘制日期以及当天状态 - * @param event - */ -void MonthBrefWidget::paintEvent(QPaintEvent *event) +CMonthDayRectWidget::CMonthDayRectWidget(MonthBrefWidget::GlobalData* globalData, QWidget *parent) : QPushButton(parent) + , m_globaldata(globalData) { - Q_UNUSED(event); - QPainter painter(this); - painter.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); - - for (int i = 0 ; i < m_DayItem.size(); ++i) { - m_DayItem[i]->paintItem(&painter, m_DayItem[i]->rect()); - } - painter.end(); + setMinimumSize(10, 10); + setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); + setFocusPolicy(Qt::NoFocus); + setTheMe(DGuiApplicationHelper::instance()->themeType()); + //系统主题切换信号 + QObject::connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::themeTypeChanged, + this,&CMonthDayRectWidget::setTheMe); } /** - * @brief MonthBrefWidget::leaveEvent 离开事件,设置当前选中的日期为空 - * @param event - */ -void MonthBrefWidget::leaveEvent(QEvent *event) -{ - Q_UNUSED(event); - CMonthDayRect::setCurrentRect(nullptr); - update(); -} - -/** - * @brief MonthBrefWidget::mousePress 鼠标点击触发事件 - * @param point - */ -void MonthBrefWidget::mousePress(const QPoint &point) -{ - //获取当前item编号 - int itemindex = getMousePosItem(point); - CalendarGlobalEnv::getGlobalEnv()->reviseValue(DDECalendar::CursorPointKey, mapToGlobal(point)); - if (!(itemindex < 0)) { - //设置选中item为press状态 - m_DayItem.at(itemindex)->setCellEvent(CMonthDayRect::CellPress); - m_press = true; - m_pressIndex = itemindex; - emit signalPressDate(m_DayItem.at(itemindex)->getDate()); - } - update(); -} - -CMonthDayRect::CMonthDayRect() - : m_rect(0, 0, 0, 0) -{ - m_dayNumFont.setPixelSize(DDECalendar::FontSizeTwelve); - m_hightFont.setPixelSize(DDECalendar::FontSizeTwelve); -} - -/** - * @brief CMonthDayRect::setTheMe 根据系统主题类型设置颜色 + * @brief CMonthDayRectWidget::setTheMe + * 系统主题变化 * @param type */ -void CMonthDayRect::setTheMe(int type) +void CMonthDayRectWidget::setTheMe(int type) { - if (type == 2) { - m_currentColor.hoverColor = "#FFFFFF"; - m_currentColor.hoverColor.setAlphaF(0.1); - m_currentColor.pressColor = "#252525"; - m_currentColor.pressColor.setAlphaF(1); - m_currentColor.normalColor = "#000000"; - m_currentColor.normalColor.setAlphaF(0.00); - m_ceventColor = QColor(204, 77, 3); - - m_notCurrentTextColor = "#C0C6D4"; - m_notCurrentTextColor.setAlphaF(0.5); - m_defaultTextColor = "#C0C6D4"; - m_selectedTextColor = Qt::white; - } else if (type == 0 || type == 1) { - m_currentColor.hoverColor = "#000000"; - m_currentColor.hoverColor.setAlphaF(0.05); - m_currentColor.pressColor = "#000000"; - m_currentColor.pressColor.setAlphaF(0.2); - m_currentColor.normalColor = "#FFFFFF"; - m_currentColor.normalColor.setAlphaF(1); + CScheduleDataManage::getScheduleDataManage()->getSystemActiveColor(); + if (type == 0 || type == 1) { m_ceventColor = QColor(255, 93, 0); - - m_selectedTextColor = Qt::white; - m_defaultTextColor = Qt::black; - m_notCurrentTextColor = "#b2b2b2"; + } else if (type == 2) { + m_ceventColor = QColor(204, 77, 3); } -} - -CMonthDayRect::~CMonthDayRect() -{ - + update(); } /** - * @brief CMonthDayRect::setDate 设置某一天的时间 + * @brief CMonthDayRect::setDate + * 设置当天的时间 * @param date */ -void CMonthDayRect::setDate(const QDate &date) +void CMonthDayRectWidget::setDate(const QDate &date) { m_date = date; } /** - * @brief CMonthDayRect::getDate 获取某一天的时间 + * @brief CMonthDayRect::getDate + * 获取当天的时间 * @return */ -QDate CMonthDayRect::getDate() const +QDate CMonthDayRectWidget::getDate() const { return m_date; } /** - * @brief CMonthDayRect::setCellEvent 设置某一天的状态,CellEventType - * @param type - */ -void CMonthDayRect::setCellEvent(const CMonthDayRect::CellEventType &type) -{ - m_cellEventType = type; - m_CurrentRect = this; -} - -/** - * @brief CMonthDayRect::setIsCurrentMonth 设置是否是当前月 - * @param isCurrMonth - */ -void CMonthDayRect::setIsCurrentMonth(const bool isCurrMonth) -{ - m_isCurrentMonth = isCurrMonth; -} - -/** - * @brief CMonthDayRect::rect 当天日期所在的矩形 - * @return + * @brief CMonthDayRectWidget::mousePressEvent + * 鼠标按下事件 + * @param event */ -QRectF CMonthDayRect::rect() const +void CMonthDayRectWidget::mousePressEvent(QMouseEvent *event) { - return m_rect; + //因双击会产生两次按下事件,第二次按下事件触发在双击事件触发后,双击后要跳转页面,因此在按下时判断本控件是否出现显示状态再进行处理 + if (event->button() == Qt::LeftButton && isVisible()) { + m_pressed = true; + //保存日程悬浮框显示位置 + CalendarGlobalEnv::getGlobalEnv()->reviseValue(DDECalendar::CursorPointKey, mapToGlobal(QPoint(width()/2,height()/2))); + m_globaldata->setSelectedDate(m_date); + emit signalClicked(m_date); + } + QWidget::mousePressEvent(event); } /** - * @brief CMonthDayRect::setRect 设置当天日期的矩形 - * @param rect + * @brief CMonthDayRectWidget::mouseDoubleClickEvent + * 鼠标双击事件 + * @param event */ -void CMonthDayRect::setRect(const QRectF &rect) +void CMonthDayRectWidget::mouseDoubleClickEvent(QMouseEvent *event) { - m_rect = rect; + if (event->button() == Qt::LeftButton) { + emit signalDoubleClick(m_date); + } + QWidget::mouseDoubleClickEvent(event); } /** - * @brief CMonthDayRect::setRect 设置当天日期的矩形 - * @param x - * @param y - * @param w - * @param h + * @brief CMonthDayRectWidget::mouseReleaseEvent + * 鼠标释放事件 + * @param event */ -void CMonthDayRect::setRect(qreal x, qreal y, qreal w, qreal h) +void CMonthDayRectWidget::mouseReleaseEvent(QMouseEvent *event) { - m_rect.setRect(x, y, w, h); + if (event->button() == Qt::LeftButton) { + m_pressed = false; + } + update(); + QWidget::mouseReleaseEvent(event); } /** - * @brief CMonthDayRect::paintItem 绘制年视图一天的所有状态并展示出来。 - * @param painter - * @param rect + * @brief CMonthDayRectWidget::paintEvent + * 绘制日期以及当天状态 + * @param event */ -void CMonthDayRect::paintItem(QPainter *painter, const QRectF &rect) +void CMonthDayRectWidget::paintEvent(QPaintEvent *event) { - m_highColor = CScheduleDataManage::getScheduleDataManage()->getSystemActiveColor(); - - if (m_date.year() < DDECalendar::QueryEarliestYear) - return; - const bool isCurrentDay = m_date == QDate::currentDate() && m_isCurrentMonth; - bool isSelectedCell = false; - if (isCurrentDay) { - isSelectedCell = true; - } - - const qreal r = rect.width() > rect.height() ? rect.height() * 0.9 : rect.width() * 0.9 ; - int fontsize = qRound(DDECalendar::FontSizeTwelve + (r - 18) * 6 / 17); + //获取待绘制的文字 + QString text = QString::number(m_date.day()); - if (fontsize < DDECalendar::FontSizeTwelve) { - fontsize = DDECalendar::FontSizeTwelve; - } - m_dayNumFont.setPixelSize(fontsize); - m_hightFont.setPixelSize(fontsize); - const qreal x = rect.x() + (rect.width() - r) / 2; - const qreal y = rect.y() + (rect.height() - r) / 2; - QRectF fillRect = QRectF(x, y, r, r); - QColor m_cellBackgroundColor; + QPainter painter(this); + painter.setRenderHint(QPainter::Antialiasing); - if (m_CurrentRect != this) { - m_cellEventType = CellNormal; - } - if (m_cellEventType == CellPress) { - m_cellBackgroundColor = m_currentColor.pressColor; - } else if (m_cellEventType == Cellhover) { - m_cellBackgroundColor = m_currentColor.hoverColor; - } else { - m_cellBackgroundColor = m_currentColor.normalColor; - } - painter->setBrush(m_cellBackgroundColor); - painter->setPen(Qt::NoPen); - painter->drawEllipse(fillRect); - - bool highflag = false; - - if (m_isCurrentMonth) { - highflag = m_searchScheduleFlag; - } - if (highflag) { - painter->setBrush(QBrush(m_highColor)); - painter->setPen(Qt::NoPen); - painter->drawEllipse(fillRect); - painter->setPen(Qt::SolidLine); - painter->setPen(m_highTextColor); - painter->setFont(m_hightFont); - painter->drawText(fillRect, Qt::AlignCenter, QString::number(m_date.day())); + //字体跟随界面大小 + qreal w = this->width(); + qreal h = this->height(); + const qreal r = w > h ? h: w; + QRectF rectf(qRound((w-r)/2), qRound((h-r)/2), r, r); + //根据高度和宽度设置时间字体的大小 + QFont font; + font.setPixelSize(int(r/20.0*12)); + painter.setFont(font); + + QColor highColor = DApplicationHelper::instance()->palette(this).highlight().color(); + + if (m_date == QDate::currentDate() && m_globaldata->isBelongMonth(m_date)) { + //当天日期 + painter.setBrush(highColor); + painter.setPen(Qt::NoPen); + painter.drawEllipse(rectf); + painter.setPen(DApplicationHelper::instance()->palette(this).highlightedText().color()); + painter.drawText(rectf, Qt::AlignCenter, text); + } else if (m_globaldata->isSelectedDate(m_date)) { + //被选中的日期 + painter.setBrush(highColor); + painter.setPen(Qt::NoPen); + painter.setOpacity(0.3); + painter.drawEllipse(rectf); + painter.setPen(highColor); + painter.setOpacity(1); + painter.drawText(rectf, Qt::AlignCenter, text); + } else if (m_globaldata->isHasSearchedByDate(m_date)) { + //有被搜索日程,绘制文字 + painter.setPen(highColor); + painter.setOpacity(1); + painter.drawText(rectf, Qt::AlignCenter, text); } else { - // draw selected cell background circle - if (isSelectedCell) { - painter->setBrush(QBrush(m_highColor)); - painter->setPen(Qt::NoPen); - painter->drawEllipse(fillRect); - } - painter->setPen(Qt::SolidLine); - - // draw text of day - if (isSelectedCell) { - painter->setPen(m_selectedTextColor); - } else if (isCurrentDay) { - painter->setPen(m_currentDayTextColor); - } else { - if (m_isCurrentMonth) - painter->setPen(m_defaultTextColor); - else - painter->setPen(m_notCurrentTextColor); + //绘制默认文字 + if (!m_globaldata->isBelongMonth(m_date)) { + //置灰日期 + painter.setOpacity(0.3); } - painter->setFont(m_dayNumFont); - painter->drawText(fillRect, Qt::AlignCenter, QString::number(m_date.day())); + painter.drawText(rectf, Qt::AlignCenter, text); + } - if (m_vlineflag) { - painter->save(); - painter->setRenderHint(QPainter::Antialiasing); - painter->setRenderHint(QPainter::HighQualityAntialiasing); - painter->setRenderHint(QPainter::SmoothPixmapTransform); - QPen pen; - pen.setWidth(2); - pen.setColor(m_ceventColor); - painter->setPen(pen); - painter->setBrush(QBrush(m_ceventColor)); - painter->setPen(Qt::NoPen); - qreal ellipse_r = rect.width() * (4 / 25); - if (ellipse_r < 4) { - ellipse_r = 4; - } else if (r > 7) { - ellipse_r = 7; - } - painter->drawEllipse(QRectF(rect.width() - ellipse_r + rect.x(), rect.y(), ellipse_r, ellipse_r)); - painter->restore(); + if (m_globaldata->isHasSearchedByDate(m_date)) { + //有被搜索日程,绘制圆圈 + QPainterPath path; + path.addEllipse(rectf); + path.addEllipse(rectf.x()+1, rectf.y()+1, rectf.width()-2, rectf.height()-2); + painter.setBrush(highColor); + painter.setPen(Qt::NoPen); + painter.drawPath(path); + } + + if (m_globaldata->isHasScheduleByDate(m_date)) { + //有日程,绘制日程圆点 + painter.setBrush(QBrush(m_ceventColor)); + painter.setPen(Qt::NoPen); + painter.setOpacity(1); + qreal ellipse_r = r * (4.0 / 25); + if (ellipse_r < 4) { + ellipse_r = 4; + } else if (ellipse_r > 7) { + ellipse_r = 7; } + painter.drawEllipse(QRectF(rectf.x() + rectf.width() - ellipse_r, rectf.y() + rect().y(), ellipse_r, ellipse_r)); } -} - -/** - * @brief CMonthDayRect::setLineFlag 设置是否有日程的标志 - * @param flag - */ -void CMonthDayRect::setLineFlag(const bool flag) -{ - m_vlineflag = flag; -} -/** - * @brief CMonthDayRect::setSearchScheduleFlag 设置是否有搜索日程标志 - * @param flag - */ -void CMonthDayRect::setSearchScheduleFlag(const bool flag) -{ - m_searchScheduleFlag = flag; + if (m_pressed) { + //按下状态,绘制点击效果 + painter.setBrush(DApplicationHelper::instance()->palette(this).text()); + painter.setPen(Qt::NoPen); + painter.setOpacity(0.3); + painter.drawEllipse(rectf); + } else if (m_hovered) { + //悬浮状态,绘制悬浮效果 + painter.setBrush(DApplicationHelper::instance()->palette(this).text()); + painter.setOpacity(0.2); + painter.setPen(Qt::NoPen); + painter.drawEllipse(rectf); + } + QWidget::paintEvent(event); } /** - * @brief CMonthDayRect::setDevicePixelRatio 设置显示缩放比例 - * @param pixel + * @brief CMonthDayRectWidget::enterEvent + * 鼠标进入事件 + * @param event */ -void CMonthDayRect::setDevicePixelRatio(const qreal pixel) +void CMonthDayRectWidget::enterEvent(QEvent *event) { - m_DevicePixelRatio = pixel; + m_hovered = true; + QWidget::enterEvent(event); } /** - * @brief CMonthDayRect::setCurrentRect 设置当前天 - * @param currrect + * 离开事件,设置当前选中的日期为空 + * */ -void CMonthDayRect::setCurrentRect(CMonthDayRect *currrect) -{ - m_CurrentRect = currrect; -} - -void CMonthDayRect::setSystemActiveColor(const QColor &activeColor) +void CMonthDayRectWidget::leaveEvent(QEvent *event) { - m_highColor = activeColor; + m_hovered = false; + QWidget::leaveEvent(event); } diff -Nru dde-calendar-5.9.1/calendar-client/src/customWidget/monthbrefwidget.h dde-calendar-5.10.0/calendar-client/src/customWidget/monthbrefwidget.h --- dde-calendar-5.9.1/calendar-client/src/customWidget/monthbrefwidget.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/customWidget/monthbrefwidget.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,67 +1,90 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef MONTHBREFWIDGET_H #define MONTHBREFWIDGET_H +#include "cschedulebasewidget.h" #include +#include #include +#include + +class CMonthDayRectWidget; -class CMonthDayRect; class MonthBrefWidget : public QWidget { Q_OBJECT public: explicit MonthBrefWidget(QWidget *parent = nullptr); ~MonthBrefWidget() override; - //设置每个月的日期 - void setDate(const int showMonth, const QVector &showDate); - //根据系统主题设置颜色 - void setTheMe(int type = 0); - //设置是否有日程的标志 - void setLintFlag(const QVector &lineFlag); - //设置是否有搜索日程 - void setSearchScheduleFlag(const QVector &searchFlag); -private: - //设置每天的日期所在矩形框的大小 - void updateSize(); - //获取点击日期的索引 - int getMousePosItem(const QPointF &pos); + + //当月所有日期共有数据 + struct GlobalData { + + private: + QDate m_showMonthDate; + static QDate m_selectedMonth; //选中的月 + static QDate m_selectedDate; //选中的日期 + bool m_scheduleDateFlag[32] = {false}; //是否有日程 + bool m_searchedDateFlag[32] = {false}; //是否有选中日程 + public: + //设置选中的日期 + void setSelectedDate(const QDate& date) { + m_selectedDate = date; + m_selectedMonth = m_showMonthDate; + } + + //判断是否是选中的日期 + bool isSelectedDate(const QDate& date) { + //当全局日期不等于此类静态日期时(其他界面更改日期的情况下),采用全局时间做判断 + if (CScheduleBaseWidget::getSelectDate() != m_selectedDate) { + return (isBelongMonth(date) && date == CScheduleBaseWidget::getSelectDate()); + } + //用此类静态日期做判断(内部界面操作) + return m_showMonthDate == m_selectedMonth && date == m_selectedDate; + } + + //判断日期是否是本月内的日期 + bool isBelongMonth(const QDate& date) { + return (m_showMonthDate.year() == date.year() && m_showMonthDate.month() == date.month()); + } + + //判断该日期是否含有日程 + bool isHasScheduleByDate(const QDate& date) { + if (isBelongMonth(date)) { + return m_scheduleDateFlag[date.day()]; + } + return false; + } + + //判断该日期是否含有被搜索的日程 + bool isHasSearchedByDate(const QDate& date) { + if (isBelongMonth(date)) { + return m_searchedDateFlag[date.day()]; + } + return false; + } + + friend MonthBrefWidget; + }; + + //设置显示的月 + void setShowMonthDate(const QDate& monthDate); + //设置含有日程的日期集合 + void setHasScheduleDateSet(const QSet &hasScheduleSet); + //设置含有搜索日程的日期集合 + void setHasSearchScheduleSet(const QSet &hasScheduleSet); + protected: - //设置每天的日期所在矩形框的大小 - void resizeEvent(QResizeEvent *event) override; - //鼠标单击事件,单击日期显示当天的日程和节日。 + //鼠标按下事件 void mousePressEvent(QMouseEvent *event) override; - //鼠标双击事件,双击跳转到上次打开的视图 - void mouseDoubleClickEvent(QMouseEvent *event) override; //鼠标释放事件 void mouseReleaseEvent(QMouseEvent *event) override; //鼠标移动事件,设置hover状态 void mouseMoveEvent(QMouseEvent *event) override; - //绘制日期以及当天状态 - void paintEvent(QPaintEvent *event) override; - //离开事件,设置当前选中的日期为空 - void leaveEvent(QEvent *event) override; -private: - //鼠标点击触发事件 - void mousePress(const QPoint &point); + signals: /** * @brief signalPressDate 鼠标点击日期的信号 @@ -74,87 +97,65 @@ */ void signalDoubleClickDate(const QDate &date); private: - QVector m_DayItem; - int m_currentMonth = 1; - bool m_press = false; - int m_pressIndex = 0; + QVector m_DayItem; + GlobalData *m_globalData = nullptr; + //触摸状态 0:原始 1:点击 2:移动 int m_touchState{0}; //触摸点击坐标 QPoint m_touchBeginPoint; }; - -class CMonthDayRect +/** + * @brief The CMonthDayRectWidget class + * 单个日期显示控件 + */ +class CMonthDayRectWidget : public QPushButton { + Q_OBJECT public: + + explicit CMonthDayRectWidget(MonthBrefWidget::GlobalData* globalData, QWidget *parent = nullptr); + //设置当天的时间 + void setDate(const QDate &date); + //获取当天的时间 + QDate getDate()const; + //系统主题变化 + void setTheMe(int type = 0); + +signals: /** - * @brief The CellEventType enum + * @brief signalPressDate 鼠标点击日期的信号 + * @param date 传递时间参数 */ - enum CellEventType { - CellNormal = 0, - Cellhover = 1, - CellPress = 2 - }; + void signalClicked(const QDate &date); /** - * @brief The CellColor struct + * @brief signalDoubleClick 鼠标双击日期的信号 + * @param date 传递时间参数 */ - struct CellColor { - QColor normalColor; - QColor hoverColor; - QColor pressColor; - }; - CMonthDayRect(); - ~CMonthDayRect(); - //设置某一天的时间 - void setDate(const QDate &date); - //获取某一天的时间 - QDate getDate()const; - //设置某一天的状态,CellEventType - void setCellEvent(const CellEventType &type); - //设置是否是当前月 - void setIsCurrentMonth(const bool isCurrMonth); - //当天日期所在的矩形 - QRectF rect() const; - //设置当天日期的矩形 - void setRect(const QRectF &rect); - //设置当天日期的矩形 - inline void setRect(qreal x, qreal y, qreal w, qreal h); - //绘制年视图一天的所有状态并展示出来。 - void paintItem(QPainter *painter, const QRectF &rect); - //设置是否有日程的标志 - void setLineFlag(const bool flag); - //设置是否有搜索日程标志 - void setSearchScheduleFlag(const bool flag); - //根据系统主题类型设置颜色 - static void setTheMe(int type = 0); - //设置显示缩放比例 - static void setDevicePixelRatio(const qreal pixel); - //设置当前天 - static void setCurrentRect(CMonthDayRect *currrect); - void setSystemActiveColor(const QColor &activeColor); + void signalDoubleClick(const QDate &date); + +protected: + //鼠标按下事件 + void mousePressEvent(QMouseEvent *event) override; + //鼠标双击事件 + void mouseDoubleClickEvent(QMouseEvent *event) override; + //鼠标释放事件 + void mouseReleaseEvent(QMouseEvent *event) override; + //绘制日期以及当天状态 + void paintEvent(QPaintEvent *event) override; + //鼠标进入事件 + void enterEvent(QEvent *event) override; + //离开事件,设置当前选中的日期为空 + void leaveEvent(QEvent *event) override; + private: - QFont m_dayNumFont; - QFont m_hightFont; - int m_themetype = 0; - CellEventType m_cellEventType {CellNormal}; - QColor m_highColor = "#0081FF"; - QColor m_highTextColor = "#FFFFFF"; - bool m_vlineflag = false; - bool m_searchScheduleFlag{false}; - QColor m_currentDayTextColor = "#2ca7f8"; - - static QColor m_defaultTextColor; - static QColor m_selectedTextColor; - static QColor m_notCurrentTextColor; - static CellColor m_currentColor; - static QColor m_ceventColor; - static CMonthDayRect *m_CurrentRect; - static qreal m_DevicePixelRatio; - - QRectF m_rect; - QDate m_date; - bool m_isCurrentMonth = false; + QDate m_date; //当前位置显示的日期 + bool m_pressed = false; //按下状态 + bool m_hovered = false; //悬浮状态 + QColor m_ceventColor = "#FF5D00"; //日程圆点颜色 + + MonthBrefWidget::GlobalData* m_globaldata = nullptr; }; diff -Nru dde-calendar-5.9.1/calendar-client/src/customWidget/scheduleRemindWidget.cpp dde-calendar-5.10.0/calendar-client/src/customWidget/scheduleRemindWidget.cpp --- dde-calendar-5.9.1/calendar-client/src/customWidget/scheduleRemindWidget.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/customWidget/scheduleRemindWidget.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "scheduleRemindWidget.h" #include "constants.h" @@ -53,7 +37,7 @@ } -void ScheduleRemindWidget::setData(const ScheduleDataInfo &vScheduleInfo, const CSchedulesColor &gcolor) +void ScheduleRemindWidget::setData(const DSchedule::Ptr &vScheduleInfo, const CSchedulesColor &gcolor) { m_centerWidget->setData(vScheduleInfo, gcolor); m_ScheduleInfo = vScheduleInfo; @@ -95,7 +79,7 @@ } -void CenterWidget::setData(const ScheduleDataInfo &vScheduleInfo, const CSchedulesColor &gcolor) +void CenterWidget::setData(const DSchedule::Ptr &vScheduleInfo, const CSchedulesColor &gcolor) { m_ScheduleInfo = vScheduleInfo; gdcolor = gcolor; @@ -134,32 +118,32 @@ { testList.clear(); QFontMetrics metrics(textfont); - textwidth = metrics.width(m_ScheduleInfo.getTitleName()); + textwidth = metrics.width(m_ScheduleInfo->summary()); textheight = metrics.height(); const int h_count = qCeil(textwidth / textRectWidth); QString text; if (h_count < 1) { - testList.append(m_ScheduleInfo.getTitleName()); + testList.append(m_ScheduleInfo->summary()); } else { const int text_Max_Height = 108; const int text_HeightMaxCount = qFloor(text_Max_Height / textheight); - for (int i = 0; i < m_ScheduleInfo.getTitleName().count(); ++i) { - text += m_ScheduleInfo.getTitleName().at(i); + for (int i = 0; i < m_ScheduleInfo->summary().count(); ++i) { + text += m_ScheduleInfo->summary().at(i); if (metrics.width(text) > textRectWidth) { text.remove(text.count() - 1, 1); testList.append(text); text = ""; if (testList.count() == (text_HeightMaxCount - 1)) { - text = m_ScheduleInfo.getTitleName().right(m_ScheduleInfo.getTitleName().count() - i); + text = m_ScheduleInfo->summary().right(m_ScheduleInfo->summary().count() - i); testList.append(metrics.elidedText(text, Qt::ElideRight, textRectWidth)); break; } --i; } else { - if (i + 1 == m_ScheduleInfo.getTitleName().count()) { + if (i + 1 == m_ScheduleInfo->summary().count()) { testList.append(text); } } @@ -183,11 +167,10 @@ painter.setPen(pen); painter.setFont(timeFont); QString timestr; - QLocale locale; - timestr = m_ScheduleInfo.getBeginDateTime().time().toString("AP " + m_timeFormat); + timestr = m_ScheduleInfo->dtStart().time().toString(m_timeFormat); QFontMetrics metrics(timeFont); - if (m_ScheduleInfo.getAllDay()) + if (m_ScheduleInfo->allDay()) timestr = tr("All Day"); int timewidth = metrics.width(timestr); int timeheight = metrics.height(); diff -Nru dde-calendar-5.9.1/calendar-client/src/customWidget/scheduleRemindWidget.h dde-calendar-5.10.0/calendar-client/src/customWidget/scheduleRemindWidget.h --- dde-calendar-5.9.1/calendar-client/src/customWidget/scheduleRemindWidget.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/customWidget/scheduleRemindWidget.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,27 +1,11 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef ScheduleRemindWidget_H #define ScheduleRemindWidget_H -#include "src/scheduledatainfo.h" +#include "dschedule.h" #include "scheduledatamanage.h" #include @@ -38,7 +22,7 @@ public: explicit ScheduleRemindWidget(QWidget *parent = nullptr); ~ScheduleRemindWidget() override; - void setData(const ScheduleDataInfo &vScheduleInfo, const CSchedulesColor &gcolor); + void setData(const DSchedule::Ptr &vScheduleInfo, const CSchedulesColor &gcolor); //设置箭头方向 void setDirection(ArrowDirection value); void setTimeFormat(QString timeformat); @@ -47,7 +31,7 @@ public slots: private: CenterWidget *m_centerWidget = nullptr; - ScheduleDataInfo m_ScheduleInfo; + DSchedule::Ptr m_ScheduleInfo; CSchedulesColor gdcolor; }; @@ -57,7 +41,7 @@ public: explicit CenterWidget(DWidget *parent = nullptr); ~CenterWidget() override; - void setData(const ScheduleDataInfo &vScheduleInfo, const CSchedulesColor &gcolor); + void setData(const DSchedule::Ptr &vScheduleInfo, const CSchedulesColor &gcolor); void setTheMe(const int type = 0); void setTimeFormat(QString timeFormat = "h:mm"); private: @@ -70,7 +54,7 @@ int textwidth; int textheight; const int textRectWidth = 165; - ScheduleDataInfo m_ScheduleInfo; + DSchedule::Ptr m_ScheduleInfo; CSchedulesColor gdcolor; QColor textColor; QColor timeColor; diff -Nru dde-calendar-5.9.1/calendar-client/src/customWidget/scheduleview.cpp dde-calendar-5.10.0/calendar-client/src/customWidget/scheduleview.cpp --- dde-calendar-5.9.1/calendar-client/src/customWidget/scheduleview.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/customWidget/scheduleview.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,21 +1,7 @@ -/* - * Copyright (C) 2017 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: kirigaya - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "scheduleview.h" #include "alldayeventview.h" #include "graphicsview.h" @@ -43,7 +29,7 @@ : DFrame(parent) , m_viewPos(viewType) , m_touchGesture(this) - , m_timeFormat(CalendarManager::getInstance()->getCalendarDateDataManage()->getTimeFormat()) + , m_timeFormat(CalendarManager::getInstance()->getTimeFormat()) { initUI(); initConnection(); @@ -124,9 +110,9 @@ m_graphicsView->setTime(time); } -void CScheduleView::setSelectSchedule(const ScheduleDataInfo &scheduleInfo) +void CScheduleView::setSelectSchedule(const DSchedule::Ptr &scheduleInfo) { - if (scheduleInfo.getAllDay()) { + if (scheduleInfo->allDay()) { m_alldaylist->setSelectSearchSchedule(scheduleInfo); } else { m_graphicsView->setSelectSearchSchedule(scheduleInfo); @@ -153,7 +139,7 @@ * @brief CScheduleView::setShowScheduleInfo 设置显示日程 * @param scheduleInfo */ -void CScheduleView::setShowScheduleInfo(const QMap > &scheduleInfo) +void CScheduleView::setShowScheduleInfo(const QMap &scheduleInfo) { m_showSchedule = scheduleInfo; updateSchedule(); @@ -216,7 +202,7 @@ painter.drawText( QRect((m_leftMargin - hourTextWidth) / 2 - 5, m_topMargin - 8 + m_vPos[i], hourTextWidth, hourTextHeight), - Qt::AlignCenter, QTime(m_vHours[i], 0).toString("AP h 时")); + Qt::AlignCenter, QTime(m_vHours[i], 0).toString(m_timeFormat.contains("AP") ? "AP h 时" : m_timeFormat)); } painter.restore(); } else { @@ -239,7 +225,7 @@ painter.drawText( QRect((m_leftMargin - hourTextWidth) / 2 - 5, m_topMargin - 8 + m_vPos[i], hourTextWidth, hourTextHeight), - Qt::AlignCenter, QTime(m_vHours[i], 0).toString("AP h 时")); + Qt::AlignCenter, QTime(m_vHours[i], 0).toString(m_timeFormat.contains("AP") ? "AP h 时" : m_timeFormat)); } painter.restore(); @@ -247,9 +233,9 @@ painter.save(); painter.setFont(font); painter.setPen(m_currenttimecolor); - QString str = QTime::currentTime().toString("AP " + m_timeFormat); + QString str = QTime::currentTime().toString(m_timeFormat); painter.drawText(QRect((m_leftMargin - hourTextWidth) / 2 - 5, - m_topMargin - 8 + m_vPos[m_vPos.count() - 1], hourTextWidth, + m_topMargin - 8 + m_vPos[m_vPos.count() - 1], hourTextWidth + 1, hourTextHeight), Qt::AlignCenter, str); painter.restore(); @@ -342,6 +328,13 @@ painter.setPen(Qt::NoPen); painter.setBrush(m_outerBorderColor); painter.drawRect(QRectF(this->width() - 1, 0, this->width(), this->height())); + //绘制个三角遮住左上角圆角 + QPainterPath path; + path.moveTo(0,0); + path.lineTo(m_radius, 0); + path.lineTo(0, m_radius); + path.lineTo(0, 0); + painter.fillPath(path, palette().color(backgroundRole())); } } @@ -480,14 +473,15 @@ emit signalsCurrentScheduleDate(date); } -void CScheduleView::slotScheduleShow(const bool isShow, const ScheduleDataInfo &out) +void CScheduleView::slotScheduleShow(const bool isShow, const DSchedule::Ptr &out) { if (isShow) { QVariant variant; CalendarGlobalEnv::getGlobalEnv()->getValueByKey(DDECalendar::CursorPointKey, variant); QPoint pos22 = variant.value(); + //根据日程类型获取颜色 CSchedulesColor gdColor = CScheduleDataManage::getScheduleDataManage()->getScheduleColorByType( - out.getType()); + out->scheduleTypeID()); QDesktopWidget *w = QApplication::desktop(); m_ScheduleRemindWidget->setData(out, gdColor); @@ -537,17 +531,19 @@ { //获取一个月的日程信息 m_graphicsView->clearSchedule(); - QVector allInfo; - QVector nonAllInfo; + DSchedule::List allInfo; + DSchedule::List nonAllInfo; - QMap >::const_iterator _iterator = m_showSchedule.constBegin(); + QMap::const_iterator _iterator = m_showSchedule.constBegin(); for (; _iterator != m_showSchedule.constEnd(); ++_iterator) { for (int i = 0; i < _iterator->size(); ++i) { - if (_iterator.value().at(i).getAllDay()) { + if (_iterator.value().at(i)->allDay()) { + //过滤 if (!allInfo.contains(_iterator.value().at(i))) { allInfo.append(_iterator.value().at(i)); } } else { + //过滤 if (!nonAllInfo.contains(_iterator.value().at(i))) { nonAllInfo.append(_iterator.value().at(i)); } diff -Nru dde-calendar-5.9.1/calendar-client/src/customWidget/scheduleview.h dde-calendar-5.10.0/calendar-client/src/customWidget/scheduleview.h --- dde-calendar-5.9.1/calendar-client/src/customWidget/scheduleview.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/customWidget/scheduleview.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,24 +1,10 @@ -/* - * Copyright (C) 2017 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: kirigaya - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef SCHEDULEVIEW_H #define SCHEDULEVIEW_H -#include "src/scheduledatainfo.h" +#include "dschedule.h" #include "scheduleRemindWidget.h" #include "../widget/touchgestureoperation.h" #include "graphicsview.h" @@ -43,12 +29,12 @@ void setTheMe(int type = 0); void setLunarVisible(bool state); void setTime(QTime time); - void setSelectSchedule(const ScheduleDataInfo &scheduleInfo); + void setSelectSchedule(const DSchedule::Ptr &scheduleInfo); void updateHeight(); bool IsDragging(); void setCurrentDate(const QDateTime ¤tDate); //设置显示日程 - void setShowScheduleInfo(const QMap > &scheduleInfo); + void setShowScheduleInfo(const QMap &scheduleInfo); void setTimeFormat(QString timeformat); signals: void signalsCurrentScheduleDate(QDate date); @@ -66,7 +52,7 @@ //快捷键删除日程 void slotDeleteitem(); void slotCurrentScheduleDate(QDate date); - void slotScheduleShow(const bool isShow, const ScheduleDataInfo &out = ScheduleDataInfo()); + void slotScheduleShow(const bool isShow, const DSchedule::Ptr &out = DSchedule::Ptr()); void slotUpdatePaint(const int topM); void slotUpdateScene(); //焦点切换到某个视图 @@ -89,7 +75,7 @@ QVector m_vPos; QVector m_vHours; CAllDayEventWeekView *m_alldaylist = nullptr; - QMap > m_showSchedule{}; + QMap m_showSchedule {}; int m_leftMargin; int m_topMargin; int m_rightMargin = 0; diff -Nru dde-calendar-5.9.1/calendar-client/src/customWidget/timeedit.cpp dde-calendar-5.10.0/calendar-client/src/customWidget/timeedit.cpp --- dde-calendar-5.9.1/calendar-client/src/customWidget/timeedit.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/customWidget/timeedit.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,21 +1,7 @@ -/* - * Copyright (C) 2015 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: kirigaya - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2015 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "timeedit.h" #include @@ -31,9 +17,7 @@ CTimeEdit::CTimeEdit(QWidget *parent) : DComboBox(parent) - , m_timeFormat(CalendarManager::getInstance()->getCalendarDateDataManage()->getTimeFormat()) - , m_timeFormatValue( - CalendarManager::getInstance()->getCalendarDateDataManage()->getTimeFormatValue()) + , m_timeFormat(CalendarManager::getInstance()->getTimeFormat()) , m_timeEdit(new CCustomTimeEdit()) , m_hasFocus(false) , m_miniTime(QTime(0, 0, 0)) @@ -254,3 +238,9 @@ style()->drawPrimitive(QStyle::PE_FrameFocusRect, &option, &painter, this); } } + +void CTimeEdit::resizeEvent(QResizeEvent *e) +{ + DComboBox::resizeEvent(e); + m_timeEdit->setFixedHeight(this->height()); +} diff -Nru dde-calendar-5.9.1/calendar-client/src/customWidget/timeedit.h dde-calendar-5.10.0/calendar-client/src/customWidget/timeedit.h --- dde-calendar-5.9.1/calendar-client/src/customWidget/timeedit.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/customWidget/timeedit.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,21 +1,7 @@ -/* - * Copyright (C) 2015 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: kirigaya - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2015 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #pragma once #include "ccustomtimeedit.h" @@ -69,10 +55,10 @@ void setTimeFormat(int value); //焦点获取效果绘制 void slotFocusDraw(bool showFocus); - + /** - * @brief slotSetPlainText 设置当前编辑框显示文本 + * @brief slotSetPlainText 设置当前编辑框显示文本 * @param arg */ void slotSetPlainText(const QString &arg); @@ -97,9 +83,9 @@ void showPopup() override; void focusInEvent(QFocusEvent *event) override; void paintEvent(QPaintEvent *e) override; + void resizeEvent(QResizeEvent *e) override; private: QString m_timeFormat = "hh:mm"; - int m_timeFormatValue = 0; QTime m_time; CCustomTimeEdit *m_timeEdit = nullptr; bool m_hasFocus; diff -Nru dde-calendar-5.9.1/calendar-client/src/customWidget/todaybutton.cpp dde-calendar-5.10.0/calendar-client/src/customWidget/todaybutton.cpp --- dde-calendar-5.9.1/calendar-client/src/customWidget/todaybutton.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/customWidget/todaybutton.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "todaybutton.h" #include "constants.h" @@ -30,87 +14,11 @@ CTodayButton::CTodayButton(QWidget *parent) : DPushButton(parent) { - m_font.setWeight(QFont::Medium); - m_font.setPixelSize(DDECalendar::FontSizeFourteen); } -void CTodayButton::setBColor(QColor normalC, QColor hoverC, QColor pressc, QColor normalC1, QColor hoverC1, QColor pressc1) -{ - m_bnormalColor = normalC; - m_bhoverColor = hoverC; - m_bPressColor = pressc; - m_dbnormalColor = normalC1; - m_dbhoverColor = hoverC1; - m_dbPressColor = pressc1; - m_shadowColor = m_bnormalColor; -} -void CTodayButton::setTColor(QColor normalC, QColor hoverC, QColor pressc) -{ - m_tnormalColor = normalC; - m_thoverColor = hoverC; - m_tPressColor = pressc; -} -void CTodayButton::setshadowColor(QColor sc) -{ - m_shadowColor = sc; -} -void CTodayButton::mousePressEvent(QMouseEvent *event) -{ - DPalette todaypa = palette(); - todaypa.setColor(DPalette::ButtonText, m_tPressColor); - todaypa.setColor(DPalette::Dark, m_dbPressColor); - todaypa.setColor(DPalette::Light, m_bPressColor); - todaypa.setColor(DPalette::Shadow, m_shadowColor); - setPalette(todaypa); - DPushButton::mousePressEvent(event); -} - -void CTodayButton::mouseReleaseEvent(QMouseEvent *event) -{ - DPalette todaypa = palette(); - todaypa.setColor(DPalette::ButtonText, m_tnormalColor); - todaypa.setColor(DPalette::Dark, m_dbnormalColor); - todaypa.setColor(DPalette::Light, m_bnormalColor); - todaypa.setColor(DPalette::Shadow, m_shadowColor); - setPalette(todaypa); - DPushButton::mouseReleaseEvent(event); -} - -void CTodayButton::focusOutEvent(QFocusEvent *event) -{ - DPalette todaypa = palette(); - todaypa.setColor(DPalette::ButtonText, m_tnormalColor); - todaypa.setColor(DPalette::Dark, m_dbnormalColor); - todaypa.setColor(DPalette::Light, m_bnormalColor); - todaypa.setColor(DPalette::Shadow, m_shadowColor); - setPalette(todaypa); - DPushButton::focusOutEvent(event); -} - -void CTodayButton::enterEvent(QEvent *event) -{ - DPalette todaypa = palette(); - todaypa.setColor(DPalette::ButtonText, m_thoverColor); - todaypa.setColor(DPalette::Dark, m_dbhoverColor); - todaypa.setColor(DPalette::Light, m_bhoverColor); - todaypa.setColor(DPalette::Shadow, m_shadowColor); - setPalette(todaypa); - DPushButton::enterEvent(event); -} - -void CTodayButton::leaveEvent(QEvent *event) -{ - DPalette todaypa = palette(); - todaypa.setColor(DPalette::ButtonText, m_tnormalColor); - todaypa.setColor(DPalette::Dark, m_dbnormalColor); - todaypa.setColor(DPalette::Light, m_bnormalColor); - todaypa.setColor(DPalette::Shadow, m_shadowColor); - setPalette(todaypa); - DPushButton::leaveEvent(event); -} void CTodayButton::keyPressEvent(QKeyEvent *event) { diff -Nru dde-calendar-5.9.1/calendar-client/src/customWidget/todaybutton.h dde-calendar-5.10.0/calendar-client/src/customWidget/todaybutton.h --- dde-calendar-5.9.1/calendar-client/src/customWidget/todaybutton.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/customWidget/todaybutton.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TODYBUTTON_H #define TODYBUTTON_H @@ -29,31 +13,10 @@ Q_OBJECT public: explicit CTodayButton(QWidget *parent = nullptr); - void setBColor(QColor normalC, QColor hoverC, QColor pressc, QColor normalC1, QColor hoverC1, QColor pressc1); - void setTColor(QColor normalC, QColor hoverC, QColor pressc); - void setshadowColor(QColor sc); protected: - void mousePressEvent(QMouseEvent *event) override; - void mouseReleaseEvent(QMouseEvent *event) override; - void focusOutEvent(QFocusEvent *event) override; - void enterEvent(QEvent *event) override; - void leaveEvent(QEvent *event) override; void keyPressEvent(QKeyEvent *event) override; private: - QColor m_bnormalColor = "#FFFFFF"; - QColor m_bhoverColor = "#FFFFFF"; - QColor m_bPressColor = "#FFFFFF"; - QColor m_dbnormalColor = "#FFFFFF"; - QColor m_dbhoverColor = "#FFFFFF"; - QColor m_dbPressColor = "#FFFFFF"; - QColor m_tnormalColor = "#000000"; - QColor m_thoverColor = "#000000"; - QColor m_tPressColor = "#000000"; - QColor m_shadowColor = "#FFFFFF"; - QFont m_font; - bool m_pressstate = false; - bool m_hovertate = false; }; #endif // TODYBUTTON_H diff -Nru dde-calendar-5.9.1/calendar-client/src/dataManage/accountitem.cpp dde-calendar-5.10.0/calendar-client/src/dataManage/accountitem.cpp --- dde-calendar-5.9.1/calendar-client/src/dataManage/accountitem.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/dataManage/accountitem.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,455 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "accountitem.h" +#include "doanetworkdbus.h" + +AccountItem::AccountItem(const DAccount::Ptr &account, QObject *parent) + : QObject(parent) + , m_account(account) + , m_dbusRequest(new DbusAccountRequest(account->dbusPath(), account->dbusInterface(), this)) +{ + initConnect(); +} + +void AccountItem::initConnect() +{ + connect(m_dbusRequest, &DbusAccountRequest::signalGetAccountInfoFinish, this, &AccountItem::slotGetAccountInfoFinish); + connect(m_dbusRequest, &DbusAccountRequest::signalGetScheduleTypeListFinish, this, &AccountItem::slotGetScheduleTypeListFinish); + connect(m_dbusRequest, &DbusAccountRequest::signalGetScheduleListFinish, this, &AccountItem::slotGetScheduleListFinish); + connect(m_dbusRequest, &DbusAccountRequest::signalGetSysColorsFinish, this, &AccountItem::slotGetSysColorsFinish); + connect(m_dbusRequest, &DbusAccountRequest::signalSearchScheduleListFinish, this, &AccountItem::slotSearchScheduleListFinish); + connect(m_dbusRequest, &DbusAccountRequest::signalDtLastUpdate, this, &AccountItem::signalDtLastUpdate); + connect(m_dbusRequest, &DbusAccountRequest::signalAccountStateChange, this, &AccountItem::signalAccountStateChange); + connect(m_dbusRequest, &DbusAccountRequest::signalSyncStateChange, this, &AccountItem::slotSyncStateChange); + connect(m_dbusRequest, &DbusAccountRequest::signalAccountStateChange, this, &AccountItem::slotAccountStateChange); + connect(m_dbusRequest, &DbusAccountRequest::signalSearchUpdate, this, &AccountItem::slotSearchUpdata); +} + +/** + * @brief AccountItem::getSyncMsg + * 同步状态码转状态说明 + * @param code 状态码 + * @return + */ +QString AccountItem::getSyncMsg(DAccount::AccountSyncState code) +{ + QString msg = ""; + switch (code) { + case DAccount::Sync_Normal: msg = tr("Sync successful"); break; + case DAccount::Sync_NetworkAnomaly: msg = tr("Network error"); break; + case DAccount::Sync_ServerException: msg = tr("Server exception"); break; + case DAccount::Sync_StorageFull: msg = tr("Storage full"); break; + } + return msg; +} + +/** + * @brief AccountItem::resetAccount + * 重新获取帐户相关数据 + */ +void AccountItem::resetAccount() +{ + querySchedulesWithParameter(QDate().currentDate().year()); + m_dbusRequest->getScheduleTypeList(); + m_dbusRequest->getSysColors(); +} + +/** + * @brief AccountItem::getAccount + * 获取帐户数据 + * @return + */ +DAccount::Ptr AccountItem::getAccount() +{ + return m_account; +} + +//获取日程 +QMap AccountItem::getScheduleMap() +{ + return m_scheduleMap; +} + +QMap AccountItem::getSearchScheduleMap() +{ + return m_searchedScheduleMap; +} + +/** + * @brief getScheduleTypeList 获取日程类型信息集 + * @return + */ +DScheduleType::List AccountItem::getScheduleTypeList() +{ + DScheduleType::List list; + for (DScheduleType::Ptr p : m_scheduleTypeList) { + if (p->privilege() != DScheduleType::None) { + list.push_back(p); + } + } + return list; +} + +//根据类型ID获取日程类型 +DScheduleType::Ptr AccountItem::getScheduleTypeByID(const QString &typeID) +{ + for (DScheduleType::Ptr p : m_scheduleTypeList) { + if (p->typeID() == typeID) { + return p; + } + } + return nullptr; +} + +DScheduleType::Ptr AccountItem::getScheduleTypeByName(const QString &typeName) +{ + for (DScheduleType::Ptr p : m_scheduleTypeList) { + if (p->typeName() == typeName || p->displayName() == typeName) { + return p; + } + } + return nullptr; +} + +DTypeColor::List AccountItem::getColorTypeList() +{ + return m_typeColorList; +} + +/** + * @brief AccountItem::isCanSyncShedule + * 获取日程是否可以同步 + * @return + */ +bool AccountItem::isCanSyncShedule() +{ + if (getAccount()->accountType() != DAccount::Account_UnionID) { + return true; + } + DOANetWorkDBus netManger; + return getAccount()->accountState().testFlag(DAccount::Account_Calendar) + && getAccount()->accountState().testFlag(DAccount::Account_Open) && netManger.getNetWorkState() == DOANetWorkDBus::Active; +} + +/** + * @brief AccountItem::isCanSyncSetting + * 获取通用设置是否可以同步 + * @return + */ +bool AccountItem::isCanSyncSetting() +{ + if (!getAccount().isNull() && getAccount()->accountType() != DAccount::Account_UnionID) { + return true; + } + DOANetWorkDBus netManger; + return getAccount()->accountState().testFlag(DAccount::Account_Setting) + && getAccount()->accountState().testFlag(DAccount::Account_Open) && netManger.getNetWorkState() == DOANetWorkDBus::Active; +} + +bool AccountItem::isEnableForUosAccount() +{ + if (getAccount()->accountType() != DAccount::Account_UnionID) { + return false; + } + + DOANetWorkDBus netManger; + return getAccount()->accountState().testFlag(DAccount::Account_Open) && netManger.getNetWorkState() == DOANetWorkDBus::Active; +} + +/** + * @brief AccountItem::setAccountExpandStatus + * 更新帐户列表展开状态 + * @param expandStatus 展开状态 + */ +void AccountItem::setAccountExpandStatus(bool expandStatus) +{ + m_account->setIsExpandDisplay(expandStatus); + m_dbusRequest->setAccountExpandStatus(expandStatus); +} + +void AccountItem::setAccountState(DAccount::AccountStates state) +{ + m_account->setAccountState(state); + m_dbusRequest->setAccountState(state); + emit signalAccountStateChange(); +} + +void AccountItem::setSyncFreq(DAccount::SyncFreqType freq) +{ + m_account->setSyncFreq(freq); + QString syncFreq = DAccount::syncFreqToJsonString(m_account); + m_dbusRequest->setSyncFreq(syncFreq); +} + +DAccount::AccountStates AccountItem::getAccountState() +{ + return m_dbusRequest->getAccountState(); +} + +bool AccountItem::getSyncState() +{ + return m_dbusRequest->getSyncState(); +} + +DAccount::SyncFreqType AccountItem::getSyncFreq() +{ + QString syncFreq = m_dbusRequest->getSyncFreq(); + DAccount::syncFreqFromJsonString(m_account, syncFreq); + return m_account->syncFreq(); +} + +/** + * @brief AccountItem::createJobType + * 创建日程类型 + * @param typeInfo 日程类型数据 + * @param callback + */ +void AccountItem::createJobType(const DScheduleType::Ptr &typeInfo, CallbackFunc callback) +{ + m_dbusRequest->setCallbackFunc(callback); + typeInfo->setPrivilege(DScheduleType::User); + m_dbusRequest->createScheduleType(typeInfo); +} + +/** + * @brief AccountItem::updateScheduleType + * 更新类型信息 + * @param typeInfo 新的日程类型数据 + * @param callback + */ +void AccountItem::updateScheduleType(const DScheduleType::Ptr &typeInfo, CallbackFunc callback) +{ + m_dbusRequest->setCallbackFunc(callback); + m_dbusRequest->updateScheduleType(typeInfo); +} + +/** + * @brief AccountItem::updateScheduleTypeShowState + * 更新类型显示状态 + * @param scheduleInfo + * @param callback + */ +void AccountItem::updateScheduleTypeShowState(const DScheduleType::Ptr &scheduleInfo, CallbackFunc callback) +{ + m_dbusRequest->setCallbackFunc(callback); + m_dbusRequest->updateScheduleTypeShowState(scheduleInfo); +} + +/** + * @brief AccountItem::deleteScheduleTypeByID + * 根据类型ID删除日程类型 + * @param typeID 日程类型id + * @param callback 回调函数 + */ +void AccountItem::deleteScheduleTypeByID(const QString &typeID, CallbackFunc callback) +{ + m_dbusRequest->setCallbackFunc(callback); + m_dbusRequest->deleteScheduleTypeByID(typeID); +} + +/** + * @brief AccountItem::scheduleTypeIsUsed + * 类型是否被日程使用 + * @param typeID 日程类型id + * @param callback 回调函数 + */ +bool AccountItem::scheduleTypeIsUsed(const QString &typeID) +{ + return m_dbusRequest->scheduleTypeByUsed(typeID); +} + +/** + * @brief AccountItem::createSchedule + * 创建日程 + * @param scheduleInfo 日程数据 + * @param callback 回调函数 + */ +void AccountItem::createSchedule(const DSchedule::Ptr &scheduleInfo, CallbackFunc callback) +{ + m_dbusRequest->setCallbackFunc(callback); + m_dbusRequest->createSchedule(scheduleInfo); +} + +/** + * @brief AccountItem::updateSchedule + * 更新日程 + * @param scheduleInfo 新的日程数据 + * @param callback 回调函数 + */ +void AccountItem::updateSchedule(const DSchedule::Ptr &scheduleInfo, CallbackFunc callback) +{ + m_dbusRequest->setCallbackFunc(callback); + m_dbusRequest->updateSchedule(scheduleInfo); +} + +DSchedule::Ptr AccountItem::getScheduleByScheduleID(const QString &scheduleID) +{ + return m_dbusRequest->getScheduleByScheduleID(scheduleID); +} + +/** + * @brief AccountItem::deleteScheduleByID + * 根据日程ID删除日程 + * @param schedule ID日程id + * @param callback 回调函数 + */ +void AccountItem::deleteScheduleByID(const QString &scheduleID, CallbackFunc callback) +{ + m_dbusRequest->setCallbackFunc(callback); + m_dbusRequest->deleteScheduleByScheduleID(scheduleID); +} + +/** + * @brief AccountItem::deleteSchedulesByTypeID + * 根据类型ID删除日程 + * @param typeID 日程类型id + * @param callback 回调函数 + */ +void AccountItem::deleteSchedulesByTypeID(const QString &typeID, CallbackFunc callback) +{ + m_dbusRequest->setCallbackFunc(callback); + m_dbusRequest->deleteSchedulesByScheduleTypeID(typeID); +} + +void AccountItem::querySchedulesWithParameter(const int year, CallbackFunc callback) +{ + QDateTime start = QDateTime(QDate(year - 1, 12, 1)); + QDateTime end = QDateTime(QDate(year + 1, 1, 31)); + querySchedulesWithParameter(start, end, callback); +} + +void AccountItem::querySchedulesWithParameter(const QDateTime &start, const QDateTime &end, CallbackFunc callback) +{ + querySchedulesWithParameter("", start, end, callback); +} + +void AccountItem::querySchedulesWithParameter(const QString &key, const QDateTime &start, const QDateTime &end, CallbackFunc callback) +{ + DScheduleQueryPar::Ptr ptr; + ptr.reset(new DScheduleQueryPar); + ptr->setKey(key); + ptr->setDtStart(start); + ptr->setDtEnd(end); + querySchedulesWithParameter(ptr, callback); +} + +/** + * @brief AccountItem::querySchedulesWithParameter + * 根据查询条件查询数据 + * @param params 查询条件 + * @param callback 回调函数 + */ +void AccountItem::querySchedulesWithParameter(const DScheduleQueryPar::Ptr ¶ms, CallbackFunc callback) +{ + m_preQuery = params; + m_dbusRequest->setCallbackFunc(callback); + m_dbusRequest->querySchedulesWithParameter(params); +} + +QString AccountItem::querySchedulesByExternal(const QString &key, const QDateTime &start, const QDateTime &end) +{ + DScheduleQueryPar::Ptr ptr; + ptr.reset(new DScheduleQueryPar); + ptr->setKey(key); + ptr->setDtStart(start); + ptr->setDtEnd(end); + QString json; + m_dbusRequest->querySchedulesByExternal(ptr, json); + return json; +} + +bool AccountItem::querySchedulesByExternal(const QString &key, const QDateTime &start, const QDateTime &end, QMap &out) +{ + DScheduleQueryPar::Ptr ptr; + ptr.reset(new DScheduleQueryPar); + ptr->setKey(key); + ptr->setDtStart(start); + ptr->setDtEnd(end); + QString json; + if (m_dbusRequest->querySchedulesByExternal(ptr, json)) { + out = DSchedule::fromMapString(json); + return true; + } + return false; +} + +/** + * @brief AccountItem::slotGetAccountInfoFinish + * 获取帐户信息完成事件 + * @param account 帐户数据 + */ +void AccountItem::slotGetAccountInfoFinish(DAccount::Ptr account) +{ + m_account = account; + emit signalAccountDataUpdate(); +} + +/** + * @brief AccountItem::slotGetScheduleTypeListFinish + * 获取日程类型数据完成事件 + * @param scheduleTypeList 日程类型数据 + */ +void AccountItem::slotGetScheduleTypeListFinish(DScheduleType::List scheduleTypeList) +{ + m_scheduleTypeList = scheduleTypeList; + emit signalScheduleTypeUpdate(); +} + +/** + * @brief AccountItem::slotGetScheduleListFinish + * 获取日程数据完成事件 + * @param map 日程数据 + */ +void AccountItem::slotGetScheduleListFinish(QMap map) +{ + m_scheduleMap = map; + emit signalScheduleUpdate(); +} + +/** + * @brief AccountItem::slotSearchScheduleListFinish + * 搜索日程数据完成事件 + * @param map 日程数据 + */ +void AccountItem::slotSearchScheduleListFinish(QMap map) +{ + m_searchedScheduleMap = map; + emit signalSearchScheduleUpdate(); +} + +/** + * @brief AccountItem::slotGetSysColorsFinish + * 获取系统颜色完成事件 + */ +void AccountItem::slotGetSysColorsFinish(DTypeColor::List typeColorList) +{ + m_typeColorList = typeColorList; +} + +void AccountItem::slotAccountStateChange(DAccount::AccountStates state) +{ + getAccount()->setAccountState(state); + emit signalAccountStateChange(); +} + +void AccountItem::slotSyncStateChange(DAccount::AccountSyncState state) +{ + getAccount()->setSyncState(state); + emit signalSyncStateChange(state); +} + +QString AccountItem::getDtLastUpdate() +{ + return m_dbusRequest->getDtLastUpdate(); +} + +void AccountItem::slotSearchUpdata() +{ + //如果存在查询则更新查询 + if (nullptr != m_preQuery) { + querySchedulesWithParameter(m_preQuery); + } +} + diff -Nru dde-calendar-5.9.1/calendar-client/src/dataManage/accountitem.h dde-calendar-5.10.0/calendar-client/src/dataManage/accountitem.h --- dde-calendar-5.9.1/calendar-client/src/dataManage/accountitem.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/dataManage/accountitem.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,151 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef ACCOUNTITEM_H +#define ACCOUNTITEM_H + +#include "dbus/dbusaccountrequest.h" +#include + +//单项帐户信息管理类 +class AccountItem : public QObject +{ + Q_OBJECT +public: + explicit AccountItem(const DAccount::Ptr &account, QObject *parent = nullptr); + + typedef QSharedPointer Ptr; + + //同步状态码转状态说明 + static QString getSyncMsg(DAccount::AccountSyncState code); + + void resetAccount(); + + //获取帐户数据 + DAccount::Ptr getAccount(); + + //获取日程 + QMap getScheduleMap(); + QMap getSearchScheduleMap(); + + // 获取日程类型信息集 + DScheduleType::List getScheduleTypeList(); + + //根据类型ID获取日程类型 + DScheduleType::Ptr getScheduleTypeByID(const QString &typeID); + DScheduleType::Ptr getScheduleTypeByName(const QString &typeName); + + //获取颜色类型列表 + DTypeColor::List getColorTypeList(); + + //获取日程是否可以同步 + bool isCanSyncShedule(); + //获取通用设置是否可以同步 + bool isCanSyncSetting(); + + //获取uos账号是否enable + bool isEnableForUosAccount(); + + //更新帐户列表展开状态 + void setAccountExpandStatus(bool expandStatus); + + //设置帐号状态 + void setAccountState(DAccount::AccountStates state); + //设置同步频率 + void setSyncFreq(DAccount::SyncFreqType freq); + //获取帐号状态 + DAccount::AccountStates getAccountState(); + //获取同步状态 + bool getSyncState(); + //获取同步频率 + DAccount::SyncFreqType getSyncFreq(); + + //创建日程类型 + void createJobType(const DScheduleType::Ptr &typeInfo, CallbackFunc callback = nullptr); + + //更新类型信息 + void updateScheduleType(const DScheduleType::Ptr &typeInfo, CallbackFunc callback = nullptr); + + //更新类型显示状态 + void updateScheduleTypeShowState(const DScheduleType::Ptr &scheduleInfo, CallbackFunc callback = nullptr); + + //根据类型ID删除日程类型 + void deleteScheduleTypeByID(const QString &typeID, CallbackFunc callback = nullptr); + + //类型是否被日程使用 + bool scheduleTypeIsUsed(const QString &typeID); + + //创建日程 + void createSchedule(const DSchedule::Ptr &scheduleInfo, CallbackFunc callback = nullptr); + + //更新日程 + void updateSchedule(const DSchedule::Ptr &scheduleInfo, CallbackFunc callback = nullptr); + + //根据日程ID获取日程 + DSchedule::Ptr getScheduleByScheduleID(const QString &scheduleID); + + //根据日程ID删除日程 + void deleteScheduleByID(const QString &scheduleID, CallbackFunc callback = nullptr); + + //根据类型ID删除日程 + void deleteSchedulesByTypeID(const QString &typeID, CallbackFunc callback = nullptr); + + //根据查询条件查询数据 + void querySchedulesWithParameter(const int year, CallbackFunc callback = nullptr); + void querySchedulesWithParameter(const QDateTime &start, const QDateTime &end, CallbackFunc callback = nullptr); + void querySchedulesWithParameter(const QString &key, const QDateTime &start, const QDateTime &end, CallbackFunc callback = nullptr); + void querySchedulesWithParameter(const DScheduleQueryPar::Ptr &, CallbackFunc callback = nullptr); + + //对外请求接口,同步 + QString querySchedulesByExternal(const QString &key, const QDateTime &start, const QDateTime &end); + bool querySchedulesByExternal(const QString &key, const QDateTime &start, const QDateTime &end, QMap& out); + +signals: + void signalAccountDataUpdate(); + void signalScheduleUpdate(); + void signalScheduleTypeUpdate(); + void signalSearchScheduleUpdate(); + void signalLogout(DAccount::Type); + void signalDtLastUpdate(QString); + void signalAccountStateChange(); + void signalSyncStateChange(DAccount::AccountSyncState); + +public slots: + //获取帐户信息完成事件 + void slotGetAccountInfoFinish(DAccount::Ptr); + //获取日程类型数据完成事件 + void slotGetScheduleTypeListFinish(DScheduleType::List); + //获取日程数据完成事件 + void slotGetScheduleListFinish(QMap); + //搜索日程数据完成事件 + void slotSearchScheduleListFinish(QMap); + //获取系统颜色完成 + void slotGetSysColorsFinish(DTypeColor::List); + //帐户状态改变事件 + void slotAccountStateChange(DAccount::AccountStates); + //同步状态改变事件 + void slotSyncStateChange(DAccount::AccountSyncState); + //获取最后一次同步时间 + QString getDtLastUpdate(); + + void slotSearchUpdata(); +private: + void initConnect(); + +private: + DAccount::Ptr m_account; //帐户数据 + DScheduleType::List m_scheduleTypeList; //日程类型数据 + DTypeColor::List m_typeColorList; //颜色数据 + DbusAccountRequest *m_dbusRequest = nullptr; //dbus请求实例 + //一年的日程信息 + QMap m_scheduleMap{}; + //搜索的日程信息 + QMap m_searchedScheduleMap{}; + + QMap m_dataStatus; //数据状态 + DScheduleQueryPar::Ptr m_preQuery = nullptr; //上一次查询 + +}; + +#endif // ACCOUNTITEM_H diff -Nru dde-calendar-5.9.1/calendar-client/src/dataManage/accountmanager.cpp dde-calendar-5.10.0/calendar-client/src/dataManage/accountmanager.cpp --- dde-calendar-5.9.1/calendar-client/src/dataManage/accountmanager.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/dataManage/accountmanager.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,257 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "accountmanager.h" + +AccountManager *AccountManager::m_accountManager = nullptr; +AccountManager::AccountManager(QObject *parent) + : QObject(parent) + , m_dbusRequest(new DbusAccountManagerRequest(this)) +{ + initConnect(); + m_dbusRequest->clientIsShow(true); + m_isSupportUid = m_dbusRequest->getIsSupportUid(); +} + +void AccountManager::initConnect() +{ + connect(m_dbusRequest, &DbusAccountManagerRequest::signalGetAccountListFinish, this, &AccountManager::slotGetAccountListFinish); + connect(m_dbusRequest, &DbusAccountManagerRequest::signalGetGeneralSettingsFinish, this, &AccountManager::slotGetGeneralSettingsFinish); +} + +bool AccountManager::getIsSupportUid() const +{ + return m_isSupportUid; +} + +AccountManager::~AccountManager() +{ + m_dbusRequest->clientIsShow(false); +} + +AccountManager *AccountManager::getInstance() +{ + static AccountManager m_accountManager; + return &m_accountManager; +} + +/** + * @brief AccountManager::getAccountList + * 获取帐户列表 + * @return 帐户列表 + */ +QList AccountManager::getAccountList() +{ + QList> accountList; + if (nullptr != m_localAccountItem.data()) { + accountList.append(m_localAccountItem); + } + + if (nullptr != m_unionAccountItem.data()) { + accountList.append(m_unionAccountItem); + } + return accountList; +} + +/** + * @brief AccountManager::getLocalAccountItem + * 获取本地帐户 + * @return + */ +AccountItem::Ptr AccountManager::getLocalAccountItem() +{ + return m_localAccountItem; +} + +/** + * @brief AccountManager::getUnionAccountItem + * 获取unionID帐户 + * @return + */ +AccountItem::Ptr AccountManager::getUnionAccountItem() +{ + return m_unionAccountItem; +} + +DScheduleType::Ptr AccountManager::getScheduleTypeByScheduleTypeId(const QString &schduleTypeId) +{ + DScheduleType::Ptr type = nullptr; + for (AccountItem::Ptr p : gAccountManager->getAccountList()) { + type = p->getScheduleTypeByID(schduleTypeId); + if (nullptr != type) { + break; + } + } + return type; +} + +AccountItem::Ptr AccountManager::getAccountItemByScheduleTypeId(const QString &schduleTypeId) +{ + DScheduleType::Ptr type = getScheduleTypeByScheduleTypeId(schduleTypeId); + if (nullptr == type) { + return nullptr; + } + return getAccountItemByAccountId(type->accountID()); +} + +AccountItem::Ptr AccountManager::getAccountItemByAccountId(const QString &accountId) +{ + AccountItem::Ptr account = nullptr; + for (AccountItem::Ptr p : gAccountManager->getAccountList()) { + if (p->getAccount()->accountID() == accountId) { + account = p; + break; + } + } + return account; +} + +AccountItem::Ptr AccountManager::getAccountItemByAccountName(const QString &accountName) +{ + AccountItem::Ptr account = nullptr; + for (AccountItem::Ptr p : gAccountManager->getAccountList()) { + if (p->getAccount()->accountName() == accountName) { + account = p; + break; + } + } + return account; +} + +DCalendarGeneralSettings::Ptr AccountManager::getGeneralSettings() +{ + return m_settings; +} + +/** + * @brief AccountManager::resetAccount + * 重置帐户信息 + */ +void AccountManager::resetAccount() +{ + m_localAccountItem.clear(); + m_unionAccountItem.clear(); + m_dbusRequest->getAccountList(); + m_dbusRequest->getCalendarGeneralSettings(); +} + +/** + * @brief AccountManager::downloadByAccountID + * 根据帐户ID下拉数据 + * @param accountID 帐户id + * @param callback 回调函数 + */ +void AccountManager::downloadByAccountID(const QString &accountID, CallbackFunc callback) +{ + emit signalSyncNum(); + m_dbusRequest->setCallbackFunc(callback); + m_dbusRequest->downloadByAccountID(accountID); +} + +/** + * @brief AccountManager::uploadNetWorkAccountData + * 更新网络帐户数据 + * @param callback 回调函数 + */ +void AccountManager::uploadNetWorkAccountData(CallbackFunc callback) +{ + m_dbusRequest->setCallbackFunc(callback); + m_dbusRequest->uploadNetWorkAccountData(); +} + +void AccountManager::setCalendarGeneralSettings(DCalendarGeneralSettings::Ptr ptr, CallbackFunc callback) +{ + m_dbusRequest->setCallbackFunc(callback); + m_dbusRequest->setCalendarGeneralSettings(ptr); +} + +void AccountManager::setFirstDayofWeek(int value) +{ + m_settings->setFirstDayOfWeek(static_cast(value)); + m_dbusRequest->setFirstDayofWeek(value); +} + +void AccountManager::setTimeFormatType(int value) +{ + m_settings->setTimeShowType(static_cast(value)); + m_dbusRequest->setTimeFormatType(value); +} + +/** + * @brief login + * 帐户登录 + */ +void AccountManager::login() +{ + m_dbusRequest->login(); +} + +/** + * @brief loginout + * 帐户登出 + */ +void AccountManager::loginout() +{ + m_dbusRequest->logout(); +} + +/** + * @brief AccountManager::slotGetAccountListFinish + * 获取帐户信息完成事件 + * @param accountList 帐户列表 + */ +void AccountManager::slotGetAccountListFinish(DAccount::List accountList) +{ + bool hasUnionAccount = false; + for (DAccount::Ptr account : accountList) { + if (account->accountType() == DAccount::Account_Local) { + QString localName = tr("Local account"); + if (!gAccountManager->getIsSupportUid()) { + localName = tr("Event types"); + } + account->setAccountName(localName); + if (!m_localAccountItem) { + m_localAccountItem.reset(new AccountItem(account, this)); + } + m_localAccountItem->resetAccount(); + + } else if (account->accountType() == DAccount::Account_UnionID) { + hasUnionAccount = true; + if (!m_unionAccountItem) { + m_unionAccountItem.reset(new AccountItem(account, this)); + m_unionAccountItem->resetAccount(); + } else if (m_unionAccountItem && m_unionAccountItem->getAccount()->accountID() != account->accountID()) { + emit m_unionAccountItem->signalLogout(m_unionAccountItem->getAccount()->accountType()); + m_unionAccountItem.reset(new AccountItem(account, this)); + m_unionAccountItem->resetAccount(); + } + } + } + if (!hasUnionAccount && m_unionAccountItem) { + emit m_unionAccountItem->signalLogout(m_unionAccountItem->getAccount()->accountType()); + m_unionAccountItem.reset(nullptr); + } + + for (AccountItem::Ptr p : getAccountList()) { + connect(p.data(), &AccountItem::signalScheduleUpdate, this, &AccountManager::signalScheduleUpdate); + connect(p.data(), &AccountItem::signalSearchScheduleUpdate, this, &AccountManager::signalSearchScheduleUpdate); + connect(p.data(), &AccountItem::signalScheduleTypeUpdate, this, &AccountManager::signalScheduleTypeUpdate); + connect(p.data(), &AccountItem::signalLogout, this, &AccountManager::signalLogout); + connect(p.data(), &AccountItem::signalAccountStateChange, this, &AccountManager::signalAccountStateChange); + } + + emit signalAccountUpdate(); +} + +/** + * @brief AccountManager::slotGetGeneralSettingsFinish + * 获取通用设置完成事件 + * @param ptr 通用设置数据 + */ +void AccountManager::slotGetGeneralSettingsFinish(DCalendarGeneralSettings::Ptr ptr) +{ + m_settings = ptr; + emit signalDataInitFinished(); + emit signalGeneralSettingsUpdate(); +} diff -Nru dde-calendar-5.9.1/calendar-client/src/dataManage/accountmanager.h dde-calendar-5.10.0/calendar-client/src/dataManage/accountmanager.h --- dde-calendar-5.9.1/calendar-client/src/dataManage/accountmanager.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/dataManage/accountmanager.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,93 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef ACCOUNTMANAGER_H +#define ACCOUNTMANAGER_H + +#include "dbus/dbusaccountmanagerrequest.h" +#include "accountitem.h" + +//所有帐户管理类 +class AccountManager : public QObject +{ + Q_OBJECT +public: + ~AccountManager() override; + + static AccountManager *getInstance(); + QList getAccountList(); + AccountItem::Ptr getLocalAccountItem(); + AccountItem::Ptr getUnionAccountItem(); + DScheduleType::Ptr getScheduleTypeByScheduleTypeId(const QString &schduleTypeId); + AccountItem::Ptr getAccountItemByScheduleTypeId(const QString &schduleTypeId); + AccountItem::Ptr getAccountItemByAccountId(const QString &accountId); + AccountItem::Ptr getAccountItemByAccountName(const QString &accountName); + DCalendarGeneralSettings::Ptr getGeneralSettings(); + + //重新获取帐户信息 + void resetAccount(); + + //根据帐户ID下拉数据 + void downloadByAccountID(const QString &accountID, CallbackFunc callback = nullptr); + //更新网络帐户数据 + void uploadNetWorkAccountData(CallbackFunc callback = nullptr); + + //设置通用设置 + void setCalendarGeneralSettings(DCalendarGeneralSettings::Ptr ptr, CallbackFunc callback = nullptr); + + //设置一周首日 + void setFirstDayofWeek(int); + //设置时间显示格式 + void setTimeFormatType(int); + //帐户登录 + void login(); + //帐户登出 + void loginout(); + + bool getIsSupportUid() const; + +signals: + void signalDataInitFinished(); + void signalAccountUpdate(); + void signalGeneralSettingsUpdate(); + + void signalAccountDataUpdate(); + void signalScheduleUpdate(); + void signalScheduleTypeUpdate(); + void signalSearchScheduleUpdate(); + void signalAccountStateChange(); + + //正在同步 + void signalSyncNum(const int num = -1); + + //帐户登出信号 + void signalLogout(DAccount::Type); + +public slots: + //获取帐户信息完成事件 + void slotGetAccountListFinish(DAccount::List accountList); + //获取通用设置完成事件 + void slotGetGeneralSettingsFinish(DCalendarGeneralSettings::Ptr ptr); + +protected: + explicit AccountManager(QObject *parent = nullptr); + +private: + void initConnect(); + +private: + static AccountManager *m_accountManager; + AccountItem::Ptr m_localAccountItem; + AccountItem::Ptr m_unionAccountItem; + DCalendarGeneralSettings::Ptr m_settings; + + DbusAccountManagerRequest *m_dbusRequest; + bool m_isSupportUid = false; +}; + +#define gAccountManager AccountManager::getInstance() +#define gLocalAccountItem gAccountManager->getLocalAccountItem() +#define gUosAccountItem gAccountManager->getUnionAccountItem() + +#endif // ACCOUNTMANAGER_H diff -Nru dde-calendar-5.9.1/calendar-client/src/dataManage/calendardatedatamanage.cpp dde-calendar-5.10.0/calendar-client/src/dataManage/calendardatedatamanage.cpp --- dde-calendar-5.9.1/calendar-client/src/dataManage/calendardatedatamanage.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/dataManage/calendardatedatamanage.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,297 +0,0 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ -#include "calendardatedatamanage.h" - -#include - -const int MonthMaxDay = 42; -Qt::DayOfWeek CalendarDateDataManager::m_weekFirstDay = Qt::Sunday; -/** - * @brief CalendarDateDataManage 构造函数 - * @param parent - */ -CalendarDateDataManager::CalendarDateDataManager() - : m_currentDateTime(QDateTime::currentDateTime()) - , m_selectDate(m_currentDateTime.date()) - , m_weekDayFormat("ddd") -{ - //设置显示年份,开始结束时间 - setYearBeginAndEndDate(m_selectDate.year()); -} -/** - * @brief setSelectDate 设置选择时间 - * @param selectDate 选择时间 - */ -void CalendarDateDataManager::setSelectDate(const QDate &selectDate, const bool isSwitchYear) -{ - m_selectDate = selectDate; - if (isSwitchYear || m_showDateRange.startDate > m_selectDate || m_showDateRange.stopDate < m_selectDate) { - //如果选择时间不在显示范围内则修改显示年份,开始和结束时间 - setYearBeginAndEndDate(m_selectDate.year()); - } -} -/** - * @brief getSelectDate 获取选择时间 - * @return 返回选择时间 - */ -QDate CalendarDateDataManager::getSelectDate() const -{ - return m_selectDate; -} -/** - * @brief setCurrentDateTime 设置当前时间 - * @param currentDateTime 当前时间 - */ -void CalendarDateDataManager::setCurrentDateTime(const QDateTime ¤tDateTime) -{ - m_currentDateTime = currentDateTime; -} -/** - * @brief getCurrentDate 获取当前时间 - * @return 返回当前时间 - */ -QDateTime CalendarDateDataManager::getCurrentDate() const -{ - return m_currentDateTime; -} -/** - * @brief getYearDate 获取全年的时间 - * @param year 设置的年份 - * @return 返回全年的时间,按照月份分组 - */ -QMap > CalendarDateDataManager::getYearDate() -{ - QMap > _resultMap; - for (int i = 1; i < 13; ++i) { - _resultMap[i] = getMonthDate(m_showDateRange.showYear, i); - } - return _resultMap; -} - -/** - * @brief getMonthDate 获取月份的所有时间 - * @param year 设置的年份 - * @param month 设置的月份 - * @return 返回当月全部时间 - */ -QVector CalendarDateDataManager::getMonthDate(const int &year, const int &month) -{ - QVector _resultDate; - //自然月的第一天 - const QDate _monthFirstDay{year, month, 1}; - //获取显示月的第一天 - const QDate _firstShowDayOfMonth = getFirstDayOfWeek(_monthFirstDay); - //获取该月所有显示时间 - for (int i = 0; i < 42; ++i) { - _resultDate.append(_firstShowDayOfMonth.addDays(i)); - } - return _resultDate; -} -/** - * @brief getWeekDate 获取一周的所有时间 - * @param date 设置的时间 - * @return 返回这个周全部时间 - */ -QVector CalendarDateDataManager::getWeekDate(const QDate &date) -{ - QVector _resultDate; - //获取这个周的第一天日期 - const QDate _firstDayofWeek = getFirstDayOfWeek(date); - //获取该周所有显示时间 - for (int i = 0; i < 7; ++i) { - _resultDate.append(_firstDayofWeek.addDays(i)); - } - return _resultDate; -} - -/** - * @brief setWeekFirstDay 设置每周以周几作为每周第一天 - * @param firstDay 每周第一天 - */ -void CalendarDateDataManager::setWeekFirstDay(const Qt::DayOfWeek &firstDay) -{ - m_weekFirstDay = firstDay; - setYearBeginAndEndDate(m_showDateRange.showYear); -} -/** - * @brief getWeekFirstDay 获取每周以周几作为每周第一天 - * @return 每周第一天 - */ -Qt::DayOfWeek CalendarDateDataManager::getWeekFirstDay() -{ - return m_weekFirstDay; -} -/** - * @brief setWeekDayFormatByID 设置周显示格式 - * @param weekDayFormatID - * 0 "dddd" - * 1 "ddd" - */ -void CalendarDateDataManager::setWeekDayFormatByID(const int &weekDayFormatID) -{ - switch (weekDayFormatID) { - case 0: - m_weekDayFormat = "dddd"; - break; - default: - m_weekDayFormat = "ddd"; - break; - } -} -/** - * @brief getWeekDayFormat 获取周显示格式 - * @return 周显示格式 - * "ddd" 周一 - * "dddd" 星期一 - */ -QString CalendarDateDataManager::getWeekDayFormat() const -{ - return m_weekDayFormat; -} - -/** - * @brief CalendarDateDataManager::getShowDateRange 获取显示年,开始结束时间 - * @return - */ -ShowDateRange CalendarDateDataManager::getShowDateRange() const -{ - return m_showDateRange; -} -/** - * @brief getFirstDayOfWeek 根据日期获取当前周第一天的日期 - * @param date 选择的日期 - * @return 当前周第一天的日期 - */ -QDate CalendarDateDataManager::getFirstDayOfWeek(const QDate &date) -{ - //根据选择时间周工作日和每周第一天的周工作日得到偏移量 - int _offset = date.dayOfWeek() - m_weekFirstDay; - //根据偏移量获取需要添加还有减去的偏移天数 - const int _offsetDay = _offset < 0 ? _offset + 7 : _offset; - //返回这周第一天的日期 - return date.addDays(0 - _offsetDay); -} -/** - * @brief getWeekNumOfYear 根据日期获取该日期处于该年第多少周 - * @param date 选择的日期 - * @return 处于当年第多少周 - */ -int CalendarDateDataManager::getWeekNumOfYear(const QDate &date) -{ - int _weekNum {0}; - //获取选择时间所在周的最后一天 - const QDate _laseDateInWeekBySelectDate = getFirstDayOfWeek(date).addDays(6); - //该年第一天 - const QDate _firstDayOfYear{_laseDateInWeekBySelectDate.year(), 1, 1}; - //该年显示的第一天日期 - const QDate _firstShowDayOfYear = getFirstDayOfWeek(_firstDayOfYear); - //处于该年显示第多少天,0为第一天 - const qint64 _dayOfShowYear = _firstShowDayOfYear.daysTo(_firstDayOfYear) + _laseDateInWeekBySelectDate.dayOfYear() - 1; - _weekNum = qFloor(_dayOfShowYear / 7) + 1; - return _weekNum; -} - -/** - * @brief CalendarDateDataManager::setTimeFormatChanged 根据value设置短时间显示格式 - * @param value - */ -void CalendarDateDataManager::setTimeFormatChanged(int value) -{ - m_timeFormatValue = value; - if (value) { - m_timeFormat = "hh:mm"; - } else { - m_timeFormat = "h:mm"; - } -} - -/** - * @brief CalendarDateDataManager::setDateFormatChanged 根据value设置短日期显示格式 - * @param value - */ -void CalendarDateDataManager::setDateFormatChanged(int value) -{ - switch (value) { - case 0: { - m_dateFormat = "yyyy/M/d"; - } break; - case 1: { - m_dateFormat = "yyyy-M-d"; - } break; - case 2: { - m_dateFormat = "yyyy.M.d"; - } break; - case 3: { - m_dateFormat = "yyyy/MM/dd"; - } break; - case 4: { - m_dateFormat = "yyyy-MM-dd"; - } break; - case 5: { - m_dateFormat = "yyyy.MM.dd"; - } break; - case 6: { - m_dateFormat = "yy/M/d"; - } break; - case 7: { - m_dateFormat = "yy-M-d"; - } break; - case 8: { - m_dateFormat = "yy.M.d"; - } break; - default: { - m_dateFormat = "yyyy-MM-dd"; - } break; - } -} - -/** - * @brief CalendarDateDataManager::getTimeFormat 获取短时间格式 - */ -QString CalendarDateDataManager::getTimeFormat() const -{ - return m_timeFormat; -} - -/** - * @brief CalendarDateDataManager::getTimeFormatValue 获取时间格式的value - */ -int CalendarDateDataManager::getTimeFormatValue() const -{ - return m_timeFormatValue; -} - -/** - * @brief CalendarDateDataManager::getDateFormat 获取短日期格式 - */ -QString CalendarDateDataManager::getDateFormat() const -{ - return m_dateFormat; -} - -void CalendarDateDataManager::setYearBeginAndEndDate(const int year) -{ - m_showDateRange.showYear = year; - QDate _firstDayOfJan(year, 1, 1); - m_showDateRange.startDate = getFirstDayOfWeek(_firstDayOfJan); - QDate _firstDayOfDec(year, 12, 1); - m_showDateRange.stopDate = getFirstDayOfWeek(_firstDayOfDec).addDays(MonthMaxDay - 1); -} diff -Nru dde-calendar-5.9.1/calendar-client/src/dataManage/calendardatedatamanage.h dde-calendar-5.10.0/calendar-client/src/dataManage/calendardatedatamanage.h --- dde-calendar-5.9.1/calendar-client/src/dataManage/calendardatedatamanage.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/dataManage/calendardatedatamanage.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,110 +0,0 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ -#ifndef CALENDARDATEDATAMANAGE_H -#define CALENDARDATEDATAMANAGE_H - -#include -#include -#include - -struct ShowDateRange { - int showYear{0}; - QDate startDate; - QDate stopDate; -}; -/** - * @brief The CalendarDateDataManager class - * 日历时间管理类 - */ -class CalendarDateDataManager -{ -public: - explicit CalendarDateDataManager(); - //设置选择时间 - void setSelectDate(const QDate &selectDate, const bool isSwitchYear = false); - //获取选择时间 - QDate getSelectDate() const; - //设置当前时间 - void setCurrentDateTime(const QDateTime ¤tDateTime = QDateTime::currentDateTime()); - //获取当前时间 - QDateTime getCurrentDate() const; - //获取全年的时间 - QMap > getYearDate(); - //获取月份的所有时间 - static QVector getMonthDate(const int &year, const int &month); - //获取一周的所有时间 - static QVector getWeekDate(const QDate &date); - //设置每周以周几作为每周第一天 - void setWeekFirstDay(const Qt::DayOfWeek &firstDay); - //获取每周以周几作为每周第一天 - static Qt::DayOfWeek getWeekFirstDay(); - //设置周显示格式 - void setWeekDayFormatByID(const int &weekDayFormatID); - //获取周显示格式 - QString getWeekDayFormat() const; - //返回显示的年份,开始和结束时间 - ShowDateRange getShowDateRange() const; - //根据日期获取当前周第一天的日期 - static QDate getFirstDayOfWeek(const QDate &date); - //根据日期获取该日期处于该年第多少周 - static int getWeekNumOfYear(const QDate &date); - - void setTimeFormatChanged(int value); - void setDateFormatChanged(int value); - QString getTimeFormat() const; - int getTimeFormatValue() const; - QString getDateFormat() const; - -private: - void setYearBeginAndEndDate(const int year); -private: - /** - * @brief m_currentDateTime 当前时间 - */ - QDateTime m_currentDateTime; - /** - * @brief m_selectDate 设置选择时间 - */ - QDate m_selectDate; - /** - * @brief m_firstDay 每周第一天 - * 1 周一 - * 2 周二 - * 3 周三 - * 4 周四 - * 5 周五 - * 6 周六 - * 7 周日 - */ - static Qt::DayOfWeek m_weekFirstDay; - /** - * @brief m_weekDayFormat 周显示格式 - * ddd 周一 - * dddd 星期一 - */ - QString m_weekDayFormat{"ddd"}; - ShowDateRange m_showDateRange; - QString m_timeFormat = "h:mm"; - QString m_dateFormat = "yyyy-MM-dd"; - int m_timeFormatValue = 0; -}; - -#endif // CALENDARDATEDATAMANAGE_H diff -Nru dde-calendar-5.9.1/calendar-client/src/dataManage/calendarmanage.cpp dde-calendar-5.10.0/calendar-client/src/dataManage/calendarmanage.cpp --- dde-calendar-5.9.1/calendar-client/src/dataManage/calendarmanage.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/dataManage/calendarmanage.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,386 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "calendarmanage.h" +#include "cschedulebasewidget.h" +#include "scheduledatamanage.h" + +#include + +const QString DBus_TimeDate_Name = "com.deepin.daemon.Timedate"; +const QString DBus_TimeDate_Path = "/com/deepin/daemon/Timedate"; + +CalendarManager *CalendarManager::m_scheduleManager = nullptr; +CalendarManager *CalendarManager::getInstance() +{ + CaHuangLiDayInfo::registerMetaType(); + if (m_scheduleManager == nullptr) { + m_scheduleManager = new CalendarManager; + qRegisterMetaType>("QMap"); + qRegisterMetaType >("QMap"); + qRegisterMetaType>("QMap"); + } + return m_scheduleManager; +} + +void CalendarManager::releaseInstance() +{ + if (m_scheduleManager != nullptr) { + delete m_scheduleManager; + m_scheduleManager = nullptr; + } +} + +//设置选择时间 +void CalendarManager::setSelectDate(const QDate &selectDate, bool isSwitchYear) +{ + m_selectDate = selectDate; + if (isSwitchYear || m_showDateRange.startDate > m_selectDate || m_showDateRange.stopDate < m_selectDate) { + //如果选择时间不在显示范围内则修改显示年份,开始和结束时间 + setYearBeginAndEndDate(m_selectDate.year()); + } +} +//获取选择时间 +QDate CalendarManager::getSelectDate() const +{ + return m_selectDate; +} +//设置当前时间 +void CalendarManager::setCurrentDateTime(const QDateTime ¤tDateTime) +{ + m_currentDateTime = currentDateTime; +} +//获取当前时间 +QDateTime CalendarManager::getCurrentDate() const +{ + return m_currentDateTime; +} + +QVector CalendarManager::getMonthDate(const int &year, const int &month) +{ + QVector _resultDate; + //自然月的第一天 + const QDate _monthFirstDay{year, month, 1}; + //获取显示月的第一天 + const QDate _firstShowDayOfMonth = getFirstDayOfWeek(_monthFirstDay); + //获取该月所有显示时间 + for (int i = 0; i < 42; ++i) { + _resultDate.append(_firstShowDayOfMonth.addDays(i)); + } + return _resultDate; +} + +QVector CalendarManager::getWeekDate(const QDate &date) +{ + QVector _resultDate; + //获取这个周的第一天日期 + const QDate _firstDayofWeek = getFirstDayOfWeek(date); + //获取该周所有显示时间 + for (int i = 0; i < 7; ++i) { + _resultDate.append(_firstDayofWeek.addDays(i)); + } + return _resultDate; +} + +//设置周显示格式 +void CalendarManager::setWeekDayFormatByID(const int &weekDayFormatID) +{ + switch (weekDayFormatID) { + case 0: + m_weekDayFormat = "dddd"; + break; + default: + m_weekDayFormat = "ddd"; + break; + } +} +//获取周显示格式 +QString CalendarManager::getWeekDayFormat() const +{ + return m_weekDayFormat; +} + +//返回显示的年份,开始和结束时间 +ShowDateRange CalendarManager::getShowDateRange() const +{ + return m_showDateRange; +} + +//根据日期获取当前周第一天的日期 +QDate CalendarManager::getFirstDayOfWeek(const QDate &date) +{ + //根据选择时间周工作日和每周第一天的周工作日得到偏移量 + int _offset = date.dayOfWeek() - getFirstDayOfWeek(); + //根据偏移量获取需要添加还有减去的偏移天数 + const int _offsetDay = (_offset + 7) % 7; + //返回这周第一天的日期 + return date.addDays(-_offsetDay); +} + +//根据日期获取该日期处于该年第多少周 +int CalendarManager::getWeekNumOfYear(const QDate &date) +{ + int _weekNum {0}; + //获取选择时间所在周的最后一天 + const QDate _laseDateInWeekBySelectDate = getInstance()->getFirstDayOfWeek(date).addDays(6); + //该年第一天 + const QDate _firstDayOfYear{_laseDateInWeekBySelectDate.year(), 1, 1}; + //该年显示的第一天日期 + const QDate _firstShowDayOfYear = getInstance()->getFirstDayOfWeek(_firstDayOfYear); + //处于该年显示第多少天,0为第一天 + const qint64 _dayOfShowYear = _firstShowDayOfYear.daysTo(_firstDayOfYear) + _laseDateInWeekBySelectDate.dayOfYear() - 1; + _weekNum = qFloor(_dayOfShowYear / 7) + 1; + return _weekNum; +} + +void CalendarManager::setTimeFormatChanged(int value) +{ + // value = 0/1,对应的时间格式不对 + if (value == 0) { + m_timeFormat = "h:mm"; + } else { + m_timeFormat = "hh:mm"; + } + updateData(); +} + +void CalendarManager::setDateFormatChanged(int value) +{ + switch (value) { + case 0: { + m_dateFormat = "yyyy/M/d"; + } break; + case 1: { + m_dateFormat = "yyyy-M-d"; + } break; + case 2: { + m_dateFormat = "yyyy.M.d"; + } break; + case 3: { + m_dateFormat = "yyyy/MM/dd"; + } break; + case 4: { + m_dateFormat = "yyyy-MM-dd"; + } break; + case 5: { + m_dateFormat = "yyyy.MM.dd"; + } break; + case 6: { + m_dateFormat = "yy/M/d"; + } break; + case 7: { + m_dateFormat = "yy-M-d"; + } break; + case 8: { + m_dateFormat = "yy.M.d"; + } break; + default: { + m_dateFormat = "yyyy-MM-dd"; + } break; + } +} + +QString CalendarManager::getTimeFormat() const +{ + return m_timeFormat; +} + +void CalendarManager::setTimeShowType(int value, bool update) +{ + m_timeShowType = value; + if (update) { + updateData(); + } +} + +int CalendarManager::getTimeShowType() const +{ + return m_timeShowType; +} + +QString CalendarManager::getDateFormat() const +{ + return m_dateFormat; +} + +void CalendarManager::setYearBeginAndEndDate(const int year) +{ + m_showDateRange.showYear = year; + QDate _firstDayOfJan(year, 1, 1); + m_showDateRange.startDate = getFirstDayOfWeek(_firstDayOfJan); + QDate _firstDayOfDec(year, 12, 1); + m_showDateRange.stopDate = getFirstDayOfWeek(_firstDayOfDec).addDays(42 - 1); + //更新日程 + gScheduleManager->resetSchedule(QDateTime(m_showDateRange.startDate), QDateTime(m_showDateRange.stopDate)); + if (m_showLunar) { + //刷新农历和节假日信息 + gLunarManager->queryLunarInfo(m_showDateRange.startDate, m_showDateRange.stopDate); + gLunarManager->queryFestivalInfo(m_showDateRange.startDate, m_showDateRange.stopDate); + } +} + +/** + * @brief CalendarManager::addShowWidget 添加显示界面 + * @param showWidget + */ +void CalendarManager::addShowWidget(CScheduleBaseWidget *showWidget) +{ + m_showWidget.append(showWidget); +} + +/** + * @brief CalendarManager::removeShowWidget 移除显示界面 + * @param showWidget + */ +void CalendarManager::removeShowWidget(CScheduleBaseWidget *showWidget) +{ + m_showWidget.removeOne(showWidget); +} + +/** + * @brief CalendarManager::getShowWidget 根据编号获取显示界面 + * @param index + * @return + */ +CScheduleBaseWidget *CalendarManager::getShowWidget(const int index) +{ + if (index < 0 || index >= m_showWidget.size()) { + return nullptr; + } + return m_showWidget.at(index); +} + +/** + * @brief CalendarManager::getShowWidgetSize 获取显示窗口的数目 + * @return + */ +int CalendarManager::getShowWidgetSize() +{ + return m_showWidget.size(); +} + +/** + * @brief CalendarManager::getShowLunar 获取农历信息 + * @return + */ +bool CalendarManager::getShowLunar() const +{ + return m_showLunar; +} + +/** + * @brief getFirstDayOfWeek + * @return 一周首日 + */ +Qt::DayOfWeek CalendarManager::getFirstDayOfWeek() +{ + return Qt::DayOfWeek(m_firstDayOfWeek); +} + +void CalendarManager::setFirstDayOfWeek(int day, bool update) +{ + m_firstDayOfWeek = day; + //更新显示界面 + if (update) { + updateData(); + } +} + +void CalendarManager::updateData() +{ + // 为了跟之前的代码一致,在这里发送信号出来; + emit sigNotifySidebarFirstDayChanged(getFirstDayOfWeek()); + for (int i = 0; i < m_showWidget.size(); ++i) { + m_showWidget.at(i)->updateData(); + } +} + +CalendarManager::CalendarManager(QObject *parent) + : QObject(parent) + , m_timeDateDbus(new DaemonTimeDate(this)) + , m_currentDateTime(QDateTime::currentDateTime()) + , m_selectDate(m_currentDateTime.date()) + , m_weekDayFormat("ddd") +{ + initConnection(); + initData(); +} + +CalendarManager::~CalendarManager() +{ + +} + +/** + * @brief CalendarManager::initData 初始化数据 + */ +void CalendarManager::initData() +{ + //获取本地语言判断是否为中文 + m_showLunar = QLocale::system().language() == QLocale::Chinese; + //获取时间日期格式 + const int _timeFormat = m_timeDateDbus->shortTimeFormat(); + const int _dateFormat = m_timeDateDbus->shortDateFormat(); + setYearBeginAndEndDate(m_selectDate.year()); + //设置时间日期格式 + setTimeFormatChanged(_timeFormat); + setDateFormatChanged(_dateFormat); + slotGeneralSettingsUpdate(); +} + +/** + * @brief CalendarManager::initConnection 初始化关联 + */ +void CalendarManager::initConnection() +{ + connect(gAccountManager, &AccountManager::signalGeneralSettingsUpdate, this, &CalendarManager::slotGeneralSettingsUpdate); + connect(m_timeDateDbus, &DaemonTimeDate::ShortTimeFormatChanged, this, &CalendarManager::signalTimeFormatChanged); + connect(m_timeDateDbus, &DaemonTimeDate::ShortTimeFormatChanged, this, &CalendarManager::slotTimeFormatChanged); // add time format slot. + connect(m_timeDateDbus, &DaemonTimeDate::ShortDateFormatChanged, this, &CalendarManager::slotDateFormatChanged); + connect(m_timeDateDbus, &DaemonTimeDate::ShortDateFormatChanged, this, &CalendarManager::signalDateFormatChanged); +} + +/** + * @brief CalendarManager::WeekBeginsChanged 关联dbus信号,每周首日改变事触发 + * @param value + */ +void CalendarManager::weekBeginsChanged(int value) +{ + setFirstDayOfWeek(value); +} + +/** + * @brief CalendarManager::slotGetLunarSuccess 农历更新成功刷新界面 + */ +void CalendarManager::slotGetLunarSuccess() +{ + //更新显示界面 + for (int i = 0; i < m_showWidget.size(); ++i) { + m_showWidget.at(i)->updateShowLunar(); + } +} + +void CalendarManager::slotGeneralSettingsUpdate() +{ + DCalendarGeneralSettings::Ptr setting = gAccountManager->getGeneralSettings(); + if (!setting) { + return; + } + setFirstDayOfWeek(setting->firstDayOfWeek()); + setTimeShowType(setting->timeShowType()); +} + +/** + * @brief CalendarManager::slotDateFormatChanged 更新日期显示格式 + * @param value + */ +void CalendarManager::slotDateFormatChanged(int value) +{ + setDateFormatChanged(value); +} + +void CalendarManager::slotTimeFormatChanged(int value) +{ + setTimeFormatChanged(value); +} diff -Nru dde-calendar-5.9.1/calendar-client/src/dataManage/calendarmanage.h dde-calendar-5.10.0/calendar-client/src/dataManage/calendarmanage.h --- dde-calendar-5.9.1/calendar-client/src/dataManage/calendarmanage.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/dataManage/calendarmanage.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,121 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef CSCHEDULEMANAGE_H +#define CSCHEDULEMANAGE_H + +#include "lunarmanager.h" +#include "dbustimedate.h" + +#include + +struct ShowDateRange { + int showYear{0}; + QDate startDate; + QDate stopDate; +}; + +typedef DBusTimedate DaemonTimeDate; +class CScheduleBaseWidget; +/** + * @brief The CalendarManage class + * 日历数据管理类 + */ +class CalendarManager : public QObject +{ + Q_OBJECT +public: + static CalendarManager *getInstance(); + static void releaseInstance(); + + //设置选择时间 + void setSelectDate(const QDate &selectDate, bool isSwitchYear = false); + //获取选择时间 + QDate getSelectDate() const; + //设置当前时间 + void setCurrentDateTime(const QDateTime ¤tDateTime = QDateTime::currentDateTime()); + //获取当前时间 + QDateTime getCurrentDate() const; + //获取月份的所有时间 + QVector getMonthDate(const int &year, const int &month); + //获取一周的所有时间 + QVector getWeekDate(const QDate &date); + //设置周显示格式 + void setWeekDayFormatByID(const int &weekDayFormatID); + //获取周显示格式 + QString getWeekDayFormat() const; + //返回显示的年份,开始和结束时间 + ShowDateRange getShowDateRange() const; + //根据日期获取当前周第一天的日期 + QDate getFirstDayOfWeek(const QDate &date); + //根据日期获取该日期处于该年第多少周 + static int getWeekNumOfYear(const QDate &date); + + void setTimeFormatChanged(int value); + void setDateFormatChanged(int value); + QString getTimeFormat() const; + void setTimeShowType(int value, bool update = true); + int getTimeShowType() const; + QString getDateFormat() const; + + //添加显示界面 + void addShowWidget(CScheduleBaseWidget *showWidget); + //移除显示界面 + void removeShowWidget(CScheduleBaseWidget *showWidget); + //根据编号获取显示界面 + CScheduleBaseWidget *getShowWidget(const int index); + //获取显示窗口的数目 + int getShowWidgetSize(); + //获取是否显示农历信息 + bool getShowLunar() const; + //获取一周首日 + Qt::DayOfWeek getFirstDayOfWeek(); + //设置一周首日 + void setFirstDayOfWeek(int, bool update = true); + void updateData(); + +signals: + void signalTimeFormatChanged(int value); + void signalDateFormatChanged(int value); + void sigNotifySidebarFirstDayChanged(int value); + +public slots: + //关联dbus信号,每周首日改变事触发 + void weekBeginsChanged(int value); + //农历更新成功刷新界面 + void slotGetLunarSuccess(); + + void slotGeneralSettingsUpdate(); + + void slotDateFormatChanged(int value); + + void slotTimeFormatChanged(int value); + +private: + explicit CalendarManager(QObject *parent = nullptr); + ~CalendarManager(); + + void setYearBeginAndEndDate(const int year); +private: + //初始化数据 + void initData(); + //初始化关联 + void initConnection(); + +private: + static CalendarManager *m_scheduleManager; + DaemonTimeDate *m_timeDateDbus; //控制中心dbus + QList m_showWidget; //日历主视图 + bool m_showLunar; //显示农历 + int m_firstDayOfWeek = Qt::Sunday; //一周首日 + QDateTime m_currentDateTime; //当前时间 + QDate m_selectDate; //当前选择的时间 + QString m_weekDayFormat{"ddd"}; //周显示格式, ddd: 周一, dddd: 星期一 + ShowDateRange m_showDateRange; //时间范围 + QString m_timeFormat = "h:mm"; //时间显示格式 + QString m_dateFormat = "yyyy-MM-dd"; //日期显示格式 + int m_timeShowType = 0; +}; +#define gCalendarManager CalendarManager::getInstance() +#endif // CSCHEDULEMANAGE_H diff -Nru dde-calendar-5.9.1/calendar-client/src/dataManage/lunarmanager.cpp dde-calendar-5.10.0/calendar-client/src/dataManage/lunarmanager.cpp --- dde-calendar-5.9.1/calendar-client/src/dataManage/lunarmanager.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/dataManage/lunarmanager.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,219 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "lunarmanager.h" + +LunarManager::LunarManager(QObject *parent) : QObject(parent) + , m_dbusRequest(new DbusHuangLiRequest) +{ + +} + +LunarManager* LunarManager::getInstace() +{ + static LunarManager lunarManager; + return &lunarManager; +} + +/** + * @brief LunarManager::getFestivalMonth + * 按月获取节假日信息 + * @param year 年 + * @param month 月 + * @param festivalInfo 数据保存位置 + * @return + */ +bool LunarManager::getFestivalMonth(quint32 year, quint32 month, FestivalInfo& festivalInfo) +{ + return m_dbusRequest->getFestivalMonth(year, month, festivalInfo); +} + +/** + * @brief LunarManager::getFestivalMonth + * 按月获取节假日信息 + * @param date 月所在日期 + * @param festivalInfo 数据储存位置 + * @return 请求成功状态 + */ +bool LunarManager::getFestivalMonth(const QDate &date, FestivalInfo& festivalInfo) +{ + return m_dbusRequest->getFestivalMonth(quint32(date.year()), quint32(date.month()), festivalInfo); +} + +/** + * @brief LunarManager::getHuangLiDay + * 按天获取黄历信息 + * @param year 年 + * @param month 月 + * @param day 日 + * @param info 数据储存位置 + * @return 请求成功状态 + */ +bool LunarManager::getHuangLiDay(quint32 year, quint32 month, quint32 day, CaHuangLiDayInfo &info) +{ + return m_dbusRequest->getHuangLiDay(year, month, day, info); +} + +/** + * @brief LunarManager::getHuangLiDay + * 按天获取农历信息 + * @param date 请求日期 + * @param info 数据储存位置 + * @return 请求成功状态 + */ +bool LunarManager::getHuangLiDay(const QDate &date, CaHuangLiDayInfo &info) +{ + return getHuangLiDay(quint32(date.year()), quint32(date.month()), quint32(date.day()), info); +} + +/** + * @brief LunarManager::getHuangLiMonth + * 按月获取农历信息 + * @param year 年 + * @param month 月 + * @param info 日 + * @param fill + * @return 请求成功状态 + */ +bool LunarManager::getHuangLiMonth(quint32 year, quint32 month, CaHuangLiMonthInfo &info, bool fill) +{ + return m_dbusRequest->getHuangLiMonth(year, month, fill, info); +} + +/** + * @brief LunarManager::getHuangLiMonth + * 按月获取农历信息 + * @param date 请求日期 + * @param info 数据储存位置 + * @return 请求成功状态 + */ +bool LunarManager::getHuangLiMonth(const QDate &date, CaHuangLiMonthInfo &info, bool fill) +{ + return getHuangLiMonth(quint32(date.year()), quint32(date.month()), info, fill); +} + +/** + * @brief LunarManager::getHuangLiShortName + * 获取当天的农历月日期和日日期名 + * @param date 请求日期 + * @return 农历名 + */ +QString LunarManager::getHuangLiShortName(const QDate &date) +{ + CaHuangLiDayInfo info = getHuangLiDay(date); + return info.mLunarMonthName + info.mLunarDayName; +} + +/** + * @brief LunarManager::queryLunarInfo + * 查询农历信息 + * @param startDate 开始时间 + * @param stopDate 结束时间 + */ +void LunarManager::queryLunarInfo(const QDate &startDate, const QDate &stopDate) +{ + QMap lunarInfoMap; + CaHuangLiMonthInfo monthInfo; + const int offsetMonth = (stopDate.year() - startDate.year()) * 12 + stopDate.month() - startDate.month(); + //获取开始时间至结束时间所在月的农历和节假日信息 + for (int i = 0; i <= offsetMonth; ++i) { + monthInfo.clear(); + QDate beginDate = startDate.addMonths(i); + getHuangLiMonth(beginDate, monthInfo); + + QDate getDate(beginDate.year(), beginDate.month(), 1); + for (int j = 0; j < monthInfo.mDays; ++j) { + lunarInfoMap[getDate.addDays(j)] = monthInfo.mCaLunarDayInfo.at(j); + } + } + m_lunarInfoMap = lunarInfoMap; +} + +/** + * @brief LunarManager::queryFestivalInfo + * 查询节假日信息 + * @param startDate 开始时间 + * @param stopDate 结束时间 + */ +void LunarManager::queryFestivalInfo(const QDate &startDate, const QDate &stopDate) +{ + QVector festivallist{}; + + const int offsetMonth = (stopDate.year() - startDate.year()) * 12 + stopDate.month() - startDate.month(); + + for (int i = 0; i <= offsetMonth; ++i) { + FestivalInfo info; + QDate beginDate = startDate.addMonths(i); + if (getFestivalMonth(beginDate, info)) { + festivallist.push_back(info); + } + } + + m_festivalDateMap.clear(); + for (FestivalInfo info : festivallist) { + for (HolidayInfo h : info.listHoliday) { + m_festivalDateMap[h.date] = h.status; + } + } +} + +/** + * @brief LunarManager::getHuangLiDay + * 获取农历信息 + * @param date 获取日期 + * @return + */ +CaHuangLiDayInfo LunarManager::getHuangLiDay(const QDate &date) +{ + //首先在缓存中查找是否存在该日期的农历信息,没有则通过dbus获取 + CaHuangLiDayInfo info; + if (m_lunarInfoMap.contains(date)) { + info = m_lunarInfoMap[date]; + } else { + getHuangLiDay(date, info); + } + return info; +} + +/** + * @brief LunarManager::getHuangLiDayMap + * 获取一定时间范围内的农历数据 + * @param startDate 开始时间 + * @param stopDate 结束时间 + * @return 农历信息 + */ +QMap LunarManager::getHuangLiDayMap(const QDate &startDate, const QDate &stopDate) +{ + QMap lunarInfoMap; + auto iterator = m_lunarInfoMap.begin(); + while(iterator != m_lunarInfoMap.end()) { + if (iterator.key() >= startDate || iterator.key() <= stopDate) { + iterator.value(); + lunarInfoMap[iterator.key()] = iterator.value(); + } + iterator++; + } + return lunarInfoMap; +} + +/** + * @brief LunarManager::getFestivalInfoDateMap + * 获取节假日日期信息 + * @param startDate 开始时间 + * @param stopDate 结束时间 + * @return 节假日日期信息 + */ +QMap LunarManager::getFestivalInfoDateMap(const QDate &startDate, const QDate &stopDate) +{ + QMap festivalDateMap; + auto iterator = m_festivalDateMap.begin(); + while(iterator != m_festivalDateMap.end()) { + if (iterator.key() >= startDate || iterator.key() <= stopDate) { + iterator.value(); + festivalDateMap[iterator.key()] = iterator.value(); + } + iterator++; + } + return festivalDateMap; +} diff -Nru dde-calendar-5.9.1/calendar-client/src/dataManage/lunarmanager.h dde-calendar-5.10.0/calendar-client/src/dataManage/lunarmanager.h --- dde-calendar-5.9.1/calendar-client/src/dataManage/lunarmanager.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/dataManage/lunarmanager.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,58 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef LUNARMANAGER_H +#define LUNARMANAGER_H + +#include "dbushuanglirequest.h" +#include "huangliData/dbusdatastruct.h" +#include "huangliData/lunardatastruct.h" +#include + +class LunarManager : public QObject +{ + Q_OBJECT +public: + explicit LunarManager(QObject *parent = nullptr); + + static LunarManager* getInstace(); + + //按月获取节假日信息 + bool getFestivalMonth(quint32 year, quint32 month, FestivalInfo& festivalInfo); + //按月获取节假日信息 + bool getFestivalMonth(const QDate &date, FestivalInfo& festivalInfo); + //按天获取黄历信息 + bool getHuangLiDay(quint32 year, quint32 month, quint32 day, CaHuangLiDayInfo &info); + //按天获取农历信息 + bool getHuangLiDay(const QDate &date, CaHuangLiDayInfo &out); + //按月获取黄历信息 + bool getHuangLiMonth(quint32 year, quint32 month, CaHuangLiMonthInfo &info, bool fill = false); + //按月获取黄历信息 + bool getHuangLiMonth(const QDate &date, CaHuangLiMonthInfo &info, bool fill = false); + + //获取当天的农历月日期和日日期名 + QString getHuangLiShortName(const QDate &date); + //查询农历信息 + void queryLunarInfo(const QDate &startDate, const QDate &stopDate); + //查询节假日信息 + void queryFestivalInfo(const QDate &startDate, const QDate &stopDate); + //获取节假日日期信息 + QMap getFestivalInfoDateMap(const QDate &startDate, const QDate &stopDate); + //获取当天农历数据 + CaHuangLiDayInfo getHuangLiDay(const QDate &date); + //获取一定时间范围内的农历数据 + QMap getHuangLiDayMap(const QDate &startDate, const QDate &stopDate); + +signals: + +public slots: + +private: + DbusHuangLiRequest* m_dbusRequest = nullptr; //dbus请求实例 + QMap m_lunarInfoMap; //缓存的农历数据 + QMap m_festivalDateMap; //缓存的节假日数据 + +}; +#define gLunarManager LunarManager::getInstace() +#endif // LUNARMANAGER_H diff -Nru dde-calendar-5.9.1/calendar-client/src/dataManage/schedulecoormanage.cpp dde-calendar-5.10.0/calendar-client/src/dataManage/schedulecoormanage.cpp --- dde-calendar-5.9.1/calendar-client/src/dataManage/schedulecoormanage.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/dataManage/schedulecoormanage.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,21 +1,7 @@ -/* - * Copyright (C) 2017 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: kirigaya - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "schedulecoormanage.h" #include diff -Nru dde-calendar-5.9.1/calendar-client/src/dataManage/schedulecoormanage.h dde-calendar-5.10.0/calendar-client/src/dataManage/schedulecoormanage.h --- dde-calendar-5.9.1/calendar-client/src/dataManage/schedulecoormanage.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/dataManage/schedulecoormanage.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,21 +1,7 @@ -/* - * Copyright (C) 2017 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: kirigaya - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef SCHEDULECOORMANAGE_H #define SCHEDULECOORMANAGE_H diff -Nru dde-calendar-5.9.1/calendar-client/src/dataManage/scheduledatamanage.cpp dde-calendar-5.10.0/calendar-client/src/dataManage/scheduledatamanage.cpp --- dde-calendar-5.9.1/calendar-client/src/dataManage/scheduledatamanage.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/dataManage/scheduledatamanage.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,64 +1,41 @@ -/* - * Copyright (C) 2017 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: kirigaya - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "scheduledatamanage.h" +#include "accountmanager.h" #include "cscheduleoperation.h" +#include "accountmanager.h" #include #include -CScheduleDataManage *CScheduleDataManage::m_vscheduleDataManage = new CScheduleDataManage; +CScheduleDataManage *CScheduleDataManage::m_vscheduleDataManage = nullptr; -CSchedulesColor CScheduleDataManage::getScheduleColorByType(int type) +// +CSchedulesColor CScheduleDataManage::getScheduleColorByType(const QString &typeId) { CSchedulesColor color; - JobTypeColorInfo colorinfo; - bool isOk = false; - if (type != 4) { - //如果不是节假日 - JobTypeInfo typeInfo; - //根据类型获取日程类型信息getJobTypeByNo - isOk = JobTypeInfoManager::instance()->getJobTypeByNo(type, typeInfo); - //根据类型关联的颜色编号获取对应的颜色 - colorinfo = typeInfo.getColorInfo(); - - } else { - //节假日 颜色变化为2 - isOk = JobTypeInfoManager::instance()->getJobTypeColorByNo(2, colorinfo); - } + DScheduleType::Ptr type = gAccountManager->getScheduleTypeByScheduleTypeId(typeId); + QColor typeColor; + if (nullptr != type) { + typeColor = type->typeColor().colorCode(); + } else if (typeId =="other"){ + //如果类型不存在则设置一个默认颜色 + typeColor = QColor("#BA60FA"); + } + + color.orginalColor = typeColor; + color.normalColor = color.orginalColor; + color.normalColor.setAlphaF(0.2); + color.pressColor = color.orginalColor; + color.pressColor.setAlphaF(0.35); - if (isOk) { - color.orginalColor = QColor(colorinfo.getColorHex()); - color.normalColor = color.orginalColor; - color.normalColor.setAlphaF(0.2); - color.pressColor = color.orginalColor; - color.pressColor.setAlphaF(0.35); - - color.hoverColor = color.orginalColor; - color.hoverColor.setAlphaF(0.3); - - color.hightColor = color.orginalColor; - color.hightColor.setAlphaF(0.35); - - } else { - //获取颜色失败 - qWarning() << "get type color fail ,type:" << type; - } + color.hoverColor = color.orginalColor; + color.hoverColor.setAlphaF(0.3); + + color.hightColor = color.orginalColor; + color.hightColor.setAlphaF(0.35); return color; } @@ -80,144 +57,17 @@ CScheduleDataManage *CScheduleDataManage::getScheduleDataManage() { + if (nullptr == m_vscheduleDataManage) { + m_vscheduleDataManage = new CScheduleDataManage(); + } return m_vscheduleDataManage; } -CScheduleDataManage::CScheduleDataManage() +CScheduleDataManage::CScheduleDataManage(QObject *parent) + : QObject(parent) { } CScheduleDataManage::~CScheduleDataManage() { } - -void JobTypeInfoManager::updateInfo() -{ - CScheduleOperation so; - so.getJobTypeList(this->m_lstJobType); - so.getColorTypeList(this->m_lstJobTypeColor); - - for (auto k = noticeObjBill.begin(); k != noticeObjBill.end(); k++) { - QMetaObject::invokeMethod(k.key(), k.value()); - } - return; -} -JobTypeInfoManager::JobTypeInfoManager() //私有静态构造函数 -{ -} -JobTypeInfoManager *JobTypeInfoManager::instance() -{ - static JobTypeInfoManager instance; //局部静态变量 - return &instance; -} -/** - * @brief isSysJobTypeColor 是否是默认颜色 - * @param colorTypeNo 颜色类型编号 - * @return 是否是默认颜色 - */ -bool JobTypeInfoManager::isSysJobTypeColor(int colorTypeNo) -{ - for (JobTypeColorInfo jobTypeColorInfo : m_lstJobTypeColor) { - if ((jobTypeColorInfo.getTypeNo() == colorTypeNo) && (jobTypeColorInfo.getAuthority() == 1)) { //设定1为展示权限 - return true; - } - } - return false; -} -/** - * @brief getSysJobTypeColor 获取指定编号的默认颜色 - * @param colorTypeNo 颜色类型编号 - * @param jobTypeColorInfo 颜色信息 - * @return 操作结果 - */ -bool JobTypeInfoManager::getSysJobTypeColor(int colorTypeNo, JobTypeColorInfo &jobTypeColorInfo) -{ - for (JobTypeColorInfo _jobTypeColorInfo : m_lstJobTypeColor) { - if ((_jobTypeColorInfo.getTypeNo() == colorTypeNo) && (_jobTypeColorInfo.getAuthority() == 1)) { //设定1为展示权限 - jobTypeColorInfo = _jobTypeColorInfo; - return true; - } - } - return false; -} - -//查询日程类型 -bool JobTypeInfoManager::getJobTypeByNo(int iNo, JobTypeInfo &jobType) -{ - for (JobTypeInfo &jb : m_lstJobType) { - if (jb.getJobTypeNo() == iNo) { - jobType = jb; - return true; - } - } - return false; -} -//查询日程类型颜色 -bool JobTypeInfoManager::getJobTypeColorByNo(int iNo, JobTypeColorInfo &jobType) -{ - for (JobTypeColorInfo &color : m_lstJobTypeColor) { - if (color.getTypeNo() == iNo) { - jobType = color; - return true; - } - } - return false; -} - -//查询日程类型名称是否重复 -bool JobTypeInfoManager::isJobTypeNameUsed(QString strName) -{ - for (JobTypeInfo &jb : m_lstJobType) { - if (jb.getJobTypeName() == strName) { - return true; - } - } - return false; -} - -bool JobTypeInfoManager::isJobTypeNameUsed(const JobTypeInfo &info) -{ - for (JobTypeInfo &jb : m_lstJobType) { - // - if (jb.getJobTypeName() == info.getJobTypeName() && jb.getJobTypeNo() != info.getJobTypeNo()) { - return true; - } - } - return false; -} -//获取自定义日程类型下一个编号 -int JobTypeInfoManager::getNextTypeNo() -{ - int typeNo = 1; - - for (JobTypeInfo &job : m_lstJobType) { - if (job.getJobTypeNo() >= typeNo) { - typeNo = job.getJobTypeNo() + 1; - } - } - if (4 == typeNo) { //节日类型占用 - typeNo += 1; - } - return typeNo; -} -//获取自定义日程类型颜色下一个编号 -int JobTypeInfoManager::getNextColorTypeNo() -{ - int colorTypeNo = 1; - for (JobTypeColorInfo &jobColor : m_lstJobTypeColor) { - if (jobColor.getTypeNo() >= colorTypeNo) { - colorTypeNo = jobColor.getTypeNo() + 1; - } - } - return colorTypeNo; -} - -void JobTypeInfoManager::addToNoticeBill(QObject *obj, const QByteArray &method) -{ - noticeObjBill.insert(obj, method); -} - -void JobTypeInfoManager::removeFromNoticeBill(QObject *obj) -{ - noticeObjBill.remove(obj); -} diff -Nru dde-calendar-5.9.1/calendar-client/src/dataManage/scheduledatamanage.h dde-calendar-5.10.0/calendar-client/src/dataManage/scheduledatamanage.h --- dde-calendar-5.9.1/calendar-client/src/dataManage/scheduledatamanage.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/dataManage/scheduledatamanage.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,24 +1,11 @@ -/* - * Copyright (C) 2017 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: kirigaya - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef SCHEDULEDATAMANAGE_H #define SCHEDULEDATAMANAGE_H -#include "src/scheduledatainfo.h" +#include "dschedule.h" +#include "dscheduletype.h" #include @@ -35,11 +22,13 @@ QColor orginalColor; //最初的颜色 }; -class CScheduleDataManage +class CScheduleDataManage : public QObject { + Q_OBJECT public: static CScheduleDataManage *getScheduleDataManage(); - CSchedulesColor getScheduleColorByType(int type); + //根据日程类型ID获取颜色信息 + CSchedulesColor getScheduleColorByType(const QString &type); static QColor getSystemActiveColor(); static QColor getTextColor(); void setTheMe(int type = 0); @@ -48,69 +37,10 @@ return m_theme; } private: - CScheduleDataManage(); + explicit CScheduleDataManage(QObject *parent = nullptr); ~CScheduleDataManage(); private: int m_theme = 0; static CScheduleDataManage *m_vscheduleDataManage; }; - -class JobTypeInfoManager -{ -private: - JobTypeInfoManager(); -public: - static JobTypeInfoManager *instance(); - /** - * @brief updateInfo 更新信息 - */ - void updateInfo(); - //查询列表、返回列表 - QList getJobTypeList() - { - return m_lstJobType; - } - - QList getJobTypeColorList() - { - return m_lstJobTypeColor; - } - - /** - * @brief isSysJobTypeColor 是否是默认颜色 - * @param colorTypeNo 颜色类型编号 - * @return 是否是默认颜色 - */ - bool isSysJobTypeColor(int colorTypeNo); - /** - * @brief getSysJobTypeColor 获取指定编号的默认颜色 - * @param colorTypeNo 颜色类型编号 - * @param jobTypeColorInfo 颜色信息 - * @return 操作结果 - */ - bool getSysJobTypeColor(int colorTypeNo, JobTypeColorInfo &jobTypeColorInfo); - //查询日程类型 - bool getJobTypeByNo(int iNo, JobTypeInfo &jobType); - //查询日程类型颜色 - bool getJobTypeColorByNo(int iNo, JobTypeColorInfo &jobType); - - //查询日程类型名称是否重复 - bool isJobTypeNameUsed(QString strName); - //根据日程类型信息判断修改的日程类型名称是否与其它日程类型名称重复 - bool isJobTypeNameUsed(const JobTypeInfo &info); - - //获取自定义日程类型下一个编号 - int getNextTypeNo(); - //获取自定义日程类型颜色下一个编号 - int getNextColorTypeNo(); - - //通知单,添加回调函数 - void addToNoticeBill(QObject *obj, const QByteArray &method); - //通知单,移除回调函数 - void removeFromNoticeBill(QObject *obj); -private: - QList m_lstJobType; - QList m_lstJobTypeColor; - QMap noticeObjBill;//当日程类型改变时,会触发notice对应的回调函数 -}; #endif // SCHEDULEVIEW_H diff -Nru dde-calendar-5.9.1/calendar-client/src/dataManage/scheduledaterangeinfo.h dde-calendar-5.10.0/calendar-client/src/dataManage/scheduledaterangeinfo.h --- dde-calendar-5.9.1/calendar-client/src/dataManage/scheduledaterangeinfo.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/dataManage/scheduledaterangeinfo.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,33 +1,17 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef SCHEDULEDATERANGEINFO_H #define SCHEDULEDATERANGEINFO_H -#include "src/scheduledatainfo.h" +#include "dschedule.h" typedef struct _tagMScheduleDateRangeInfo { QDate bdate; QDate edate; bool state; int num; - ScheduleDataInfo tData; + DSchedule::Ptr tData; bool operator <(const _tagMScheduleDateRangeInfo &info)const { diff -Nru dde-calendar-5.9.1/calendar-client/src/dataManage/schedulemanager.cpp dde-calendar-5.10.0/calendar-client/src/dataManage/schedulemanager.cpp --- dde-calendar-5.9.1/calendar-client/src/dataManage/schedulemanager.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/dataManage/schedulemanager.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,267 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "schedulemanager.h" + +ScheduleManager::ScheduleManager(QObject *parent) : QObject(parent) +{ + initconnect(); +} + +ScheduleManager *ScheduleManager::getInstace() +{ + static ScheduleManager manager; + return &manager; +} + +void ScheduleManager::initconnect() +{ + connect(gAccountManager, &AccountManager::signalScheduleUpdate, this, &ScheduleManager::slotScheduleUpdate); + connect(gAccountManager, &AccountManager::signalSearchScheduleUpdate, this, &ScheduleManager::slotSearchUpdate); +} + +/** + * @brief ScheduleManager::resetSchedule + * 重新读取日程数据 + * @param year 年 + */ +void ScheduleManager::resetSchedule(int year) +{ + for (AccountItem::Ptr p : gAccountManager->getAccountList()) { + p->querySchedulesWithParameter(year); + } +} + +void ScheduleManager::resetSchedule(const QDateTime &start, const QDateTime &end) +{ + for (AccountItem::Ptr p : gAccountManager->getAccountList()) { + p->querySchedulesWithParameter(start, end); + } +} + +/** + * @brief ScheduleManager::updateSchedule + * 更新日程数据 + */ +void ScheduleManager::updateSchedule() +{ + m_scheduleMap.clear(); + if (nullptr != gAccountManager->getLocalAccountItem()) { + m_scheduleMap = gAccountManager->getLocalAccountItem()->getScheduleMap(); + } + + if (nullptr != gAccountManager->getUnionAccountItem()) { + QMap scheduleMap = gAccountManager->getUnionAccountItem()->getScheduleMap(); + if (m_scheduleMap.size() == 0) { + m_scheduleMap = scheduleMap; + } else { + auto iterator = scheduleMap.begin(); + while (iterator != scheduleMap.end()) { + DSchedule::List list = m_scheduleMap[iterator.key()]; + list.append(iterator.value()); + m_scheduleMap[iterator.key()] = list; + iterator++; + } + } + } + emit signalScheduleUpdate(); +} + +/** + * @brief ScheduleManager::updateSearchSchedule + * 更新被搜索的日程数据 + */ +void ScheduleManager::updateSearchSchedule() +{ + m_searchScheduleMap.clear(); + if (nullptr != gLocalAccountItem) { + m_searchScheduleMap = gLocalAccountItem->getSearchScheduleMap(); + } + if (nullptr != gUosAccountItem) { + QMap scheduleMap = gUosAccountItem->getSearchScheduleMap(); + if (m_searchScheduleMap.size() == 0) { + m_searchScheduleMap = scheduleMap; + } else { + auto iterator = scheduleMap.begin(); + while (iterator != scheduleMap.end()) { + DSchedule::List list = m_searchScheduleMap[iterator.key()]; + list.append(iterator.value()); + m_searchScheduleMap[iterator.key()] = list; + iterator++; + } + } + } + emit signalSearchScheduleUpdate(); +} + +/** + * @brief ScheduleManager::slotScheduleUpdate + * 日程数据更新事件 + */ +void ScheduleManager::slotScheduleUpdate() +{ + updateSchedule(); +} + +void ScheduleManager::slotSearchUpdate() +{ + updateSearchSchedule(); +} + +/** + * @brief ScheduleManager::getAllScheduleMap + * 获取所有的日程数据 + * @return + */ +QMap ScheduleManager::getAllScheduleMap() +{ + return m_scheduleMap; +} + +/** + * @brief ScheduleManager::getScheduleMap + * 获取一定时间范围内的日程 + * @param startDate 开始时间 + * @param stopDate 结束时间 + * @return + */ +QMap ScheduleManager::getScheduleMap(const QDate &startDate, const QDate &stopDate) const +{ + QMap map; + QDate date = startDate; + while (date != stopDate) { + if (m_scheduleMap.contains(date)) { + map[date] = m_scheduleMap[date]; + } + date = date.addDays(1); + } + + if (m_scheduleMap.contains(date)) { + map[date] = m_scheduleMap[date]; + } + return map; +} + +/** + * @brief ScheduleManager::getAllSearchedScheduleMap + * 获取所有的被搜索的日程数据 + * @return + */ +QMap ScheduleManager::getAllSearchedScheduleMap() +{ + return m_searchScheduleMap; +} + +/** + * @brief ScheduleManager::getAllSearchedScheduleList + * 获取所有的被搜索的日程数据 + * @return + */ +DSchedule::List ScheduleManager::getAllSearchedScheduleList() +{ + DSchedule::List list; + for (DSchedule::List l : m_searchScheduleMap.values()) { + list.append(l); + } + return list; +} + +/** + * @brief ScheduleManager::getAllScheduleDate + * 获取所有的有日程的时间 + * @return + */ +QSet ScheduleManager::getAllScheduleDate() +{ + QSet set; + for (QDate date : m_scheduleMap.keys()) { + set.insert(date); + } + return set; +} + +/** + * @brief ScheduleManager::getAllSearchedScheduleDate + * 获取所有有被搜索日程的时间 + * @return + */ +QSet ScheduleManager::getAllSearchedScheduleDate() +{ + QSet set; + for (QDate date : m_searchScheduleMap.keys()) { + set.insert(date); + } + return set; +} + +/** + * @brief ScheduleManager::getScheduleByDay + * 获取某天的日程 + * @param date 需要获取日程的日期 + * @return + */ +DSchedule::List ScheduleManager::getScheduleByDay(QDate date) +{ + if (m_scheduleMap.contains(date)) { + return m_scheduleMap[date]; + } + return DSchedule::List(); +} + +/** + * @brief ScheduleManager::getScheduleTypeByScheduleId + * 根据日程类型id获取日程类型 + * @param id + * @return + */ +DScheduleType::Ptr ScheduleManager::getScheduleTypeByScheduleId(const QString &id) +{ + DScheduleType::Ptr type = nullptr; + for (AccountItem::Ptr p : gAccountManager->getAccountList()) { + type = p->getScheduleTypeByID(id); + if (nullptr != type) { + break; + } + } + return type; +} + +/** + * @brief ScheduleManager::searchSchedule + * 搜索日程 + * @param key 搜索关键字 + * @param startTime 开始时间 + * @param endTime 结束时间 + */ +void ScheduleManager::searchSchedule(const QString &key, const QDateTime &startTime, const QDateTime &endTime) +{ + m_searchScheduleMap.clear(); + static int count = 0; + count = 0; + + m_searchQuery.reset(new DScheduleQueryPar); + m_searchQuery->setKey(key); + m_searchQuery->setDtStart(startTime); + m_searchQuery->setDtEnd(endTime); + for (AccountItem::Ptr p : gAccountManager->getAccountList()) { + count ++; + p->querySchedulesWithParameter(m_searchQuery, [&](CallMessge) { + count--; + if (count == 0) { + this->updateSearchSchedule(); + } + }); + } +} + +/** + * @brief ScheduleManager::clearSearchSchedule + * 情况已搜索的如此数据 + */ +void ScheduleManager::clearSearchSchedule() +{ + m_searchScheduleMap.clear(); + m_searchQuery.reset(nullptr); + emit signalSearchScheduleUpdate(); +} diff -Nru dde-calendar-5.9.1/calendar-client/src/dataManage/schedulemanager.h dde-calendar-5.10.0/calendar-client/src/dataManage/schedulemanager.h --- dde-calendar-5.9.1/calendar-client/src/dataManage/schedulemanager.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/dataManage/schedulemanager.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,77 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef SCHEDULEMANAGER_H +#define SCHEDULEMANAGER_H + +#include "accountmanager.h" +#include "lunarmanager.h" +#include + +class ScheduleManager : public QObject +{ + Q_OBJECT +public: + explicit ScheduleManager(QObject *parent = nullptr); + + static ScheduleManager* getInstace(); + + //获取一年的所有日程 + QMap getAllScheduleMap(); + //根据起始时间和结束时间获取日程 + QMap getScheduleMap(const QDate &startDate, const QDate &stopDate) const; + //获取所有的搜索到的日程(按日期分类) + QMap getAllSearchedScheduleMap(); + //获取所有搜索到的日程 + DSchedule::List getAllSearchedScheduleList(); + + //获取所有有日程的时间 + QSet getAllScheduleDate(); + //获取所有有被搜索日程的时间 + QSet getAllSearchedScheduleDate(); + //获取某一天的日程 + DSchedule::List getScheduleByDay(QDate); + + //根据日程id获取日程类型 + DScheduleType::Ptr getAccountByScheduleId(const QString& id); + DScheduleType::Ptr getScheduleTypeByScheduleId(const QString& id); + + //搜索日程 + void searchSchedule(const QString &key, const QDateTime &startTime, const QDateTime &endTime); + //清空搜索的日程 + void clearSearchSchedule(); + + //重置一年的日程信息 + void resetSchedule(int year); + void resetSchedule(const QDateTime& start, const QDateTime& end); + +signals: + //日程数据更新信号 + void signalScheduleUpdate(); + //被搜索日程数据更新信号 + void signalSearchScheduleUpdate(); + +public slots: + //日程数据更新事件 + void slotScheduleUpdate(); + void slotSearchUpdate(); + +private: + void initconnect(); + + //更新日程 + void updateSchedule(); + //更新被搜索的日程 + void updateSearchSchedule(); + +private: + QMap m_scheduleMap; //一年的日程数据 + QMap m_searchScheduleMap; //被搜索的日程数据 + DScheduleQueryPar::Ptr m_searchQuery; //上一次搜索的条件 + + + LunarManager m_lunarManager; +}; +#define gScheduleManager ScheduleManager::getInstace() +#endif // SCHEDULEMANAGER_H diff -Nru dde-calendar-5.9.1/calendar-client/src/dbus/cdbuspendingcallwatcher.cpp dde-calendar-5.10.0/calendar-client/src/dbus/cdbuspendingcallwatcher.cpp --- dde-calendar-5.9.1/calendar-client/src/dbus/cdbuspendingcallwatcher.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/dbus/cdbuspendingcallwatcher.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,45 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "cdbuspendingcallwatcher.h" + +CDBusPendingCallWatcher::CDBusPendingCallWatcher(const QDBusPendingCall &call, QString member, QObject *parent) + : QDBusPendingCallWatcher(call, parent) + , m_member(member) +{ + connect(this, &QDBusPendingCallWatcher::finished, this, [this](){ + //转发调用完成事件 + emit this->signalCallFinished(this); + }); +} + +/** + * @brief CDBusPendingCallWatcher::setCallbackFunc + * 设置回调函数 + * @param func 回调函数 + */ +void CDBusPendingCallWatcher::setCallbackFunc(CallbackFunc func) +{ + m_func = func; +} + +/** + * @brief CDBusPendingCallWatcher::getCallbackFunc + * 获取回调函数 + * @return 回调函数 + */ +CallbackFunc CDBusPendingCallWatcher::getCallbackFunc() +{ + return m_func; +} + +/** + * @brief CDBusPendingCallWatcher::getmember + * 设置调用方法名 + * @return 方法名 + */ +QString CDBusPendingCallWatcher::getmember() +{ + return m_member; +} diff -Nru dde-calendar-5.9.1/calendar-client/src/dbus/cdbuspendingcallwatcher.h dde-calendar-5.10.0/calendar-client/src/dbus/cdbuspendingcallwatcher.h --- dde-calendar-5.9.1/calendar-client/src/dbus/cdbuspendingcallwatcher.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/dbus/cdbuspendingcallwatcher.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,50 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef CDBUSPENDINGCALLWATCHER_H +#define CDBUSPENDINGCALLWATCHER_H + +#include + +/** + * @brief The CallMessge struct + * dbus请求回调数据 + */ +struct CallMessge{ + int code; //返回码,0:请求成功,大于0:请求失败 + QVariant msg; //返回值,根据实际需求可返回任意数据 +}; + +/** + * @brief CallbackFunc + * dbus请求回调函数类型 + */ +typedef std::function CallbackFunc; + +//继承QDbus回调观察者,将部分自定义的数据包装在回调类中 +class CDBusPendingCallWatcher : public QDBusPendingCallWatcher +{ + Q_OBJECT +public: + explicit CDBusPendingCallWatcher(const QDBusPendingCall &call, QString member, QObject *parent = nullptr); + + //设置回调函数 + void setCallbackFunc(CallbackFunc func); + //获取回调函数 + CallbackFunc getCallbackFunc(); + + //设置调用方法名 + QString getmember(); + +signals: + void signalCallFinished(CDBusPendingCallWatcher*); + +public slots: + +private: + QString m_member; //调用的dbus方法名 + CallbackFunc m_func = nullptr; //回调函数指针 +}; + +#endif // CDBUSPENDINGCALLWATCHER_H diff -Nru dde-calendar-5.9.1/calendar-client/src/dbus/dbusaccountmanagerrequest.cpp dde-calendar-5.10.0/calendar-client/src/dbus/dbusaccountmanagerrequest.cpp --- dde-calendar-5.9.1/calendar-client/src/dbus/dbusaccountmanagerrequest.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/dbus/dbusaccountmanagerrequest.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,194 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "dbusaccountmanagerrequest.h" +#include +#include + +DbusAccountManagerRequest::DbusAccountManagerRequest(QObject *parent) + : DbusRequestBase("/com/deepin/dataserver/Calendar/AccountManager", "com.deepin.dataserver.Calendar.AccountManager", QDBusConnection::sessionBus(), parent) +{ + +} + +/** + * @brief setFirstDayofWeek + * 设置一周首日 + */ +void DbusAccountManagerRequest::setFirstDayofWeek(int value) +{ + QDBusInterface interface(this->service(), this->path(), this->interface(), QDBusConnection::sessionBus(), this); + interface.setProperty("firstDayOfWeek", QVariant(value)); +} + +/** + * @brief DbusAccountManagerRequest::setTimeFormatType + * 设置时间显示格式 + */ +void DbusAccountManagerRequest::setTimeFormatType(int value) +{ + QDBusInterface interface(this->service(), this->path(), this->interface(), QDBusConnection::sessionBus(), this); + interface.setProperty("timeFormatType", QVariant(value)); +} + +/** + * @brief DbusAccountManagerRequest::getAccountList + * 请求帐户列表 + */ +void DbusAccountManagerRequest::getAccountList() +{ + asyncCall("getAccountList"); +} + +/** + * @brief DbusAccountManagerRequest::downloadByAccountID + * 根据帐户id下拉数据 + * @param accountID 帐户id + */ +void DbusAccountManagerRequest::downloadByAccountID(const QString &accountID) +{ + asyncCall("downloadByAccountID", QVariant(accountID)); +} + +/** + * @brief DbusAccountManagerRequest::uploadNetWorkAccountData + * 更新网络帐户数据 + */ +void DbusAccountManagerRequest::uploadNetWorkAccountData() +{ + asyncCall("uploadNetWorkAccountData"); +} + +/** + * @brief DbusAccountManagerRequest::getCalendarGeneralSettings + * 获取通用设置 + */ +void DbusAccountManagerRequest::getCalendarGeneralSettings() +{ + asyncCall("getCalendarGeneralSettings"); +} + +/** + * @brief DbusAccountManagerRequest::setCalendarGeneralSettings + * 设置通用设置 + * @param ptr 通用设置 + */ +void DbusAccountManagerRequest::setCalendarGeneralSettings(DCalendarGeneralSettings::Ptr ptr) +{ + QString jsonStr; + DCalendarGeneralSettings::toJsonString(ptr, jsonStr); + asyncCall("setCalendarGeneralSettings", QVariant(jsonStr)); +} + +/** + * @brief DbusAccountManagerRequest::login + * 帐户登录 + */ +void DbusAccountManagerRequest::login() +{ + asyncCall("login"); +} + +/** + * @brief DbusAccountManagerRequest::loginout + * 帐户登出 + */ +void DbusAccountManagerRequest::logout() +{ + asyncCall("logout"); +} + +void DbusAccountManagerRequest::clientIsShow(bool isShow) +{ + QList argumentList; + argumentList << isShow; + //不需要返回结果,发送完直接结束 + callWithArgumentList(QDBus::NoBlock, QStringLiteral("calendarIsShow"), argumentList); +} + +bool DbusAccountManagerRequest::getIsSupportUid() +{ + QList argumentList; + // + QDBusMessage msg = callWithArgumentList(QDBus::Block, QStringLiteral("isSupportUid"), argumentList); + if (msg.type() == QDBusMessage::ReplyMessage) { + QVariant variant = msg.arguments().first(); + return variant.toBool(); + } else { + return false; + } +} + +/** + * @brief DbusAccountManagerRequest::slotCallFinished + * dbus调用完成事件 + * @param call 回调类 + */ +void DbusAccountManagerRequest::slotCallFinished(CDBusPendingCallWatcher *call) +{ + int ret = 0; + bool canCall = true; + //错误处理 + if (call->isError()) { + //打印错误信息 + qWarning() << call->reply().member() << call->error().message(); + ret = 1; + } else if (call->getmember() == "getAccountList") { + //"getAccountList"方法回调事件 + QDBusPendingReply reply = *call; + //获取返回值 + QString str = reply.argumentAt<0>(); + DAccount::List accountList; + //解析字符串 + if (DAccount::fromJsonListString(accountList, str)) { + emit signalGetAccountListFinish(accountList); + } else { + qWarning() <<"AccountList Parsing failed!"; + ret = 2; + } + } else if (call->getmember() == "getCalendarGeneralSettings") { + QDBusPendingReply reply = *call; + QString str = reply.argumentAt<0>(); + DCalendarGeneralSettings::Ptr ptr; + ptr.reset(new DCalendarGeneralSettings()); + if (DCalendarGeneralSettings::fromJsonString(ptr, str)) { + emit signalGetGeneralSettingsFinish(ptr); + } else { + qWarning() <<"AccountList Parsing failed!"; + ret = 2; + } + } else if (call->getmember() == "setCalendarGeneralSettings") { + canCall = false; + setCallbackFunc(call->getCallbackFunc()); + getCalendarGeneralSettings(); + } + + //执行回调函数 + if (canCall && call->getCallbackFunc() != nullptr) { + call->getCallbackFunc()({ret, ""}); + } + //释放内存 + call->deleteLater(); +} + +void DbusAccountManagerRequest::slotDbusCall(const QDBusMessage &msg) +{ + if (msg.member() == "accountUpdate") { + getAccountList(); + }else if (msg.member() == "PropertiesChanged") { + QDBusPendingReply reply = msg; + onPropertiesChanged(reply.argumentAt<0>(), reply.argumentAt<1>(), reply.argumentAt<2>()); + } +} + +void DbusAccountManagerRequest::onPropertiesChanged(const QString &, const QVariantMap &changedProperties, const QStringList &) +{ + for (QVariantMap::const_iterator it = changedProperties.cbegin(), end = changedProperties.cend(); it != end; ++it) { + if (it.key() == "firstDayOfWeek") { + getCalendarGeneralSettings(); + } else if (it.key() == "timeFormatType") { + getCalendarGeneralSettings(); + } + } +} diff -Nru dde-calendar-5.9.1/calendar-client/src/dbus/dbusaccountmanagerrequest.h dde-calendar-5.10.0/calendar-client/src/dbus/dbusaccountmanagerrequest.h --- dde-calendar-5.9.1/calendar-client/src/dbus/dbusaccountmanagerrequest.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/dbus/dbusaccountmanagerrequest.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,62 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef DBUSACCOUNTMANAGERREQUEST_H +#define DBUSACCOUNTMANAGERREQUEST_H + +#include "dbusrequestbase.h" +#include "daccount.h" +#include "dcalendargeneralsettings.h" + +//所有帐户信息管理类 +class DbusAccountManagerRequest : public DbusRequestBase +{ + Q_OBJECT +public: + explicit DbusAccountManagerRequest(QObject *parent = nullptr); + + //设置一周首日 + void setFirstDayofWeek(int); + //设置时间显示格式 + void setTimeFormatType(int); + + //获取帐户列表 + void getAccountList(); + //根据帐户id下拉数据 + void downloadByAccountID(const QString &accountID); + //更新网络帐户数据 + void uploadNetWorkAccountData(); + //获取通用设置 + void getCalendarGeneralSettings(); + //设置通用设置 + void setCalendarGeneralSettings(DCalendarGeneralSettings::Ptr ptr); + // + void clientIsShow(bool isShow); + //获取是否支持云同步 + bool getIsSupportUid(); + + //帐户登录 + void login(); + //帐户登出 + void logout(); + +signals: + //获取帐户列表数据完成信号 + void signalGetAccountListFinish(DAccount::List accountList); + //获取通用设置完成信号 + void signalGetGeneralSettingsFinish(DCalendarGeneralSettings::Ptr ptr); + +public slots: + //dbus调用完成事件 + void slotCallFinished(CDBusPendingCallWatcher *) override; + //后端发送信号事件 + void slotDbusCall(const QDBusMessage &msg) override; + +private: + void onPropertiesChanged(const QString &interfaceName, + const QVariantMap &changedProperties, + const QStringList &invalidatedProperties); +}; + +#endif // DBUSACCOUNTMANAGERREQUEST_H diff -Nru dde-calendar-5.9.1/calendar-client/src/dbus/dbusaccountrequest.cpp dde-calendar-5.10.0/calendar-client/src/dbus/dbusaccountrequest.cpp --- dde-calendar-5.9.1/calendar-client/src/dbus/dbusaccountrequest.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/dbus/dbusaccountrequest.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,353 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "dbusaccountrequest.h" +#include + +#include +#include +#include + +DbusAccountRequest::DbusAccountRequest(const QString &path, const QString &interface, QObject *parent) + : DbusRequestBase(path, interface, QDBusConnection::sessionBus(), parent) +{ +} + +/** + * @brief getAccountInfo 获取帐户信息 + * @return + */ +void DbusAccountRequest::getAccountInfo() +{ + asyncCall("getAccountInfo"); +} + +/** + * @brief DbusAccountRequest::setAccountExpandStatus + * 设置帐户列表展开状态 + * @param expandStatus 展开状态 + */ +void DbusAccountRequest::setAccountExpandStatus(bool expandStatus) +{ + QDBusInterface interface(this->service(), this->path(), this->interface(), QDBusConnection::sessionBus(), this); + interface.setProperty("isExpand", QVariant(expandStatus)); +} + +void DbusAccountRequest::setAccountState(DAccount::AccountStates state) +{ + QDBusInterface interface(this->service(), this->path(), this->interface(), QDBusConnection::sessionBus(), this); + interface.setProperty("accountState", QVariant(state)); +} + +void DbusAccountRequest::setSyncFreq(const QString &freq) +{ + QDBusInterface interface(this->service(), this->path(), this->interface(), QDBusConnection::sessionBus(), this); + interface.setProperty("syncFreq", QVariant(freq)); +} + +DAccount::AccountStates DbusAccountRequest::getAccountState() +{ + QDBusInterface interface(this->service(), this->path(), this->interface(), QDBusConnection::sessionBus(), this); + return static_cast(interface.property("accountState").toInt()); +} + +DAccount::AccountSyncState DbusAccountRequest::getSyncState() +{ + QDBusInterface interface(this->service(), this->path(), this->interface(), QDBusConnection::sessionBus(), this); + return static_cast(interface.property("syncState").toInt()) ; +} + +QString DbusAccountRequest::getSyncFreq() +{ + QDBusInterface interface(this->service(), this->path(), this->interface(), QDBusConnection::sessionBus(), this); + return interface.property("syncFreq").toString(); +} + +/** + * @brief getScheduleTypeList 获取日程类型信息集 + * @return + */ +void DbusAccountRequest::getScheduleTypeList() +{ + asyncCall("getScheduleTypeList"); +} + +/** + * @brief getScheduleTypeByID 根据日程类型ID获取日程类型信息 + * @param typeID 日程类型ID + * @return + */ +void DbusAccountRequest::getScheduleTypeByID(const QString &typeID) +{ + asyncCall("getScheduleTypeByID", QVariant(typeID)); +} + +/** + * @brief createScheduleType 创建日程类型 + * @param typeInfo 类型信息 + * @return 日程类型ID + */ +void DbusAccountRequest::createScheduleType(const DScheduleType::Ptr &typeInfo) +{ + QString jsonStr; + DScheduleType::toJsonString(typeInfo, jsonStr); + asyncCall("createScheduleType", QVariant(jsonStr)); +} + +/** + * @brief updateScheduleType 更新日程类型 + * @param typeInfo 类型信息 + * @return 是否成功,true:更新成功 + */ +void DbusAccountRequest::updateScheduleType(const DScheduleType::Ptr &typeInfo) +{ + QString jsonStr; + DScheduleType::toJsonString(typeInfo, jsonStr); + asyncCall("updateScheduleType", QVariant(jsonStr)); +} + +/** + * @brief DbusAccountRequest::updateScheduleTypeShowState + * 更新类型显示状态 + * @param typeInfo + */ +void DbusAccountRequest::updateScheduleTypeShowState(const DScheduleType::Ptr &typeInfo) +{ + QString jsonStr; + DScheduleType::toJsonString(typeInfo, jsonStr); + QString callName = "updateScheduleTypeShowState"; + asyncCall("updateScheduleType", callName, QVariant(jsonStr)); +} + +/** + * @brief deleteScheduleTypeByID 根据日程类型ID删除日程类型 + * @param typeID 日程类型ID + * @return 是否成功,true:更新成功 + */ +void DbusAccountRequest::deleteScheduleTypeByID(const QString &typeID) +{ + QList argumentList; + asyncCall("deleteScheduleTypeByID", QVariant(typeID)); +} + +/** + * @brief scheduleTypeByUsed 日程类型是否被使用 + * @param typeID 日程类型ID + * @return + */ +bool DbusAccountRequest::scheduleTypeByUsed(const QString &typeID) +{ + QDBusMessage ret = call("scheduleTypeByUsed", QVariant(typeID)); + return ret.arguments().value(0).toBool(); +} + +/** + * @brief createSchedule 创建日程 + * @param ScheduleInfo 日程信息 + * @return 返回日程ID + */ +void DbusAccountRequest::createSchedule(const DSchedule::Ptr &scheduleInfo) +{ + QString jsonStr; + DSchedule::toJsonString(scheduleInfo, jsonStr); + asyncCall("createSchedule", QVariant(jsonStr)); +} + +/** + * @brief updateSchedule 更新日程 + * @param ScheduleInfo 日程信息 + * @return 是否成功,true:更新成功 + */ +void DbusAccountRequest::updateSchedule(const DSchedule::Ptr &scheduleInfo) +{ + QString jsonStr; + DSchedule::toJsonString(scheduleInfo, jsonStr); + asyncCall("updateSchedule", QVariant(jsonStr)); +} + +DSchedule::Ptr DbusAccountRequest::getScheduleByScheduleID(const QString &scheduleID) +{ + QList argumentList; + argumentList << QVariant::fromValue(scheduleID); + QDBusPendingCall pCall = asyncCallWithArgumentList(QStringLiteral("getScheduleByScheduleID"), argumentList); + pCall.waitForFinished(); + QDBusMessage reply = pCall.reply(); + if (reply.type() != QDBusMessage::ReplyMessage) { + qWarning() << "getScheduleTypeByID error ," << reply; + return nullptr; + } + QDBusReply scheduleReply = reply; + + QString scheduleStr = scheduleReply.value(); + DSchedule::Ptr schedule; + DSchedule::fromJsonString(schedule, scheduleStr); + return schedule; +} + +/** + * @brief deleteScheduleByScheduleID 根据日程ID删除日程 + * @param ScheduleID 日程ID + * @return 是否成功,true:删除成功 + */ +void DbusAccountRequest::deleteScheduleByScheduleID(const QString &scheduleID) +{ + QList argumentList; + asyncCall("deleteScheduleByScheduleID", QVariant(scheduleID)); +} + +/** + * @brief deleteSchedulesByScheduleTypeID 根据日程类型ID删除日程 + * @param typeID 日程类型ID + * @return 是否成功,true:删除成功 + */ +void DbusAccountRequest::deleteSchedulesByScheduleTypeID(const QString &typeID) +{ + QList argumentList; + asyncCall("deleteSchedulesByScheduleTypeID", QVariant(typeID)); +} + +/** + * @brief querySchedulesWithParameter 根据查询参数查询日程 + * @param params 具体的查询参数 + * @return 查询到的日程集 + */ +void DbusAccountRequest::querySchedulesWithParameter(const DScheduleQueryPar::Ptr ¶ms) +{ + //key为空为正常日程获取,不为空则为搜索日程 + QString callName = "searchSchedulesWithParameter"; + if (params->key().isEmpty()) { + callName = "querySchedulesWithParameter"; + m_priParams = params; + } + QString jsonStr = DScheduleQueryPar::toJsonString(params); + asyncCall("querySchedulesWithParameter", callName, QVariant(jsonStr)); +} + +bool DbusAccountRequest::querySchedulesByExternal(const DScheduleQueryPar::Ptr ¶ms, QString &json) +{ + QDBusPendingReply reply = call("querySchedulesWithParameter", QVariant(params)); + if (reply.isError()) { + qWarning() << reply.error().message(); + return false; + } + json = reply.argumentAt<0>(); + return true; +} + +void DbusAccountRequest::getSysColors() +{ + asyncCall("getSysColors"); +} + +QString DbusAccountRequest::getDtLastUpdate() +{ + QDBusInterface interface(this->service(), this->path(), this->interface(), QDBusConnection::sessionBus(), this); + QString datetime = interface.property("dtLastUpdate").toString(); + return datetime; +} + +void DbusAccountRequest::slotCallFinished(CDBusPendingCallWatcher *call) +{ + int ret = 0; + bool canCall = true; + QVariant msg; + + if (call->isError()) { + qWarning() << call->reply().member() << call->error().message(); + ret = 1; + } else { + if (call->getmember() == "getAccountInfo") { + QDBusPendingReply reply = *call; + QString str = reply.argumentAt<0>(); + DAccount::Ptr ptr; + ptr.reset(new DAccount()); + if (DAccount::fromJsonString(ptr, str)) { + emit signalGetAccountInfoFinish(ptr); + } else { + qWarning() << "AccountInfo Parsing failed!"; + ret = 2; + } + } else if (call->getmember() == "getScheduleTypeList") { + QDBusPendingReply reply = *call; + QString str = reply.argumentAt<0>(); + DScheduleType::List stList; + if (DScheduleType::fromJsonListString(stList, str)) { + emit signalGetScheduleTypeListFinish(stList); + } else { + qWarning() << "ScheduleTypeList Parsing failed!"; + ret = 2; + } + } else if (call->getmember() == "querySchedulesWithParameter") { + QDBusPendingReply reply = *call; + QString str = reply.argumentAt<0>(); + QMap map = DSchedule::fromMapString(str); + emit signalGetScheduleListFinish(map); + } else if (call->getmember() == "searchSchedulesWithParameter") { + QDBusPendingReply reply = *call; + QString str = reply.argumentAt<0>(); + QMap map = DSchedule::fromMapString(str); + emit signalSearchScheduleListFinish(map); + } else if (call->getmember() == "getSysColors") { + QDBusPendingReply reply = *call; + QString str = reply.argumentAt<0>(); + DTypeColor::List list = DTypeColor::fromJsonString(str); + emit signalGetSysColorsFinish(list); + } else if (call->getmember() == "createScheduleType") { + //创建日程类型结束 + QDBusPendingReply reply = *call; + QString scheduleTypeId = reply.argumentAt<0>(); + msg = scheduleTypeId; + } else if (call->getmember() == "updateScheduleTypeShowState") { + //更新日程类型显示状态结束 + canCall = false; + //重新读取日程数据 + setCallbackFunc(call->getCallbackFunc()); + querySchedulesWithParameter(m_priParams); + } + } + if (canCall && call->getCallbackFunc() != nullptr) { + call->getCallbackFunc()({ret, msg}); + } + call->deleteLater(); +} + +void DbusAccountRequest::slotDbusCall(const QDBusMessage &msg) +{ + if (msg.member() == "PropertiesChanged") { + QDBusPendingReply reply = msg; + onPropertiesChanged(reply.argumentAt<0>(), reply.argumentAt<1>(), reply.argumentAt<2>()); + } else if (msg.member() == "scheduleTypeUpdate") { + getScheduleTypeList(); + } else if (msg.member() == "scheduleUpdate") { + //更新全局数据 + querySchedulesWithParameter(m_priParams); + //更新搜索数据 + emit signalSearchUpdate(); + } +} + +void DbusAccountRequest::onPropertiesChanged(const QString &, const QVariantMap &changedProperties, const QStringList &) +{ + for (QVariantMap::const_iterator it = changedProperties.cbegin(), end = changedProperties.cend(); it != end; ++it) { + if (it.key() == "syncState") { + int state = it.value().toInt(); + emit signalSyncStateChange(static_cast(state)); + } else if (it.key() == "accountState") { + int state = it.value().toInt(); + emit signalAccountStateChange(static_cast(state)); + } + if (it.key() == "dtLastUpdate") { + emit signalDtLastUpdate(getDtLastUpdate()); + } + if (it.key() == "accountState") { + emit signalAccountStateChange(getAccountState()); + } + if (it.key() == "dtLastUpdate") { + emit signalDtLastUpdate(getDtLastUpdate()); + } + if (it.key() == "accountState") { + emit signalAccountStateChange(getAccountState()); + } + } +} diff -Nru dde-calendar-5.9.1/calendar-client/src/dbus/dbusaccountrequest.h dde-calendar-5.10.0/calendar-client/src/dbus/dbusaccountrequest.h --- dde-calendar-5.9.1/calendar-client/src/dbus/dbusaccountrequest.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/dbus/dbusaccountrequest.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,157 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef DBUSACCOUNTREQUEST_H +#define DBUSACCOUNTREQUEST_H + +#include "dbusrequestbase.h" +#include "daccount.h" +#include "dschedule.h" +#include "dscheduletype.h" +#include "dtypecolor.h" +#include "dschedulequerypar.h" + +//单项帐户信息请求类 +class DbusAccountRequest : public DbusRequestBase +{ + Q_OBJECT +public: + explicit DbusAccountRequest(const QString &path, const QString &interface, QObject *parent = nullptr); + + /** + * @brief setAccountExpandStatus + * 设置帐户列表展开状态 + * @param expandStatus 展开状态 + */ + void setAccountExpandStatus(bool expandStatus); + + void setAccountState(DAccount::AccountStates state); + void setSyncFreq(const QString &freq); + DAccount::AccountStates getAccountState(); + DAccount::AccountSyncState getSyncState(); + QString getSyncFreq(); + /** + * @brief getAccountInfo 获取帐户信息 + * @return + */ + void getAccountInfo(); + + /** + * @brief getScheduleTypeList 获取日程类型信息集 + * @return + */ + void getScheduleTypeList(); + + /** + * @brief getScheduleTypeByID 根据日程类型ID获取日程类型信息 + * @param typeID 日程类型ID + * @return + */ + void getScheduleTypeByID(const QString &typeID); + + /** + * @brief createScheduleType 创建日程类型 + * @param typeInfo 类型信息 + * @return 日程类型ID + */ + void createScheduleType(const DScheduleType::Ptr &typeInfo); + + /** + * @brief updateScheduleType 更新日程类型 + * @param typeInfo 类型信息 + * @return 是否成功,true:更新成功 + */ + void updateScheduleType(const DScheduleType::Ptr &typeInfo); + + /** + * @brief updateScheduleTypeShowState + * 更新类型显示状态 + * @param typeInfo + */ + void updateScheduleTypeShowState(const DScheduleType::Ptr &typeInfo); + + /** + * @brief deleteScheduleTypeByID 根据日程类型ID删除日程类型 + * @param typeID 日程类型ID + * @return 是否成功,true:更新成功 + */ + void deleteScheduleTypeByID(const QString &typeID); + + /** + * @brief scheduleTypeByUsed 日程类型是否被使用 + * @param typeID 日程类型ID + * @return + */ + bool scheduleTypeByUsed(const QString &typeID); + + /** + * @brief createSchedule 创建日程 + * @param ScheduleInfo 日程信息 + * @return 返回日程ID + */ + void createSchedule(const DSchedule::Ptr &scheduleInfo); + + /** + * @brief updateSchedule 更新日程 + * @param ScheduleInfo 日程信息 + * @return 是否成功,true:更新成功 + */ + void updateSchedule(const DSchedule::Ptr &scheduleInfo); + + DSchedule::Ptr getScheduleByScheduleID(const QString &scheduleID); + + /** + * @brief deleteScheduleByScheduleID 根据日程ID删除日程 + * @param ScheduleID 日程ID + * @return 是否成功,true:删除成功 + */ + void deleteScheduleByScheduleID(const QString &scheduleID); + + /** + * @brief deleteSchedulesByScheduleTypeID 根据日程类型ID删除日程 + * @param typeID 日程类型ID + * @return 是否成功,true:删除成功 + */ + void deleteSchedulesByScheduleTypeID(const QString &typeID); + + /** + * @brief querySchedulesWithParameter 根据查询参数查询日程 + * @param params 具体的查询参数 + * @return 查询到的日程集 + */ + void querySchedulesWithParameter(const DScheduleQueryPar::Ptr ¶ms); + //对外查询接口,同步 + bool querySchedulesByExternal(const DScheduleQueryPar::Ptr ¶ms, QString &json); + + void getSysColors(); + + //获取最后一次同步时间 + QString getDtLastUpdate(); +signals: + void signalGetAccountInfoFinish(DAccount::Ptr); + void signalGetScheduleTypeListFinish(DScheduleType::List); + void signalGetScheduleListFinish(QMap); + void signalSearchScheduleListFinish(QMap); + void signalGetSysColorsFinish(DTypeColor::List); + void signalDtLastUpdate(QString); + void signalSyncStateChange(DAccount::AccountSyncState); + void signalAccountStateChange(DAccount::AccountStates); + void signalSearchUpdate(); + +public slots: + //dbus服务端调用 + void slotDbusCall(const QDBusMessage &msg) override; + void slotCallFinished(CDBusPendingCallWatcher *) override; + +private: + void onPropertiesChanged(const QString &interfaceName, + const QVariantMap &changedProperties, + const QStringList &invalidatedProperties); + +private: + DScheduleQueryPar::Ptr m_priParams; //上一次查询日程的数据 + +}; + +#endif // DBUSACCOUNTREQUEST_H diff -Nru dde-calendar-5.9.1/calendar-client/src/dbus/dbuscalendar_adaptor.cpp dde-calendar-5.10.0/calendar-client/src/dbus/dbuscalendar_adaptor.cpp --- dde-calendar-5.9.1/calendar-client/src/dbus/dbuscalendar_adaptor.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/dbus/dbuscalendar_adaptor.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,12 +1,6 @@ -/* - * This file was generated by qdbusxml2cpp version 0.8 - * Command line was: qdbusxml2cpp -a dbuscalendar_adaptor -c CalendarAdaptor com.deepin.Calendar.xml - * - * qdbusxml2cpp is Copyright (C) 2015 The Qt Company Ltd. - * - * This is an auto-generated file. - * Do not edit! All changes made to it will be lost. - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later #include "dbuscalendar_adaptor.h" #include "calendarmainwindow.h" diff -Nru dde-calendar-5.9.1/calendar-client/src/dbus/dbuscalendar_adaptor.h dde-calendar-5.10.0/calendar-client/src/dbus/dbuscalendar_adaptor.h --- dde-calendar-5.9.1/calendar-client/src/dbus/dbuscalendar_adaptor.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/dbus/dbuscalendar_adaptor.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,13 +1,6 @@ -/* - * This file was generated by qdbusxml2cpp version 0.8 - * Command line was: qdbusxml2cpp -a dbuscalendar_adaptor -c CalendarAdaptor com.deepin.Calendar.xml - * - * qdbusxml2cpp is Copyright (C) 2015 The Qt Company Ltd. - * - * This is an auto-generated file. - * This file may have been hand-edited. Look for HAND-EDIT comments - * before re-generating it. - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later #ifndef DBUSCALENDAR_ADAPTOR_H #define DBUSCALENDAR_ADAPTOR_H diff -Nru dde-calendar-5.9.1/calendar-client/src/dbus/dbushuanglirequest.cpp dde-calendar-5.10.0/calendar-client/src/dbus/dbushuanglirequest.cpp --- dde-calendar-5.9.1/calendar-client/src/dbus/dbushuanglirequest.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/dbus/dbushuanglirequest.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,149 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "dbushuanglirequest.h" +#include + +DbusHuangLiRequest::DbusHuangLiRequest(QObject *parent) + : DbusRequestBase("/com/deepin/dataserver/Calendar/HuangLi", "com.deepin.dataserver.Calendar.HuangLi", QDBusConnection::sessionBus(), parent) +{ + +} + +/** + * @brief DbusHuangLiRequest::getFestivalMonth + * 按月获取节假日信息 + * @param year + * @param month + */ +bool DbusHuangLiRequest::getFestivalMonth(quint32 year, quint32 month, FestivalInfo& festivalInfo) +{ + QDBusPendingReply reply = call("getFestivalMonth", QVariant(year), QVariant(month)); + + if (reply.isError()) { + qWarning() << reply.error().message(); + return false; + } + + QString json = reply.argumentAt<0>(); + QJsonParseError json_error; + QJsonDocument jsonDoc(QJsonDocument::fromJson(json.toLocal8Bit(), &json_error)); + + if (json_error.error != QJsonParseError::NoError) { + return false; + } + //解析数据 + QJsonArray rootarry = jsonDoc.array(); + for (int i = 0; i < rootarry.size(); i++) { + QJsonObject subObj = rootarry.at(i).toObject(); + //因为是预先定义好的JSON数据格式,所以这里可以这样读取 + if (subObj.contains("id")) { + festivalInfo.ID = subObj.value("id").toString(); + } + if (subObj.contains("name")) { + festivalInfo.FestivalName = subObj.value("name").toString(); + } + if (subObj.contains("description")) { + festivalInfo.description = subObj.value("description").toString(); + } + if (subObj.contains("rest")) { + festivalInfo.Rest = subObj.value("rest").toString(); + } + if (subObj.contains("month")) { + festivalInfo.month = subObj.value("month").toInt(); + } + if (subObj.contains("list")) { + QJsonArray sublistArray = subObj.value("list").toArray(); + for (int j = 0; j < sublistArray.size(); j++) { + QJsonObject hsubObj = sublistArray.at(j).toObject(); + HolidayInfo dayinfo; + if (hsubObj.contains("status")) { + dayinfo.status = static_cast(hsubObj.value("status").toInt()); + } + if (hsubObj.contains("date")) { + dayinfo.date = QDate::fromString(hsubObj.value("date").toString(), "yyyy-M-d"); + } + festivalInfo.listHoliday.append(dayinfo); + } + } + festivalInfo.year = static_cast(year); + } + return true; +} + +/** + * @brief DbusHuangLiRequest::getHuangLiDay + * 按天获取黄历信息 + * @param year + * @param month + * @param day + */ +bool DbusHuangLiRequest::getHuangLiDay(quint32 year, quint32 month, quint32 day, CaHuangLiDayInfo &info) +{ + QDBusPendingReply reply = call("getHuangLiDay", QVariant(year), QVariant(month), QVariant(day)); + + if (reply.isError()) { + qWarning() << reply.error().message(); + return false; + } + + QString json = reply.argumentAt<0>(); + bool isVoild; + info.strJsonToInfo(json, isVoild); + return isVoild; +} + +/** + * @brief DbusHuangLiRequest::getHuangLiMonth + * 按月获取黄历信息 + * @param year + * @param month + * @param fill + */ +bool DbusHuangLiRequest::getHuangLiMonth(quint32 year, quint32 month, bool fill, CaHuangLiMonthInfo &info) +{ + QDBusPendingReply reply = call("getHuangLiMonth", QVariant(year), QVariant(month), QVariant(fill)); + if (reply.isError()) { + qWarning() << reply.error().message(); + return false; + } + QString json = reply.argumentAt<0>(); + + bool infoIsVaild; + info.strJsonToInfo(json, infoIsVaild); + return infoIsVaild; +} + +/** + * @brief DbusHuangLiRequest::getLunarInfoBySolar + * 获取农历信息 + * @param year + * @param month + * @param day + */ +void DbusHuangLiRequest::getLunarInfoBySolar(quint32 year, quint32 month, quint32 day) +{ + asyncCall("getLunarInfoBySolar", QVariant(year), QVariant(month), QVariant(day)); +} + +/** + * @brief DbusHuangLiRequest::getLunarMonthCalendar + * 获取农历月日程 + * @param year + * @param month + * @param fill + */ +void DbusHuangLiRequest::getLunarMonthCalendar(quint32 year, quint32 month, bool fill) +{ + asyncCall("getLunarMonthCalendar", QVariant(year), QVariant(month), QVariant(fill)); +} + +void DbusHuangLiRequest::slotCallFinished(CDBusPendingCallWatcher* call) +{ + if (call->isError()) { + qWarning() << call->reply().member() << call->error().message(); + return; + } + call->deleteLater(); +} diff -Nru dde-calendar-5.9.1/calendar-client/src/dbus/dbushuanglirequest.h dde-calendar-5.10.0/calendar-client/src/dbus/dbushuanglirequest.h --- dde-calendar-5.9.1/calendar-client/src/dbus/dbushuanglirequest.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/dbus/dbushuanglirequest.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,37 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef DBUSHUANGLIREQUEST_H +#define DBUSHUANGLIREQUEST_H + +#include "dbusrequestbase.h" +#include "huangliData/lunardatastruct.h" +#include "huangliData/dbusdatastruct.h" + +//黄历数据请求类 +class DbusHuangLiRequest : public DbusRequestBase +{ + Q_OBJECT +public: + explicit DbusHuangLiRequest(QObject *parent = nullptr); + + //按月获取节假日信息 + bool getFestivalMonth(quint32 year, quint32 month, FestivalInfo&); + //按天获取黄历信息 + bool getHuangLiDay(quint32 year, quint32 month, quint32 day, CaHuangLiDayInfo &); + //按月获取黄历信息 + bool getHuangLiMonth(quint32 year, quint32 month, bool fill, CaHuangLiMonthInfo &); + //获取农历信息 + void getLunarInfoBySolar(quint32 year, quint32 month, quint32 day); + //获取农历月日程 + void getLunarMonthCalendar(quint32 year, quint32 month, bool fill); + +signals: + +public slots: + void slotCallFinished(CDBusPendingCallWatcher*) override; + +}; + +#endif // DBUSHUANGLIREQUEST_H diff -Nru dde-calendar-5.9.1/calendar-client/src/dbus/dbusrequestbase.cpp dde-calendar-5.10.0/calendar-client/src/dbus/dbusrequestbase.cpp --- dde-calendar-5.9.1/calendar-client/src/dbus/dbusrequestbase.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/dbus/dbusrequestbase.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,82 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "dbusrequestbase.h" +#include + +DbusRequestBase::DbusRequestBase(const QString &path, const QString &interface, const QDBusConnection &connection, QObject *parent) + : QDBusAbstractInterface(DBUS_SERVER_NAME, path, interface.toStdString().c_str(), connection, parent) +{ + //关联后端dbus触发信号 + if (!QDBusConnection::sessionBus().connect(this->service(), this->path(), this->interface(), "", this, SLOT(slotDbusCall(QDBusMessage)))) { + qWarning() << "the connection was fail!" << "path: " << this->path() << "interface: " << this->interface(); + }; + //关联后端dbus触发信号 + if (!QDBusConnection::sessionBus().connect(this->service(), this->path(), "org.freedesktop.DBus.Properties", "", this, SLOT(slotDbusCall(QDBusMessage)))) { + qWarning() << "the connection was fail!" << "path: " << this->path() << "interface: " << this->interface(); + }; +} + +void DbusRequestBase::setCallbackFunc(CallbackFunc func) +{ + m_callbackFunc = func; +} + +/** + * @brief DbusRequestBase::asyncCall + * 异步访问dbus接口 + * @param method dbus方法名 + * @param args 参数 + */ +void DbusRequestBase::asyncCall(const QString &method, const QList &args) +{ + QDBusPendingCall async = QDBusAbstractInterface::asyncCall(method, args); + CDBusPendingCallWatcher *watcher = new CDBusPendingCallWatcher(async, method, this); + //将回调函数放进CallWatcher中,随CallWatcher调用结果返回 + watcher->setCallbackFunc(m_callbackFunc); + //清楚回调函数,防止多方法调用时混淆 + setCallbackFunc(nullptr); + connect(watcher, &CDBusPendingCallWatcher::signalCallFinished, this, &DbusRequestBase::slotCallFinished); +} + +/** + * @brief DbusRequestBase::asyncCall + * 异步访问dbus接口 + * @param method dbus方法名 + * @param args 参数 + */ +void DbusRequestBase::asyncCall(const QString &method, + const QVariant &arg1, const QVariant &arg2, const QVariant &arg3, const QVariant &arg4, + const QVariant &arg5, const QVariant &arg6, const QVariant &arg7, const QVariant &arg8) +{ + asyncCall(method, method, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); +} + +/** + * @brief DbusRequestBase::asyncCall + * 异步访问dbus接口 + * @param method dbus方法名 + * @param args 参数 + */ +void DbusRequestBase::asyncCall(const QString &method, const QString &callName, + const QVariant &arg1, const QVariant &arg2, const QVariant &arg3, const QVariant &arg4, + const QVariant &arg5, const QVariant &arg6, const QVariant &arg7, const QVariant &arg8) +{ + QDBusPendingCall async = QDBusAbstractInterface::asyncCall(method, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); + CDBusPendingCallWatcher *watcher = new CDBusPendingCallWatcher(async, callName, this); + //将回调函数放进CallWatcher中,随CallWatcher调用结果返回 + watcher->setCallbackFunc(m_callbackFunc); + //清楚回调函数,防止多方法调用时混淆 + setCallbackFunc(nullptr); + connect(watcher, &CDBusPendingCallWatcher::signalCallFinished, this, &DbusRequestBase::slotCallFinished); +} + +/** + * @brief slotDbusCall + * dbus服务端调用 + * @param msg 调用消息 + */ +void DbusRequestBase::slotDbusCall(const QDBusMessage &msg) +{ +} diff -Nru dde-calendar-5.9.1/calendar-client/src/dbus/dbusrequestbase.h dde-calendar-5.10.0/calendar-client/src/dbus/dbusrequestbase.h --- dde-calendar-5.9.1/calendar-client/src/dbus/dbusrequestbase.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/dbus/dbusrequestbase.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,60 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef DBUSREQUESTBASE_H +#define DBUSREQUESTBASE_H + +#include "cdbuspendingcallwatcher.h" +#include +#include + +#define DBUS_SERVER_NAME "com.deepin.dataserver.Calendar" + +//继承QDbus接口类,包装自定义接口访问 +class DbusRequestBase : public QDBusAbstractInterface +{ + Q_OBJECT +public: + explicit DbusRequestBase(const QString &path, const QString &interface, + const QDBusConnection &connection = QDBusConnection::sessionBus(), + QObject *parent = nullptr); + + //设置回调函数 + void setCallbackFunc(CallbackFunc func); + +signals: + +public slots: + //dbus服务端调用 + virtual void slotDbusCall(const QDBusMessage &msg); + //dbus调用完成事件 + virtual void slotCallFinished(CDBusPendingCallWatcher*) = 0; + +protected: + //异步调用,包装异步调用事件 + void asyncCall(const QString &method, const QList &args); + void asyncCall(const QString &method, + const QVariant &arg1 = QVariant(), + const QVariant &arg2 = QVariant(), + const QVariant &arg3 = QVariant(), + const QVariant &arg4 = QVariant(), + const QVariant &arg5 = QVariant(), + const QVariant &arg6 = QVariant(), + const QVariant &arg7 = QVariant(), + const QVariant &arg8 = QVariant()); + void asyncCall(const QString &method, const QString &callName, + const QVariant &arg1 = QVariant(), + const QVariant &arg2 = QVariant(), + const QVariant &arg3 = QVariant(), + const QVariant &arg4 = QVariant(), + const QVariant &arg5 = QVariant(), + const QVariant &arg6 = QVariant(), + const QVariant &arg7 = QVariant(), + const QVariant &arg8 = QVariant()); + +private: + CallbackFunc m_callbackFunc = nullptr; //回调函数 +}; + +#endif // DBUSREQUESTBASE_H diff -Nru dde-calendar-5.9.1/calendar-client/src/dbus/dbustimedate.cpp dde-calendar-5.10.0/calendar-client/src/dbus/dbustimedate.cpp --- dde-calendar-5.9.1/calendar-client/src/dbus/dbustimedate.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/dbus/dbustimedate.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,85 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "dbustimedate.h" + +#include +#include +#include +#include + +#define NETWORK_DBUS_INTEERFACENAME "com.deepin.daemon.Timedate" +#define NETWORK_DBUS_NAME "com.deepin.daemon.Timedate" +#define NETWORK_DBUS_PATH "/com/deepin/daemon/Timedate" + +DBusTimedate::DBusTimedate(QObject *parent) + : QDBusAbstractInterface(NETWORK_DBUS_NAME, NETWORK_DBUS_PATH, NETWORK_DBUS_INTEERFACENAME, QDBusConnection::sessionBus(), parent) +{ + //关联后端dbus触发信号 + if (!QDBusConnection::sessionBus().connect(NETWORK_DBUS_NAME, + NETWORK_DBUS_PATH, + "org.freedesktop.DBus.Properties", + QLatin1String("PropertiesChanged"), this, + SLOT(propertiesChanged(QDBusMessage)))) { + qWarning() << "the PropertiesChanged was fail!"; + qWarning() << this->lastError(); + } + + m_hasDateTimeFormat = getHasDateTimeFormat(); +} + +int DBusTimedate::shortTimeFormat() +{ + //如果存在对应的时间设置则获取,否则默认为4 + return m_hasDateTimeFormat ? getPropertyByName("ShortTimeFormat").toInt() : 4; +} + +int DBusTimedate::shortDateFormat() +{ + //如果存在对应的时间设置则获取,否则默认为1 + return m_hasDateTimeFormat ? getPropertyByName("ShortDateFormat").toInt() : 1; +} + +void DBusTimedate::propertiesChanged(const QDBusMessage &msg) +{ + QList arguments = msg.arguments(); + // 参数固定长度 + if (3 != arguments.count()) + return; + QString interfaceName = msg.arguments().at(0).toString(); + if (interfaceName != this->interface()) + return; + QVariantMap changedProps = qdbus_cast(arguments.at(1).value()); + QStringList keys = changedProps.keys(); + foreach (const QString &prop, keys) { + if (prop == "ShortTimeFormat") { + emit ShortTimeFormatChanged(changedProps[prop].toInt()); + } else if (prop == "ShortDateFormat") { + emit ShortDateFormatChanged(changedProps[prop].toInt()); + } + } +} + +QVariant DBusTimedate::getPropertyByName(const char *porpertyName) +{ + QDBusInterface dbusinterface(this->service(), this->path(), this->interface(), QDBusConnection::sessionBus(), this); + return dbusinterface.property(porpertyName); +} + +bool DBusTimedate::getHasDateTimeFormat() +{ + QDBusMessage msg = QDBusMessage::createMethodCall(NETWORK_DBUS_NAME, + NETWORK_DBUS_PATH, + "org.freedesktop.DBus.Introspectable", + QStringLiteral("Introspect")); + + QDBusMessage reply = QDBusConnection::sessionBus().call(msg); + + if (reply.type() == QDBusMessage::ReplyMessage) { + QVariant variant = reply.arguments().first(); + return variant.toString().contains("\"ShortDateFormat\""); + } else { + return false; + } +} diff -Nru dde-calendar-5.9.1/calendar-client/src/dbus/dbustimedate.h dde-calendar-5.10.0/calendar-client/src/dbus/dbustimedate.h --- dde-calendar-5.9.1/calendar-client/src/dbus/dbustimedate.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/dbus/dbustimedate.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,33 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef DBUSTIMEDATE_H +#define DBUSTIMEDATE_H + +#include + +//通过dbus获取控制中心相关时间设置 +class DBusTimedate : public QDBusAbstractInterface +{ + Q_OBJECT + Q_PROPERTY(int ShortTimeFormat READ shortTimeFormat NOTIFY ShortTimeFormatChanged) + Q_PROPERTY(int ShortDateFormat READ shortDateFormat NOTIFY ShortDateFormatChanged) +public: + explicit DBusTimedate(QObject *parent = nullptr); + int shortTimeFormat(); + int shortDateFormat(); +signals: + void ShortDateFormatChanged(int value) const; + void ShortTimeFormatChanged(int value) const; + +public slots: + void propertiesChanged(const QDBusMessage &msg); +private: + QVariant getPropertyByName(const char *porpertyName); + bool getHasDateTimeFormat(); +private: + bool m_hasDateTimeFormat = false; //是否含有 +}; + +#endif // DBUSTIMEDATE_H diff -Nru dde-calendar-5.9.1/calendar-client/src/dbus/doanetworkdbus.cpp dde-calendar-5.10.0/calendar-client/src/dbus/doanetworkdbus.cpp --- dde-calendar-5.9.1/calendar-client/src/dbus/doanetworkdbus.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/dbus/doanetworkdbus.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,64 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "doanetworkdbus.h" + +#include +#include +#include +#include + +DOANetWorkDBus::DOANetWorkDBus(QObject *parent) + : QDBusAbstractInterface(NETWORK_DBUS_NAME, NETWORK_DBUS_PATH, NETWORK_DBUS_INTEERFACENAME, QDBusConnection::sessionBus(), parent) +{ + if (!this->isValid()) { + qWarning() << "Error connecting remote object, service:" << this->service() << ",path:" << this->path() << ",interface" << this->interface(); + } + + //关联后端dbus触发信号 + if (!QDBusConnection::sessionBus().connect(this->service(), this->path(), "org.freedesktop.DBus.Properties", "PropertiesChanged", "sa{sv}as", this, SLOT(propertiesChanged(QDBusMessage)))) { + qWarning() << "the connection was fail!"; + } +} + +/** + * @brief getUserName 获取用户名 + * @return + */ +DOANetWorkDBus::NetWorkState DOANetWorkDBus::getNetWorkState() +{ + return getPropertyByName("State").toInt() == 70 ? DOANetWorkDBus::Active : DOANetWorkDBus::Disconnect; +} + +//根据属性名称获取对应属性值 +QVariant DOANetWorkDBus::getPropertyByName(const char *porpertyName) +{ + QDBusInterface dbusinterface(this->service(), this->path(), this->interface(), QDBusConnection::sessionBus(), this); + return dbusinterface.property(porpertyName); +} + +//监听服务对象信号 +void DOANetWorkDBus::propertiesChanged(const QDBusMessage &msg) +{ + QList arguments = msg.arguments(); + // 参数固定长度 + if (3 != arguments.count()) + return; + QString interfaceName = msg.arguments().at(0).toString(); + if (interfaceName != this->interface()) + return; + QVariantMap changedProps = qdbus_cast(arguments.at(1).value()); + QStringList keys = changedProps.keys(); + foreach (const QString &prop, keys) { + if (prop == "State") { + int state = changedProps[prop].toInt(); + if(70 == state){ + emit sign_NetWorkChange(DOANetWorkDBus::Active); + }else if(20 == state){ + emit sign_NetWorkChange(DOANetWorkDBus::Disconnect); + } + + } + } +} diff -Nru dde-calendar-5.9.1/calendar-client/src/dbus/doanetworkdbus.h dde-calendar-5.10.0/calendar-client/src/dbus/doanetworkdbus.h --- dde-calendar-5.9.1/calendar-client/src/dbus/doanetworkdbus.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/dbus/doanetworkdbus.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,45 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef DOANETWORKDBUS_H +#define DOANETWORKDBUS_H + +#include + +#define NETWORK_DBUS_INTEERFACENAME "com.deepin.daemon.Network" +#define NETWORK_DBUS_NAME "com.deepin.daemon.Network" +#define NETWORK_DBUS_PATH "/com/deepin/daemon/Network" + +class DOANetWorkDBus : public QDBusAbstractInterface +{ + Q_OBJECT +public: + explicit DOANetWorkDBus(QObject *parent = nullptr); + + + + enum NetWorkState { + Active = 1, //已连接 + Disconnect, //已断开 + Connecting, //连接中 + unknow //未知 + }; + Q_ENUM(NetWorkState) + + /** + * @brief getNetWorkState 获取网络状态 + * @return + */ + DOANetWorkDBus::NetWorkState getNetWorkState(); + +signals: + void sign_NetWorkChange(DOANetWorkDBus::NetWorkState); + +public slots: + void propertiesChanged(const QDBusMessage &msg); +private: + QVariant getPropertyByName(const char *porpertyName); +}; + +#endif // DOANETWORKDBUS_H diff -Nru dde-calendar-5.9.1/calendar-client/src/dbus/exportedinterface.cpp dde-calendar-5.10.0/calendar-client/src/dbus/exportedinterface.cpp --- dde-calendar-5.9.1/calendar-client/src/dbus/exportedinterface.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/dbus/exportedinterface.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,27 +1,14 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "exportedinterface.h" #include "scheduledatamanage.h" #include "calendarmainwindow.h" #include "cscheduleoperation.h" +#include "accountmanager.h" +#include "units.h" +#include "compatibledata.h" #include #include @@ -36,7 +23,8 @@ QVariant ExportedInterface::invoke(const QString &action, const QString ¶meters) const { - ScheduleDataInfo info; + //对外接口数据设置 + DSchedule::Ptr info; Exportpara para; QString tstr = parameters; CScheduleOperation _scheduleOperation; @@ -47,6 +35,9 @@ if (action == "CREATE") { // 创建日程 + if (info.isNull()) { + return QVariant(false); + } bool _createSucc = _scheduleOperation.createSchedule(info); //如果创建失败 if (!_createSucc) { @@ -55,16 +46,20 @@ } else if (action == "VIEW") { dynamic_cast(m_object)->viewWindow(para.viewType); } else if (action == "QUERY") { - // 对外接口查询日程 - QString qstr = _scheduleOperation.queryScheduleStr(para.ADTitleName, para.ADStartTime, para.ADEndTime); - return QVariant(qstr); + if (gLocalAccountItem) { + DSchedule::Map scheduleMap = DSchedule::fromMapString(gLocalAccountItem->querySchedulesByExternal(para.ADTitleName, para.ADStartTime, para.ADEndTime)); + QString qstr = DDE_Calendar::getExternalSchedule(scheduleMap); + return QVariant(qstr); + } else { + return ""; + } } else if (action == "CANCEL") { //对外接口删除日程 - QMap > out; -// //口查询日程 - if (_scheduleOperation.queryScheduleInfo(para.ADTitleName, para.ADStartTime, para.ADEndTime, out)) { + QMap out; + //口查询日程 + if (gLocalAccountItem && gLocalAccountItem->querySchedulesByExternal(para.ADTitleName, para.ADStartTime, para.ADEndTime, out)) { //删除查询到的日程 - QMap >::const_iterator _iterator = nullptr; + QMap::const_iterator _iterator = nullptr; for (_iterator = out.constBegin(); _iterator != out.constEnd(); ++_iterator) { for (int i = 0 ; i < _iterator.value().size(); ++i) { _scheduleOperation.deleteOnlyInfo(_iterator.value().at(i)); @@ -77,8 +72,10 @@ return QVariant(true); } -bool ExportedInterface::analysispara(QString ¶meters, ScheduleDataInfo &info, Exportpara ¶) const +bool ExportedInterface::analysispara(QString ¶meters, DSchedule::Ptr &info, Exportpara ¶) const { + //如果是创建则info有效 + //如果是其他则para有效 QJsonParseError json_error; QJsonDocument jsonDoc(QJsonDocument::fromJson(parameters.toLocal8Bit(), &json_error)); @@ -86,7 +83,8 @@ return false; } QJsonObject rootObj = jsonDoc.object(); - info = ScheduleDataInfo::JsonToSchedule(rootObj); + //数据反序列化 + info = DDE_Calendar::getScheduleByExported(parameters); if (rootObj.contains("ViewName")) { para.viewType = rootObj.value("ViewName").toInt(); diff -Nru dde-calendar-5.9.1/calendar-client/src/dbus/exportedinterface.h dde-calendar-5.10.0/calendar-client/src/dbus/exportedinterface.h --- dde-calendar-5.9.1/calendar-client/src/dbus/exportedinterface.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/dbus/exportedinterface.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,27 +1,11 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef EXPORTEDINTERFACE_H #define EXPORTEDINTERFACE_H -#include "src/scheduledatainfo.h" +#include "dschedule.h" #include @@ -41,7 +25,8 @@ explicit ExportedInterface(QObject *parent = nullptr); QVariant invoke(const QString &action, const QString ¶meters) const override; private: - bool analysispara(QString ¶meters, ScheduleDataInfo &info, Exportpara ¶) const; + bool analysispara(QString ¶meters, DSchedule::Ptr &info, Exportpara ¶) const; + private: QObject *m_object = nullptr; }; diff -Nru dde-calendar-5.9.1/calendar-client/src/dialog/dcalendarddialog.cpp dde-calendar-5.10.0/calendar-client/src/dialog/dcalendarddialog.cpp --- dde-calendar-5.9.1/calendar-client/src/dialog/dcalendarddialog.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/dialog/dcalendarddialog.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "dcalendarddialog.h" #include "constants.h" @@ -27,8 +11,8 @@ DCalendarDDialog::DCalendarDDialog(QWidget *parent) : DDialog(parent) - , m_timeFormat(CalendarManager::getInstance()->getCalendarDateDataManage()->getTimeFormat()) - , m_dateFormat(CalendarManager::getInstance()->getCalendarDateDataManage()->getDateFormat()) + , m_timeFormat(CalendarManager::getInstance()->getTimeFormat()) + , m_dateFormat(CalendarManager::getInstance()->getDateFormat()) { connect(CalendarManager::getInstance(), &CalendarManager::signalTimeFormatChanged, this, &DCalendarDDialog::setTimeFormat); connect(CalendarManager::getInstance(), &CalendarManager::signalDateFormatChanged, this, &DCalendarDDialog::setDateFormat); diff -Nru dde-calendar-5.9.1/calendar-client/src/dialog/dcalendarddialog.h dde-calendar-5.10.0/calendar-client/src/dialog/dcalendarddialog.h --- dde-calendar-5.9.1/calendar-client/src/dialog/dcalendarddialog.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/dialog/dcalendarddialog.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef DCALENDARDDIALOG_H #define DCALENDARDDIALOG_H diff -Nru dde-calendar-5.9.1/calendar-client/src/dialog/myscheduleview.cpp dde-calendar-5.10.0/calendar-client/src/dialog/myscheduleview.cpp --- dde-calendar-5.9.1/calendar-client/src/dialog/myscheduleview.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/dialog/myscheduleview.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,27 +1,14 @@ -/* - * Copyright (C) 2017 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: kirigaya - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "myscheduleview.h" #include "scheduledlg.h" #include "scheduledatamanage.h" #include "cdynamicicon.h" #include "constants.h" #include "cscheduleoperation.h" +#include "lunarmanager.h" #include #include @@ -34,7 +21,7 @@ #include DGUI_USE_NAMESPACE -CMyScheduleView::CMyScheduleView(const ScheduleDataInfo &schduleInfo, QWidget *parent) +CMyScheduleView::CMyScheduleView(const DSchedule::Ptr &schduleInfo, QWidget *parent) : DCalendarDDialog(parent) { setContentsMargins(0, 0, 0, 0); @@ -47,6 +34,18 @@ //设置初始化弹窗内容 updateDateTimeFormat(); focusNextPrevChild(false); + slotAccountStateChange(); +} + +void CMyScheduleView::setSchedules(const DSchedule::Ptr &schduleInfo) +{ + m_scheduleInfo = schduleInfo; +} + +void CMyScheduleView::updateFormat() +{ + updateDateTimeFormat(); + slotAccountStateChange(); } /** @@ -59,7 +58,7 @@ if (nullptr == m_timeLabel || nullptr == m_scheduleLabel) { return; } - QString strText = m_scheduleInfo.getTitleName(); + QString strText = m_scheduleInfo->summary(); QString resultStr = nullptr; QFont labelF; labelF.setWeight(QFont::Medium); @@ -101,7 +100,8 @@ area->setFixedHeight(m_scheduleLabelH); m_scheduleLabel->setText(resultStr); - if (m_scheduleInfo.getIsLunar()) { + m_timeLabelH = 26; + if (m_scheduleInfo->lunnar()) { QString timeName = m_timeLabel->text(); int index = timeName.indexOf("~"); //重新计算法字符串像素长度 @@ -115,8 +115,8 @@ } else { m_timeLabelH = 26; } - m_timeLabel->setText(timeName); } + m_timeLabel->setText(timeName); } else { m_timeLabelH = 26; } @@ -127,6 +127,16 @@ setFixedHeight(m_defaultH + m_timeLabelH + m_scheduleLabelH); } +void CMyScheduleView::slotAccountStateChange() +{ + AccountItem::Ptr item = gAccountManager->getAccountItemByScheduleTypeId(m_scheduleInfo->scheduleTypeID()); + if (!item) { + return; + } + //根据可同步状态设置删除按钮是否可用 + getButtons()[0]->setEnabled(item->isCanSyncShedule()); +} + /** * @brief setLabelTextColor 设置label文字颜色 * @param type 主题type @@ -140,19 +150,16 @@ //时间显示颜色 QColor timeColor; if (type == 2) { - titleColor = "#FFFFFF"; - titleColor.setAlphaF(0.9); + titleColor = "#C0C6D4"; scheduleTitleColor = "#FFFFFF"; - scheduleTitleColor.setAlphaF(0.8); timeColor = "#FFFFFF"; timeColor.setAlphaF(0.7); } else { - titleColor = "#000000"; - titleColor.setAlphaF(0.9); + titleColor = "#001A2E"; scheduleTitleColor = "#000000"; - scheduleTitleColor.setAlphaF(0.7); + scheduleTitleColor.setAlphaF(0.9); timeColor = "#000000"; - timeColor.setAlphaF(0.7); + timeColor.setAlphaF(0.6); } //设置颜色 setPaletteTextColor(m_Title, titleColor); @@ -181,12 +188,27 @@ */ void CMyScheduleView::updateDateTimeFormat() { - if (m_scheduleInfo.getType() == DDECalendar::FestivalTypeID) { - m_timeLabel->setText(m_scheduleInfo.getBeginDateTime().toString(m_dateFormat)); + //如果为节假日 + if (CScheduleOperation::isFestival(m_scheduleInfo)) { + m_timeLabel->setText(m_scheduleInfo->dtStart().toString(m_dateFormat)); } else { - QString beginName = getDataByFormat(m_scheduleInfo.getBeginDateTime().date(), m_dateFormat) + " " + m_scheduleInfo.getBeginDateTime().time().toString(m_timeFormat); - QString endName = getDataByFormat(m_scheduleInfo.getEndDateTime().date(), m_dateFormat) + " " + m_scheduleInfo.getEndDateTime().time().toString(m_timeFormat); - m_timeLabel->setText(beginName + " ~ " + endName); + QString showTime; + QString beginName, endName; + if (m_scheduleInfo->allDay()) { + if (m_scheduleInfo->isMultiDay()) { + beginName = getDataByFormat(m_scheduleInfo->dtStart().date(), m_dateFormat); + endName = getDataByFormat(m_scheduleInfo->dtEnd().date(), m_dateFormat); + showTime = beginName + " ~ " + endName; + } else { + showTime = getDataByFormat(m_scheduleInfo->dtStart().date(), m_dateFormat); + } + + } else { + beginName = getDataByFormat(m_scheduleInfo->dtStart().date(), m_dateFormat) + " " + m_scheduleInfo->dtStart().time().toString(m_timeFormat); + endName = getDataByFormat(m_scheduleInfo->dtEnd().date(), m_dateFormat) + " " + m_scheduleInfo->dtEnd().time().toString(m_timeFormat); + showTime = beginName + " ~ " + endName; + } + m_timeLabel->setText(showTime); } slotAutoFeed(); } @@ -194,9 +216,9 @@ QString CMyScheduleView::getDataByFormat(const QDate &date, QString format) { QString name = date.toString(format); - if (m_scheduleInfo.getIsLunar()) { + if (m_scheduleInfo->lunnar()) { //接入农历时间 - name += CScheduleDBus::getInstance()->getHuangLiShortName(date); + name += gLunarManager->getHuangLiShortName(date); } return name; } @@ -211,10 +233,9 @@ Q_UNUSED(buttonName); if (buttonIndex == 0) { //删除日程 - CScheduleOperation _scheduleOpertion(this); - if (_scheduleOpertion.deleteSchedule(m_scheduleInfo)) { + if (CScheduleOperation(m_scheduleInfo->scheduleTypeID(), this).deleteSchedule(m_scheduleInfo)) { accept(); - }; + } return; } if (buttonIndex == 1) { @@ -239,17 +260,10 @@ m_Title = new QLabel(this); m_Title->setFixedSize(108, 51); m_Title->setAlignment(Qt::AlignCenter); - QFont titleFont; - //设置字重 - titleFont.setWeight(QFont::Bold); - m_Title->setFont(titleFont); - DFontSizeManager::instance()->bind(m_Title, DFontSizeManager::T5); + DFontSizeManager::instance()->bind(m_Title, DFontSizeManager::T5, QFont::DemiBold); //设置日期图标 QIcon t_icon(CDynamicIcon::getInstance()->getPixmap()); setIcon(t_icon); - QFont labelTitle; - labelTitle.setWeight(QFont::DemiBold); - m_Title->setFont(labelTitle); m_Title->setText(tr("My Event")); m_Title->move(137, 0); @@ -289,7 +303,8 @@ mainLayout->addSpacing(5); mainLayout->addWidget(m_timeLabel); - if (m_scheduleInfo.getType() == DDECalendar::FestivalTypeID) { + //如果为节假日日程 + if (CScheduleOperation::isFestival(m_scheduleInfo)) { addButton(tr("OK", "button"), false, DDialog::ButtonNormal); QAbstractButton *button_ok = getButton(0); button_ok->setFixedSize(360, 36); @@ -300,6 +315,7 @@ QAbstractButton *button = getButton(i); button->setFixedSize(165, 36); } + //TODO:如果为不可修改日程则设置删除按钮无效 } //这种中心铺满的weiget,显示日程标题和时间的控件 @@ -320,7 +336,8 @@ QObject::connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::themeTypeChanged, this, &CMyScheduleView::setLabelTextColor); - if (m_scheduleInfo.getType() == DDECalendar::FestivalTypeID) { + //如果为节假日日程 + if (CScheduleOperation::isFestival(m_scheduleInfo)) { connect(this, &DDialog::buttonClicked, this, &CMyScheduleView::close); } else { connect(this, &DDialog::buttonClicked, this, &CMyScheduleView::slotBtClick); @@ -330,4 +347,5 @@ QShortcut *shortcut = new QShortcut(this); shortcut->setKey(QKeySequence(QLatin1String("ESC"))); connect(shortcut, SIGNAL(activated()), this, SLOT(close())); + connect(gAccountManager, &AccountManager::signalAccountStateChange, this, &CMyScheduleView::slotAccountStateChange); } diff -Nru dde-calendar-5.9.1/calendar-client/src/dialog/myscheduleview.h dde-calendar-5.10.0/calendar-client/src/dialog/myscheduleview.h --- dde-calendar-5.9.1/calendar-client/src/dialog/myscheduleview.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/dialog/myscheduleview.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,25 +1,11 @@ -/* - * Copyright (C) 2017 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: kirigaya - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef MYSCHEDULEVIEW_H #define MYSCHEDULEVIEW_H -#include "src/scheduledatainfo.h" +#include "dschedule.h" #include "dcalendarddialog.h" #include @@ -39,12 +25,16 @@ { Q_OBJECT public: - explicit CMyScheduleView(const ScheduleDataInfo &schduleInfo, QWidget *parent = nullptr); + explicit CMyScheduleView(const DSchedule::Ptr &schduleInfo, QWidget *parent = nullptr); - ScheduleDataInfo getSchedules() + DSchedule::Ptr getSchedules() { return m_scheduleInfo; } + + void setSchedules(const DSchedule::Ptr &schduleInfo); + void updateFormat(); + signals: void signalsEditorDelete(int type = 0); public slots: @@ -52,6 +42,9 @@ void slotBtClick(int buttonIndex, const QString &buttonName); void slotAutoFeed(const QFont &font = QFont()); + + //帐户状态更新 + void slotAccountStateChange(); private: //界面初始化 void initUI(); @@ -76,7 +69,7 @@ QLabel *m_scheduleLabel = nullptr; QLabel *m_timeLabel = nullptr; QLabel *m_Title = nullptr; - ScheduleDataInfo m_scheduleInfo; //日程 + DSchedule::Ptr m_scheduleInfo; //日程 QScrollArea *area = nullptr; QFont labelF; int m_defaultH = 117; //时间显示高度 diff -Nru dde-calendar-5.9.1/calendar-client/src/dialog/schedulectrldlg.cpp dde-calendar-5.10.0/calendar-client/src/dialog/schedulectrldlg.cpp --- dde-calendar-5.9.1/calendar-client/src/dialog/schedulectrldlg.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/dialog/schedulectrldlg.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,21 +1,7 @@ -/* - * Copyright (C) 2017 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: kirigaya - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "schedulectrldlg.h" #include "scheduledlg.h" #include "scheduledatamanage.h" diff -Nru dde-calendar-5.9.1/calendar-client/src/dialog/schedulectrldlg.h dde-calendar-5.10.0/calendar-client/src/dialog/schedulectrldlg.h --- dde-calendar-5.9.1/calendar-client/src/dialog/schedulectrldlg.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/dialog/schedulectrldlg.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,21 +1,7 @@ -/* - * Copyright (C) 2017 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: kirigaya - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef CSCHEDULECTRLDLG_H #define CSCHEDULECTRLDLG_H diff -Nru dde-calendar-5.9.1/calendar-client/src/dialog/scheduledlg.cpp dde-calendar-5.10.0/calendar-client/src/dialog/scheduledlg.cpp --- dde-calendar-5.9.1/calendar-client/src/dialog/scheduledlg.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/dialog/scheduledlg.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,21 +1,7 @@ -/* - * Copyright (C) 2017 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: kirigaya - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "scheduledlg.h" #include "schedulectrldlg.h" #include "scheduledatamanage.h" @@ -24,6 +10,8 @@ #include "cscheduleoperation.h" #include "cdynamicicon.h" #include "configsettings.h" +#include "accountmanager.h" +#include "units.h" #include #include @@ -37,9 +25,9 @@ #include #include #include +#include const int dialog_width = 468; //对话框宽度 - DGUI_USE_NAMESPACE CScheduleDlg::CScheduleDlg(int type, QWidget *parent, const bool isAllDay) : DCalendarDDialog(parent) @@ -50,7 +38,7 @@ initUI(); initConnection(); setTabFouseOrder(); - initColor(); + slotAccountUpdate(); if (type == 1) { m_titleLabel->setText(tr("New Event")); @@ -68,7 +56,11 @@ } else { m_titleLabel->setText(tr("Edit Event")); } - setFixedSize(dialog_width, 524); + setFixedSize(dialog_width, 561); + if (!gAccountManager->getIsSupportUid()) { + setFixedSize(dialog_width, 561 - 36); + } + //焦点设置到输入框 m_textEdit->setFocus(); } @@ -77,36 +69,57 @@ { } -void CScheduleDlg::setData(const ScheduleDataInfo &info) +void CScheduleDlg::setData(const DSchedule::Ptr &info) { - m_ScheduleDataInfo = info; - m_typeComBox->setCurrentJobTypeNo(info.getType()); + m_scheduleDataInfo = info; + if (m_type == 1) { //如果为新建则设置为提示信息 - m_textEdit->setPlaceholderText(info.getTitleName()); + m_textEdit->setPlaceholderText(info->summary()); + m_accountItem = gAccountManager->getLocalAccountItem(); } else { //如果为编辑则显示 - m_textEdit->setPlainText(info.getTitleName()); + m_textEdit->setPlainText(info->summary()); //光标移动到文末 m_textEdit->moveCursor(QTextCursor::End, QTextCursor::MoveAnchor); + m_accountItem = gAccountManager->getAccountItemByScheduleTypeId(info->scheduleTypeID()); + //编辑状态下帐户不可切换,因此将帐户选择框置灰 + m_accountComBox->setEnabled(false); } - m_beginDateEdit->setDate(info.getBeginDateTime().date()); - m_beginTimeEdit->setTime(info.getBeginDateTime().time()); - m_endDateEdit->setDate(info.getEndDateTime().date()); - m_endTimeEdit->setTime(info.getEndDateTime().time()); - m_allDayCheckbox->setChecked(info.getAllDay()); - m_endRepeatDate->setMinimumDate(info.getBeginDateTime().date()); + if (nullptr != m_accountItem) { + //更新帐户下拉框和类型选择框 + m_accountComBox->setCurrentText(m_accountItem->getAccount()->accountName()); + m_typeComBox->updateJobType(m_accountItem); + } else { + m_accountItem = gAccountManager->getLocalAccountItem(); + } - m_currentDate = info.getBeginDateTime(); - m_EndDate = info.getEndDateTime(); + if (m_scheduleDataInfo) { + m_typeComBox->setCurrentJobTypeNo(m_scheduleDataInfo->scheduleTypeID()); + } + + m_beginDateEdit->setDate(info->dtStart().date()); + m_beginTimeEdit->setTime(info->dtStart().time()); + m_endDateEdit->setDate(info->dtEnd().date()); + m_endTimeEdit->setTime(info->dtEnd().time()); + m_allDayCheckbox->setChecked(info->allDay()); + m_endRepeatDate->setMinimumDate(info->dtStart().date()); + + m_currentDate = info->dtStart(); + m_EndDate = info->dtEnd(); + if (info->lunnar()) { + m_lunarRadioBtn->click(); + } else { + m_solarRadioBtn->click(); + } updateEndTimeListAndTimeDiff(m_currentDate, m_EndDate); - slotallDayStateChanged(info.getAllDay()); + slotallDayStateChanged(info->allDay()); //根据是否为农历更新重复选项 - updateRepeatCombox(info.getIsLunar()); + updateRepeatCombox(info->lunnar()); initRmindRpeatUI(); - setShowState(info.getIsLunar()); + setShowState(info->lunnar()); } void CScheduleDlg::setDate(const QDateTime &date) @@ -152,159 +165,164 @@ */ bool CScheduleDlg::clickOkBtn() { - ScheduleDataInfo _newSchedule = m_ScheduleDataInfo; + return selectScheduleType(); +} + +/** + * @brief CScheduleDlg::selectScheduleType + * 选择日程类型 + * @return 是否可关闭弹窗 + */ +bool CScheduleDlg::selectScheduleType() +{ + //编辑状态,需要创建日程 + if (m_typeComBox->isEditable()) { + DScheduleType::Ptr type; + type.reset(new DScheduleType()); + type->setTypeID("0"); + type->setDisplayName(m_typeComBox->lineEdit()->text()); + type->setTypeColor(*m_colorSeletorWideget->getSelectedColorInfo().data()); + if (m_bCanCreateType) { + m_bCanCreateType = false; + //创建日程类型,等待回调 + m_accountItem->createJobType(type, [&](CallMessge call) { + if (call.code == 0) { + //返回值为日程类型id + createSchedule(call.msg.toString()); + } else { + m_bCanCreateType = true; + } + //关闭本弹窗 + this->close(); + }); + } + + } else if (m_typeComBox->currentIndex() >= 0) { + //选择已有日程,直接创建日程 + return createSchedule(m_typeComBox->getCurrentJobTypeNo()); + } + return false; +} + +/** + * @brief CScheduleDlg::createSchedule + * 创建日程 + * @param scheduleTypeId 日程所属日程类型的id + * @return + */ +bool CScheduleDlg::createSchedule(const QString &scheduleTypeId) +{ + //创建新的日程实例 + DSchedule::Ptr schedule; + schedule.reset(new DSchedule()); + //设置所属日程类型id + schedule->setScheduleTypeID(scheduleTypeId); + QDateTime beginDateTime, endDateTime; beginDateTime.setDate(m_beginDateEdit->date()); beginDateTime.setTime(m_beginTimeEdit->getTime()); endDateTime.setDate(m_endDateEdit->date()); endDateTime.setTime(m_endTimeEdit->getTime()); + schedule->setDtStart(beginDateTime); + schedule->setDtEnd(endDateTime); + //设置是否为农历日程 switch (m_calendarCategoryRadioGroup->checkedId()) { case 1: //农历日程 - _newSchedule.setIsLunar(true); + schedule->setLunnar(true); break; default: //公历日程 - _newSchedule.setIsLunar(false); + schedule->setLunnar(false); break; } if (m_textEdit->toPlainText().isEmpty()) { - _newSchedule.setTitleName(m_textEdit->placeholderText()); + schedule->setSummary(m_textEdit->placeholderText()); } else { - _newSchedule.setTitleName(m_textEdit->toPlainText()); + schedule->setSummary(m_textEdit->toPlainText().trimmed()); } - if (_newSchedule.getTitleName().isEmpty()) { + if (schedule->summary().isEmpty()) { return false; } - //如果类型选项不为负数则设置日程类型 - if (m_typeComBox->isEditable()) { - JobTypeInfo jobType(0, m_typeComBox->lineEdit()->text(), m_colorSeletorWideget->getSelectedColorInfo()); - //创建日程类型 - if (CScheduleOperation().createJobType(jobType)) { - _newSchedule.setType(jobType.getJobTypeNo()); - } - } else if (m_typeComBox->currentIndex() >= 0) - _newSchedule.setType(m_typeComBox->getCurrentJobTypeNo()); if (beginDateTime > endDateTime) { DCalendarDDialog *prompt = new DCalendarDDialog(this); - prompt->setIcon(QIcon(":/resources/icon/warning.svg")); + prompt->setIcon(QIcon(":/icons/deepin/builtin/icons/dde_calendar_warning.svg")); prompt->setMessage(tr("End time must be greater than start time")); prompt->addButton(tr("OK", "button"), true, DDialog::ButtonNormal); prompt->exec(); return false; } - if (m_type == 1) - _newSchedule.setID(0) ; - _newSchedule.setAllDay(m_allDayCheckbox->isChecked()); + schedule->setAllDay(m_allDayCheckbox->isChecked()); - RemindData _remindData; - if (_newSchedule.getAllDay()) { - _remindData.setRemindTime(QTime(9, 0)); - switch (m_rmindCombox->currentIndex()) { - case 1: - _remindData.setRemindNum(DDECalendar::OnStartDay); - break; - case 2: - _remindData.setRemindNum(DDECalendar::OneDayBeforeWithDay); - break; - case 3: - _remindData.setRemindNum(DDECalendar::TwoDayBeforeWithDay); - break; - case 4: - _remindData.setRemindNum(DDECalendar::OneWeekBeforeWithDay); - break; - default: - break; + //设置提醒规则 + DSchedule::AlarmType alarmType; + if (schedule->allDay()) { + alarmType = static_cast(m_rmindCombox->currentIndex() + 8); + } else { + alarmType = static_cast(m_rmindCombox->currentIndex()); + } + schedule->setAlarmType(alarmType); + + //设置重复规则 + DSchedule::RRuleType rruleType; + if (schedule->lunnar()) { + //0:从不 1:每月 2:每年 + if (m_beginrepeatCombox->currentIndex() == 1) { + rruleType = DSchedule::RRule_Month; + } else if (m_beginrepeatCombox->currentIndex() == 2) { + rruleType = DSchedule::RRule_Year; + } else { + rruleType = DSchedule::RRule_None; } } else { - switch (m_rmindCombox->currentIndex()) { - case 1: - _remindData.setRemindNum(DDECalendar::AtTimeOfEvent); - break; - case 2: - _remindData.setRemindNum(DDECalendar::FifteenMinutesBefore); - break; - case 3: - _remindData.setRemindNum(DDECalendar::ThirtyMinutesBefore); - break; - case 4: - _remindData.setRemindNum(DDECalendar::OneHourBefore); - break; - case 5: - _remindData.setRemindNum(DDECalendar::OneDayBeforeWithMinutes); - break; - case 6: - _remindData.setRemindNum(DDECalendar::TwoDayBeforeWithMinutes); - break; - case 7: - _remindData.setRemindNum(DDECalendar::OneWeekBeforeWithMinutes); - break; - default: - break; - } + //0:从不 1:每天 2:每个工作日 3:每周 4:每月 5:每年 + rruleType = static_cast(m_beginrepeatCombox->currentIndex()); } - _newSchedule.setRemindData(_remindData); - - RepetitionRule _repetitionRule; - //根据是否为农历日程,设置对应的重复规则 - RepetitionRule::RRuleID ruleID; - if (_newSchedule.getIsLunar()) { - switch (m_beginrepeatCombox->currentIndex()) { - case 1: - //每月 - ruleID = RepetitionRule::RRule_EVEMONTH; - break; - case 2: { - //每年 - ruleID = RepetitionRule::RRule_EVEYEAR; - } break; - default: - //默认不重复 - ruleID = RepetitionRule::RRule_NONE; - break; + schedule->setRRuleType(rruleType); + if (m_endrepeatCombox->currentIndex() == 1) { + //结束与次数 + if (m_endrepeattimes->text().isEmpty()) { + return false; } + schedule->recurrence()->setDuration(m_endrepeattimes->text().toInt() + 1); - } else { - ruleID = static_cast(m_beginrepeatCombox->currentIndex()); - } - _repetitionRule.setRuleId(ruleID); - if (_repetitionRule.getRuleId() > 0) { - _repetitionRule.setRuleType(static_cast - (m_endrepeatCombox->currentIndex())); - if (m_endrepeatCombox->currentIndex() == 1) { - if (m_endrepeattimes->text().isEmpty()) { - return false; - } - _repetitionRule.setEndCount(m_endrepeattimes->text().toInt()); - } else if (m_endrepeatCombox->currentIndex() == 2) { - QDateTime endrpeattime = beginDateTime; - endrpeattime.setDate(m_endRepeatDate->date()); + } else if (m_endrepeatCombox->currentIndex() == 2) { + //结束与日期 + QDateTime endrpeattime = beginDateTime; + endrpeattime.setDate(m_endRepeatDate->date()); - if (beginDateTime > endrpeattime) { - return false; - } - _repetitionRule.setEndDate(endrpeattime); + if (beginDateTime > endrpeattime) { + return false; } + schedule->recurrence()->setDuration(0); + schedule->recurrence()->setEndDateTime(endrpeattime); + } else { + //永不 + schedule->recurrence()->setDuration(-1); } - _newSchedule.setRepetitionRule(_repetitionRule); - _newSchedule.setBeginDateTime(beginDateTime); - _newSchedule.setEndDateTime(endDateTime); - CScheduleOperation _scheduleOperation(this); + CScheduleOperation _scheduleOperation(m_accountItem, this); + + bool res = false; if (m_type == 1) { //创建日程 - _scheduleOperation.createSchedule(_newSchedule); + schedule->setUid("0"); + res = _scheduleOperation.createSchedule(schedule); } else if (m_type == 0) { - //修改日程,根据返回的参数判断是否关闭对话框 - return _scheduleOperation.changeSchedule(_newSchedule, m_ScheduleDataInfo); + schedule->setUid(m_scheduleDataInfo->uid()); + //如果有重复规则则将原来数据的忽略列表添加进来 + if (schedule->recurs() && m_scheduleDataInfo->recurs()) { + schedule->recurrence()->setExDateTimes(m_scheduleDataInfo->recurrence()->exDateTimes()); + } + res = _scheduleOperation.changeSchedule(schedule, m_scheduleDataInfo); } - return true; + return res; } void CScheduleDlg::updateEndTimeListAndTimeDiff(const QDateTime &begin, const QDateTime &end) @@ -386,7 +404,7 @@ //确定 //自动化测试会出现短时间内按钮click2次的情况。添加第一次触发后将保存按钮置灰的设置。 //若保存按钮不启用则不处理 - if (getButton(1)->isEnabled()) { + if (getButton(1)->isEnabled() && !this->isHidden()) { m_setAccept = clickOkBtn(); //若新建或编辑成功则将保存按钮置灰 getButton(1)->setEnabled(!m_setAccept); @@ -429,7 +447,9 @@ return; } - m_context = m_textEdit->toPlainText(); + setOkBtnEnabled(); + + m_context = m_textEdit->toPlainText().trimmed(); } void CScheduleDlg::slotendrepeatTextchange() @@ -465,14 +485,20 @@ m_rmindCombox->addItem(tr("1 day before")); m_rmindCombox->addItem(tr("2 days before")); m_rmindCombox->addItem(tr("1 week before")); + m_rmindCombox->setCurrentIndex(2); m_beginTimeEdit->setVisible(true); m_endTimeEdit->setVisible(true); if (m_type == 0) { - m_beginDateEdit->setDate(m_ScheduleDataInfo.getBeginDateTime().date()); - m_beginTimeEdit->setTime(m_ScheduleDataInfo.getBeginDateTime().time()); - m_endDateEdit->setDate(m_ScheduleDataInfo.getEndDateTime().date()); - m_endTimeEdit->setTime(m_ScheduleDataInfo.getEndDateTime().time()); + m_beginDateEdit->setDate(m_scheduleDataInfo->dtStart().date()); + m_beginTimeEdit->setTime(m_scheduleDataInfo->dtStart().time()); + m_endDateEdit->setDate(m_scheduleDataInfo->dtEnd().date()); + m_endTimeEdit->setTime(m_scheduleDataInfo->dtEnd().time()); + if (m_scheduleDataInfo->dtStart().time() == m_scheduleDataInfo->dtEnd().time() + && m_scheduleDataInfo->dtEnd().time().toString() == "00:00:00") { + m_endTimeEdit->setTime(QTime(23, 59, 59)); + } + } else { m_beginDateEdit->setDate(m_currentDate.date()); m_beginTimeEdit->setTime(m_currentDate.time()); @@ -485,20 +511,20 @@ m_rmindCombox->addItem(tr("1 day before")); m_rmindCombox->addItem(tr("2 days before")); m_rmindCombox->addItem(tr("1 week before")); + m_rmindCombox->setCurrentIndex(2); m_beginTimeEdit->setVisible(false); m_endTimeEdit->setVisible(false); if (m_type == 0) { - m_beginDateEdit->setDate(m_ScheduleDataInfo.getBeginDateTime().date()); + m_beginDateEdit->setDate(m_scheduleDataInfo->dtStart().date()); m_beginTimeEdit->setTime(QTime(0, 0)); - m_endDateEdit->setDate(m_ScheduleDataInfo.getEndDateTime().date()); + m_endDateEdit->setDate(m_scheduleDataInfo->dtEnd().date()); m_endTimeEdit->setTime(QTime(23, 59)); } else { m_beginDateEdit->setDate(m_currentDate.date()); m_endDateEdit->setDate(m_EndDate.date()); m_beginTimeEdit->setTime(QTime(0, 0)); m_endTimeEdit->setTime(QTime(23, 59)); - m_rmindCombox->setCurrentIndex(2); } } } @@ -510,6 +536,9 @@ } else { m_endrepeatWidget->setVisible(false); } + //不论重复日程选哪种模式,结束重复都是从不 + m_endrepeatCombox->setCurrentIndex(0); + sloteRpeatactivated(0); setOkBtnEnabled(); resize(); } @@ -531,6 +560,7 @@ } else { m_endrepeattimesWidget->setVisible(false); m_endRepeatDate->setVisible(true); + m_endRepeatDate->setEditCursorPos(0); } setOkBtnEnabled(); } @@ -544,6 +574,33 @@ } } +void CScheduleDlg::slotAccoutBoxActivated(const QString &text) +{ + m_accountItem = gAccountManager->getAccountItemByAccountName(text); + m_typeComBox->updateJobType(m_accountItem); + resetColor(m_accountItem); + getButtons()[1]->setEnabled(true); + //将焦点转移到类型选择框上 + m_typeComBox->setFocus(); + setShowState(m_lunarRadioBtn->isChecked()); +} + +void CScheduleDlg::signalLogout(DAccount::Type type) +{ + if (DAccount::Account_UnionID == type && gUosAccountItem == m_accountItem) { + if (m_type) { + //TODO:弹窗提示? + qInfo() << m_accountComBox->currentText() << "帐户已退出"; + getButtons()[1]->setEnabled(false); + m_accountItem.reset(nullptr); + } else { + m_accountComBox->setEnabled(true); + m_type = 1; + m_titleLabel->setText(tr("New Event")); + } + } +} + void CScheduleDlg::slotTypeRpeatactivated(int index) { Q_UNUSED(index); @@ -609,10 +666,6 @@ //名称为全空格,返回 m_typeComBox->showAlertMessage(tr("The name can not only contain whitespaces")); m_typeComBox->setAlert(true); - } else if (JobTypeInfoManager::instance()->isJobTypeNameUsed(tStitlename)) { - //重名,返回 - m_typeComBox->showAlertMessage(tr("The name already exists")); - m_typeComBox->setAlert(true); } else { //如果日程类型编辑框存在焦点(没有编辑结束)且有警告则取消警告和提示信息 if (m_typeComBox->hasFocus() && m_typeComBox->isAlert()) { @@ -752,6 +805,33 @@ QVBoxLayout *maintlayout = new QVBoxLayout; maintlayout->setMargin(0); maintlayout->setSpacing(10); + //帐户 + { + QHBoxLayout *hlayout = new QHBoxLayout; + hlayout->setSpacing(0); + hlayout->setMargin(0); + + DLabel *aLabel = new DLabel(tr("Calendar account:")); + aLabel->setToolTip(tr("Calendar account")); + DFontSizeManager::instance()->bind(aLabel, DFontSizeManager::T6); + aLabel->setElideMode(Qt::ElideRight); + aLabel->setFont(mlabelF); + aLabel->setAlignment(Qt::AlignLeft | Qt::AlignVCenter); + aLabel->setFixedSize(label_Fixed_Width, item_Fixed_Height); + + m_accountComBox = new DComboBox(this); + m_accountComBox->setFixedSize(350, item_Fixed_Height); + hlayout->addWidget(aLabel); + hlayout->addWidget(m_accountComBox); + QWidget *widget = new QWidget; + widget->setLayout(hlayout); + widget->setFixedHeight(item_Fixed_Height); + maintlayout->addWidget(widget); + if (!gAccountManager->getIsSupportUid()) { + widget->hide(); + } + } + //类型 { //使用网格布局 @@ -774,7 +854,6 @@ m_typeComBox->setObjectName("ScheduleTypeCombobox"); m_typeComBox->setAccessibleName("ScheduleTypeCombobox"); m_typeComBox->setFixedSize(350, item_Fixed_Height); - initJobTypeComboBox();//todo m_colorSeletorWideget = new ColorSeletorWidget(); m_colorSeletorWideget->hide(); @@ -783,8 +862,10 @@ typelayout->addWidget(m_typeComBox, 0, 1); typelayout->addWidget(m_colorSeletorWideget, 1, 1); //添加垂直间隔 - typelayout->setVerticalSpacing(5); - maintlayout->addLayout(typelayout); + typelayout->setVerticalSpacing(10); + QWidget *widget = new QWidget; + widget->setLayout(typelayout); + maintlayout->addWidget(widget); } //内容 @@ -838,14 +919,18 @@ m_adllDayLabel->setText(str_allDayLabel); m_adllDayLabel->setFont(mlabelF); m_adllDayLabel->setAlignment(Qt::AlignLeft | Qt::AlignVCenter); - m_adllDayLabel->setFixedSize(label_Fixed_Width, item_Fixed_Height); + m_adllDayLabel->setFixedSize(label_Fixed_Width, 25); m_allDayCheckbox = new DCheckBox(this); + m_allDayCheckbox->setFixedHeight(25); //设置对象名称和辅助显示名称 m_allDayCheckbox->setObjectName("AllDayCheckBox"); m_allDayCheckbox->setAccessibleName("AllDayCheckBox"); alldayLabellayout->addWidget(m_adllDayLabel); alldayLabellayout->addWidget(m_allDayCheckbox); - maintlayout->addLayout(alldayLabellayout); + QWidget *widget = new QWidget; + widget->setLayout(alldayLabellayout); + widget->setFixedHeight(25); + maintlayout->addWidget(widget); } //时间 @@ -856,12 +941,14 @@ tLabel->setElideMode(Qt::ElideRight); tLabel->setFont(mlabelF); tLabel->setAlignment(Qt::AlignLeft | Qt::AlignVCenter); - tLabel->setFixedSize(DDECalendar::NewScheduleLabelWidth, item_Fixed_Height); + tLabel->setFixedSize(DDECalendar::NewScheduleLabelWidth, 25); m_solarRadioBtn = new DRadioButton(tr("Solar")); m_lunarRadioBtn = new DRadioButton(tr("Lunar")); m_solarRadioBtn->setMinimumWidth(72); m_lunarRadioBtn->setMinimumWidth(72); + m_solarRadioBtn->setFixedHeight(25); + m_lunarRadioBtn->setFixedHeight(25); m_calendarCategoryRadioGroup = new QButtonGroup(this); m_calendarCategoryRadioGroup->setExclusive(true); @@ -875,8 +962,13 @@ tLayout->addWidget(m_solarRadioBtn); tLayout->addWidget(m_lunarRadioBtn); tLayout->addStretch(1); + tLayout->setAlignment(m_solarRadioBtn, Qt::AlignVCenter); + tLayout->setAlignment(m_lunarRadioBtn, Qt::AlignVCenter); - maintlayout->addLayout(tLayout); + QWidget *widget = new QWidget; + widget->setLayout(tLayout); + widget->setFixedHeight(25); + maintlayout->addWidget(widget); } //开始时间 @@ -913,7 +1005,11 @@ beginLabellayout->addSpacing(8); beginLabellayout->addWidget(m_beginTimeEdit); beginLabellayout->addStretch(); - maintlayout->addLayout(beginLabellayout); + + QWidget *widget = new QWidget; + widget->setLayout(beginLabellayout); + widget->setFixedHeight(item_Fixed_Height); + maintlayout->addWidget(widget); } //结束时间 @@ -951,7 +1047,10 @@ enQLabellayout->addWidget(m_endTimeEdit); enQLabellayout->addStretch(); - maintlayout->addLayout(enQLabellayout); + QWidget *widget = new QWidget; + widget->setLayout(enQLabellayout); + widget->setFixedHeight(item_Fixed_Height); + maintlayout->addWidget(widget); } //提醒 @@ -979,7 +1078,10 @@ rminQLabellayout->addWidget(m_remindSetLabel); rminQLabellayout->addWidget(m_rmindCombox); rminQLabellayout->addStretch(); - maintlayout->addLayout(rminQLabellayout); + QWidget *widget = new QWidget; + widget->setLayout(rminQLabellayout); + widget->setFixedHeight(item_Fixed_Height); + maintlayout->addWidget(widget); } //重复 @@ -1011,7 +1113,10 @@ repeatLabellayout->addWidget(m_beginrepeatLabel); repeatLabellayout->addWidget(m_beginrepeatCombox); repeatLabellayout->addStretch(); - maintlayout->addLayout(repeatLabellayout); + QWidget *widget = new QWidget; + widget->setLayout(repeatLabellayout); + widget->setFixedHeight(item_Fixed_Height); + maintlayout->addWidget(widget); } //结束重复 @@ -1086,11 +1191,14 @@ endrepeatLabellayout->addWidget(m_endRepeatDate); endrepeatLabellayout->addStretch(); m_endRepeatDate->setVisible(false); + //设置最大日期 + m_endRepeatDate->setMaximumDate(QDate(2100, 12, 31)); m_endrepeatWidget = new DWidget; //设置对象名称和辅助显示名称 m_endrepeatWidget->setObjectName("EndRepeatDateWidget"); m_endrepeatWidget->setAccessibleName("EndRepeatDateWidget"); m_endrepeatWidget->setLayout(endrepeatLabellayout); + m_endrepeatWidget->setFixedHeight(item_Fixed_Height); maintlayout->addWidget(m_endrepeatWidget); m_endrepeatWidget->setVisible(false); } @@ -1128,6 +1236,8 @@ &CScheduleDlg::sloteRpeatactivated); connect(m_typeComBox, QOverload::of(&QComboBox::activated), this, &CScheduleDlg::slotTypeRpeatactivated); + connect(m_accountComBox, QOverload::of(&QComboBox::activated), this, + &CScheduleDlg::slotAccoutBoxActivated); connect(m_beginDateEdit, &DDateEdit::userDateChanged, this, &CScheduleDlg::slotBDateEidtInfo); QShortcut *shortcut = new QShortcut(this); shortcut->setKey(QKeySequence(QLatin1String("ESC"))); @@ -1141,6 +1251,28 @@ connect(m_typeComBox, &JobTypeComboBox::signalAddTypeBtnClicked, this, &CScheduleDlg::slotBtnAddItemClicked); connect(m_typeComBox, &JobTypeComboBox::editTextChanged, this, &CScheduleDlg::slotTypeEditTextChanged); connect(m_typeComBox, &JobTypeComboBox::editingFinished, this, &CScheduleDlg::slotJobComboBoxEditingFinished); + connect(gAccountManager, &AccountManager::signalLogout, this, &CScheduleDlg::signalLogout); + connect(gAccountManager, &AccountManager::signalAccountUpdate, this, &CScheduleDlg::slotAccountUpdate); + connect(gAccountManager, &AccountManager::signalAccountStateChange, this, &CScheduleDlg::slotAccountStateChange); +} + +void CScheduleDlg::slotAccountUpdate() +{ + m_accountComBox->clear(); + QList accountList = gAccountManager->getAccountList(); + for (AccountItem::Ptr p : accountList) { + m_accountComBox->addItem(p->getAccount()->accountName()); + } + initJobTypeComboBox(); +} + +/** + * @brief CScheduleDlg::slotAccountStateChange + * 帐户状态发生改变,刷新界面显示 + */ +void CScheduleDlg::slotAccountStateChange() +{ + setShowState(m_lunarRadioBtn->isChecked()); } void CScheduleDlg::initDateEdit() @@ -1151,84 +1283,56 @@ m_endDateEdit->setMaximumDate(QDate(DDECalendar::QueryLatestYear, 12, 31)); return; } + void CScheduleDlg::initJobTypeComboBox() { - m_typeComBox->updateJobType(); + m_accountItem = gAccountManager->getAccountItemByAccountName(m_accountComBox->currentText()); + m_typeComBox->updateJobType(m_accountItem); + resetColor(m_accountItem); } void CScheduleDlg::initRmindRpeatUI() { - if (m_ScheduleDataInfo.getAllDay()) { - if (m_ScheduleDataInfo.getRemindData().getRemindNum() > -1) { - if (m_ScheduleDataInfo.getRemindData().getRemindNum() == DDECalendar::OnStartDay) { - m_rmindCombox->setCurrentIndex(1); - } else if (m_ScheduleDataInfo.getRemindData().getRemindNum() == DDECalendar::OneDayBeforeWithDay) { - m_rmindCombox->setCurrentIndex(2); - } else if (m_ScheduleDataInfo.getRemindData().getRemindNum() == DDECalendar::TwoDayBeforeWithDay) { - m_rmindCombox->setCurrentIndex(3); - } else if (m_ScheduleDataInfo.getRemindData().getRemindNum() == DDECalendar::OneWeekBeforeWithDay) { - m_rmindCombox->setCurrentIndex(4); - } - } else { - m_rmindCombox->setCurrentIndex(0); - } - } else { - if (m_ScheduleDataInfo.getRemindData().getRemindNum() > -1) { - if (m_ScheduleDataInfo.getRemindData().getRemindNum() == DDECalendar::AtTimeOfEvent) { - m_rmindCombox->setCurrentIndex(1); - } else if (m_ScheduleDataInfo.getRemindData().getRemindNum() == DDECalendar::FifteenMinutesBefore) { - m_rmindCombox->setCurrentIndex(2); - } else if (m_ScheduleDataInfo.getRemindData().getRemindNum() == DDECalendar::ThirtyMinutesBefore) { - m_rmindCombox->setCurrentIndex(3); - } else if (m_ScheduleDataInfo.getRemindData().getRemindNum() == DDECalendar::OneHourBefore) { - m_rmindCombox->setCurrentIndex(4); - } else if (m_ScheduleDataInfo.getRemindData().getRemindNum() == - DDECalendar::OneDayBeforeWithMinutes) { - m_rmindCombox->setCurrentIndex(5); - } else if (m_ScheduleDataInfo.getRemindData().getRemindNum() == - DDECalendar::TwoDayBeforeWithMinutes) { - m_rmindCombox->setCurrentIndex(6); - } else if (m_ScheduleDataInfo.getRemindData().getRemindNum() == - DDECalendar::OneWeekBeforeWithMinutes) { - m_rmindCombox->setCurrentIndex(7); - } - } else { - m_rmindCombox->setCurrentIndex(0); - } + //提醒规则 + if (m_scheduleDataInfo->allDay()) { + m_rmindCombox->setCurrentIndex(m_scheduleDataInfo->getAlarmType() - 8); + } else { + m_rmindCombox->setCurrentIndex(m_scheduleDataInfo->getAlarmType()); } - slotbRpeatactivated(m_ScheduleDataInfo.getRepetitionRule().getRuleId()); - RepetitionRule::RRuleID ruleID = m_ScheduleDataInfo.getRepetitionRule().getRuleId(); - if (m_ScheduleDataInfo.getIsLunar()) { - switch (ruleID) { - case RepetitionRule::RRule_EVEYEAR: - m_beginrepeatCombox->setCurrentIndex(2); - break; - case RepetitionRule::RRule_EVEMONTH: + + //重复规则 + if (m_scheduleDataInfo->lunnar()) { + //如果为农历 + switch (m_scheduleDataInfo->getRRuleType()) { + case DSchedule::RRule_Month: m_beginrepeatCombox->setCurrentIndex(1); break; + case DSchedule::RRule_Year: + m_beginrepeatCombox->setCurrentIndex(2); + break; default: m_beginrepeatCombox->setCurrentIndex(0); break; } - } else { - m_beginrepeatCombox->setCurrentIndex(ruleID); - } - if (m_ScheduleDataInfo.getRepetitionRule().getRuleId() != 0) { - if (m_ScheduleDataInfo.getRepetitionRule().getRuleType() == 0) { - m_endrepeatCombox->setCurrentIndex(0); - } else if (m_ScheduleDataInfo.getRepetitionRule().getRuleType() == 1) { - m_endrepeatCombox->setCurrentIndex(1); - m_endrepeattimes->setText(QString::number(m_ScheduleDataInfo.getRepetitionRule().getEndCount())); - } else if (m_ScheduleDataInfo.getRepetitionRule().getRuleType() == 2) { - m_endrepeatCombox->setCurrentIndex(2); - m_endRepeatDate->setDate(m_ScheduleDataInfo.getRepetitionRule().getEndDate().date()); - } - m_endrepeatWidget->show(); - sloteRpeatactivated(m_ScheduleDataInfo.getRepetitionRule().getRuleType()); } else { - m_endrepeatWidget->hide(); + //如果为公历 + m_beginrepeatCombox->setCurrentIndex(m_scheduleDataInfo->getRRuleType()); + } + slotbRpeatactivated(m_beginrepeatCombox->currentIndex()); + if (m_scheduleDataInfo->recurrence()->duration() < 0) { + //永不 + m_endrepeatCombox->setCurrentIndex(0); + } else if (m_scheduleDataInfo->recurrence()->duration() == 0) { + //结束于日期 + m_endrepeatCombox->setCurrentIndex(2); + m_endRepeatDate->setDate(m_scheduleDataInfo->recurrence()->endDateTime().date()); + } else { + //结束与次数 + m_endrepeatCombox->setCurrentIndex(1); + m_endrepeattimes->setText(QString::number(m_scheduleDataInfo->recurrence()->duration() - 1)); } + sloteRpeatactivated(m_endrepeatCombox->currentIndex()); } void CScheduleDlg::setTheMe(const int type) @@ -1264,13 +1368,15 @@ setTabOrder(m_rmindCombox, m_beginrepeatCombox); setTabOrder(m_beginrepeatCombox, m_endrepeatCombox); //结束于次数,设置tab顺序 - if (m_ScheduleDataInfo.getRepetitionRule().getRuleType() == - RepetitionRule::RRuleEndType::RRuleType_FREQ) - setTabOrder(m_endrepeatCombox, m_endrepeattimes); - //结束于日期,设置tab顺序 - if (m_ScheduleDataInfo.getRepetitionRule().getRuleType() == - RepetitionRule::RRuleEndType::RRuleType_DATE) - setTabOrder(m_endrepeatCombox, m_endRepeatDate); + //如果为重复日程 + if (!m_scheduleDataInfo.isNull() && m_scheduleDataInfo->getRRuleType() != DSchedule::RRule_None) { + //如果为结束于次数 + if (m_scheduleDataInfo->recurrence()->duration() > 0) { + setTabOrder(m_endrepeatCombox, m_endrepeattimes); + } else if (m_scheduleDataInfo->recurrence()->duration() == 0) { + setTabOrder(m_endrepeatCombox, m_endRepeatDate); + } + } } void CScheduleDlg::updateIsOneMoreDay(const QDateTime &begin, const QDateTime &end) @@ -1321,8 +1427,18 @@ */ void CScheduleDlg::setShowState(bool jobIsLunar) { - //如果不显示农历 - if (isShowLunar()) { + m_solarRadioBtn->setEnabled(true); + m_lunarRadioBtn->setEnabled(true); + setWidgetEnabled(true); + getButton(1)->setEnabled(true); + if (!m_accountItem || !m_accountItem->isCanSyncShedule()) { + //不可同步日程,除帐户选择外其他的控件都置灰 + m_solarRadioBtn->setEnabled(false); + m_lunarRadioBtn->setEnabled(false); + setWidgetEnabled(false); + getButton(1)->setEnabled(false); + } else if (isShowLunar()) { + //如果不显示农历 m_lunarRadioBtn->setEnabled(true); m_beginDateEdit->setLunarCalendarStatus(jobIsLunar); m_endDateEdit->setLunarCalendarStatus(jobIsLunar); @@ -1365,19 +1481,38 @@ m_endRepeatDate->setEnabled(isEnabled); } -void CScheduleDlg::initColor() +void CScheduleDlg::resetColor(const AccountItem::Ptr &account) { + m_colorSeletorWideget->resetColorButton(account); //将用户上一次选择的自定义颜色添加进去 QString colorName = CConfigSettings::getInstance()->value("LastUserColor", "").toString(); if (!colorName.isEmpty()) { - m_colorSeletorWideget->setUserColor(JobTypeColorInfo(0, colorName, 7)); + //设置颜色 + DTypeColor::Ptr typeColor; + typeColor.reset(new DTypeColor); + typeColor->setColorCode(colorName); + typeColor->setPrivilege(DTypeColor::PriUser); + m_colorSeletorWideget->setUserColor(typeColor); } - //选中上一次选中的颜色 - int colorId = CConfigSettings::getInstance()->value("LastSysColorTypeNo", -1).toInt(); - if (colorId > 0) { - m_colorSeletorWideget->setSelectedColorById(colorId); + QVariant colorId = CConfigSettings::getInstance()->value("LastSysColorTypeNo", -1); + int colorNum = 0; + if (colorId.type() == QVariant::Int) { + //如果是int型表示为旧颜色编号 + colorNum = colorId.toInt(); + } else { + QString &&colorIdStr = colorId.toString(); + //如果都为空表示为初始状态,则选中第一个 + if (colorName.isEmpty() && colorIdStr.isEmpty()) { + colorNum = -1; + } else if (!colorIdStr.isEmpty()) { + //如果颜色id不为空则表示颜色为内置颜色 + colorNum = GTypeColor.keys().indexOf(colorIdStr); + } else { + colorNum = 9; + } } + m_colorSeletorWideget->setSelectedColorById(colorNum); } void CScheduleDlg::resize() @@ -1388,10 +1523,14 @@ } if (m_colorSeletorWideget->isVisible()) { - h += 18 + 5; + h += 18 + 10; + } + if (!gAccountManager->getIsSupportUid()) { + h -= 36; } - //524: 默认界面高度, h: 新增控件高度 - setFixedSize(dialog_width, 524 + h); + + //573: 默认界面高度, h: 新增控件高度 + setFixedSize(dialog_width, 573 + h); } void CScheduleDlg::setOkBtnEnabled() @@ -1401,7 +1540,7 @@ //根据类型输入框的内容判断保存按钮是否有效 if (m_OkBt != nullptr && m_typeComBox->lineEdit() != nullptr) { const QString &typeStr = m_typeComBox->lineEdit()->text(); - if (typeStr.isEmpty() || typeStr.trimmed().isEmpty() || JobTypeInfoManager::instance()->isJobTypeNameUsed(typeStr)) { + if (typeStr.isEmpty() || typeStr.trimmed().isEmpty()) { m_OkBt->setEnabled(false); //若内容无效直接退出,不判断结束次数是否为空 return; @@ -1416,4 +1555,10 @@ //日期 //永不 m_OkBt->setEnabled(true); } + + if (!m_textEdit->toPlainText().isEmpty() && m_textEdit->toPlainText().trimmed().isEmpty()) { + m_OkBt->setEnabled(false); + } else { + m_OkBt->setEnabled(true); + } } diff -Nru dde-calendar-5.9.1/calendar-client/src/dialog/scheduledlg.h dde-calendar-5.10.0/calendar-client/src/dialog/scheduledlg.h --- dde-calendar-5.9.1/calendar-client/src/dialog/scheduledlg.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/dialog/scheduledlg.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,25 +1,11 @@ -/* - * Copyright (C) 2017 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: kirigaya - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef SCHEDULEDLG_H #define SCHEDULEDLG_H -//#include "src/scheduledatainfo.h" +#include "dschedule.h" #include "dcalendarddialog.h" #include "cdateedit.h" #include "jobtypecombobox.h" @@ -49,12 +35,16 @@ CScheduleDlg(int type, QWidget *parent = nullptr, const bool isAllDay = true); ~CScheduleDlg() override; - void setData(const ScheduleDataInfo &info); + void setData(const DSchedule::Ptr &info); void setDate(const QDateTime &date); void setAllDay(bool flag); private: //确定按钮处理 bool clickOkBtn(); + //选择日程类型 + bool selectScheduleType(); + //创建日程 + bool createSchedule(const QString& scheduleTypeId); /** * @brief updateEndTimeListAndTimeDiff 更新结束时间(time),结束时间下拉列表和开始时间和结束时间差 @@ -115,6 +105,13 @@ void slotbRpeatactivated(int index); void sloteRpeatactivated(int index); void slotJobComboBoxEditingFinished(); + void slotAccoutBoxActivated(const QString &text); + //帐户登出信号 + void signalLogout(DAccount::Type); + //帐户信息更新 + void slotAccountUpdate(); + //帐户状态 + void slotAccountStateChange(); protected: bool eventFilter(QObject *obj, QEvent *pEvent) override; @@ -125,7 +122,7 @@ private: void initUI(); - void initColor(); + void resetColor(const AccountItem::Ptr&); void initConnection(); void initDateEdit(); void initJobTypeComboBox(); @@ -172,6 +169,9 @@ void setOkBtnEnabled(); private: + + DComboBox *m_accountComBox = nullptr; //帐户下拉选择框 + QLabel *m_typeLabel = nullptr; //DComboBox *m_typeComBox = nullptr; JobTypeComboBox *m_typeComBox = nullptr; @@ -212,13 +212,14 @@ bool m_isMoreThenOneDay = false; private: //日程 - ScheduleDataInfo m_ScheduleDataInfo; - QList m_lstJobType; + DSchedule::Ptr m_scheduleDataInfo; + AccountItem::Ptr m_accountItem; int m_type; // 1新建 0 编辑日程 QDateTime m_currentDate; QDateTime m_EndDate; bool m_typeEditStatus = false; //日程类型编辑状态 int m_prevCheckRadioID = -1; //上一次点击Radio的id编号 + bool m_bCanCreateType = true;; }; #endif // SCHEDULEDLG_H diff -Nru dde-calendar-5.9.1/calendar-client/src/dialog/scheduletypeeditdlg.cpp dde-calendar-5.10.0/calendar-client/src/dialog/scheduletypeeditdlg.cpp --- dde-calendar-5.9.1/calendar-client/src/dialog/scheduletypeeditdlg.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/dialog/scheduletypeeditdlg.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,27 +1,12 @@ -/* -* Copyright (C) 2019 ~ 2019 UnionTech Software Technology Co.,Ltd. -* -* Author: leilong -* -* Maintainer: leilong -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "scheduletypeeditdlg.h" #include "scheduledatamanage.h" #include "cscheduleoperation.h" #include "configsettings.h" +#include "units.h" #include #include @@ -38,7 +23,7 @@ init(); } -ScheduleTypeEditDlg::ScheduleTypeEditDlg(const JobTypeInfo &jobTypeOld, QWidget *parent) +ScheduleTypeEditDlg::ScheduleTypeEditDlg(const DScheduleType &jobTypeOld, QWidget *parent) : DDialog(parent) , m_jobTypeOld(jobTypeOld) , m_jobTypeNew(jobTypeOld) @@ -49,6 +34,56 @@ init(); } +DScheduleType ScheduleTypeEditDlg::newJsonType() +{ + m_jobTypeNew.setTypeColor(*m_colorSeletor->getSelectedColorInfo()); + return m_jobTypeNew; +} + +void ScheduleTypeEditDlg::setAccount(AccountItem::Ptr account) +{ + m_colorSeletor->resetColorButton(account); + + //将用户上一次选择的自定义颜色添加进去 + QString colorName = CConfigSettings::getInstance()->value("LastUserColor", "").toString(); + if (!colorName.isEmpty()) { + //设置颜色 + DTypeColor::Ptr typeColor; + typeColor.reset(new DTypeColor); + typeColor->setColorID(0); + typeColor->setColorCode(colorName); + typeColor->setPrivilege(DTypeColor::PriUser); + m_colorSeletor->setUserColor(typeColor); + } + switch (m_dialogType) { + case DialogEditType: { + //编辑日程类型 + //设置颜色 + m_colorSeletor->setSelectedColor(m_jobTypeOld.typeColor()); + } break; + default: { + //默认新建日程,选中上一次选中的颜色 + //选中上一次选中的颜色 + QVariant colorId = CConfigSettings::getInstance()->value("LastSysColorTypeNo", -1); + int colorNum = 0; + if (colorId.type() == QVariant::Int) { + //如果是int型表示为旧颜色编号 + colorNum = colorId.toInt(); + } else { + QString &&colorIdStr = colorId.toString(); + if(colorName.isEmpty() && colorIdStr.isEmpty()){ + colorNum = -1; + } else if (!colorIdStr.isEmpty()) { + colorNum = GTypeColor.keys().indexOf(colorIdStr); + } else { + colorNum = 9; + } + } + m_colorSeletor->setSelectedColorById(colorNum); + } break; + } +} + void ScheduleTypeEditDlg::init() { initView(); @@ -79,20 +114,24 @@ maintlayout->setSpacing(10); QHBoxLayout *eLayout = new QHBoxLayout; - QLabel *eName = new QLabel(tr("Name:")); - eName->setFixedWidth(42); + m_eName = new QLabel(tr("Name:")); + m_eName->setToolTip(m_eName->text()); + m_eName->setFixedWidth(42); m_lineEdit = new DLineEdit(); m_lineEdit->setClearButtonEnabled(false); //不显示按钮 - eLayout->addWidget(eName); + eLayout->addWidget(m_eName); eLayout->addWidget(m_lineEdit, 1); QHBoxLayout *cLayout = new QHBoxLayout; - QLabel *cName = new QLabel(tr("Color:")); - cName->setFixedWidth(42); + m_cName = new QLabel(tr("Color:")); + m_cName->setToolTip(m_cName->text()); + m_strLabelName = m_eName->text(); + m_strLabelColor = m_cName->text(); + m_cName->setFixedWidth(42); m_colorSeletor = new ColorSeletorWidget(); - cLayout->addWidget(cName); + cLayout->addWidget(m_cName); cLayout->addWidget(m_colorSeletor); cLayout->addStretch(1); @@ -111,7 +150,7 @@ gwi->setLayout(maintlayout); gwi->setMinimumWidth(360); addContent(gwi, Qt::AlignCenter); - + setLabelText(); //添加按钮 addButton(tr("Cancel", "button")); addButton(tr("Save", "button"), false, DDialog::ButtonRecommend); @@ -126,29 +165,9 @@ void ScheduleTypeEditDlg::initData() { m_titleLabel->setText(m_title); - m_lineEdit->setText(m_jobTypeOld.getJobTypeName()); - m_typeText = m_jobTypeOld.getJobTypeName();//编辑时要初始化数据 - this->getButton(1)->setEnabled(!m_jobTypeOld.getJobTypeName().isEmpty());//如果是新增,则保存按钮默认不可用 - - //将用户上一次选择的自定义颜色添加进去 - QString colorName = CConfigSettings::getInstance()->value("LastUserColor", "").toString(); - if (!colorName.isEmpty()) { - m_colorSeletor->setUserColor(JobTypeColorInfo(0, colorName, 7)); - } - - switch (m_dialogType) { - case DialogEditType: { - //编辑日程类型 - m_colorSeletor->setSelectedColor(m_jobTypeOld.getColorInfo()); - } break; - default: { - //默认新建日程,选中上一次选中的颜色 - int colorId = CConfigSettings::getInstance()->value("LastSysColorTypeNo", -1).toInt(); - if (colorId > 0) { - m_colorSeletor->setSelectedColorById(colorId); - } - } break; - } + m_lineEdit->setText(m_jobTypeOld.displayName()); + m_typeText = m_jobTypeOld.displayName(); //编辑时要初始化数据 + this->getButton(1)->setEnabled(!m_jobTypeOld.displayName().isEmpty()); //如果是新增,则保存按钮默认不可用 } void ScheduleTypeEditDlg::slotEditTextChanged(const QString &strName) @@ -188,45 +207,54 @@ this->getButton(1)->setEnabled(false); return; } - m_jobTypeNew.setJobTypeName(tStitlename); - //在编辑日程状态下不对编辑的日程类型名做重名处理 - bool isUsed = m_dialogType == DialogEditType ? JobTypeInfoManager::instance()->isJobTypeNameUsed(m_jobTypeNew) - : JobTypeInfoManager::instance()->isJobTypeNameUsed(tStitlename); - - if (isUsed) { - //重名,返回 - m_lineEdit->showAlertMessage(tr("The name already exists")); - m_lineEdit->setAlert(true); - this->getButton(1)->setEnabled(false); - return; - } + m_jobTypeNew.setDisplayName(tStitlename); + m_lineEdit->setAlert(false); m_lineEdit->hideAlertMessage(); this->getButton(1)->setEnabled(true); return; } +void ScheduleTypeEditDlg::changeEvent(QEvent *e) { + DDialog::changeEvent(e); + if(e->type() == QEvent::FontChange) { + setLabelText(); + } +} void ScheduleTypeEditDlg::slotFocusChanged(bool onFocus) { //如果焦点移出,且输入内容为空 if (!onFocus && m_lineEdit->text().isEmpty()) { - emit m_lineEdit->textChanged(""); +// emit m_lineEdit->textChanged(""); + emit m_lineEdit->editingFinished(); } } - +void ScheduleTypeEditDlg::setLabelText() { + QLocale local; + if(local.language() == QLocale::Chinese) { + return; + } + QString str = m_strLabelName.trimmed(); + QFontMetrics fontMetrice(m_eName->font()); + if(fontMetrice.width(str) > (m_eName->width()+6)) { + str = fontMetrice.elidedText(str,Qt::ElideRight,m_eName->width()); + } + m_eName->setText(str); + str = m_strLabelColor.trimmed(); + if(fontMetrice.width(str) > (m_eName->width()+5)) { + str = fontMetrice.elidedText(str,Qt::ElideRight,m_cName->width()); + } + m_cName->setText(str); +} void ScheduleTypeEditDlg::slotBtnCancel() { - this->close(); + this->reject(); } void ScheduleTypeEditDlg::slotBtnNext() { - //先修改颜色 - m_jobTypeNew.setColorInfo(m_colorSeletor->getSelectedColorInfo()); - - CScheduleOperation so; - //更新或创建日程类型 - so.updateJobType(m_jobTypeOld, m_jobTypeNew); + m_jobTypeNew.setTypeColor(*m_colorSeletor->getSelectedColorInfo()); + this->accept(); } void ScheduleTypeEditDlg::slotEditingFinished() diff -Nru dde-calendar-5.9.1/calendar-client/src/dialog/scheduletypeeditdlg.h dde-calendar-5.10.0/calendar-client/src/dialog/scheduletypeeditdlg.h --- dde-calendar-5.9.1/calendar-client/src/dialog/scheduletypeeditdlg.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/dialog/scheduletypeeditdlg.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,28 +1,15 @@ -/* -* Copyright (C) 2019 ~ 2019 UnionTech Software Technology Co.,Ltd. -* -* Author: leilong -* -* Maintainer: leilong -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef SCHEDULETYPEEDITDLG_H #define SCHEDULETYPEEDITDLG_H #include "colorseletorwidget.h" -#include "src/scheduledatainfo.h" +#include "dschedule.h" +#include "dscheduletype.h" +#include "daccount.h" +#include "accountitem.h" #include #include @@ -36,7 +23,11 @@ //新增 explicit ScheduleTypeEditDlg(QWidget *parent = nullptr); //iJobTypeNo==0 ? 新增 or 修改 - explicit ScheduleTypeEditDlg(const JobTypeInfo &jobTypeOld, QWidget *parent = nullptr); + explicit ScheduleTypeEditDlg(const DScheduleType &jobTypeOld, QWidget *parent = nullptr); + + DScheduleType newJsonType(); + + void setAccount(AccountItem::Ptr account); private: enum DialogType { //对话框类型 @@ -72,20 +63,30 @@ */ void slotEditingFinished(); + void setLabelText(); + private: void init(); void initView(); void initData(); - +protected: + void changeEvent(QEvent *) override; private: - JobTypeInfo m_jobTypeOld; //被修改的日程类型 - JobTypeInfo m_jobTypeNew; //修改后的日程类型 + DScheduleType m_jobTypeOld; //被修改的日程类型 + DScheduleType m_jobTypeNew; //修改后的日程类型 QString m_title = ""; //弹窗名 DLineEdit *m_lineEdit = nullptr; //编辑器 QLabel *m_titleLabel = nullptr; //弹窗名控件 ColorSeletorWidget *m_colorSeletor = nullptr; //颜色选择器 DialogType m_dialogType; QString m_typeText; //输入框上一次输入后的文本 + + QLabel * m_eName = Q_NULLPTR; + QLabel * m_cName = Q_NULLPTR; + + + QString m_strLabelName; + QString m_strLabelColor; }; #endif // SCHEDULETYPEEDITDLG_H diff -Nru dde-calendar-5.9.1/calendar-client/src/dialog/settingdialog.cpp dde-calendar-5.10.0/calendar-client/src/dialog/settingdialog.cpp --- dde-calendar-5.9.1/calendar-client/src/dialog/settingdialog.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/dialog/settingdialog.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,727 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "settingdialog.h" +#include "cdynamicicon.h" +#include "accountmanager.h" +#include "settingWidget/userloginwidget.h" +#include "accountmanager.h" +#include "calendarmanage.h" +#include "units.h" + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include + +using namespace SettingWidget; +//静态的翻译不会真的翻译,但是会更新ts文件 +//像static QString a = QObject::tr("hello"), a实际等于hello,但是ts会有hello这个词条 +//调用DSetingDialog时会用到上述场景 +static CalendarSettingSetting setting_account = { + "setting_account", + QObject::tr("Account settings"), + { + { + "account", + QObject::tr("Account"), + {{ + "login", //key + "", //name + "login", //type + "" //default + } + } + }, + { + "account_sync_items", + QObject::tr("Select items to be synced"), + {{ + "Account_Calendar", //key + QObject::tr("Events"), //name + "SyncTagRadioButton", //type + "" //default + }, + + { + "Account_Setting", //key + QObject::tr("General settings"), //name + "SyncTagRadioButton", //type + "" //default + } + } + }, + { + "sync_interval", + "", + { { + "Sync_interval", //key + QObject::tr("Sync interval"), //name + "SyncTimeCombobox", //type + "" + } + } + }, + { + "manual_sync", + "", + {{ + "manual_sync", //key + "", //name + "ManualSyncButton", //type + "" //default + } + } + }, + } +}; + +static CalendarSettingSetting setting_base = { + "setting_base", + QObject::tr("Manage calendar"), + { + { + "acccount_items", + "", + { + { + "AccountCombobox", //key + QObject::tr("Calendar account"), //name + "AccountCombobox", //type + "" + } + } + }, + { + "event_types", + QObject::tr("Event types"), + { + { + "JobTypeListView", //key + "", //name + "JobTypeListView", //type + "" //default + } + } + } + } +}; + +static CalendarSettingSetting setting_base_noaccount = { + "setting_base", + QObject::tr("Manage calendar"), + { + { + "event_types", + QObject::tr("Event types"), + { + { + "JobTypeListView", //key + "", //name + "JobTypeListView", //type + "" //default + } + } + } + } +}; + +static CalendarSettingSetting setting_general = { + "setting_general", + QObject::tr("General settings"), + { + { + "general", + QObject::tr("General"), + { + { + "firstday", //key + QObject::tr("First day of week"), //name + "FirstDayofWeek", //type + "", //default + "Sunday" //text + }, + + { + "time", //key + QObject::tr("Time"), //name + "Time", //type + "" //default + } + } + } + } +}; +CSettingDialog::CSettingDialog(QWidget *parent) : DSettingsDialog(parent) +{ + initWidget(); + initConnect(); + initData(); + initWidgetDisplayStatus(); + initView(); +} + +void CSettingDialog::initView() +{ + setIcon(CDynamicIcon::getInstance()->getPixmap()); + setFixedSize(682, 506); + widgetFactory()->registerWidget("login", UserloginWidget::createloginButton); + widgetFactory()->registerWidget("FirstDayofWeek", std::bind(&CSettingDialog::createFirstDayofWeekWidget, this, std::placeholders::_1)); + widgetFactory()->registerWidget("Time", std::bind(&CSettingDialog::createTimeTypeWidget, this, std::placeholders::_1)); + widgetFactory()->registerWidget("AccountCombobox", std::bind(&CSettingDialog::createAccountCombobox, this, std::placeholders::_1)); + widgetFactory()->registerWidget("JobTypeListView", std::bind(&CSettingDialog::createJobTypeListView, this, std::placeholders::_1)); + widgetFactory()->registerWidget("SyncTagRadioButton", std::bind(&CSettingDialog::createSyncTagRadioButton, this, std::placeholders::_1)); + widgetFactory()->registerWidget("SyncTimeCombobox", std::bind(&CSettingDialog::createSyncFreqCombobox, this, std::placeholders::_1)); + widgetFactory()->registerWidget("ManualSyncButton", std::bind(&CSettingDialog::createManualSyncButton, this, std::placeholders::_1)); + QString strJson; + + CalendarSettingSettings calendarSettings; + if (gAccountManager->getIsSupportUid()) { + calendarSettings.append(setting_account); + calendarSettings.append(setting_base); + } else { + calendarSettings.append(setting_base_noaccount); + } + + calendarSettings.append(setting_general); + + QJsonObject obj; + obj.insert("groups", calendarSettings.toJson()); + strJson = QJsonDocument(obj).toJson(QJsonDocument::Compact); + + auto settings = Dtk::Core::DSettings::fromJson(strJson.toLatin1()); + setObjectName("SettingDialog"); + updateSettings(settings); + //恢复默认设置按钮不显示 + setResetVisible(false); + //QList + QList lstwidget = findChildren(); + if (lstwidget.size() > 0) { //accessibleName + for (QWidget *wid : lstwidget) { + if ("ContentWidgetForsetting_base.event_types" == wid->accessibleName() + || ("ContentSubTitleText" == wid->objectName() && "setting_base.event_types" == wid->property("key").toString())) { + QSpacerItem *spaceitem = new QSpacerItem(1, 1, QSizePolicy::Policy::Expanding); + wid->layout()->addItem(spaceitem); + DIconButton *addButton = this->createTypeAddButton(); + wid->layout()->addWidget(addButton); + //使addButton的右边距等于view的右边距 + int leftMargin = wid->layout()->contentsMargins().left(); + wid->layout()->setContentsMargins(leftMargin, 0, leftMargin, 0); + } + if (wid->accessibleName().contains("DefaultWidgetAtContentRow")) { + //DefaultWidgetAtContentRow是设置对话框右边每一个option条目对应widget的accessibleName的前缀,所以如果后续有更多条目,需要做修改 + wid->layout()->setMargin(0); + } + } + } + + //未登录uos帐号时,移除部分选项 + if (!gUosAccountItem) { + setGroupVisible("setting_account.account_sync_items", false); + setGroupVisible("setting_account.sync_interval", false); + setGroupVisible("setting_account.manual_sync", false); + } + + //移除立刻同步按钮的背景色 + QWidget *ManualSyncWidget = this->findChild("ManualSyncWidget"); + ManualSyncWidget = ManualSyncWidget == nullptr ? nullptr : ManualSyncWidget->parentWidget(); + ManualSyncWidget = ManualSyncWidget == nullptr ? nullptr : ManualSyncWidget->parentWidget(); + DBackgroundGroup *bk = ManualSyncWidget == nullptr ? nullptr : qobject_cast(ManualSyncWidget); + if (bk) { + bk->setBackgroundRole(QPalette::Base); + } + //首次显示JobTypeListView时,更新日程类型 + m_scheduleTypeWidget->updateCalendarAccount(m_accountComboBox->currentData().toString()); + + + //账户登出登入时,隐藏显示相关界面 + connect(gAccountManager, &AccountManager::signalAccountUpdate, this, [ = ]() { + if (!this->groupIsVisible("setting_account")) + return; + setGroupVisible("setting_account.account_sync_items", gUosAccountItem != nullptr); + setGroupVisible("setting_account.sync_interval", gUosAccountItem != nullptr); + setGroupVisible("setting_account.manual_sync", gUosAccountItem != nullptr); + }); + + //同步项 + m_radiobuttonAccountCalendar = qobject_cast(this->findChild("Account_Calendar")); + m_radiobuttonAccountSetting = qobject_cast(this->findChild("Account_Setting")); + + // Q_ASSERT(m_radiobuttonAccountSetting); + + connect(gAccountManager, &AccountManager::signalAccountStateChange, this, &CSettingDialog::slotSyncTagButtonUpdate); + connect(gAccountManager, &AccountManager::signalAccountUpdate, this, &CSettingDialog::slotSyncTagButtonUpdate); + if (m_radiobuttonAccountCalendar) + connect(m_radiobuttonAccountCalendar, &SyncTagRadioButton::clicked, this, &CSettingDialog::slotSyncAccountStateUpdate); + if (m_radiobuttonAccountSetting) + connect(m_radiobuttonAccountSetting, &SyncTagRadioButton::clicked, this, &CSettingDialog::slotSyncAccountStateUpdate); + + slotSyncTagButtonUpdate(); +} + +void CSettingDialog::initWidget() +{ + initFirstDayofWeekWidget(); + initTimeTypeWidget(); + initAccountComboBoxWidget(); + initScheduleTypeWidget(); + initTypeAddWidget(); + initSyncFreqWidget(); + initManualSyncButton(); +} + +void CSettingDialog::initConnect() +{ + connect(gAccountManager, &AccountManager::signalGeneralSettingsUpdate, this, &CSettingDialog::slotGeneralSettingsUpdate); + connect(gAccountManager, &AccountManager::signalAccountUpdate, this, &CSettingDialog::slotAccountUpdate); + connect(gAccountManager, &AccountManager::signalLogout, this, &CSettingDialog::slotLogout); + connect(gAccountManager, &AccountManager::signalAccountStateChange, this, &CSettingDialog::slotAccountStateChange); + connect(m_firstDayofWeekCombobox, QOverload::of(&QComboBox::currentIndexChanged), this, &CSettingDialog::slotFirstDayofWeekCurrentChanged); + connect(m_timeTypeCombobox, QOverload::of(&QComboBox::currentIndexChanged), this, &CSettingDialog::slotTimeTypeCurrentChanged); + connect(m_accountComboBox, QOverload::of(&QComboBox::currentIndexChanged), this, &CSettingDialog::slotAccountCurrentChanged); + connect(m_typeAddBtn, &DIconButton::clicked, this, &CSettingDialog::slotTypeAddBtnClickded); + //当日常类型超过上限时,更新button的状态 + connect(m_scheduleTypeWidget, &JobTypeListView::signalAddStatusChanged, m_typeAddBtn, &DIconButton::setEnabled); + //TODO:更新union帐户的的同步频率 + connect(m_syncFreqComboBox, QOverload::of(&QComboBox::currentIndexChanged), this, &CSettingDialog::slotSetUosSyncFreq); + connect(m_syncBtn, &QPushButton::clicked, this, &CSettingDialog::slotUosManualSync); + connect(m_ptrNetworkState, &DOANetWorkDBus::sign_NetWorkChange, this, &CSettingDialog::slotNetworkStateChange); +} + +void CSettingDialog::slotNetworkStateChange(DOANetWorkDBus::NetWorkState state) +{ + if (DOANetWorkDBus::NetWorkState::Active == state) { + if (!gUosAccountItem.isNull() && (gUosAccountItem->isCanSyncSetting() || gUosAccountItem->isCanSyncShedule())) { + m_syncBtn->setEnabled(true); + } + } else if (DOANetWorkDBus::NetWorkState::Disconnect == state) { + m_syncBtn->setEnabled(false); + } +} + +void CSettingDialog::initData() +{ + //通用设置数据初始化 + slotGeneralSettingsUpdate(); + //初始化账户信息 + slotAccountUpdate(); + //日程类型添加按钮初始化 + m_typeAddBtn->setEnabled(m_scheduleTypeWidget->canAdd()); + //同步频率数据初始化 + { + int index = 0; + if (gUosAccountItem) { + index = m_syncFreqComboBox->findData(gUosAccountItem->getAccount()->syncFreq()); + } + m_syncFreqComboBox->setCurrentIndex(index); + } + slotAccountStateChange(); +} + +void CSettingDialog::initWidgetDisplayStatus() +{ + +} + +void CSettingDialog::initFirstDayofWeekWidget() +{ + m_firstDayofWeekWidget = new QWidget(); + + m_firstDayofWeekCombobox = new QComboBox(m_firstDayofWeekWidget); + m_firstDayofWeekCombobox->setFixedSize(150, 36); + m_firstDayofWeekCombobox->addItem(tr("Sunday")); + m_firstDayofWeekCombobox->addItem(tr("Monday")); + + QHBoxLayout *layout = new QHBoxLayout(m_firstDayofWeekWidget); + layout->setContentsMargins(0, 0, 0, 0); + layout->setSpacing(0); + layout->addStretch(10); + layout->addWidget(m_firstDayofWeekCombobox, 1); + + m_firstDayofWeekWidget->setLayout(layout); +} + +void CSettingDialog::initTimeTypeWidget() +{ + m_timeTypeWidget = new QWidget(); + + m_timeTypeCombobox = new QComboBox(m_timeTypeWidget); + m_timeTypeCombobox->setFixedSize(150, 36); + m_timeTypeCombobox->addItem(tr("24-hour clock")); + m_timeTypeCombobox->addItem(tr("12-hour clock")); + + QHBoxLayout *layout = new QHBoxLayout(m_timeTypeWidget); + layout->setContentsMargins(0, 0, 0, 0); + layout->setSpacing(0); + layout->addStretch(10); + layout->addWidget(m_timeTypeCombobox, 1); + + m_timeTypeWidget->setLayout(layout); +} + +void CSettingDialog::initAccountComboBoxWidget() +{ + m_accountComboBox = new QComboBox(); + m_accountComboBox->setFixedSize(150, 36); +} + +void CSettingDialog::initTypeAddWidget() +{ + m_typeAddBtn = new DIconButton(DStyle::SP_IncreaseElement, nullptr); + m_typeAddBtn->setFixedSize(20, 20); +} + +void CSettingDialog::initScheduleTypeWidget() +{ + m_scheduleTypeWidget = new JobTypeListView; + m_scheduleTypeWidget->setObjectName("JobTypeListView"); +} + +void CSettingDialog::initSyncFreqWidget() +{ + m_syncFreqComboBox = new QComboBox; + m_syncFreqComboBox->setMaximumWidth(150); + m_syncFreqComboBox->addItem(tr("Manual"), DAccount::SyncFreq_Maunal); + m_syncFreqComboBox->addItem(tr("15 mins"), DAccount::SyncFreq_15Mins); + m_syncFreqComboBox->addItem(tr("30 mins"), DAccount::SyncFreq_30Mins); + m_syncFreqComboBox->addItem(tr("1 hour"), DAccount::SyncFreq_1hour); + m_syncFreqComboBox->addItem(tr("24 hours"), DAccount::SyncFreq_24hour); + m_syncFreqComboBox->setCurrentIndex(1); // 默认15分钟 +} + +void CSettingDialog::initManualSyncButton() +{ + m_manualSyncWidget = new QWidget; + m_ptrNetworkState = new DOANetWorkDBus(this); + m_manualSyncWidget->setObjectName("ManualSyncWidget"); + m_syncBtn = new QPushButton(m_manualSyncWidget); + m_syncBtn->setFixedSize(266, 36); + m_syncBtn->setText(tr("Sync Now")); + + m_syncTimeLabel = new QLabel; + + QVBoxLayout *layout = new QVBoxLayout; + layout->addWidget(m_syncBtn, 0, Qt::AlignCenter); + layout->addWidget(m_syncTimeLabel, 0, Qt::AlignCenter); + m_manualSyncWidget->setLayout(layout); + +} + +void CSettingDialog::slotGeneralSettingsUpdate() +{ + DCalendarGeneralSettings::Ptr setting = gAccountManager->getGeneralSettings(); + if (!setting) { + return; + } + setFirstDayofWeek(setting->firstDayOfWeek()); + setTimeType(setting->timeShowType()); +} + +void CSettingDialog::slotAccountUpdate() +{ + accountUpdate(); + //判断账户是否为登录状态,并建立连接 + if (gUosAccountItem) { + slotLastSyncTimeUpdate(gUosAccountItem->getDtLastUpdate()); + connect(gUosAccountItem.get(), &AccountItem::signalDtLastUpdate, this, &CSettingDialog::slotLastSyncTimeUpdate); + } +} + +void CSettingDialog::slotLogout(DAccount::Type type) +{ + if (DAccount::Account_UnionID == type) { + + } +} + +void CSettingDialog::slotFirstDayofWeekCurrentChanged(int index) +{ + DCalendarGeneralSettings::Ptr setting = gAccountManager->getGeneralSettings(); + if (index == setting->firstDayOfWeek() % 7) { + return; + } + //此次只设置一周首日,不刷新界面 + if (index == 0) { + gAccountManager->setFirstDayofWeek(7); + gCalendarManager->setFirstDayOfWeek(7, false); + } else if (index == 1) { + gAccountManager->setFirstDayofWeek(1); + gCalendarManager->setFirstDayOfWeek(1, false); + } +} + +void CSettingDialog::slotTimeTypeCurrentChanged(int index) +{ + DCalendarGeneralSettings::Ptr setting = gAccountManager->getGeneralSettings(); + if (index == setting->timeShowType()) { + return; + } + gAccountManager->setTimeFormatType(index); + //设置时间显示格式不刷新界面 + gCalendarManager->setTimeShowType(index, false); +} + +void CSettingDialog::slotAccountCurrentChanged(int index) +{ + if (m_scheduleTypeWidget) { + m_scheduleTypeWidget->updateCalendarAccount(m_accountComboBox->itemData(index).toString()); + setTypeEnable(index); + } +} + +void CSettingDialog::slotTypeAddBtnClickded() +{ + if (m_scheduleTypeWidget) { + m_scheduleTypeWidget->slotAddScheduleType(); + } +} + +void CSettingDialog::slotSetUosSyncFreq(int freq) +{ + QComboBox *com = qobject_cast(sender()); + if (!com) + return; + if (!gUosAccountItem) + return; + gUosAccountItem->setSyncFreq(DAccount::SyncFreqType(com->itemData(freq).toInt())); +} + +void CSettingDialog::slotUosManualSync() +{ + if (!gUosAccountItem) + return; + gAccountManager->downloadByAccountID(gUosAccountItem->getAccount()->accountID()); +} + +void CSettingDialog::slotSyncTagButtonUpdate() +{ + if (!gUosAccountItem) + return; + + auto state = gUosAccountItem->getAccount()->accountState(); + m_radiobuttonAccountCalendar->setChecked(state & DAccount::Account_Calendar); + m_radiobuttonAccountSetting->setChecked(state & DAccount::Account_Setting); + + m_radiobuttonAccountCalendar->setEnabled(gUosAccountItem->isEnableForUosAccount()); + m_radiobuttonAccountSetting->setEnabled(gUosAccountItem->isEnableForUosAccount()); +} + +void CSettingDialog::slotSyncAccountStateUpdate(bool status) +{ + if (!gUosAccountItem) + return; + + auto state = gUosAccountItem->getAccountState(); + + if (m_radiobuttonAccountSetting->isChecked()) + state = state | DAccount::Account_Setting; + else + state = state & ~DAccount::Account_Setting; + + if (m_radiobuttonAccountCalendar->isChecked()) + state = state | DAccount::Account_Calendar; + else + state = state & ~DAccount::Account_Calendar; + + gUosAccountItem->setAccountState(state); + if (status) { + slotUosManualSync(); + } +} + +void CSettingDialog::slotLastSyncTimeUpdate(const QString &datetime) +{ + QString dtstr; + if (gCalendarManager->getTimeShowType()) { + dtstr = dtFromString(datetime).toString("yyyy/MM/dd ap hh:mm"); + } else { + dtstr = dtFromString(datetime).toString("yyyy/MM/dd hh:mm"); + } + + if (m_syncTimeLabel && gUosAccountItem && !dtstr.isEmpty()) { + m_syncTimeLabel->setText(tr("Last sync") + ":" + dtstr); + } +} + +void CSettingDialog::slotAccountStateChange() +{ + if (!gUosAccountItem) { + return; + } + if (m_syncBtn) { + if (gUosAccountItem->isCanSyncSetting() || gUosAccountItem->isCanSyncShedule()) { + m_syncBtn->setEnabled(true); + } else { + m_syncBtn->setEnabled(false); + } + } + + if (m_syncFreqComboBox) { + if (gUosAccountItem->isCanSyncSetting() || gUosAccountItem->isCanSyncShedule()) { + m_syncFreqComboBox->setEnabled(true); + } else { + m_syncFreqComboBox->setEnabled(false); + } + } + if (m_accountComboBox && m_typeAddBtn) { + setTypeEnable(m_accountComboBox->currentIndex()); + } +} + +void CSettingDialog::setFirstDayofWeek(int value) +{ + if (!m_firstDayofWeekCombobox) { + return; + } + //设置一周首日并刷新界面 + if (value == 1) { + m_firstDayofWeekCombobox->setCurrentIndex(1); + gCalendarManager->setFirstDayOfWeek(1, true); + } else { + m_firstDayofWeekCombobox->setCurrentIndex(0); + gCalendarManager->setFirstDayOfWeek(7, true); + } +} + + +void CSettingDialog::setTimeType(int value) +{ + if (!m_timeTypeCombobox) { + return; + } + if (value > 1 || value < 0) { + value = 0; + } + //设置时间显示格式并刷新界面 + m_timeTypeCombobox->setCurrentIndex(value); + gCalendarManager->setTimeShowType(value, true); +} + +void CSettingDialog::accountUpdate() +{ + if (nullptr == m_accountComboBox) { + return; + } + QVariant oldAccountID = m_accountComboBox->currentData(); + m_accountComboBox->blockSignals(true); + m_accountComboBox->clear(); + for (auto account : gAccountManager->getAccountList()) { + m_accountComboBox->addItem(account->getAccount()->accountName(), account->getAccount()->accountID()); + } + m_accountComboBox->setCurrentIndex(m_accountComboBox->findData(oldAccountID)); + if (m_accountComboBox->currentIndex() < 0) + m_accountComboBox->setCurrentIndex(0); + m_accountComboBox->blockSignals(false); + + m_syncFreqComboBox->setCurrentIndex(1); //每次登录的时候 默认15分钟 + slotAccountCurrentChanged(m_accountComboBox->currentIndex()); +} + +void CSettingDialog::setTypeEnable(int index) +{ + if (!gUosAccountItem) return; + + QString accountId = m_accountComboBox->itemData(index).toString(); + + AccountItem::Ptr account = gAccountManager->getAccountItemByAccountId(accountId); + + if (account->getAccount()->accountType() == DAccount::Account_Local || gUosAccountItem->isCanSyncShedule()) { + if (account->getScheduleTypeList().count() < 20) { + m_typeAddBtn->setEnabled(true); + m_scheduleTypeWidget->setItemEnabled(true); + } + } else { + m_typeAddBtn->setEnabled(false); + m_scheduleTypeWidget->setItemEnabled(false); + } +} + +QPair CSettingDialog::createFirstDayofWeekWidget(QObject *obj) +{ + auto option = qobject_cast(obj); + + QPair optionWidget = DSettingsWidgetFactory::createStandardItem(QByteArray(), option, m_firstDayofWeekWidget); + // 获取初始值 + option->setValue(option->defaultValue()); + return optionWidget; +} + +QPair CSettingDialog::createTimeTypeWidget(QObject *obj) +{ + auto option = qobject_cast(obj); + QPair optionWidget = DSettingsWidgetFactory::createStandardItem(QByteArray(), option, m_timeTypeWidget); + // 获取初始值 + option->setValue(option->defaultValue()); + return optionWidget; +} + +QPair CSettingDialog::createAccountCombobox(QObject *obj) +{ + auto option = qobject_cast(obj); + QPair optionWidget = DSettingsWidgetFactory::createStandardItem(QByteArray(), option, m_accountComboBox); + return optionWidget; +} + +QPair CSettingDialog::createSyncFreqCombobox(QObject *obj) +{ + auto option = qobject_cast(obj); + QPair optionWidget = DSettingsWidgetFactory::createStandardItem(QByteArray(), option, m_syncFreqComboBox); + return optionWidget; +} + +QPair CSettingDialog::createSyncTagRadioButton(QObject *obj) +{ + auto option = qobject_cast(obj); + DAccount::AccountState type = DAccount::Account_Calendar; + if (option->key().endsWith("Account_Calendar")) + type = DAccount::Account_Calendar; + if (option->key().endsWith("Account_Setting")) + type = DAccount::Account_Setting; + + SyncTagRadioButton *widget = new SyncTagRadioButton; + widget->setObjectName(option->key().section('.', -1));//设置objectname为Account_Calendar 或 Account_Setting + widget->setFixedWidth(16); + QPair optionWidget = DSettingsWidgetFactory::createStandardItem(QByteArray(), option, widget); + + //iconLabel + QLabel *iconLabel = new QLabel; + iconLabel->setFixedSize(24, 24); + if (DAccount::Account_Calendar == type) + iconLabel->setPixmap(DHiDPIHelper::loadNxPixmap(":/icons/deepin/builtin/icons/dde_calendar_sync_schedule_32px.svg")); + if (DAccount::Account_Setting == type) + iconLabel->setPixmap(DHiDPIHelper::loadNxPixmap(":/icons/deepin/builtin/icons/dde_calendar_sync_setting_32px.svg")); + + //iconWidget + QHBoxLayout *layout = new QHBoxLayout; + layout->addWidget(iconLabel); + layout->addWidget(optionWidget.first); + layout->setContentsMargins(0, 1, 0, 1); + QWidget *iconWidget = new QWidget; + iconWidget->setLayout(layout); + optionWidget.first = iconWidget; + + return optionWidget; +} + +QWidget *CSettingDialog::createManualSyncButton(QObject *obj) +{ + return m_manualSyncWidget; +} + +QWidget *CSettingDialog::createJobTypeListView(QObject *) +{ + return m_scheduleTypeWidget; +} + +DIconButton *CSettingDialog::createTypeAddButton() +{ + return m_typeAddBtn; +} diff -Nru dde-calendar-5.9.1/calendar-client/src/dialog/settingdialog.h dde-calendar-5.10.0/calendar-client/src/dialog/settingdialog.h --- dde-calendar-5.9.1/calendar-client/src/dialog/settingdialog.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/dialog/settingdialog.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,100 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef SETTINGDIALOG_H +#define SETTINGDIALOG_H + +#include "settingWidget/settingwidgets.h" +#include "doanetworkdbus.h" +#include +#include + +DWIDGET_USE_NAMESPACE + +class CSettingDialog : public DSettingsDialog +{ + Q_OBJECT +public: + explicit CSettingDialog(QWidget *parent = nullptr); + +private: + QPair createFirstDayofWeekWidget(QObject *obj); + QPair createTimeTypeWidget(QObject *obj); + QPair createAccountCombobox(QObject *obj); + QPair createSyncFreqCombobox(QObject *obj); + QPair createSyncTagRadioButton(QObject *obj); + QWidget *createManualSyncButton(QObject *obj); + QWidget *createJobTypeListView(QObject *obj); + DIconButton *createTypeAddButton(); + +public slots: + void slotGeneralSettingsUpdate(); + void slotAccountUpdate(); + void slotLogout(DAccount::Type); + void slotLastSyncTimeUpdate(const QString &datetime); + //帐户状态发送改变 + void slotAccountStateChange(); + + void slotFirstDayofWeekCurrentChanged(int index); + void slotTimeTypeCurrentChanged(int index); + void slotAccountCurrentChanged(int index); + void slotTypeAddBtnClickded(); + void slotSetUosSyncFreq(int freq); + void slotUosManualSync(); + void slotNetworkStateChange(DOANetWorkDBus::NetWorkState state); + //更新同步项按钮状态 + void slotSyncTagButtonUpdate(); + //点击同步项时,更新uos账户状态 + void slotSyncAccountStateUpdate(bool); + +private: + void initFirstDayofWeekWidget(); + void initTimeTypeWidget(); + void initAccountComboBoxWidget(); + void initTypeAddWidget(); + void initScheduleTypeWidget(); + void initSyncFreqWidget(); + void initManualSyncButton(); + + void setFirstDayofWeek(int value); + void setTimeType(int value); + void accountUpdate(); + + void setTypeEnable(int index); +private: + void initWidget(); + void initConnect(); + void initData(); + + void initWidgetDisplayStatus(); + void initView(); + +private: + //一周首日 + QWidget *m_firstDayofWeekWidget = nullptr; + QComboBox *m_firstDayofWeekCombobox = nullptr; + + //时间格式 + QWidget *m_timeTypeWidget = nullptr; + QComboBox *m_timeTypeCombobox = nullptr; + + //帐户选择 + QComboBox *m_accountComboBox = nullptr; + //同步频率 + QComboBox *m_syncFreqComboBox = nullptr; + + DIconButton *m_typeAddBtn = nullptr; + + JobTypeListView *m_scheduleTypeWidget = nullptr; + + //手动同步按钮和同步时间显示 + QLabel *m_syncTimeLabel = nullptr; + QPushButton *m_syncBtn = nullptr; + QWidget *m_manualSyncWidget = nullptr; + DOANetWorkDBus *m_ptrNetworkState; + SettingWidget::SyncTagRadioButton *m_radiobuttonAccountCalendar = nullptr; + SettingWidget::SyncTagRadioButton *m_radiobuttonAccountSetting = nullptr; +}; + +#endif // SETTINGDIALOG_H diff -Nru dde-calendar-5.9.1/calendar-client/src/dialog/timejumpdialog.cpp dde-calendar-5.10.0/calendar-client/src/dialog/timejumpdialog.cpp --- dde-calendar-5.9.1/calendar-client/src/dialog/timejumpdialog.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/dialog/timejumpdialog.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,228 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "timejumpdialog.h" +#include "cschedulebasewidget.h" +#include +#include + +TimeJumpDialog::TimeJumpDialog(ArrowDirection direction, QWidget *parent) : DArrowRectangle(direction, DArrowRectangle::FloatWindow, parent) +{ + setWindowFlags(Qt::Popup); + initView(); + initConnect(); +} + +void TimeJumpDialog::initView() +{ + setRadius(16); //设置圆角大小 + setArrowWidth(60); //设置箭头宽度 + setArrowHeight(30); //设置箭头高度 + setRadiusArrowStyleEnable(true); //设置箭头圆角样式 + setBackgroundColor(DBlurEffectWidget::AutoColor); //设置背景样式 + setMargin(10); //设置边距 + + m_yearEdit = new CTimeLineEdit(EditYear, this); + m_monthEdit = new CTimeLineEdit(EditMonth, this); + m_dayEdit = new CTimeLineEdit(EditDay, this); + m_jumpButton = new DSuggestButton(tr("Go", "button"), this); + + m_yearEdit->setFixedSize(98, 36); + m_monthEdit->setFixedSize(88, 36); + m_dayEdit->setFixedSize(88, 36); + m_jumpButton->setFixedSize(82, 36); + + QHBoxLayout *hLayout = new QHBoxLayout(this); + hLayout->setMargin(0); + hLayout->setSpacing(10); + + hLayout->addWidget(m_yearEdit); + hLayout->addWidget(m_monthEdit); + hLayout->addWidget(m_dayEdit); + hLayout->addWidget(m_jumpButton); + + QWidget *wgt = new QWidget(); + wgt->setLayout(hLayout); + setContent(wgt); + +} + +void TimeJumpDialog::initConnect() +{ + connect(m_yearEdit, &CTimeLineEdit::signalNumChange, this, &TimeJumpDialog::slotEditNumChange); + connect(m_monthEdit, &CTimeLineEdit::signalNumChange, this, &TimeJumpDialog::slotEditNumChange); + connect(m_dayEdit, &CTimeLineEdit::signalNumChange, this, &TimeJumpDialog::slotEditNumChange); + connect(m_yearEdit, &CTimeLineEdit::signalDateJump, this, &TimeJumpDialog::slotDateJump); + connect(m_monthEdit, &CTimeLineEdit::signalDateJump, this, &TimeJumpDialog::slotDateJump); + connect(m_dayEdit, &CTimeLineEdit::signalDateJump, this, &TimeJumpDialog::slotDateJump); + connect(m_jumpButton, &QPushButton::clicked, this, &TimeJumpDialog::slotJumpButtonClicked); +} + +void TimeJumpDialog::initData() +{ + m_yearEdit->setRange(1900, 2100); + m_monthEdit->setRange(1, 12); + //设置天编辑器限制范围 + m_dayEdit->setRange(1, getMaxDayNum()); + m_yearEdit->setNum(m_date.year()); + m_monthEdit->setNum(m_date.month()); + m_dayEdit->setNum(m_date.day()); + resetEdietStepEnable(); +} + +/** + * @brief TimeJumpDialog::showPopup + * 显示函数 + * @param date 初始显示的日期 + * @param pos 显示位置 + */ +void TimeJumpDialog::showPopup(const QDate &date, const QPoint &pos) +{ + showPopup(date, pos.x(), pos.y()); +} + +/** + * @brief TimeJumpDialog::showPopup + * 显示函数 + * @param date 初始显示事件 + * @param x 显示位置x坐标 + * @param y 显示位置y坐标 + */ +void TimeJumpDialog::showPopup(const QDate &date, int x, int y) +{ + //保存时间 + m_date = date; + //初始化数据 + initData(); + //将焦点转移到年编辑器 + m_yearEdit->clearFocus(); + m_monthEdit->clearFocus(); + m_dayEdit->clearFocus(); + //m_yearEdit->selectAll(); + //显示 + show(x, y); +} + +/** + * @brief TimeJumpDialog::getMaxDayNum + * 获取当月最大天数 + */ +int TimeJumpDialog::getMaxDayNum() +{ + static int dayNum[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; + int maxDay = dayNum[m_date.month() - 1]; + if (m_date.month() == 2 && QDate::isLeapYear(m_date.year())) { + maxDay = 29; + } + return maxDay; +} + +/** + * @brief TimeJumpDialog::resetEdietStepEnable + * 重置编辑器状态 + */ +void TimeJumpDialog::resetEdietStepEnable() +{ + //将所有编辑器调整为可上下编辑状态 + m_yearEdit->setStepEnabled(CTimeLineEdit::StepUpEnabled | CTimeLineEdit::StepDownEnabled); + m_monthEdit->setStepEnabled(CTimeLineEdit::StepUpEnabled | CTimeLineEdit::StepDownEnabled); + m_dayEdit->setStepEnabled(CTimeLineEdit::StepUpEnabled | CTimeLineEdit::StepDownEnabled); + + //根据每一级当前值设置上下编辑状态 + if (m_yearEdit->value() == m_yearEdit->minimum()) { + m_yearEdit->setStepEnabled(CTimeLineEdit::StepUpEnabled); + if (m_monthEdit->value() == m_monthEdit->minimum()) { + m_monthEdit->setStepEnabled(CTimeLineEdit::StepUpEnabled); + if (m_dayEdit->value() == m_dayEdit->minimum()) { + m_dayEdit->setStepEnabled(CTimeLineEdit::StepUpEnabled); + } + } + } else if (m_yearEdit->value() == m_yearEdit->maximum()) { + m_yearEdit->setStepEnabled(CTimeLineEdit::StepDownEnabled); + if (m_monthEdit->value() == m_monthEdit->maximum()) { + m_monthEdit->setStepEnabled(CTimeLineEdit::StepDownEnabled); + if (m_dayEdit->value() == m_dayEdit->maximum()) { + m_dayEdit->setStepEnabled(CTimeLineEdit::StepDownEnabled); + } + } + } +} + +/** + * @brief TimeJumpDialog::slotEditNumChange + * 编辑器数字改变事件 + * @param id 编辑器id + * @param num 编辑器内容改变后的数字 + */ +void TimeJumpDialog::slotEditNumChange(int id, int num) +{ + switch (id) { + case EditYear: + //更改年 + { + //因直接设置一年的年月日可能会造成更改月或年后该日期不存在导致的日期错误, + //所以变化年或者月时先将日变为1,后续再根据实际情况更改日日期 + int day = m_date.day(); + m_date.setDate(num, m_date.month(), 1); + int maxDay = getMaxDayNum(); + day = day > maxDay ? maxDay : day; + m_date.setDate(m_date.year(), m_date.month(), day); + m_dayEdit->setRange(1, maxDay); + } + break; + case EditMonth: + //更改月 + { + int day = m_date.day(); + m_date.setDate(m_date.year(), num, 1); + int maxDay = getMaxDayNum(); + day = day > maxDay ? maxDay : day; + m_date.setDate(m_date.year(), m_date.month(), day); + m_dayEdit->setRange(1, maxDay); + } + break; + case EditDay: + //更改日 + m_date.setDate(m_date.year(), m_date.month(), num); + break; + } + resetEdietStepEnable(); +} + +/** + * @brief TimeJumpDialog::slotDateJump + * 编辑器事件跳转事件 + * @param id 编辑器id + * @param num 跳转量 + */ +void TimeJumpDialog::slotDateJump(int id, int num) +{ + switch (id) { + case EditYear: + m_date = m_date.addYears(num); + break; + case EditMonth: + m_date = m_date.addMonths(num); + break; + case EditDay: + m_date = m_date.addDays(num); + break; + } + //初始化数据 + initData(); +} + +/** + * @brief TimeJumpDialog::slotJumpButtonClicked + * 跳转按钮点击事件 + */ +void TimeJumpDialog::slotJumpButtonClicked() +{ + //将焦点转移到button控件上,使在跳转时间前正在编辑的edit控件触发finished事件 + m_jumpButton->setFocus(); + //设置全局时间 + CScheduleBaseWidget::setSelectDate(m_date); + //隐藏控件 + hide(); +} diff -Nru dde-calendar-5.9.1/calendar-client/src/dialog/timejumpdialog.h dde-calendar-5.10.0/calendar-client/src/dialog/timejumpdialog.h --- dde-calendar-5.9.1/calendar-client/src/dialog/timejumpdialog.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/dialog/timejumpdialog.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,62 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef TIMEJUMPDIALOG_H +#define TIMEJUMPDIALOG_H + +#include "ctimelineedit.h" +#include +#include +#include + +DWIDGET_USE_NAMESPACE + +//时间跳转弹窗 +class TimeJumpDialog : public DArrowRectangle +{ + Q_OBJECT +public: + + //时间编辑控件类型 + enum EditType{ + EditYear = 1, + EditMonth, + EditDay, + }; + + explicit TimeJumpDialog(ArrowDirection direction, QWidget *parent = nullptr); + + //显示控件 + void showPopup(const QDate& date, const QPoint& pos); + void showPopup(const QDate& date, int x, int y); + +signals: + +public slots: + //时间编辑器数字改变事件 + void slotEditNumChange(int id, int num); + //时间编辑器时间跳转时间 + void slotDateJump(int id, int num); + //跳转控件点击事件 + void slotJumpButtonClicked(); + +private: + void initView(); + void initConnect(); + void initData(); + //获取当月最大天数 + int getMaxDayNum(); + //重置编辑器状态 + void resetEdietStepEnable(); + +private: + QDate m_date; + + CTimeLineEdit *m_yearEdit = nullptr; //年编辑器 + CTimeLineEdit *m_monthEdit = nullptr; //月编辑器 + CTimeLineEdit *m_dayEdit = nullptr; //天编辑器 + DSuggestButton *m_jumpButton = nullptr; //跳转控件 +}; + +#endif // TIMEJUMPDIALOG_H diff -Nru dde-calendar-5.9.1/calendar-client/src/KeyPress/calldaykeyleftdeal.cpp dde-calendar-5.10.0/calendar-client/src/KeyPress/calldaykeyleftdeal.cpp --- dde-calendar-5.9.1/calendar-client/src/KeyPress/calldaykeyleftdeal.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/KeyPress/calldaykeyleftdeal.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "calldaykeyleftdeal.h" #include "graphicsItem/cweekdaybackgrounditem.h" diff -Nru dde-calendar-5.9.1/calendar-client/src/KeyPress/calldaykeyleftdeal.h dde-calendar-5.10.0/calendar-client/src/KeyPress/calldaykeyleftdeal.h --- dde-calendar-5.9.1/calendar-client/src/KeyPress/calldaykeyleftdeal.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/KeyPress/calldaykeyleftdeal.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef CALLDAYKEYLEFTDEAL_H #define CALLDAYKEYLEFTDEAL_H diff -Nru dde-calendar-5.9.1/calendar-client/src/KeyPress/calldaykeyrightdeal.cpp dde-calendar-5.10.0/calendar-client/src/KeyPress/calldaykeyrightdeal.cpp --- dde-calendar-5.9.1/calendar-client/src/KeyPress/calldaykeyrightdeal.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/KeyPress/calldaykeyrightdeal.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "calldaykeyrightdeal.h" #include "graphicsItem/cweekdaybackgrounditem.h" diff -Nru dde-calendar-5.9.1/calendar-client/src/KeyPress/calldaykeyrightdeal.h dde-calendar-5.10.0/calendar-client/src/KeyPress/calldaykeyrightdeal.h --- dde-calendar-5.9.1/calendar-client/src/KeyPress/calldaykeyrightdeal.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/KeyPress/calldaykeyrightdeal.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef CALLDAYKEYRIGHTDEAL_H #define CALLDAYKEYRIGHTDEAL_H diff -Nru dde-calendar-5.9.1/calendar-client/src/KeyPress/ckeydowndeal.cpp dde-calendar-5.10.0/calendar-client/src/KeyPress/ckeydowndeal.cpp --- dde-calendar-5.9.1/calendar-client/src/KeyPress/ckeydowndeal.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/KeyPress/ckeydowndeal.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "ckeydowndeal.h" #include "graphicsItem/cscenebackgrounditem.h" diff -Nru dde-calendar-5.9.1/calendar-client/src/KeyPress/ckeydowndeal.h dde-calendar-5.10.0/calendar-client/src/KeyPress/ckeydowndeal.h --- dde-calendar-5.9.1/calendar-client/src/KeyPress/ckeydowndeal.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/KeyPress/ckeydowndeal.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef CKEYDOWNDEAL_H #define CKEYDOWNDEAL_H diff -Nru dde-calendar-5.9.1/calendar-client/src/KeyPress/ckeyenabledeal.cpp dde-calendar-5.10.0/calendar-client/src/KeyPress/ckeyenabledeal.cpp --- dde-calendar-5.9.1/calendar-client/src/KeyPress/ckeyenabledeal.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/KeyPress/ckeyenabledeal.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "ckeyenabledeal.h" #include "cgraphicsscene.h" #include "scheduledlg.h" diff -Nru dde-calendar-5.9.1/calendar-client/src/KeyPress/ckeyenabledeal.h dde-calendar-5.10.0/calendar-client/src/KeyPress/ckeyenabledeal.h --- dde-calendar-5.9.1/calendar-client/src/KeyPress/ckeyenabledeal.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/KeyPress/ckeyenabledeal.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef CKEYENABLEDEAL_H #define CKEYENABLEDEAL_H diff -Nru dde-calendar-5.9.1/calendar-client/src/KeyPress/ckeyleftdeal.cpp dde-calendar-5.10.0/calendar-client/src/KeyPress/ckeyleftdeal.cpp --- dde-calendar-5.9.1/calendar-client/src/KeyPress/ckeyleftdeal.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/KeyPress/ckeyleftdeal.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "ckeyleftdeal.h" #include "graphicsItem/cscenebackgrounditem.h" diff -Nru dde-calendar-5.9.1/calendar-client/src/KeyPress/ckeyleftdeal.h dde-calendar-5.10.0/calendar-client/src/KeyPress/ckeyleftdeal.h --- dde-calendar-5.9.1/calendar-client/src/KeyPress/ckeyleftdeal.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/KeyPress/ckeyleftdeal.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef CKEYLEFTDEAL_H #define CKEYLEFTDEAL_H diff -Nru dde-calendar-5.9.1/calendar-client/src/KeyPress/ckeypressdealbase.cpp dde-calendar-5.10.0/calendar-client/src/KeyPress/ckeypressdealbase.cpp --- dde-calendar-5.9.1/calendar-client/src/KeyPress/ckeypressdealbase.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/KeyPress/ckeypressdealbase.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "ckeypressdealbase.h" #include "cgraphicsscene.h" diff -Nru dde-calendar-5.9.1/calendar-client/src/KeyPress/ckeypressdealbase.h dde-calendar-5.10.0/calendar-client/src/KeyPress/ckeypressdealbase.h --- dde-calendar-5.9.1/calendar-client/src/KeyPress/ckeypressdealbase.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/KeyPress/ckeypressdealbase.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef CKEYPRESSDEALBASE_H #define CKEYPRESSDEALBASE_H diff -Nru dde-calendar-5.9.1/calendar-client/src/KeyPress/ckeypressprxy.cpp dde-calendar-5.10.0/calendar-client/src/KeyPress/ckeypressprxy.cpp --- dde-calendar-5.9.1/calendar-client/src/KeyPress/ckeypressprxy.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/KeyPress/ckeypressprxy.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "ckeypressprxy.h" #include diff -Nru dde-calendar-5.9.1/calendar-client/src/KeyPress/ckeypressprxy.h dde-calendar-5.10.0/calendar-client/src/KeyPress/ckeypressprxy.h --- dde-calendar-5.9.1/calendar-client/src/KeyPress/ckeypressprxy.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/KeyPress/ckeypressprxy.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef CKEYPRESSPRXY_H #define CKEYPRESSPRXY_H diff -Nru dde-calendar-5.9.1/calendar-client/src/KeyPress/ckeyrightdeal.cpp dde-calendar-5.10.0/calendar-client/src/KeyPress/ckeyrightdeal.cpp --- dde-calendar-5.9.1/calendar-client/src/KeyPress/ckeyrightdeal.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/KeyPress/ckeyrightdeal.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "ckeyrightdeal.h" #include "graphicsItem/cscenebackgrounditem.h" diff -Nru dde-calendar-5.9.1/calendar-client/src/KeyPress/ckeyrightdeal.h dde-calendar-5.10.0/calendar-client/src/KeyPress/ckeyrightdeal.h --- dde-calendar-5.9.1/calendar-client/src/KeyPress/ckeyrightdeal.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/KeyPress/ckeyrightdeal.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef CKEYRIGHTDEAL_H #define CKEYRIGHTDEAL_H diff -Nru dde-calendar-5.9.1/calendar-client/src/KeyPress/ckeyupdeal.cpp dde-calendar-5.10.0/calendar-client/src/KeyPress/ckeyupdeal.cpp --- dde-calendar-5.9.1/calendar-client/src/KeyPress/ckeyupdeal.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/KeyPress/ckeyupdeal.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "ckeyupdeal.h" #include "graphicsItem/cscenebackgrounditem.h" diff -Nru dde-calendar-5.9.1/calendar-client/src/KeyPress/ckeyupdeal.h dde-calendar-5.10.0/calendar-client/src/KeyPress/ckeyupdeal.h --- dde-calendar-5.9.1/calendar-client/src/KeyPress/ckeyupdeal.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/KeyPress/ckeyupdeal.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef CKEYUPDEAL_H #define CKEYUPDEAL_H diff -Nru dde-calendar-5.9.1/calendar-client/src/KeyPress/cscenetabkeydeal.cpp dde-calendar-5.10.0/calendar-client/src/KeyPress/cscenetabkeydeal.cpp --- dde-calendar-5.9.1/calendar-client/src/KeyPress/cscenetabkeydeal.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/KeyPress/cscenetabkeydeal.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "cscenetabkeydeal.h" #include "graphicsItem/cscenebackgrounditem.h" diff -Nru dde-calendar-5.9.1/calendar-client/src/KeyPress/cscenetabkeydeal.h dde-calendar-5.10.0/calendar-client/src/KeyPress/cscenetabkeydeal.h --- dde-calendar-5.9.1/calendar-client/src/KeyPress/cscenetabkeydeal.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/KeyPress/cscenetabkeydeal.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef CSCENETABKEYDEAL_H #define CSCENETABKEYDEAL_H diff -Nru dde-calendar-5.9.1/calendar-client/src/KeyPress/cweekdayscenetabkeydeal.cpp dde-calendar-5.10.0/calendar-client/src/KeyPress/cweekdayscenetabkeydeal.cpp --- dde-calendar-5.9.1/calendar-client/src/KeyPress/cweekdayscenetabkeydeal.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/KeyPress/cweekdayscenetabkeydeal.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "cweekdayscenetabkeydeal.h" #include "graphicsItem/cweekdaybackgrounditem.h" diff -Nru dde-calendar-5.9.1/calendar-client/src/KeyPress/cweekdayscenetabkeydeal.h dde-calendar-5.10.0/calendar-client/src/KeyPress/cweekdayscenetabkeydeal.h --- dde-calendar-5.9.1/calendar-client/src/KeyPress/cweekdayscenetabkeydeal.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/KeyPress/cweekdayscenetabkeydeal.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef CWEEKDAYSCENETABKEYDEAL_H #define CWEEKDAYSCENETABKEYDEAL_H diff -Nru dde-calendar-5.9.1/calendar-client/src/main.cpp dde-calendar-5.10.0/calendar-client/src/main.cpp --- dde-calendar-5.9.1/calendar-client/src/main.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/main.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,29 +1,14 @@ -/* - * Copyright (C) 2017 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: kirigaya - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later #include "environments.h" #include "calendarmainwindow.h" #include "exportedinterface.h" #include "configsettings.h" #include "accessible/accessible.h" -#include "src/DebugTimeManager.h" #include "tabletconfig.h" +#include "schedulemanager.h" #include #include @@ -40,7 +25,6 @@ if (!QString(qgetenv("XDG_CURRENT_DESKTOP")).toLower().startsWith("deepin")) { setenv("XDG_CURRENT_DESKTOP", "Deepin", 1); } - PERF_PRINT_BEGIN("POINT-01", ""); QGuiApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); //适配deepin-turbo启动加速 DApplication *app = nullptr; @@ -58,6 +42,9 @@ #endif if (DGuiApplicationHelper::setSingleInstance(app->applicationName(), DGuiApplicationHelper::UserScope)) { + //准备数据 + gAccountManager->resetAccount(); + app->setOrganizationName("deepin"); app->setApplicationName("dde-calendar"); app->loadTranslator(); @@ -102,11 +89,7 @@ } ww.slotTheme(DGuiApplicationHelper::instance()->themeType()); ww.show(); - PERF_PRINT_END("POINT-01"); return app->exec(); } - - PERF_PRINT_END("POINT-01"); - return 0; } diff -Nru dde-calendar-5.9.1/calendar-client/src/scheduleTask/calendarmanage.cpp dde-calendar-5.10.0/calendar-client/src/scheduleTask/calendarmanage.cpp --- dde-calendar-5.9.1/calendar-client/src/scheduleTask/calendarmanage.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/scheduleTask/calendarmanage.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,293 +0,0 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ -#include "calendarmanage.h" -#include "cschedulebasewidget.h" -#include "scheduledatamanage.h" - -#include - -const QString DBus_TimeDate_Name = "com.deepin.daemon.Timedate"; -const QString DBus_TimeDate_Path = "/com/deepin/daemon/Timedate"; - -CalendarManager *CalendarManager::m_scheduleManager = nullptr; -CalendarManager *CalendarManager::getInstance() -{ - ScheduleDataInfo::registerMetaType(); - CaHuangLiDayInfo::registerMetaType(); - if (m_scheduleManager == nullptr) { - m_scheduleManager = new CalendarManager; - qRegisterMetaType > >("QMap >"); - qRegisterMetaType>("QMap"); - qRegisterMetaType >("QMap"); - qRegisterMetaType>("QMap"); - } - return m_scheduleManager; -} - -void CalendarManager::releaseInstance() -{ - if (m_scheduleManager != nullptr) { - delete m_scheduleManager; - m_scheduleManager = nullptr; - } -} - -/** - * @brief CalendarManager::addShowWidget 添加显示界面 - * @param showWidget - */ -void CalendarManager::addShowWidget(CScheduleBaseWidget *showWidget) -{ - m_showWidget.append(showWidget); -} - -/** - * @brief CalendarManager::removeShowWidget 移除显示界面 - * @param showWidget - */ -void CalendarManager::removeShowWidget(CScheduleBaseWidget *showWidget) -{ - m_showWidget.removeOne(showWidget); -} - -/** - * @brief CalendarManager::getShowWidget 根据编号获取显示界面 - * @param index - * @return - */ -CScheduleBaseWidget *CalendarManager::getShowWidget(const int index) -{ - if (index < 0 || index >= m_showWidget.size()) { - return nullptr; - } - return m_showWidget.at(index); -} - -/** - * @brief CalendarManager::getShowWidgetSize 获取显示窗口的数目 - * @return - */ -int CalendarManager::getShowWidgetSize() -{ - return m_showWidget.size(); -} - -/** - * @brief CalendarManager::getCalendarDateDataManage 获取日历时间数据管理 - * @return - */ -CalendarDateDataManager *CalendarManager::getCalendarDateDataManage() const -{ - return m_dateManage; -} - -/** - * @brief CalendarManager::getScheduleTask 获取日程任务 - * @return - */ -CScheduleTask *CalendarManager::getScheduleTask() const -{ - return m_scheduleTask; -} - -/** - * @brief CalendarManager::getShowLunar 获取农历信息 - * @return - */ -bool CalendarManager::getShowLunar() const -{ - return m_showLunar; -} - -CalendarManager::CalendarManager(QObject *parent) - : QObject(parent) - , m_dateManage(new CalendarDateDataManager) - , m_timeDateDbus(new DaemonTimeDate(DBus_TimeDate_Name, DBus_TimeDate_Path, QDBusConnection::sessionBus(), this)) - , m_scheduleTask(new CScheduleTask(this)) -{ - initData(); - initConnection(); - //更新日程类型和颜色 - updateJobTypeColor(); -} - -CalendarManager::~CalendarManager() -{ - delete m_dateManage; -} - -/** - * @brief CalendarManager::initData 初始化数据 - */ -void CalendarManager::initData() -{ - //获取本地语言判断是否为中文 - m_showLunar = QLocale::system().language() == QLocale::Chinese; - //获取每周第一天 - const int _weekFirstDay = m_timeDateDbus->weekBegins(); - //获取时间日期格式 - const int _timeFormat = m_timeDateDbus->shortTimeFormat(); - const int _dateFormat = m_timeDateDbus->shortDateFormat(); - //设置时间日期格式 - m_dateManage->setTimeFormatChanged(_timeFormat); - m_dateManage->setDateFormatChanged(_dateFormat); - setWeekBegins(_weekFirstDay); -} - -/** - * @brief CalendarManager::initConnection 初始化关联 - */ -void CalendarManager::initConnection() -{ - connect(m_timeDateDbus, &DaemonTimeDate::WeekBeginsChanged, this, &CalendarManager::WeekBeginsChanged); - connect(m_timeDateDbus, &DaemonTimeDate::ShortTimeFormatChanged, this, &CalendarManager::slotTimeFormatChanged); - connect(m_timeDateDbus, &DaemonTimeDate::ShortTimeFormatChanged, this, &CalendarManager::signalTimeFormatChanged); - connect(m_timeDateDbus, &DaemonTimeDate::ShortDateFormatChanged, this, &CalendarManager::slotDateFormatChanged); - connect(m_timeDateDbus, &DaemonTimeDate::ShortDateFormatChanged, this, &CalendarManager::signalDateFormatChanged); - connect(m_scheduleTask, &CScheduleTask::signalUpdateScheduleShow, this, &CalendarManager::slotGetScheduleSuccess); - connect(m_scheduleTask, &CScheduleTask::signalLunarGetSuccess, this, &CalendarManager::slotGetLunarSuccess); - connect(m_scheduleTask, &CScheduleTask::jobsUpdate, this, &CalendarManager::slotJobsUpdated); - connect(m_scheduleTask, &CScheduleTask::jobsTypeOrColorUpdate, this, &CalendarManager::slotUpdateJobTypeColor); - connect(m_scheduleTask, &CScheduleTask::signalUpdateSearchSchedule, this, &CalendarManager::slotUpdateSearchSchedule); -} - -/** - * @brief CalendarManager::setWeekBegins 设置每周首日 - * @param value - */ -void CalendarManager::setWeekBegins(const int value) -{ - //将从TimeDate DBus获取到的数字与周对应 - QMap WeekBeginMap{ - {0, Qt::DayOfWeek::Monday}, - {1, Qt::DayOfWeek::Tuesday}, - {2, Qt::DayOfWeek::Wednesday}, - {3, Qt::DayOfWeek::Thursday}, - {4, Qt::DayOfWeek::Friday}, - {5, Qt::DayOfWeek::Saturday}, - {6, Qt::DayOfWeek::Sunday} - }; - if (value >= 0 && value < 7) { - //设置每周第一天 - m_dateManage->setWeekFirstDay(WeekBeginMap[value]); - } else { - qWarning() << "setWeekBegins err ,set value:" << value; - } -} - -/** - * @brief CalendarManager::updateJobs 更新日程信息 - */ -void CalendarManager::updateJobs() -{ - //更新dbus数据 - ShowDateRange _showDateRange = m_dateManage->getShowDateRange(); - //获取显示年份前后一个月数据 - m_scheduleTask->updateInfo(_showDateRange.startDate.addDays(-42), _showDateRange.stopDate.addDays(42), m_showLunar); -} - -void CalendarManager::updateJobTypeColor() -{ - JobTypeInfoManager::instance()->updateInfo(); -} - -/** - * @brief CalendarManager::WeekBeginsChanged 关联dbus信号,每周首日改变事触发 - * @param value - */ -void CalendarManager::WeekBeginsChanged(int value) -{ - //设置每周首日 - setWeekBegins(value); - //更新显示界面 - for (int i = 0; i < m_showWidget.size(); ++i) { - m_showWidget.at(i)->updateData(); - } - //更新dbus数据 - updateJobs(); -} - -/** - * @brief CalendarManager::slotGetScheduleSuccess 日程更新成功刷新界面 - */ -void CalendarManager::slotGetScheduleSuccess() -{ - //更新显示界面 - for (int i = 0; i < m_showWidget.size(); ++i) { - m_showWidget.at(i)->updateShowSchedule(); - } -} - -/** - * @brief CalendarManager::slotGetLunarSuccess 农历更新成功刷新界面 - */ -void CalendarManager::slotGetLunarSuccess() -{ - //更新显示界面 - for (int i = 0; i < m_showWidget.size(); ++i) { - m_showWidget.at(i)->updateShowLunar(); - } -} - -/** - * @brief CalendarManager::slotJobsUpdated 接收dbus信号更新日程日程信息 - * @param Ids - */ -void CalendarManager::slotJobsUpdated() -{ - updateJobs(); -} - -void CalendarManager::slotUpdateSearchSchedule() -{ - //更新显示界面 - for (int i = 0; i < m_showWidget.size(); ++i) { - m_showWidget.at(i)->updateSearchScheduleInfo(); - } -} - -void CalendarManager::slotUpdateJobTypeColor() -{ - updateJobTypeColor(); -} - -/** - * @brief CalendarManager::slotTimeFormatChanged 更新时间显示格式 - * @param value - */ -void CalendarManager::slotTimeFormatChanged(int value) -{ - QString timeFormat; - m_dateManage->setTimeFormatChanged(value); - //更新显示界面 - for (int i = 0; i < m_showWidget.size(); ++i) { - m_showWidget.at(i)->updateData(); - } -} - -/** - * @brief CalendarManager::slotDateFormatChanged 更新日期显示格式 - * @param value - */ -void CalendarManager::slotDateFormatChanged(int value) -{ - m_dateManage->setDateFormatChanged(value); -} diff -Nru dde-calendar-5.9.1/calendar-client/src/scheduleTask/calendarmanage.h dde-calendar-5.10.0/calendar-client/src/scheduleTask/calendarmanage.h --- dde-calendar-5.9.1/calendar-client/src/scheduleTask/calendarmanage.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/scheduleTask/calendarmanage.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,99 +0,0 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ -#ifndef CSCHEDULEMANAGE_H -#define CSCHEDULEMANAGE_H - -#include "calendardatedatamanage.h" -#include "scheduletask.h" - -#include - -#include - -typedef com::deepin::daemon::Timedate DaemonTimeDate; -class CScheduleBaseWidget; -/** - * @brief The CalendarManage class - * 日历数据管理类 - */ -class CalendarManager : public QObject -{ - Q_OBJECT -public: - static CalendarManager *getInstance(); - static void releaseInstance(); - //添加显示界面 - void addShowWidget(CScheduleBaseWidget *showWidget); - //移除显示界面 - void removeShowWidget(CScheduleBaseWidget *showWidget); - //根据编号获取显示界面 - CScheduleBaseWidget *getShowWidget(const int index); - //获取显示窗口的数目 - int getShowWidgetSize(); - //获取日历时间数据管理 - CalendarDateDataManager *getCalendarDateDataManage() const; - //获取日程任务 - CScheduleTask *getScheduleTask() const; - //获取是否显示农历信息 - bool getShowLunar() const; -signals: - void signalTimeFormatChanged(int value); - void signalDateFormatChanged(int value); -private: - explicit CalendarManager(QObject *parent = nullptr); - ~CalendarManager(); -private: - //初始化数据 - void initData(); - //初始化关联 - void initConnection(); - //设置每周首日 - void setWeekBegins(const int value); - //更新日程信息 - void updateJobs(); - //更新日程类型颜色 - void updateJobTypeColor(); -public slots: - //关联dbus信号,每周首日改变事触发 - void WeekBeginsChanged(int value); - //日程更新成功刷新界面 - void slotGetScheduleSuccess(); - //农历更新成功刷新界面 - void slotGetLunarSuccess(); - //接收dbus信号更新日程日程信息 - void slotJobsUpdated(); - // - void slotUpdateSearchSchedule(); - //更新日程类型颜色 - void slotUpdateJobTypeColor(); - - void slotTimeFormatChanged(int value); - void slotDateFormatChanged(int value); -private: - static CalendarManager *m_scheduleManager; - CalendarDateDataManager *m_dateManage; - DaemonTimeDate *m_timeDateDbus; - CScheduleTask *m_scheduleTask; - QList m_showWidget; - bool m_showLunar; -}; - -#endif // CSCHEDULEMANAGE_H diff -Nru dde-calendar-5.9.1/calendar-client/src/scheduleTask/cscheduledbus.cpp dde-calendar-5.10.0/calendar-client/src/scheduleTask/cscheduledbus.cpp --- dde-calendar-5.9.1/calendar-client/src/scheduleTask/cscheduledbus.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/scheduleTask/cscheduledbus.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,498 +0,0 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ -#include "cscheduledbus.h" - -#include -#include -#include - - -CScheduleDBus *CScheduleDBus::m_scheduleDBus = nullptr; -CScheduleDBus::CScheduleDBus(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent) - : QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent) -{ - //关联后端dbus触发信号 - if (!QDBusConnection::sessionBus().connect(this->service(), this->path(), staticInterfaceName(), "", this, SLOT(propertyChanged(QDBusMessage)))) { - qWarning() << "the connection was fail!"; - }; -} - -CScheduleDBus *CScheduleDBus::getInstance() -{ - if (m_scheduleDBus == nullptr) { - m_scheduleDBus = new CScheduleDBus(DBUS_NAME, DBUS_PATH, QDBusConnection::sessionBus()); - } - return m_scheduleDBus; -} - -void CScheduleDBus::releaseInstance() -{ - delete m_scheduleDBus; - m_scheduleDBus = nullptr; -} - -CScheduleDBus::~CScheduleDBus() -{ - -} - -/** - * @brief CScheduleDBus::CreateJob 创建日程 - * @param info 日程信息 - * @return -1表示失败, 创建日程ID - */ -qint64 CScheduleDBus::CreateJob(const ScheduleDataInfo &info) -{ - if (!info.isValid()) { - qWarning() << "this is not a valid info :" << info << " createJob Err"; - return -1; - } - QList argumentList; - argumentList << QVariant::fromValue(info.ScheduleToJsonStr(info)); - QDBusPendingCall pCall = asyncCallWithArgumentList(QStringLiteral("CreateJob"), argumentList); - pCall.waitForFinished(); - QDBusMessage reply = pCall.reply(); - if (reply.type() != QDBusMessage::ReplyMessage) { - qWarning() << "createJob err ," << reply; - return -1; - } - QDBusReply id = reply; - return id.value(); -} - -/** - * @brief CScheduleDBus::GetJobs 获取日程信息 - * @param startDate 开始时间 - * @param endDate 结束时间 - * @return - */ -bool CScheduleDBus::GetJobs(const QDate &startDate, const QDate &endDate, QMap > &info) -{ - QList argumentList; - argumentList << QVariant::fromValue(static_cast(startDate.year())) - << QVariant::fromValue(static_cast(startDate.month())) - << QVariant::fromValue(static_cast(startDate.day())); - argumentList << QVariant::fromValue(static_cast(endDate.year())) - << QVariant::fromValue(static_cast(endDate.month())) - << QVariant::fromValue(static_cast(endDate.day())); - QDBusPendingCall pCall = asyncCallWithArgumentList(QStringLiteral("GetJobs"), argumentList); - pCall.waitForFinished(); - QDBusMessage reply = pCall.reply(); - if (reply.type() != QDBusMessage::ReplyMessage) { - qWarning() << "GetJobs err ," << reply; - return false; - } - QDBusReply jobs = reply; - - if (!jobs.isValid()) - return false; - info = ScheduleDataInfo::StrJsonToRangeInfo(jobs.value()); - return true; -} - -/** - * @brief CScheduleDBus::GetJob 根据日程id获取对应日程 - * @param jobId 日程id - * @param out 获取到的日程信息 - * @return - */ -bool CScheduleDBus::GetJob(qint64 jobId, ScheduleDataInfo &out) -{ - QList argumentList; - argumentList << QVariant::fromValue(jobId); - QDBusPendingCall pCall = asyncCallWithArgumentList(QStringLiteral("GetJob"), argumentList); - pCall.waitForFinished(); - QDBusMessage reply = pCall.reply(); - if (reply.type() != QDBusMessage::ReplyMessage) { - qWarning() << "GetJob err ," << reply; - return false; - } - QDBusReply jobs = reply; - if (!jobs.isValid()) - return false; - out = ScheduleDataInfo::JsonStrToSchedule(jobs.value()); - return true; -} - -/** - * @brief CScheduleDBus::UpdateJob 更新日程 - * @param info 需要更新的日程信息 - * @return - */ -bool CScheduleDBus::UpdateJob(const ScheduleDataInfo &info) -{ - QList argumentList; - argumentList << QVariant::fromValue(ScheduleDataInfo::ScheduleToJsonStr(info)); - QDBusPendingCall pCall = asyncCallWithArgumentList(QStringLiteral("UpdateJob"), argumentList); - pCall.waitForFinished(); - QDBusMessage reply = pCall.reply(); - if (reply.type() != QDBusMessage::ReplyMessage) { - qWarning() << "UpdateJob err ," << reply; - return false; - } - return true; -} - -/** - * @brief CScheduleDBus::DeleteJob 根据日程id删除日程 - * @param jobId 需要删除的日程id - * @return - */ -bool CScheduleDBus::DeleteJob(qint64 jobId) -{ - QList argumentList; - argumentList << QVariant::fromValue(jobId); - QDBusPendingCall pCall = asyncCallWithArgumentList(QStringLiteral("DeleteJob"), argumentList); - pCall.waitForFinished(); - QDBusMessage reply = pCall.reply(); - if (reply.type() != QDBusMessage::ReplyMessage) { - qWarning() << "DeleteJob err ," << reply; - return false; - } - return true; -} - -/** - * @brief CScheduleDBus::QueryJobs 查询一段时间内某日程 - * @param key 需要查询日程的关键字 - * @param starttime 开始时间 - * @param endtime 结束时间 - * @param out 查询到的日程 - * @return - */ -bool CScheduleDBus::QueryJobs(QString key, QDateTime starttime, QDateTime endtime, QMap > &out) -{ - //若时间无效则退出查询 - if (starttime.isNull() || endtime.isNull()) { - qWarning() << "starttime or endtime is not Valid"; - return false; - } - QJsonObject qjson; - qjson.insert("Key", key); - qjson.insert("Start", ScheduleDataInfo::DateTimeToStringDate(starttime)); - qjson.insert("End", ScheduleDataInfo::DateTimeToStringDate(endtime)); - // 构建 JSON 文档 - QJsonDocument qdocument; - qdocument.setObject(qjson); - QByteArray qbyteArray = qdocument.toJson(QJsonDocument::Compact); - QString strJson(qbyteArray); - QList argumentList; - argumentList << QVariant::fromValue(strJson); - QDBusPendingCall pCall = asyncCallWithArgumentList(QStringLiteral("QueryJobs"), argumentList); - pCall.waitForFinished(); - QDBusMessage reply = pCall.reply(); - if (reply.type() != QDBusMessage::ReplyMessage) { - qWarning() << "QueryJobs err ," << reply; - return false; - } - QDBusReply jobs = reply; - if (!jobs.isValid()) - return false; - out = ScheduleDataInfo::StrJsonToRangeInfo(jobs.value()); - return true; -} - -/** - * @brief CScheduleDBus::QueryJobs 查询日程 - * @param key - * @param starttime - * @param endtime - * @param outStr - * @return - */ -bool CScheduleDBus::QueryJobs(QString key, QDateTime starttime, QDateTime endtime, QString &outStr) -{ - outStr = ""; - //若时间无效则退出查询 - if (starttime.isNull() || endtime.isNull()) { - qWarning() << "starttime or endtime is not Valid"; - return false; - } - QJsonObject qjson; - qjson.insert("Key", key); - qjson.insert("Start", ScheduleDataInfo::DateTimeToStringDate(starttime)); - qjson.insert("End", ScheduleDataInfo::DateTimeToStringDate(endtime)); - // 构建 JSON 文档 - QJsonDocument qdocument; - qdocument.setObject(qjson); - QByteArray qbyteArray = qdocument.toJson(QJsonDocument::Compact); - QString strJson(qbyteArray); - QList argumentList; - argumentList << QVariant::fromValue(strJson); - QDBusPendingCall pCall = asyncCallWithArgumentList(QStringLiteral("QueryJobs"), argumentList); - pCall.waitForFinished(); - QDBusMessage reply = pCall.reply(); - if (reply.type() != QDBusMessage::ReplyMessage) { - qWarning() << "QueryJobs err ," << reply; - return false; - } - QDBusReply jobs = reply; - if (!jobs.isValid()) - return false; - outStr = jobs.value(); - return true; -} - -/** - * @brief CScheduleDBus::GetFestivalMonth 获取班休信息 - * @param year 年 - * @param month 月 - * @return - */ -bool CScheduleDBus::GetFestivalMonth(quint32 year, quint32 month, QVector &out) -{ - QList argumentList; - argumentList << QVariant::fromValue(year) << QVariant::fromValue(month) ; - QDBusPendingCall pCall = asyncCallWithArgumentList(QStringLiteral("GetFestivalMonth"), argumentList); - pCall.waitForFinished(); - QDBusMessage reply = pCall.reply(); - if (reply.type() != QDBusMessage::ReplyMessage) { - qWarning() << "GetFestivalMonth err ," << reply; - return false; - } - QDBusReply jobs = reply; - if (!jobs.isValid()) - return false; - - QJsonParseError json_error; - QJsonDocument jsonDoc(QJsonDocument::fromJson(jobs.value().toLocal8Bit(), &json_error)); - - if (json_error.error != QJsonParseError::NoError) { - return false; - } - - QJsonArray rootarry = jsonDoc.array(); - - for (int i = 0; i < rootarry.size(); i++) { - - QJsonObject subObj = rootarry.at(i).toObject(); - FestivalInfo festivalInfoday; - - //因为是预先定义好的JSON数据格式,所以这里可以这样读取 - if (subObj.contains("id")) { - festivalInfoday.ID = subObj.value("id").toString(); - } - if (subObj.contains("name")) { - festivalInfoday.FestivalName = subObj.value("name").toString(); - } - if (subObj.contains("description")) { - festivalInfoday.description = subObj.value("description").toString(); - } - if (subObj.contains("rest")) { - festivalInfoday.Rest = subObj.value("rest").toString(); - } - if (subObj.contains("month")) { - festivalInfoday.month = subObj.value("month").toInt(); - } - if (subObj.contains("list")) { - QJsonArray sublistArray = subObj.value("list").toArray(); - for (int j = 0; j < sublistArray.size(); j++) { - QJsonObject hsubObj = sublistArray.at(j).toObject(); - HolidayInfo dayinfo; - if (hsubObj.contains("status")) { - dayinfo.status = static_cast(hsubObj.value("status").toInt()); - } - if (hsubObj.contains("date")) { - dayinfo.date = QDate::fromString(hsubObj.value("date").toString(), "yyyy-M-d"); - } - festivalInfoday.listHoliday.append(dayinfo); - } - } - festivalInfoday.year = static_cast(year); - out.append(festivalInfoday); - } - return true; -} - -/** - * @brief CScheduleDBus::GetHuangLiDay 获取某天的农历信息 - * @param getDay - * @param out - * @return - */ -bool CScheduleDBus::GetHuangLiDay(const QDate &getDay, CaHuangLiDayInfo &out) -{ - QList argumentList; - argumentList << QVariant::fromValue(static_cast(getDay.year())) - << QVariant::fromValue(static_cast(getDay.month())) - << QVariant::fromValue(static_cast(getDay.day())); - QDBusPendingCall pCall = asyncCallWithArgumentList(QStringLiteral("GetHuangLiDay"), argumentList); - pCall.waitForFinished(); - QDBusMessage reply = pCall.reply(); - if (reply.type() != QDBusMessage::ReplyMessage) { - qWarning() << "GetHuangLiDay err ," << reply; - return false; - } - QDBusReply jobs = reply; - if (!jobs.isValid()) - return false; - bool _isVoild; - out.strJsonToInfo(jobs.value(), _isVoild); - return _isVoild; -} - -/** - * @brief CScheduleDBus::GetHuangLiMonth 获取某月的农历信息 - * @param year - * @param month - * @param fill - * @return - */ -bool CScheduleDBus::GetHuangLiMonth(const quint32 year, const quint32 month, bool &fill, CaHuangLiMonthInfo &out) -{ - QList argumentList; - argumentList << QVariant::fromValue(year) << QVariant::fromValue(month) << QVariant::fromValue(fill); - QDBusPendingCall pCall = asyncCallWithArgumentList(QStringLiteral("GetHuangLiMonth"), argumentList); - pCall.waitForFinished(); - QDBusMessage reply = pCall.reply(); - if (reply.type() != QDBusMessage::ReplyMessage) { - qWarning() << "GetHuangLiMonth err ," << reply; - return false; - } - QDBusReply jobs = reply; - if (!jobs.isValid()) - return false; - bool _infoIsVaild; - out.strJsonToInfo(jobs.value(), _infoIsVaild); - return _infoIsVaild; -} - -QString CScheduleDBus::getHuangLiShortName(const QDate &date) -{ - CaHuangLiDayInfo info; - if (GetHuangLiDay(date, info)) { - return info.mLunarMonthName + info.mLunarDayName; - } - return ""; -} - - -void CScheduleDBus::propertyChanged(const QDBusMessage &msg) -{ - if (msg.type() == QDBusMessage::SignalMessage && msg.path() == this->path() && msg.interface() == this->interface()) { - if (msg.member() == "JobsUpdated") { - //日程更新信号 - emit jobsUpdate(); - } - - if (msg.member() == "JobTypeOrColorUpdated") { - //日程类型或颜色更新 - emit jobsTypeOrColorUpdate(); - } - } -} - -//获取日程类型信息列表 -bool CScheduleDBus::GetJobTypeList(QString &strJson) -{ - QDBusPendingCall pCall = asyncCall(QStringLiteral("GetJobTypeList")); - pCall.waitForFinished(); - QDBusMessage reply = pCall.reply(); - if (reply.type() != QDBusMessage::ReplyMessage) { - qWarning() << "GetJobTypeList err ," << reply; - return false; - } - QDBusReply jobs = reply; - if (!jobs.isValid()) - return false; - strJson = jobs.value(); - return true; -} -//新增日程类型信息 -bool CScheduleDBus::AddJobType(QString strJson) -{ - QDBusPendingCall pCall = asyncCallWithArgumentList(QStringLiteral("CreateJobType"), {QVariant(strJson)}); - pCall.waitForFinished(); - QDBusMessage reply = pCall.reply(); - if (reply.type() != QDBusMessage::ReplyMessage) { - qWarning() << "AddJobType err ," << reply << " strJson:" << strJson; - return false; - } - QDBusReply jobs = reply; - if (!jobs.isValid()) - return false; - return jobs.value(); -} -//更新日程类型信息 -bool CScheduleDBus::UpdateJobType(QString strJson) -{ - QDBusPendingCall pCall = asyncCallWithArgumentList(QStringLiteral("UpdateJobType"), {QVariant(strJson)}); - pCall.waitForFinished(); - QDBusMessage reply = pCall.reply(); - if (reply.type() != QDBusMessage::ReplyMessage) { - qWarning() << "UpdateJobType err ," << reply << " strJson:" << strJson; - return false; - } - QDBusReply jobs = reply; - if (!jobs.isValid()) - return false; - return jobs.value(); -} -//删除日程类型信息 -bool CScheduleDBus::DeleteJobType(int jobTypeNo) -{ - QDBusPendingCall pCall = asyncCallWithArgumentList(QStringLiteral("DeleteJobType"), {QVariant(jobTypeNo)}); - pCall.waitForFinished(); - QDBusMessage reply = pCall.reply(); - if (reply.type() != QDBusMessage::ReplyMessage) { - qWarning() << "DeleteJobType err ," << reply << " jobTypeNo:" << jobTypeNo; - return false; - } - QDBusReply jobs = reply; - if (!jobs.isValid()) - return false; - return jobs.value(); -} -/** - * @brief isJobTypeUsed 获取日程类型是否被使用 - * return bool 返回是否被使用 - */ -bool CScheduleDBus::isJobTypeUsed(int jobTypeNo) -{ - QDBusPendingCall pCall = asyncCallWithArgumentList(QStringLiteral("isJobTypeUsed"), {QVariant(jobTypeNo)}); - pCall.waitForFinished(); - QDBusMessage reply = pCall.reply(); - if (reply.type() != QDBusMessage::ReplyMessage) { - qWarning() << "isJobTypeUsed err ," << reply << " jobTypeNo:" << jobTypeNo; - return false; - } - QDBusReply jobs = reply; - if (!jobs.isValid()) - return false; - return jobs.value(); -} - -//获取颜色信息列表 -bool CScheduleDBus::GetJobTypeColorList(QString &strJson) -{ - QDBusPendingCall pCall = asyncCall(QStringLiteral("GetColorTypeList")); - pCall.waitForFinished(); - QDBusMessage reply = pCall.reply(); - if (reply.type() != QDBusMessage::ReplyMessage) { - qWarning() << "GetColorTypeList err ," << reply; - return false; - } - QDBusReply jobs = reply; - if (!jobs.isValid()) - return false; - strJson = jobs.value(); - return true; -} diff -Nru dde-calendar-5.9.1/calendar-client/src/scheduleTask/cscheduledbus.h dde-calendar-5.10.0/calendar-client/src/scheduleTask/cscheduledbus.h --- dde-calendar-5.9.1/calendar-client/src/scheduleTask/cscheduledbus.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/scheduleTask/cscheduledbus.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,97 +0,0 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ -#ifndef CSCHEDULEDBUS_H -#define CSCHEDULEDBUS_H - -#include "src/scheduledatainfo.h" -#include "src/dbusdatastruct.h" -#include "src/lunardatastruct.h" - -#include -#include -#include - - -#define DBUS_INTEERFACENAME "com.deepin.dataserver.Calendar" -#define DBUS_NAME "com.deepin.dataserver.Calendar" -#define DBUS_PATH "/com/deepin/dataserver/Calendar" - -class CScheduleDBus : public QDBusAbstractInterface -{ - Q_OBJECT -public: - static CScheduleDBus *getInstance(); - static void releaseInstance(); - ~CScheduleDBus(); -public: - static inline const char *staticInterfaceName() - { - return DBUS_INTEERFACENAME; - } -public: - //创建日程 - qint64 CreateJob(const ScheduleDataInfo &info); - //根据开始结束日期获取日程 - bool GetJobs(const QDate &startDate, const QDate &endDate, QMap > &info); - //根据日程id 获取日程 - bool GetJob(qint64 jobId, ScheduleDataInfo &out); - //更新日程信息 - bool UpdateJob(const ScheduleDataInfo &info); - //删除日程 - bool DeleteJob(qint64 jobId); - //查询日程 - bool QueryJobs(QString key, QDateTime starttime, QDateTime endtime, QMap > &out); - //查询日程 - bool QueryJobs(QString key, QDateTime starttime, QDateTime endtime, QString &outStr); - //获取节假日班休信息 - bool GetFestivalMonth(quint32 year, quint32 month, QVector &out); - //按天获取农历信息 - bool GetHuangLiDay(const QDate &getDay, CaHuangLiDayInfo &out); - //按月获取农历信息 - bool GetHuangLiMonth(const quint32 year, const quint32 month, bool &fill, CaHuangLiMonthInfo &out); - //获取当天的农历月日期和日日期名 - QString getHuangLiShortName(const QDate &date); - - //获取日程类型信息列表 - bool GetJobTypeList(QString &strJson); - //新增日程类型信息 - bool AddJobType(QString strJson); - //更新日程类型信息 - bool UpdateJobType(QString strJson); - //删除日程类型信息 - bool DeleteJobType(int jobTypeNo); - //获取日程类型是否被使用 - bool isJobTypeUsed(int jobTypeNo); - //获取颜色信息列表 - bool GetJobTypeColorList(QString &strJson); -signals: - void jobsUpdate(); - //日程类型或颜色更新 - void jobsTypeOrColorUpdate(); -public slots: - void propertyChanged(const QDBusMessage &msg); -private: - explicit CScheduleDBus(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = nullptr); - - static CScheduleDBus *m_scheduleDBus; - -}; -#endif // CSCHEDULEDBUS_H diff -Nru dde-calendar-5.9.1/calendar-client/src/scheduleTask/cscheduleoperation.cpp dde-calendar-5.10.0/calendar-client/src/scheduleTask/cscheduleoperation.cpp --- dde-calendar-5.9.1/calendar-client/src/scheduleTask/cscheduleoperation.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/scheduleTask/cscheduleoperation.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,50 +1,53 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "cscheduleoperation.h" -#include "cscheduledbus.h" #include "schedulectrldlg.h" #include "configsettings.h" #include "dcalendarddialog.h" #include "cdynamicicon.h" +#include "accountmanager.h" +#include "lunarmanager.h" +#include "doanetworkdbus.h" + -CScheduleOperation::CScheduleOperation(QWidget *parent) +CScheduleOperation::CScheduleOperation(const AccountItem::Ptr &accountItem, QWidget *parent) : QObject(parent) - , m_DBusManager(CScheduleDBus::getInstance()) + , m_accountItem(accountItem) , m_widget(parent) { + //如果为空默认设置为本地帐户 + if (m_accountItem.isNull()) { + m_accountItem = gAccountManager->getLocalAccountItem(); + } +} +CScheduleOperation::CScheduleOperation(const QString &scheduleTypeID, QWidget *parent) + : QObject(parent) + , m_accountItem(gAccountManager->getAccountItemByScheduleTypeId(scheduleTypeID)) + , m_widget(parent) +{ + //如果为空默认设置为本地帐户 + if (m_accountItem.isNull()) { + qWarning() << "Cannot get account by schedule type,scheduleTypeID:" << scheduleTypeID; + m_accountItem = gAccountManager->getLocalAccountItem(); + } } /** * @brief CScheduleOperation::createSchedule 创建日程 * @param scheduleInfo */ -bool CScheduleOperation::createSchedule(const ScheduleDataInfo &scheduleInfo) +bool CScheduleOperation::createSchedule(const DSchedule::Ptr &scheduleInfo) { //如果为农历且重复类型为每年 - if (scheduleInfo.getIsLunar() && RepetitionRule::RRule_EVEYEAR == scheduleInfo.getRepetitionRule().getRuleId()) { + if (scheduleInfo->lunnar() && scheduleInfo->getRRuleType() == DSchedule::RRule_Year) { lunarMessageDialogShow(scheduleInfo); } - return m_DBusManager->CreateJob(scheduleInfo); + m_accountItem->createSchedule(scheduleInfo); + return true; } /** @@ -52,15 +55,24 @@ * @param newInfo * @param oldInfo */ -bool CScheduleOperation::changeSchedule(const ScheduleDataInfo &newInfo, const ScheduleDataInfo &oldInfo) +bool CScheduleOperation::changeSchedule(const DSchedule::Ptr &newInfo, const DSchedule::Ptr &oldInfo) { bool _result {false}; - if (newInfo.getRepetitionRule().getRuleId() == 0 && newInfo.getRepetitionRule().getRuleId() == oldInfo.getRepetitionRule().getRuleId()) { + + if (newInfo->getRRuleType() == DSchedule::RRule_None && newInfo->getRRuleType() == oldInfo->getRRuleType()) { //如果为普通日程且没有修改重复类型则更新日程 - _result = m_DBusManager->UpdateJob(newInfo); + if(newInfo->allDay() != oldInfo->allDay()) { + if(newInfo->allDay()) { + newInfo->setAlarmType(DSchedule::AlarmType::Alarm_15Hour_Front); + } else { + newInfo->setAlarmType(DSchedule::AlarmType::Alarm_15Min_Front); + } + } + m_accountItem->updateSchedule(newInfo); + _result = true; } else { //如果切换了全天状态则提醒是否修改全部 - if (newInfo.getAllDay() != oldInfo.getAllDay()) { + if (newInfo->allDay() != oldInfo->allDay()) { CScheduleCtrlDlg msgBox(m_widget); msgBox.setText( tr("All occurrences of a repeating event must have the same all-day status.")); @@ -74,9 +86,10 @@ } else if (msgBox.clickButton() == 1) { //更新日程 showLunarMessageDialog(newInfo, oldInfo); - _result = m_DBusManager->UpdateJob(newInfo); + m_accountItem->updateSchedule(newInfo); + _result = true; } - } else if (oldInfo.getRepetitionRule().getRuleId() != newInfo.getRepetitionRule().getRuleId()) { + } else if (newInfo->getRRuleType() != oldInfo->getRRuleType()) { //修改重复规则 CScheduleCtrlDlg msgBox(m_widget); msgBox.setText(tr("You are changing the repeating rule of this event.")); @@ -89,7 +102,8 @@ } else if (msgBox.clickButton() == 1) { //更新日程 showLunarMessageDialog(newInfo, oldInfo); - _result = m_DBusManager->UpdateJob(newInfo); + m_accountItem->updateSchedule(newInfo); + _result = true; } } else { _result = changeRecurInfo(newInfo, oldInfo); @@ -102,11 +116,11 @@ * @brief CScheduleOperation::deleteSchedule 删除日程 * @param scheduleInfo */ -bool CScheduleOperation::deleteSchedule(const ScheduleDataInfo &scheduleInfo) +bool CScheduleOperation::deleteSchedule(const DSchedule::Ptr &scheduleInfo) { bool _restuleBool {false}; //如果为普通日程 - if (scheduleInfo.getRepetitionRule().getRuleId() == 0) { + if (scheduleInfo->getRRuleType() == DSchedule::RRule_None) { CScheduleCtrlDlg msgBox(m_widget); msgBox.setText(tr("You are deleting an event.")); msgBox.setInformativeText(tr("Are you sure you want to delete this event?")); @@ -116,12 +130,16 @@ if (msgBox.clickButton() == 0) { return false; } else if (msgBox.clickButton() == 1) { - m_DBusManager->DeleteJob(scheduleInfo.getID()); + // m_DBusManager->DeleteJob(scheduleInfo.getID()); + m_accountItem->deleteScheduleByID(scheduleInfo->uid()); _restuleBool = true; } } else { + //获取原始日程 + DSchedule::Ptr primevalSchedule = m_accountItem->getScheduleByScheduleID(scheduleInfo->uid()); //如果为重复日程的第一个 - if (scheduleInfo.getRecurID() == 0) { + int num = DSchedule::numberOfRepetitions(primevalSchedule, scheduleInfo->dtStart()) ; + if (num == 1) { CScheduleCtrlDlg msgBox(m_widget); msgBox.setText(tr("You are deleting an event.")); msgBox.setInformativeText(tr("Do you want to delete all occurrences of this event, or only the selected occurrence?")); @@ -133,14 +151,12 @@ return false; } else if (msgBox.clickButton() == 1) { //删除所有日程 - m_DBusManager->DeleteJob(scheduleInfo.getID()); + m_accountItem->deleteScheduleByID(scheduleInfo->uid()); _restuleBool = true; } else if (msgBox.clickButton() == 2) { //仅删除此日程 - ScheduleDataInfo newschedule; - m_DBusManager->GetJob(scheduleInfo.getID(), newschedule); - newschedule.getIgnoreTime().append(scheduleInfo.getBeginDateTime()); - m_DBusManager->UpdateJob(newschedule); + primevalSchedule->recurrence()->addExDateTime(scheduleInfo->dtStart()); + m_accountItem->updateSchedule(primevalSchedule); _restuleBool = true; } } else { @@ -156,63 +172,47 @@ return false; } else if (msgBox.clickButton() == 1) { //删除选中日程及之后的日程 - ScheduleDataInfo newschedule; - //获取原始日程信息 - m_DBusManager->GetJob(scheduleInfo.getID(), newschedule); //修改重复规则 - changeRepetitionRule(newschedule, scheduleInfo); + QList &&exDt = primevalSchedule->recurrence()->exDateTimes(); + changeRepetitionRule(primevalSchedule, scheduleInfo); //如果修改后的日程为普通日程且忽略列表内包含日程开始时间则删除该日程 - if (newschedule.getRepetitionRule().getRuleId() == RepetitionRule::RRule_NONE && newschedule.getIgnoreTime().contains(newschedule.getBeginDateTime())) { + if (primevalSchedule->getRRuleType() == DSchedule::RRule_None + && exDt.contains(primevalSchedule->dtStart())) { //删除日程 - m_DBusManager->DeleteJob(newschedule.getID()); + m_accountItem->deleteScheduleByID(primevalSchedule->uid()); } else { //更新日程 - m_DBusManager->UpdateJob(newschedule); + m_accountItem->updateSchedule(primevalSchedule); } _restuleBool = true; } else if (msgBox.clickButton() == 2) { - ScheduleDataInfo newschedule; - m_DBusManager->GetJob(scheduleInfo.getID(), newschedule); - newschedule.getIgnoreTime().append(scheduleInfo.getBeginDateTime()); - m_DBusManager->UpdateJob(newschedule); + primevalSchedule->recurrence()->addExDateTime(scheduleInfo->dtStart()); + m_accountItem->updateSchedule(primevalSchedule); _restuleBool = true; } } } - return _restuleBool; -} - -QString CScheduleOperation::queryScheduleStr(const QString &key, const QDateTime &startTime, const QDateTime &endTime) -{ - QString _resultStr; - m_DBusManager->QueryJobs(key, startTime, endTime, _resultStr); - return _resultStr; -} - -bool CScheduleOperation::queryScheduleInfo(const QString &key, const QDateTime &startTime, const QDateTime &endTime, QMap > &info) -{ - return m_DBusManager->QueryJobs(key, startTime, endTime, info); + return _restuleBool; } /** * @brief CScheduleOperation::deleteOnlyInfo 删除日程 仅删除此日程 不弹框提醒 * @param scheduleInfo */ -void CScheduleOperation::deleteOnlyInfo(const ScheduleDataInfo &scheduleInfo) +void CScheduleOperation::deleteOnlyInfo(const DSchedule::Ptr &scheduleInfo) { //如果为纪念日或节日则不处理 - if (scheduleInfo.getType() == 4) + if (isFestival(scheduleInfo)) return; //如果为普通日程则删除 - if (scheduleInfo.getRepetitionRule().getRuleId() == RepetitionRule::RRule_NONE) { - m_DBusManager->DeleteJob(scheduleInfo.getID()); - } else { + if (scheduleInfo->recurs()) { //仅删除此日程 - ScheduleDataInfo newschedule; - m_DBusManager->GetJob(scheduleInfo.getID(), newschedule); - newschedule.getIgnoreTime().append(scheduleInfo.getBeginDateTime()); - m_DBusManager->UpdateJob(newschedule); + DSchedule::Ptr newschedule = m_accountItem->getScheduleByScheduleID(scheduleInfo->uid()); + newschedule->recurrence()->addExDateTime(scheduleInfo->dtStart()); + m_accountItem->updateSchedule(newschedule); + } else { + m_accountItem->deleteScheduleByID(scheduleInfo->uid()); } } @@ -221,11 +221,15 @@ * @param newinfo * @param oldinfo */ -bool CScheduleOperation::changeRecurInfo(const ScheduleDataInfo &newinfo, const ScheduleDataInfo &oldinfo) +bool CScheduleOperation::changeRecurInfo(const DSchedule::Ptr &newinfo, const DSchedule::Ptr &oldinfo) { bool _result{false}; //如果为重复类型第一个 - if (newinfo.getRecurID() == 0) { + // 获取原始数据 + DSchedule::Ptr primevalScheduleData = m_accountItem->getScheduleByScheduleID(oldinfo->uid()); + int primevalDuration = primevalScheduleData->recurrence()->duration(); + int num = DSchedule::numberOfRepetitions(primevalScheduleData, oldinfo->dtStart()); + if (num == 1) { CScheduleCtrlDlg msgBox(m_widget); msgBox.setText(tr("You are changing a repeating event.")); msgBox.setInformativeText( @@ -240,20 +244,17 @@ _result = false; } else if (msgBox.clickButton() == 1) { //修改所有日程 - ScheduleDataInfo _scheduleDataInfo = newinfo; - RepetitionRule _rule = _scheduleDataInfo.getRepetitionRule(); //如果此重复日程只有它一个则将修改为普通日程 - if ((_rule.getRuleType() == 1 && _rule.getEndCount() < 1) || - (_rule.getRuleType() == 2 && _scheduleDataInfo.getBeginDateTime().daysTo(_rule.getEndDate()) < 0)) { - _rule.setRuleId(RepetitionRule::RRuleID::RRule_NONE); - _rule.setRuleType(RepetitionRule::RRuleEndType::RRuleType_NEVER); - } - _scheduleDataInfo.setRepetitionRule(_rule); - //TODO 清空忽略日程 - _scheduleDataInfo.getIgnoreTime().clear(); + DSchedule::Ptr _scheduleDataInfo(newinfo->clone()); //更新日程 showLunarMessageDialog(_scheduleDataInfo, oldinfo); - _result = m_DBusManager->UpdateJob(_scheduleDataInfo); + //如果为非全天且结束于日期则更新结束时间 + if(!_scheduleDataInfo->allDay() && _scheduleDataInfo->recurrence()->duration() ==0){ + QDateTime dtEnd(_scheduleDataInfo->recurrence()->endDateTime().date(),_scheduleDataInfo->dtStart().time()); + _scheduleDataInfo->recurrence()->setEndDateTime(dtEnd); + } + m_accountItem->updateSchedule(_scheduleDataInfo); + _result = true; } else if (msgBox.clickButton() == 2) { //仅修改此日程 _result = changeOnlyInfo(newinfo, oldinfo); @@ -273,40 +274,47 @@ _result = false; } else if (msgBox.clickButton() == 1) { // 根据id获取日程并修改 - ScheduleDataInfo updatescheduleData; - // 获取原始数据 - m_DBusManager->GetJob(oldinfo.getID(), updatescheduleData); //修改重复规则 - changeRepetitionRule(updatescheduleData, newinfo); + + QList &&exDt = primevalScheduleData->recurrence()->exDateTimes(); + changeRepetitionRule(primevalScheduleData, oldinfo); //如果修改后的日程为普通日程且忽略列表内包含日程开始时间则删除该日程 - if (updatescheduleData.getRepetitionRule().getRuleId() == RepetitionRule::RRule_NONE && updatescheduleData.getIgnoreTime().contains(updatescheduleData.getBeginDateTime())) { + if (primevalScheduleData->getRRuleType() == DSchedule::RRule_None + &&exDt.contains(primevalScheduleData->dtStart())) { //删除日程 - m_DBusManager->DeleteJob(updatescheduleData.getID()); + m_accountItem->deleteScheduleByID(primevalScheduleData->uid()); } else { //更新日程 - m_DBusManager->UpdateJob(updatescheduleData); + m_accountItem->updateSchedule(primevalScheduleData); } + //创建日程 - ScheduleDataInfo newschedule = newinfo; - //获取重复规则 - RepetitionRule _rule = newschedule.getRepetitionRule(); - if (_rule.getRuleType() == 1) { - //更新重复规则 - _rule.setEndCount(qAbs(_rule.getEndCount() - newschedule.getRecurID())); - if (_rule.getEndCount() < 1) { - _rule.setRuleId(RepetitionRule::RRuleID::RRule_NONE); - _rule.setRuleType(RepetitionRule::RRuleEndType::RRuleType_NEVER); + DSchedule::Ptr newschedule(newinfo->clone()); + + if (primevalDuration > 0) { + //如果结束与次数 + int newDuration = primevalDuration - num + 1; + //如果重复次数大于1 + if (newDuration > 1) { + newschedule->recurrence()->setDuration(newDuration); + } else { + newschedule->setRRuleType(DSchedule::RRule_None); } + newschedule->setRecurrenceId(QDateTime()); + } else if (primevalDuration ==0) { + //结束于日期 + QDateTime dtEnd(newschedule->recurrence()->endDateTime().date(),newschedule->dtStart().time()); + newschedule->recurrence()->setEndDateTime(dtEnd); } - newschedule.setRecurID(0); - newschedule.setID(0); - newschedule.setRepetitionRule(_rule); + //如果结束为永不和时间则不需要修改 + //创建新日程 //如果为农历且重复类型为每年 - if (newschedule.getIsLunar() && RepetitionRule::RRule_EVEYEAR == newschedule.getRepetitionRule().getRuleId()) { + if (newschedule->lunnar() && DSchedule::RRule_Year == newschedule->getRRuleType()) { lunarMessageDialogShow(newschedule); } - _result = m_DBusManager->CreateJob(newschedule); + m_accountItem->createSchedule(newschedule); + _result = true; } else if (msgBox.clickButton() == 2) { _result = changeOnlyInfo(newinfo, oldinfo); } @@ -319,21 +327,21 @@ * @param newinfo * @param oldinfo */ -bool CScheduleOperation::changeOnlyInfo(const ScheduleDataInfo &newinfo, const ScheduleDataInfo &oldinfo) +bool CScheduleOperation::changeOnlyInfo(const DSchedule::Ptr &newinfo, const DSchedule::Ptr &oldinfo) { - ScheduleDataInfo newschedule = newinfo; - newschedule.getRepetitionRule().clear(); - newschedule.setRecurID(0); - newschedule.setID(0); - newschedule.getIgnoreTime().clear(); + //修改日程 + DSchedule::Ptr newschedule(newinfo->clone()); + newschedule->setRRuleType(DSchedule::RRule_None); + newschedule->setRecurrenceId(QDateTime()); //创建日程 - m_DBusManager->CreateJob(newschedule); - ScheduleDataInfo updatescheduleData; + m_accountItem->createSchedule(newschedule); + //获取原始信息 - m_DBusManager->GetJob(oldinfo.getID(), updatescheduleData); - updatescheduleData.getIgnoreTime().append(oldinfo.getBeginDateTime()); + DSchedule::Ptr updatescheduleData = m_accountItem->getScheduleByScheduleID(oldinfo->uid()); + updatescheduleData->recurrence()->addExDateTime(oldinfo->dtStart()); //更新原始信息 - return m_DBusManager->UpdateJob(updatescheduleData); + m_accountItem->updateSchedule(updatescheduleData); + return true; } /** @@ -341,121 +349,31 @@ * @param newinfo * @param oldinfo */ -void CScheduleOperation::changeRepetitionRule(ScheduleDataInfo &newinfo, const ScheduleDataInfo &oldinfo) +void CScheduleOperation::changeRepetitionRule(DSchedule::Ptr &newinfo, const DSchedule::Ptr &oldinfo) { - switch (newinfo.getRepetitionRule().getRuleType()) { - case RepetitionRule::RRuleType_FREQ: { + int num = DSchedule::numberOfRepetitions(newinfo, oldinfo->dtStart()); + //修改重复规则 + if (newinfo->recurrence()->duration() > 0) { //如果为结束与次数则修改结束次数 - newinfo.getRepetitionRule().setEndCount(oldinfo.getRecurID() - 1); - //结束次数为0表示不重复,设置为普通日程 - if (newinfo.getRepetitionRule().getEndCount() < 1) { - newinfo.getRepetitionRule().setRuleId(RepetitionRule::RRuleID::RRule_NONE); - newinfo.getRepetitionRule().setRuleType(RepetitionRule::RRuleEndType::RRuleType_NEVER); - } - break; - } - default: { - //如果该日程结束类型为永不和结束于日期则修改结束日期 - newinfo.getRepetitionRule().setRuleType(RepetitionRule::RRuleType_DATE); - //设置结束日期,默认为0点 - QDateTime endDate(QDate(oldinfo.getBeginDateTime().date().addDays(-1)), QTime()); - newinfo.getRepetitionRule().setEndDate(endDate); - break; - } - } -} - -/** - * @brief CScheduleOperation::createJobType 创建日程类型 - * @param newinfo - * @param oldinfo - */ -bool CScheduleOperation::createJobType(JobTypeInfo &jobTypeInfo)//新增时,颜色可能是:自定义/默认类型。以“自定义颜色编码默认为0”来区分. -{ - //创建日程 - QString strJson = ""; - - int colorTypeNo = jobTypeInfo.getColorInfo().getTypeNo(); - - //以“自定义颜色编码默认为0”来区分. - if (0 == colorTypeNo) { - colorTypeNo = JobTypeInfoManager::instance()->getNextColorTypeNo(); - jobTypeInfo.getColorInfo().setTypeNo(colorTypeNo); - //保存新选择的颜色值 - CConfigSettings::getInstance()->setOption("LastUserColor", jobTypeInfo.getColorInfo().getColorHex()); - } - //保存选择的颜色编号,只记录系统默认颜色的编号 - if (jobTypeInfo.getColorInfo().getTypeNo() < 10) - CConfigSettings::getInstance()->setOption("LastSysColorTypeNo", jobTypeInfo.getColorInfo().getTypeNo()); - - if (0 == jobTypeInfo.getJobTypeNo()) { - jobTypeInfo.setJobTypeNo(JobTypeInfoManager::instance()->getNextTypeNo()); - jobTypeInfo.getColorInfo().setTypeNo(colorTypeNo); - } - jobTypeInfo.setAuthority(7);//自定义日程类型默认权限为7 - - JobTypeInfo::jobTypeInfoToJsonStr(jobTypeInfo, strJson); - return m_DBusManager->AddJobType(strJson);// no:10,hex:#123 -} - -/** - * @brief CScheduleOperation::updateJobType 修改日程类型 - * @param oldJobTypeInfo - * @param newJobTypeInfo - * 只能更新名称和颜色 - * 颜色可能是:自定义-自定义、自定义-默认类型、默认类型-默认类型 - */ -bool CScheduleOperation::updateJobType(JobTypeInfo &oldJobTypeInfo, JobTypeInfo &newJobTypeInfo) -{ - //如果oldJobTypeInfo中typeno为0,则是新增 - if (0 == oldJobTypeInfo.getJobTypeNo()) { - return createJobType(newJobTypeInfo); - } - bool bRet = true; - //如果修改的日程类型没有改变则不处理 - if (oldJobTypeInfo == newJobTypeInfo) { - return bRet; - } - - //更新日程类型 - newJobTypeInfo.setJobTypeNo(oldJobTypeInfo.getJobTypeNo()); - //以“自定义颜色编码默认为0”来区分. - if (0 == newJobTypeInfo.getColorTypeNo()) { - //配置新颜色编号 - if (oldJobTypeInfo.getColorTypeNo() > 9) { - newJobTypeInfo.getColorInfo().setTypeNo(oldJobTypeInfo.getColorTypeNo()); + int duration = num - 1; + if (duration > 1) { + newinfo->recurrence()->setDuration(duration); } else { - newJobTypeInfo.getColorInfo().setTypeNo(JobTypeInfoManager::instance()->getNextColorTypeNo()); + //结束次数小于等于0表示不重复,设置为普通日程 + newinfo->setRRuleType(DSchedule::RRule_None); } - //保存新选择的颜色值 - CConfigSettings::getInstance()->setOption("LastUserColor", newJobTypeInfo.getColorInfo().getColorHex()); - } - - bRet = updateJobType(newJobTypeInfo); - //如果更新成功,且是系统默认颜色,缓存编号,只记录系统默认颜色的编号 - if (bRet && newJobTypeInfo.getColorInfo().getTypeNo() < 10) { - CConfigSettings::getInstance()->setOption("LastSysColorTypeNo", newJobTypeInfo.getColorInfo().getTypeNo()); + } else { + //如果该日程结束类型为永不和结束于日期则修改结束日期 + newinfo->recurrence()->setDuration(0); + QDateTime dtEnd(oldinfo->dtStart().addDays(-1)); + newinfo->recurrence()->setEndDateTime(dtEnd); } - return bRet; -} -/** - * @brief CScheduleOperation::updateJobType 修改日程类型 - * @param jobTypeInfo - * 只能更新名称和颜色编号 - */ -bool CScheduleOperation::updateJobType(const JobTypeInfo &jobTypeInfo) -{ - //修改日程 - QString strJson = ""; - JobTypeInfo::jobTypeInfoToJsonStr(jobTypeInfo, strJson); - return m_DBusManager->UpdateJobType(strJson); } -void CScheduleOperation::lunarMessageDialogShow(const ScheduleDataInfo &newinfo) +void CScheduleOperation::lunarMessageDialogShow(const DSchedule::Ptr &newinfo) { //如果该日程为闰月日程,因为对应的闰月需要间隔好多年,所以添加对应的提示信息 - CaHuangLiDayInfo huangLiInfo; - CScheduleDBus::getInstance()->GetHuangLiDay(newinfo.getBeginDateTime().date(), huangLiInfo); + CaHuangLiDayInfo huangLiInfo = gLunarManager->getHuangLiDay(newinfo->dtStart().date());; if (huangLiInfo.mLunarMonthName.contains("闰")) { DCalendarDDialog prompt(m_widget); prompt.setIcon(QIcon(CDynamicIcon::getInstance()->getPixmap())); @@ -472,65 +390,51 @@ } } -void CScheduleOperation::showLunarMessageDialog(const ScheduleDataInfo &newinfo, const ScheduleDataInfo &oldinfo) +void CScheduleOperation::showLunarMessageDialog(const DSchedule::Ptr &newinfo, const DSchedule::Ptr &oldinfo) { //在阴历每年重复情况下如果修改了开始时间或重复规则 - if (newinfo.getIsLunar() && RepetitionRule::RRule_EVEYEAR == newinfo.getRepetitionRule().getRuleId()) { - if (oldinfo.getBeginDateTime().date() != newinfo.getBeginDateTime().date() - || oldinfo.getRepetitionRule().getRuleId() != newinfo.getRepetitionRule().getRuleId() - || oldinfo.getIsLunar() != newinfo.getIsLunar()) { + //农历日程重复每年闰月是否提示 + if (newinfo->lunnar() && DSchedule::RRule_Year == newinfo->getRRuleType()) { + if (oldinfo->dtStart().date() != newinfo->dtStart().date() + || oldinfo->getRRuleType() != newinfo->getRRuleType() + || oldinfo->lunnar() != newinfo->lunnar()) { //判断是否为闰月 lunarMessageDialogShow(newinfo); } } } -/** - * @brief CScheduleOperation::getJobTypeList 获取日程类型列表 - * @param lstJobTypeInfo - * @return 操作结果 - */ -bool CScheduleOperation::getJobTypeList(QList &lstJobTypeInfo) + +bool CScheduleOperation::isFestival(const DSchedule::Ptr &schedule) { - QString strJson; - if (!m_DBusManager->GetJobTypeList(strJson)) { + //判断是否为节假日日程 + AccountItem::Ptr account = gAccountManager->getAccountItemByScheduleTypeId(schedule->scheduleTypeID()); + if (account.isNull()) { + qWarning() << "Cannot get account by schedule type,scheduleTypeID:" << schedule->scheduleTypeID(); return false; } - JobTypeInfo::jsonStrToJobTypeInfoList(strJson, lstJobTypeInfo); - return true; + DScheduleType::Ptr scheduleType = gAccountManager->getScheduleTypeByScheduleTypeId(schedule->scheduleTypeID()); + //如果为本地日程且日程类型为None则表示为节假日日程 + return account->getAccount()->accountType() == DAccount::Account_Local && scheduleType->privilege() == 0; } -/** - * @brief CScheduleOperation::deleteJobType 删除日程类型 - * @param iJobTypeNo - * @return 操作结果 - */ -bool CScheduleOperation::deleteJobType(const int iJobTypeNo) +bool CScheduleOperation::scheduleIsInvariant(const DSchedule::Ptr &schedule) { - //删除日程类型 - return m_DBusManager->DeleteJobType(iJobTypeNo); -} -/** - * @brief CScheduleOperation::isJobTypeUsed 获取日程类型是否被使用 - * @param iJobTypeNo - * @return 操作结果 - */ -bool CScheduleOperation::isJobTypeUsed(const int iJobTypeNo) -{ - //获取日程类型是否被使用 - return m_DBusManager->isJobTypeUsed(iJobTypeNo); -} + //如果为网络帐户,且没有网络或者帐户开关关闭 -/** - * @brief CScheduleOperation::getColorTypeList 获取颜色类型列表 - * @param lstColorTypeInfo - * @return 操作结果 - */ -bool CScheduleOperation::getColorTypeList(QList &lstColorTypeInfo) -{ - QString strJson; - if (!m_DBusManager->GetJobTypeColorList(strJson)) { + AccountItem::Ptr accountItem = gAccountManager->getAccountItemByScheduleTypeId(schedule->scheduleTypeID()); + if (accountItem.isNull()) return false; + DAccount::Ptr account = accountItem->getAccount(); + if (account->accountType() == DAccount::Account_UnionID) { + DOANetWorkDBus netManger; + //网络判断 + //如果uid日历同步关闭则日程不可修改 + if (netManger.getNetWorkState() != DOANetWorkDBus::Active + || !account->accountState().testFlag(DAccount::Account_Open) + || !account->accountState().testFlag(DAccount::Account_Calendar)) { + return true; + } } - return JobTypeInfo::jsonStrToColorTypeInfoList(strJson, lstColorTypeInfo); + return false; } diff -Nru dde-calendar-5.9.1/calendar-client/src/scheduleTask/cscheduleoperation.h dde-calendar-5.10.0/calendar-client/src/scheduleTask/cscheduleoperation.h --- dde-calendar-5.9.1/calendar-client/src/scheduleTask/cscheduleoperation.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/scheduleTask/cscheduleoperation.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,27 +1,12 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef CSCHEDULEOPERATION_H #define CSCHEDULEOPERATION_H #include "scheduledatamanage.h" +#include "accountitem.h" #include #include @@ -35,50 +20,39 @@ { Q_OBJECT public: - explicit CScheduleOperation(QWidget *parent = nullptr); + explicit CScheduleOperation(const AccountItem::Ptr &accountItem = nullptr, QWidget *parent = nullptr); + explicit CScheduleOperation(const QString &scheduleTypeID, QWidget *parent = nullptr); //创建日程 - bool createSchedule(const ScheduleDataInfo &scheduleInfo); + bool createSchedule(const DSchedule::Ptr &scheduleInfo); //修改日程 - bool changeSchedule(const ScheduleDataInfo &newInfo, const ScheduleDataInfo &oldInfo); + bool changeSchedule(const DSchedule::Ptr &newInfo, const DSchedule::Ptr &oldInfo); //删除日程 false :取消删除 true: 确定删除 - bool deleteSchedule(const ScheduleDataInfo &scheduleInfo); - //查询日程 - QString queryScheduleStr(const QString &key, const QDateTime &startTime, const QDateTime &endTime); - //获取查询日程 - bool queryScheduleInfo(const QString &key, const QDateTime &startTime, const QDateTime &endTime, QMap > &info); + bool deleteSchedule(const DSchedule::Ptr &scheduleInfo); //删除日程 仅删除此日程 不弹框提醒 - void deleteOnlyInfo(const ScheduleDataInfo &scheduleInfo); + void deleteOnlyInfo(const DSchedule::Ptr &scheduleInfo); + + + //是否为节假日日程 + static bool isFestival(const DSchedule::Ptr &schedule); + //日程是不可修改的 + static bool scheduleIsInvariant(const DSchedule::Ptr &schedule); - //创建日程类型 - bool createJobType(JobTypeInfo &jobTypeInfo);//新增时,颜色可能是:自定义/默认类型。以“自定义颜色编码默认为0”来区分. - //更新日程类型 - //更新名称和颜色,颜色可能是:自定义-自定义、自定义-默认类型、默认类型-默认类型 - bool updateJobType(JobTypeInfo &oldJobTypeInfo, JobTypeInfo &newJobTypeInfo); - //获取日程类型列表 - bool getJobTypeList(QList &lstJobTypeInfo); - //删除日程类型 - bool deleteJobType(const int iJobTypeNo); - //获取日程类型是否被使用 - bool isJobTypeUsed(const int iJobTypeNo); - //获取颜色类型列表 - bool getColorTypeList(QList &lstColorTypeInfo); private: //修改重复日程 - bool changeRecurInfo(const ScheduleDataInfo &newinfo, const ScheduleDataInfo &oldinfo); + bool changeRecurInfo(const DSchedule::Ptr &newinfo, const DSchedule::Ptr &oldinfo); //修改重复日程,仅修改此日程 - bool changeOnlyInfo(const ScheduleDataInfo &newinfo, const ScheduleDataInfo &oldinfo); + bool changeOnlyInfo(const DSchedule::Ptr &newinfo, const DSchedule::Ptr &oldinfo); //修改重复规则 - void changeRepetitionRule(ScheduleDataInfo &newinfo, const ScheduleDataInfo &oldinfo); - //更新日程类型(这里的接口是私有的,供updateJobType同名接口调用,在另一接口中做修改的逻辑,这里实现功能) - bool updateJobType(const JobTypeInfo &jobTypeInfo); + void changeRepetitionRule(DSchedule::Ptr &newinfo, const DSchedule::Ptr &oldinfo); + //农历每年闰月提示信息 - void lunarMessageDialogShow(const ScheduleDataInfo &newinfo); + void lunarMessageDialogShow(const DSchedule::Ptr &newinfo); //根据新旧日程信息判断是否提示 - void showLunarMessageDialog(const ScheduleDataInfo &newinfo, const ScheduleDataInfo &oldinfo); + void showLunarMessageDialog(const DSchedule::Ptr &newinfo, const DSchedule::Ptr &oldinfo); signals: public slots: private: - CScheduleDBus *m_DBusManager = nullptr; + AccountItem::Ptr m_accountItem; QWidget *m_widget; }; diff -Nru dde-calendar-5.9.1/calendar-client/src/scheduleTask/scheduletask.cpp dde-calendar-5.10.0/calendar-client/src/scheduleTask/scheduletask.cpp --- dde-calendar-5.9.1/calendar-client/src/scheduleTask/scheduletask.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/scheduleTask/scheduletask.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,332 +0,0 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ -#include "scheduletask.h" - -#include - -CScheduleTask::CScheduleTask(QObject *parent) - : QObject(parent) -{ - m_DBusManager = CScheduleDBus::getInstance(); - m_work = new DataGetWork(m_DBusManager); - connect(m_work, &DataGetWork::signalGetSchedule, this, &CScheduleTask::slotGetSchedule); - connect(m_work, &DataGetWork::signalGetLunar, this, &CScheduleTask::slotGetLunar); - connect(m_DBusManager, &CScheduleDBus::jobsUpdate, this, &CScheduleTask::jobsUpdate); - connect(m_DBusManager, &CScheduleDBus::jobsTypeOrColorUpdate, this, &CScheduleTask::jobsTypeOrColorUpdate); -} - -CScheduleTask::~CScheduleTask() -{ - delete m_work; - CScheduleDBus::releaseInstance(); -} - -/** - * @brief CScheduleTask::updateInfo 更新缓存信息 - * @param startDate 开始时间 - * @param stopDate 结束时间 - */ -void CScheduleTask::updateInfo(const QDate &startDate, const QDate &stopDate, const bool isGetLunar) -{ - m_queryScheduleInfo.clear(); - m_fullInfo.clear(); - if (isGetLunar) { - m_huangLiInfo.clear(); - m_festivalInfo.clear(); - } - addQueryRange(startDate, stopDate, isGetLunar); -} - -/** - * @brief CScheduleTask::hasScheduleInfo 判断是否含有日程信息 - * @param startDate 开始时间 - * @param stopDate 结束时间 - * @return - */ -bool CScheduleTask::hasScheduleInfo(const QDate &startDate, const QDate &stopDate) -{ - return m_queryScheduleInfo.contains(startDate) && m_queryScheduleInfo.contains(stopDate); -} - -/** - * @brief CScheduleTask::getScheduleInfo 获取缓存中日程信息 - * @param startDate 开始时间 - * @param stopDate 结束时间 - * @return - */ -QMap > CScheduleTask::getScheduleInfo(const QDate &startDate, const QDate &stopDate) -{ - QMap > _resultInfo{}; - qint64 _offsetDay = startDate.daysTo(stopDate); - QDate _infoDate = startDate; - for (int i = 0; i <= _offsetDay; ++i) { - _infoDate = startDate.addDays(i); - if (m_queryScheduleInfo.contains(_infoDate)) { - _resultInfo[_infoDate] = m_queryScheduleInfo[_infoDate]; - } - } - return _resultInfo; -} - -/** - * @brief CScheduleTask::getDateHasSchedule 获取日期是否含有日程标志 - * @return - */ -QMap CScheduleTask::getDateHasSchedule() const -{ - return m_fullInfo; -} - -/** - * @brief CScheduleTask::getHuangLiInfo 获取缓存中农历信息 - * @param startDate - * @param stopDate - * @return - */ -QMap CScheduleTask::getHuangLiInfo(const QDate &startDate, const QDate &stopDate) -{ - QMap _resultInfo{}; - qint64 _offsetDay = startDate.daysTo(stopDate); - QDate _infoDate = startDate; - for (int i = 0; i <= _offsetDay; ++i) { - _infoDate = startDate.addDays(i); - if (m_huangLiInfo.contains(_infoDate)) { - _resultInfo[_infoDate] = m_huangLiInfo[_infoDate]; - } - } - return _resultInfo; -} - -/** - * @brief CScheduleTask::getFestivalInfo 获取缓存中班休信息 - * @param startDate - * @param stopDate - * @return - */ -QMap CScheduleTask::getFestivalInfo(const QDate &startDate, const QDate &stopDate) -{ - QMap _resultInfo{}; - qint64 _offsetDay = startDate.daysTo(stopDate); - QDate _infoDate = startDate; - for (int i = 0; i <= _offsetDay; ++i) { - _infoDate = startDate.addDays(i); - if (m_festivalInfo.contains(_infoDate)) { - _resultInfo[_infoDate] = m_festivalInfo[_infoDate]; - } - } - return _resultInfo; -} - -/** - * @brief CScheduleTask::getSearchScheduleInfo 搜索日程 - * @param key 关键字 - * @param startTime 开始时间 - * @param endTime 结束时间 - * @return - */ -QMap > CScheduleTask::getSearchScheduleInfo(const QString &key, const QDateTime &startTime, const QDateTime &endTime) -{ - m_searchScheduleInfo.clear(); - m_searchScheduleInfoVector.clear(); - m_DBusManager->QueryJobs(key, startTime, endTime, m_searchScheduleInfo); - //获取搜索到的日程信息 - QMap >::const_iterator _iterator = nullptr; - for (_iterator = m_searchScheduleInfo.constBegin(); _iterator != m_searchScheduleInfo.constEnd(); ++_iterator) { - for (int i = 0; i < _iterator->size(); ++i) { - if (!m_searchScheduleInfoVector.contains(_iterator.value().at(i))) { - m_searchScheduleInfoVector.append(_iterator.value().at(i)); - } - } - } - //更新界面显示 - emit signalUpdateSearchSchedule(); - return m_searchScheduleInfo; -} - -/** - * @brief CScheduleTask::getSearchScheduleInfo 获取缓存中搜索结果 - * @return - */ -QMap > CScheduleTask::getSearchScheduleInfo() const -{ - return m_searchScheduleInfo; -} - -/** - * @brief CScheduleTask::getSearchScheduleInfoVector 获取缓存搜到的日程 - * @return - */ -QVector CScheduleTask::getSearchScheduleInfoVector() const -{ - return m_searchScheduleInfoVector; -} - -/** - * @brief CScheduleTask::clearSearchScheduleInfo 清空搜索日程信息 - */ -void CScheduleTask::clearSearchScheduleInfo() -{ - m_searchScheduleInfo.clear(); - m_searchScheduleInfoVector.clear(); - //更新界面显示 - emit signalUpdateSearchSchedule(); -} - -/** - * @brief CScheduleTask::addQueryRange 添加需要查询日程的时间范围 - * @param startDate 开始时间 - * @param stopDate 结束时间 - */ -void CScheduleTask::addQueryRange(const QDate &startDate, const QDate &stopDate, const bool isGetLunar) -{ - m_work->addQueryRange(startDate, stopDate, isGetLunar); -} - -/** - * @brief CScheduleTask::slotGetSchedule 接收查询的日程信息 - * @param scheduleInfo - * @param hasSchedule - */ -void CScheduleTask::slotGetSchedule(const QMap > &scheduleInfo, const QMap &hasSchedule) -{ - m_queryScheduleInfo = scheduleInfo; - m_fullInfo = hasSchedule; - emit signalUpdateScheduleShow(); -} - -void CScheduleTask::slotGetLunar(const QMap &lunarInfo, const QMap &festivalInfo) -{ - m_huangLiInfo = lunarInfo; - m_festivalInfo = festivalInfo; - emit signalLunarGetSuccess(); -} - -DataGetWork::DataGetWork(CScheduleDBus *_DataManage) - : m_DataManage(_DataManage) -{ - -} - -DataGetWork::~DataGetWork() -{ - -} - -/** - * @brief DataGetWork::addQueryRange 添加查询范围 - * @param startDate 开始时间 - * @param stopDate 结束时间 - */ -void DataGetWork::addQueryRange(const QDate &startDate, const QDate &stopDate, const bool isGetLunar) -{ - QueryRange _queryRange{startDate, stopDate}; - m_isGetLunar = isGetLunar; - //添加查询 - m_queryScheduleRange.append(_queryRange); - startQuery(); -} - -/** - * @brief DataGetWork::startQuery 开始查询 - */ -void DataGetWork::startQuery() -{ - //如果需要查询日期的缓存不为空则开始查询 - if (m_queryScheduleRange.size() > 0) { - QueryRange _queryRange; - //获取最后一个 - _queryRange = m_queryScheduleRange.last(); - //清空 - m_queryScheduleRange.clear(); - //是否获取农历信息 - if (m_isGetLunar) { - queryLunarInfo(_queryRange); - } - queryScheduleInfo(_queryRange); - } -} - -/** - * @brief DataGetWork::queryScheduleInfo 查询日程信息 - */ -void DataGetWork::queryScheduleInfo(const QueryRange &queryRange) -{ - QMap > _queryScheduleInfo{}; - QMap _dateHasSchedule{}; - //查询日程数据 - m_DataManage->GetJobs(queryRange._startDate, queryRange._stopDate, _queryScheduleInfo); - QMap >::const_iterator _infoIter = _queryScheduleInfo.constBegin(); - //遍历确认这些日期是否包含日程 - for (; _infoIter != _queryScheduleInfo.constEnd(); ++_infoIter) { - _queryScheduleInfo[_infoIter.key()] = _infoIter.value(); - _dateHasSchedule[_infoIter.key()] = _infoIter.value().size() > 0 ? true : false; - } - //如果缓存为空则更新 - if (m_queryScheduleRange.size() == 0) - emit signalGetSchedule(_queryScheduleInfo, _dateHasSchedule); -} - -void DataGetWork::queryLunarInfo(const QueryRange &queryRange) -{ - bool _fill = false; - CaHuangLiMonthInfo _monthInfo; - QMap _huangLiYear {}; - QMap _festivalYear{}; - quint32 _year ; - quint32 _month ; - QDate _beginDate; - QVector _festivallist{}; - //获取开始时间和结束时间相差多少个月 - const int _offsetMonth = (queryRange._stopDate.year() - queryRange._startDate.year()) * 12 + queryRange._stopDate.month() - queryRange._startDate.month(); - //获取开始时间至结束时间所在月的农历和节假日信息 - for (int i = 0; i <= _offsetMonth; ++i) { - _monthInfo.clear(); - _beginDate = queryRange._startDate.addMonths(i); - _year = static_cast(_beginDate.year()); - _month = static_cast(_beginDate.month()); - m_DataManage->GetFestivalMonth(_year, _month, _festivallist); - m_DataManage->GetHuangLiMonth(_year, _month, _fill, _monthInfo); - QDate _getDate(_beginDate.year(), _beginDate.month(), 1); - Q_ASSERT(_monthInfo.mDays == _monthInfo.mCaLunarDayInfo.size()); - for (int j = 0; j < _monthInfo.mDays; ++j) { - _huangLiYear[_getDate.addDays(j)] = _monthInfo.mCaLunarDayInfo.at(j); - } - } - QDate _queryDate; - //获取全年的班休信息 - for (int i = 0; i <= queryRange._startDate.daysTo(queryRange._stopDate); ++i) { - _queryDate = queryRange._startDate.addDays(i); - _festivalYear[_queryDate] = getFestivalInfoByDate(_queryDate, _festivallist); - } - emit signalGetLunar(_huangLiYear, _festivalYear); -} - -char DataGetWork::getFestivalInfoByDate(const QDate &date, const QVector &festivalInfo) -{ - for (int i = 0; i < festivalInfo.count(); i++) { - for (int j = 0; j < festivalInfo[i].listHoliday.count(); j++) { - if (festivalInfo[i].listHoliday[j].date == date) { - return festivalInfo[i].listHoliday[j].status; - } - } - } - return 0; -} diff -Nru dde-calendar-5.9.1/calendar-client/src/scheduleTask/scheduletask.h dde-calendar-5.10.0/calendar-client/src/scheduleTask/scheduletask.h --- dde-calendar-5.9.1/calendar-client/src/scheduleTask/scheduletask.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/scheduleTask/scheduletask.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,131 +0,0 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ -#ifndef SCHEDULETASK_H -#define SCHEDULETASK_H - -#include "cscheduledbus.h" -#include "src/scheduledatainfo.h" -#include "src/calendardatastruct.h" - -#include -#include -#include -#include - -struct QueryRange { - QDate _startDate; //开始日期 - QDate _stopDate; //结束日期 -}; - -class DataGetWork; -class CScheduleTask : public QObject -{ - Q_OBJECT -public: - explicit CScheduleTask(QObject *parent = nullptr); - ~CScheduleTask(); -public: - //更新缓存信息 - void updateInfo(const QDate &startDate, const QDate &stopDate, const bool isGetLunar = false); - //判断是否含有这个时间段的日程信息 - bool hasScheduleInfo(const QDate &startDate, const QDate &stopDate); - //获取缓存中日程信息 - QMap > getScheduleInfo(const QDate &startDate, const QDate &stopDate); - //获取日期是否含有日程标志 - QMap getDateHasSchedule() const; - //获取缓存中农历信息 - QMap getHuangLiInfo(const QDate &startDate, const QDate &stopDate); - //获取缓存中班休信息 - QMap getFestivalInfo(const QDate &startDate, const QDate &stopDate); - //获取搜索信息 - QMap > getSearchScheduleInfo(const QString &key, const QDateTime &startTime, const QDateTime &endTime); - //获取缓存中搜索结果 - QMap > getSearchScheduleInfo() const; - //获取缓存搜到的日程 - QVector getSearchScheduleInfoVector() const; - //清空搜索日程 - void clearSearchScheduleInfo(); -private: - //添加查询时间范围 - void addQueryRange(const QDate &startDate, const QDate &stopDate, const bool isGetLunar); -signals: - //日程获取成功信号 - void signalUpdateScheduleShow(); - //搜索日程更新 - void signalUpdateSearchSchedule(); - //农历信息获取成功信号 - void signalLunarGetSuccess(); - //日程更新信号 - void jobsUpdate(); - - void jobsTypeOrColorUpdate(); -public slots: - //接收查询的日程信息 - void slotGetSchedule(const QMap > &scheduleInfo, const QMap &hasSchedule); - //接收农历信息 - void slotGetLunar(const QMap &lunarInfo, const QMap &festivalInfo); -private: - QThread m_workerThread; - CScheduleDBus *m_DBusManager = nullptr; - DataGetWork *m_work = nullptr; - //一年的日程信息 - QMap > m_queryScheduleInfo{}; - //一年是否含有日程 - QMap m_fullInfo{}; - //一年的黄历信息 - QMap m_huangLiInfo {}; - //一年的班休信息 - QMap m_festivalInfo{}; - //搜索的日程信息 - QMap > m_searchScheduleInfo{}; - QVector m_searchScheduleInfoVector{}; -}; - - -class DataGetWork : public QObject -{ - Q_OBJECT -public: - explicit DataGetWork(CScheduleDBus *_DataManage); - ~DataGetWork(); -public: - //添加查询时间范围 - void addQueryRange(const QDate &startDate, const QDate &stopDate, const bool isGetLunar); -private: - //查询日程信息 - void queryScheduleInfo(const QueryRange &queryRange); - //查询农历信息 - void queryLunarInfo(const QueryRange &queryRange); - //根据时间获取班休信息 - char getFestivalInfoByDate(const QDate &date, const QVector &festivalInfo); -signals: - void signalGetSchedule(const QMap > &scheduleInfo, const QMap &hasSchedule); - void signalGetLunar(const QMap &lunarInfo, const QMap &festivalInfo); -public slots: - // 开始查询 - void startQuery(); -private: - CScheduleDBus *m_DataManage = nullptr; - QVector m_queryScheduleRange{}; - bool m_isGetLunar{false}; -}; - -#endif // SCHEDULETASK_H diff -Nru dde-calendar-5.9.1/calendar-client/src/settingstranslation.cpp dde-calendar-5.10.0/calendar-client/src/settingstranslation.cpp --- dde-calendar-5.9.1/calendar-client/src/settingstranslation.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/settingstranslation.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,9 +0,0 @@ -#include - -void GenerateSettingTranslate() -{ - auto manage_calendar = QObject::tr("Manage calendar"); - auto event_type = QObject::tr("Event types"); - Q_UNUSED(manage_calendar); - Q_UNUSED(event_type); -} diff -Nru dde-calendar-5.9.1/calendar-client/src/shortcut.cpp dde-calendar-5.10.0/calendar-client/src/shortcut.cpp --- dde-calendar-5.9.1/calendar-client/src/shortcut.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/shortcut.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,21 +1,6 @@ -/* - * Copyright (C) 2017 ~ 2018 Deepin Technology Co., Ltd. - * - * Maintainer: Peng Hui - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later #include "shortcut.h" diff -Nru dde-calendar-5.9.1/calendar-client/src/shortcut.h dde-calendar-5.10.0/calendar-client/src/shortcut.h --- dde-calendar-5.9.1/calendar-client/src/shortcut.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/shortcut.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,21 +1,6 @@ -/* - * Copyright (C) 2017 ~ 2018 Deepin Technology Co., Ltd. - * - * Maintainer: Peng Hui - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later #ifndef SHORTCUT_H #define SHORTCUT_H diff -Nru dde-calendar-5.9.1/calendar-client/src/singleton.h dde-calendar-5.10.0/calendar-client/src/singleton.h --- dde-calendar-5.9.1/calendar-client/src/singleton.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/singleton.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,6 @@ -/* - * Copyright (C) 2016 ~ 2018 Wuhan Deepin Technology Co., Ltd. - * - * Author: Iceyer - * - * Maintainer: Iceyer - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2016 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later #pragma once #include diff -Nru dde-calendar-5.9.1/calendar-client/src/tabletconfig.cpp dde-calendar-5.10.0/calendar-client/src/tabletconfig.cpp --- dde-calendar-5.9.1/calendar-client/src/tabletconfig.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/tabletconfig.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "tabletconfig.h" //默认不为平板模式 diff -Nru dde-calendar-5.9.1/calendar-client/src/tabletconfig.h dde-calendar-5.10.0/calendar-client/src/tabletconfig.h --- dde-calendar-5.9.1/calendar-client/src/tabletconfig.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/tabletconfig.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TABLETCONFIG_H #define TABLETCONFIG_H diff -Nru dde-calendar-5.9.1/calendar-client/src/view/alldayeventview.cpp dde-calendar-5.10.0/calendar-client/src/view/alldayeventview.cpp --- dde-calendar-5.9.1/calendar-client/src/view/alldayeventview.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/view/alldayeventview.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,21 +1,7 @@ -/* - * Copyright (C) 2017 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: kirigaya - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "alldayeventview.h" #include "schedulecoormanage.h" #include "schedulectrldlg.h" @@ -59,7 +45,7 @@ bool CAllDayEventWeekView::MeetCreationConditions(const QDateTime &date) { - return qAbs(date.daysTo(m_PressDate) < 7); + return qAbs(date.daysTo(m_PressDate)) < 7; } void CAllDayEventWeekView::slotCreate(const QDateTime &date) @@ -93,21 +79,19 @@ m_rightMenu->exec(QCursor::pos()); } -void CAllDayEventWeekView::MoveInfoProcess(ScheduleDataInfo &info, const QPointF &pos) +void CAllDayEventWeekView::MoveInfoProcess(DSchedule::Ptr &info, const QPointF &pos) { Q_UNUSED(pos); - if (info.getAllDay()) { + if (info->allDay()) { qint64 offset = m_PressDate.daysTo(m_MoveDate); - info.setBeginDateTime(info.getBeginDateTime().addDays(offset)); - info.setEndDateTime(info.getEndDateTime().addDays(offset)); + info->setDtStart(info->dtStart().addDays(offset)); + info->setDtEnd(info->dtEnd().addDays(offset)); } else { - qint64 offset = info.getBeginDateTime().daysTo(info.getEndDateTime()); - info.setAllDay(true); -// info.remind = true; - info.getRemindData().setRemindTime(QTime(9, 0)); - info.getRemindData().setRemindNum(1); - m_DragScheduleInfo.setBeginDateTime(QDateTime(m_MoveDate.date(), QTime(0, 0, 0))); - m_DragScheduleInfo.setEndDateTime(QDateTime(m_MoveDate.addDays(offset).date(), QTime(23, 59, 59))); + qint64 offset = info->dtStart().daysTo(info->dtEnd()); + info->setAllDay(true); + info->setAlarmType(DSchedule::Alarm_15Hour_Front); + m_DragScheduleInfo->setDtStart(QDateTime(m_MoveDate.date(), QTime(0, 0, 0))); + m_DragScheduleInfo->setDtEnd(QDateTime(m_MoveDate.addDays(offset).date(), QTime(23, 59, 59))); } upDateInfoShow(ChangeWhole, info); } @@ -133,7 +117,7 @@ * @brief CAllDayEventWeekView::setSelectSearchSchedule 设置搜索选中日程 * @param info */ -void CAllDayEventWeekView::setSelectSearchSchedule(const ScheduleDataInfo &info) +void CAllDayEventWeekView::setSelectSearchSchedule(const DSchedule::Ptr &info) { DragInfoGraphicsView::setSelectSearchSchedule(info); for (int i = 0; i < m_baseShowItem.size(); ++i) { @@ -170,9 +154,9 @@ } } -void CAllDayEventWeekView::upDateInfoShow(const DragStatus &status, const ScheduleDataInfo &info) +void CAllDayEventWeekView::upDateInfoShow(const DragStatus &status, const DSchedule::Ptr &info) { - QVector vListData; + DSchedule::List vListData; vListData = m_scheduleInfo; switch (status) { case NONE: @@ -196,8 +180,13 @@ QVector vMDaySchedule; for (int i = 0; i < vListData.count(); i++) { - QDate tbegindate = vListData.at(i).getBeginDateTime().date(); - QDate tenddate = vListData.at(i).getEndDateTime().date(); + DSchedule::Ptr ptr = vListData.at(i); + if (ptr.isNull()) { + continue; + } + + QDate tbegindate = ptr->dtStart().date(); + QDate tenddate = ptr->dtEnd().date(); if (tbegindate < m_beginDate) tbegindate = m_beginDate; if (tenddate > m_endDate) @@ -205,7 +194,7 @@ MScheduleDateRangeInfo sinfo; sinfo.bdate = tbegindate; sinfo.edate = tenddate; - sinfo.tData = vListData.at(i); + sinfo.tData = ptr; sinfo.state = false; vMDaySchedule.append(sinfo); } @@ -248,7 +237,7 @@ if (flag) vMDaySchedule[i].state = true; } - QVector> vResultData; + QVector vResultData; for (int i = 0; i < vListData.count(); i++) { QVector vId; for (int j = 0; j < tNum; j++) { @@ -262,7 +251,7 @@ vId.append(vCfillSchedule[i][j]); } } - QVector tData; + DSchedule::List tData; for (int j = 0; j < vId.count(); j++) { tData.append(vMDaySchedule[vId[j]].tData); } @@ -294,13 +283,13 @@ { } -void CAllDayEventWeekView::setDayData(const QVector> &vlistData) +void CAllDayEventWeekView::setDayData(const QVector &vlistData) { m_vlistData = vlistData; updateDateShow(); } -void CAllDayEventWeekView::setInfo(const QVector &info) +void CAllDayEventWeekView::setInfo(const DSchedule::List &info) { m_scheduleInfo = info; } @@ -370,8 +359,8 @@ { Q_UNUSED(average) for (int i = 0; i < m_vlistData[index].size(); ++i) { - const ScheduleDataInfo &info = m_vlistData[index].at(i); - QRectF drawrect = m_coorManage->getAllDayDrawRegion(info.getBeginDateTime().date(), info.getEndDateTime().date()); + const DSchedule::Ptr &info = m_vlistData[index].at(i); + QRectF drawrect = m_coorManage->getAllDayDrawRegion(info->dtStart().date(), info->dtEnd().date()); drawrect.setY(2 + (itemHeight + 1) * index); drawrect.setHeight(itemHeight); @@ -417,6 +406,5 @@ void CAllDayEventWeekView::slotUpdateScene() { - pressScheduleInit(); this->scene()->update(); } diff -Nru dde-calendar-5.9.1/calendar-client/src/view/alldayeventview.h dde-calendar-5.10.0/calendar-client/src/view/alldayeventview.h --- dde-calendar-5.9.1/calendar-client/src/view/alldayeventview.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/view/alldayeventview.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,21 +1,7 @@ -/* - * Copyright (C) 2017 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: kirigaya - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef ALLDAYEVENTVIEW_H #define ALLDAYEVENTVIEW_H @@ -38,15 +24,15 @@ public: CAllDayEventWeekView(QWidget *parent = nullptr, ViewPosition type = WeekPos); ~CAllDayEventWeekView() override; - void setDayData(const QVector> &vlistData); - void setInfo(const QVector &info); - QVector> &getListData() + void setDayData(const QVector &vlistData); + void setInfo(const DSchedule::List &info); + QVector &getListData() { return m_vlistData; } void updateHeight(); //获取搜索选中日程 - void setSelectSearchSchedule(const ScheduleDataInfo &info) override; + void setSelectSearchSchedule(const DSchedule::Ptr &info) override; void setMargins(int left, int top, int right, int bottom); //更新日程显示 void updateInfo() override; @@ -68,12 +54,13 @@ //根据鼠标移动的距离判断是否创建日程 bool JudgeIsCreate(const QPointF &pos) override; void RightClickToCreate(QGraphicsItem *listItem, const QPoint &pos) override; - void MoveInfoProcess(ScheduleDataInfo &info, const QPointF &pos) override; + void MoveInfoProcess(DSchedule::Ptr &info, const QPointF &pos) override; QDateTime getDragScheduleInfoBeginTime(const QDateTime &moveDateTime) override; QDateTime getDragScheduleInfoEndTime(const QDateTime &moveDateTime) override; PosInItem getPosInItem(const QPoint &p, const QRectF &itemRect) override; QDateTime getPosDate(const QPoint &p) override; - void upDateInfoShow(const DragStatus &status = NONE, const ScheduleDataInfo &info = ScheduleDataInfo()) override; + void upDateInfoShow(const DragStatus &status = NONE, const DSchedule::Ptr &info = DSchedule::Ptr()) override; + protected: void mouseDoubleClickEvent(QMouseEvent *event) override; void wheelEvent(QWheelEvent *event) override; @@ -83,8 +70,8 @@ void updateItemHeightByFontSize(); private: int itemHeight = 22; - QVector> m_vlistData; - QVector m_scheduleInfo; + QVector m_vlistData; + QVector m_scheduleInfo; QVector m_baseShowItem; bool m_updateDflag = false; }; diff -Nru dde-calendar-5.9.1/calendar-client/src/view/cgraphicsscene.cpp dde-calendar-5.10.0/calendar-client/src/view/cgraphicsscene.cpp --- dde-calendar-5.9.1/calendar-client/src/view/cgraphicsscene.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/view/cgraphicsscene.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "cgraphicsscene.h" #include "graphicsItem/cscenebackgrounditem.h" diff -Nru dde-calendar-5.9.1/calendar-client/src/view/cgraphicsscene.h dde-calendar-5.10.0/calendar-client/src/view/cgraphicsscene.h --- dde-calendar-5.9.1/calendar-client/src/view/cgraphicsscene.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/view/cgraphicsscene.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef CGRAPHICSSCENE_H #define CGRAPHICSSCENE_H diff -Nru dde-calendar-5.9.1/calendar-client/src/view/cweekdaygraphicsview.cpp dde-calendar-5.10.0/calendar-client/src/view/cweekdaygraphicsview.cpp --- dde-calendar-5.9.1/calendar-client/src/view/cweekdaygraphicsview.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/view/cweekdaygraphicsview.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "cweekdaygraphicsview.h" #include "constants.h" diff -Nru dde-calendar-5.9.1/calendar-client/src/view/cweekdaygraphicsview.h dde-calendar-5.10.0/calendar-client/src/view/cweekdaygraphicsview.h --- dde-calendar-5.9.1/calendar-client/src/view/cweekdaygraphicsview.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/view/cweekdaygraphicsview.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef CWEEKDAYGRAPHICSVIEW_H #define CWEEKDAYGRAPHICSVIEW_H diff -Nru dde-calendar-5.9.1/calendar-client/src/view/draginfographicsview.cpp dde-calendar-5.10.0/calendar-client/src/view/draginfographicsview.cpp --- dde-calendar-5.9.1/calendar-client/src/view/draginfographicsview.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/view/draginfographicsview.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "draginfographicsview.h" #include "scheduledlg.h" #include "schedulectrldlg.h" @@ -27,6 +11,7 @@ #include "graphicsItem/cscenebackgrounditem.h" #include "calendarglobalenv.h" #include "scheduledatamanage.h" +#include "graphicsItem/scheduleitem.h" #include @@ -46,7 +31,7 @@ #include //定义拖拽日程 -ScheduleDataInfo DragInfoGraphicsView::m_DragScheduleInfo; +DSchedule::Ptr DragInfoGraphicsView::m_DragScheduleInfo; bool DragInfoGraphicsView::m_hasUpdateMark = false; DragInfoGraphicsView::DragInfoGraphicsView(DWidget *parent) @@ -92,12 +77,13 @@ connect(m_Scene, &CGraphicsScene::signalsetNextFocus, this, &DragInfoGraphicsView::slotsetNextFocus); setFocusPolicy(Qt::StrongFocus); //日程类型发生改变,刷新界面 - JobTypeInfoManager::instance()->addToNoticeBill(this->viewport(), "update"); + connect(gAccountManager, &AccountManager::signalScheduleTypeUpdate, [&]() { + this->viewport()->update(); + }); } DragInfoGraphicsView::~DragInfoGraphicsView() { - JobTypeInfoManager::instance()->removeFromNoticeBill(this->viewport()); } void DragInfoGraphicsView::mousePressEvent(QMouseEvent *event) @@ -227,84 +213,91 @@ DragInfoItem::setPressFlag(false); } - DragInfoItem *item = dynamic_cast(itemAt(event->pos())); - - if (item != nullptr) { - if (item->getData().getType() != DDECalendar::FestivalTypeID) { - if (m_DragStatus == NONE) { - switch (getPosInItem(event->pos(), item->rect())) { - case LEFT: - case RIGHT: - setCursor(Qt::SplitHCursor); - break; - case TOP: - case BOTTOM: - setCursor(Qt::SplitVCursor); - break; - default: - setCursor(Qt::ArrowCursor); - break; + if (m_DragStatus == NONE) { + DragInfoItem *item = dynamic_cast(itemAt(event->pos())); + if (item != nullptr) { + if (isCanDragge(item->getData())) { + if (m_DragStatus == NONE) { + switch (getPosInItem(event->pos(), item->rect())) { + case LEFT: + case RIGHT: + setCursor(Qt::SplitHCursor); + break; + case TOP: + case BOTTOM: + setCursor(Qt::SplitVCursor); + break; + default: + setCursor(Qt::ArrowCursor); + break; + } } } + } else { + if (m_DragStatus == NONE) { + setCursor(Qt::ArrowCursor); + } } } else { - if (m_DragStatus == NONE) { - setCursor(Qt::ArrowCursor); - } - } - QDateTime gDate = getPosDate(event->pos()); - switch (m_DragStatus) { - case IsCreate: - m_isCreate = JudgeIsCreate(event->pos()); - if (m_isCreate) { + QDateTime gDate = getPosDate(event->pos()); + switch (m_DragStatus) { + case IsCreate: + if (gDate.date().year() >= DDECalendar::QueryEarliestYear && gDate.date().year() <= DDECalendar::QueryLatestYear) { + if (m_PressDate.date().year() >= DDECalendar::QueryEarliestYear && m_PressDate.date().year() <= DDECalendar::QueryLatestYear) { + //如果拖拽创建为false则判断是否可被创建。如果为true则不需要判断 + m_isCreate = m_isCreate ? m_isCreate : JudgeIsCreate(event->pos()); + if (m_isCreate) { + if (!IsEqualtime(m_MoveDate, gDate)) { + m_MoveDate = gDate; + m_DragScheduleInfo = getScheduleInfo(m_PressDate, m_MoveDate); + upDateInfoShow(IsCreate, m_DragScheduleInfo); + //更新背景上显示的item + updateBackgroundShowItem(); + setPressSelectInfo(m_DragScheduleInfo); + } + } + } + } + break; + case ChangeBegin: if (!IsEqualtime(m_MoveDate, gDate)) { m_MoveDate = gDate; - m_DragScheduleInfo = getScheduleInfo(m_PressDate, m_MoveDate); - upDateInfoShow(IsCreate, m_DragScheduleInfo); - //更新背景上显示的item - updateBackgroundShowItem(); - setPressSelectInfo(m_DragScheduleInfo); + //获取日程开始时间 + QDateTime _beginTime = getDragScheduleInfoBeginTime(m_MoveDate); + m_DragScheduleInfo->setDtStart(_beginTime); + m_DragScheduleInfo->setDtEnd(m_InfoEndTime); + upDateInfoShow(ChangeBegin, m_DragScheduleInfo); } - } - break; - case ChangeBegin: - if (!IsEqualtime(m_MoveDate, gDate)) { - m_MoveDate = gDate; - //获取日程开始时间 - QDateTime _beginTime = getDragScheduleInfoBeginTime(m_MoveDate); - m_DragScheduleInfo.setBeginDateTime(_beginTime); - m_DragScheduleInfo.setEndDateTime(m_InfoEndTime); - upDateInfoShow(ChangeBegin, m_DragScheduleInfo); - } - break; - case ChangeEnd: - if (!IsEqualtime(m_MoveDate, gDate)) { - m_MoveDate = gDate; - m_DragScheduleInfo.setBeginDateTime(m_InfoBeginTime); - //获取结束时间 - QDateTime _endTime = getDragScheduleInfoEndTime(m_MoveDate); - m_DragScheduleInfo.setEndDateTime(_endTime); - upDateInfoShow(ChangeEnd, m_DragScheduleInfo); - } - break; - case ChangeWhole: { - if (!m_PressRect.contains(event->pos())) { - //拖拽前设置是否已经更新日程界面标志为否 - m_hasUpdateMark = false; - m_Drag->exec(Qt::MoveAction); - m_Drag = nullptr; - m_DragStatus = NONE; - setCursor(Qt::ArrowCursor); - //如果拖拽结束后没有修改日程则更新下界面日程显示 - if (!m_hasUpdateMark) { - updateInfo(); + break; + case ChangeEnd: + if (!IsEqualtime(m_MoveDate, gDate)) { + m_MoveDate = gDate; + m_DragScheduleInfo->setDtStart(m_InfoBeginTime); + //获取结束时间 + QDateTime _endTime = getDragScheduleInfoEndTime(m_MoveDate); + m_DragScheduleInfo->setDtEnd(_endTime); + upDateInfoShow(ChangeEnd, m_DragScheduleInfo); + } + break; + case ChangeWhole: { + if (!m_PressRect.contains(event->pos())) { + //拖拽前设置是否已经更新日程界面标志为否 + m_hasUpdateMark = false; + m_Drag->exec(Qt::MoveAction); + m_Drag = nullptr; + m_DragStatus = NONE; + setCursor(Qt::ArrowCursor); + //如果拖拽结束后没有修改日程则更新下界面日程显示 + if (!m_hasUpdateMark) { + updateInfo(); + } } + } break; + default: + break; } } - break; - default: - break; - } + DGraphicsView::mouseMoveEvent(event); } @@ -329,11 +322,19 @@ QGraphicsItem *listItem = itemAt(event->pos()); DragInfoItem *infoitem = dynamic_cast(listItem); + CScheduleItem *tt = dynamic_cast(listItem); + if (tt != nullptr && tt->getType() != 0) { + return; + } if (infoitem != nullptr) { - if (infoitem->getData().getType() != DDECalendar::FestivalTypeID) { + //是否为节假日日程判断 + if (!CScheduleOperation::isFestival(infoitem->getData())) { m_rightMenu->clear(); m_rightMenu->addAction(m_editAction); m_rightMenu->addAction(m_deleteAction); + //如果日程是不可修改的则设置删除按钮无效 + m_deleteAction->setEnabled(!CScheduleOperation::scheduleIsInvariant(infoitem->getData())); + QAction *action_t = m_rightMenu->exec(QCursor::pos()); if (action_t == m_editAction) { @@ -357,17 +358,17 @@ void DragInfoGraphicsView::dragEnterEvent(QDragEnterEvent *event) { if (event->mimeData()->hasFormat("Info")) { - QJsonParseError json_error; QString str = event->mimeData()->data("Info"); - QJsonDocument jsonDoc(QJsonDocument::fromJson(str.toLocal8Bit(), &json_error)); + DSchedule::Ptr info; + DSchedule::fromJsonString(info, str); - if (json_error.error != QJsonParseError::NoError) { + if (info.isNull()) { event->ignore(); } - QJsonObject rootobj = jsonDoc.object(); - ScheduleDataInfo info = ScheduleDataInfo::JsonToSchedule(rootobj); - if ((event->source() != this && info.getRepetitionRule().getRuleId() > 0) || info.getType() == DDECalendar::FestivalTypeID) { + //如果该日程是不能被拖拽的则忽略不接受 + //重复日程不能被切换全天和非全天 + if ((event->source() != this && info->recurs()) || !isCanDragge(info)) { event->ignore(); } else { event->accept(); @@ -400,8 +401,8 @@ if (!IsEqualtime(m_MoveDate, gDate)) { m_MoveDate = gDate; QJsonObject rootobj = jsonDoc.object(); - m_DragScheduleInfo = ScheduleDataInfo::JsonToSchedule(rootobj); - m_DragScheduleInfo.setIsMoveInfo(true); + DSchedule::fromJsonString(m_DragScheduleInfo, str); + m_DragScheduleInfo->setMoved(true); MoveInfoProcess(m_DragScheduleInfo, event->posF()); DragInfoItem::setPressSchedule(m_DragScheduleInfo); } @@ -411,12 +412,19 @@ { if (event->mimeData()->hasFormat("Info")) { if (event->source() != this || m_MoveDate != m_PressDate) { - updateScheduleInfo(m_DragScheduleInfo); - } else { - emit signalsUpdateSchedule(); + //后面方法出现模态框,阻塞,导致拖拽图片不消失,手动先调用取消接口解决 + QDrag::cancel(); + + auto startDate = m_DragScheduleInfo->dtStart(); + auto endDate = m_DragScheduleInfo->dtEnd(); + if (startDate.date().year() >= DDECalendar::QueryEarliestYear && endDate.date().year() <= DDECalendar::QueryLatestYear) { + updateScheduleInfo(m_DragScheduleInfo); + } else { + emit signalsUpdateSchedule(); + } + m_DragStatus = NONE; + m_MoveDate = m_MoveDate.addMonths(-2); } - m_DragStatus = NONE; - m_MoveDate = m_MoveDate.addMonths(-2); } } @@ -481,7 +489,7 @@ * @brief DragInfoGraphicsView::setPressSelectInfo 设置点击选中日程 * @param info */ -void DragInfoGraphicsView::setPressSelectInfo(const ScheduleDataInfo &info) +void DragInfoGraphicsView::setPressSelectInfo(const DSchedule::Ptr &info) { DragInfoItem::setPressSchedule(info); } @@ -490,14 +498,14 @@ * @brief DragInfoGraphicsView::updateScheduleInfo 拖拽更新日程信息 * @param info */ -void DragInfoGraphicsView::updateScheduleInfo(const ScheduleDataInfo &info) +void DragInfoGraphicsView::updateScheduleInfo(const DSchedule::Ptr &info) { QVariant variant; //获取主窗口指针 CalendarGlobalEnv::getGlobalEnv()->getValueByKey("MainWindow", variant); QObject *parent = static_cast(variant.value()); //设置父类为主窗口 - CScheduleOperation _scheduleOperation(qobject_cast(parent)); + CScheduleOperation _scheduleOperation(info->scheduleTypeID(), qobject_cast(parent)); if (_scheduleOperation.changeSchedule(info, m_PressScheduleInfo)) { //如果日程修改成功则更新更新标志 m_hasUpdateMark = true; @@ -517,13 +525,14 @@ if (item != nullptr) { PosInItem mpressstatus = getPosInItem(pos, item->boundingRect()); - if (mpressstatus != MIDDLE && item->getData().getType() == 4) { + if (mpressstatus != MIDDLE && !isCanDragge(item->getData())) { return; } - m_DragScheduleInfo = item->getData(); + //拖拽使用副本,不更改原始日程 + m_DragScheduleInfo.reset(item->getData()->clone()); m_PressScheduleInfo = item->getData(); - m_InfoBeginTime = m_DragScheduleInfo.getBeginDateTime(); - m_InfoEndTime = m_DragScheduleInfo.getEndDateTime(); + m_InfoBeginTime = m_DragScheduleInfo->dtStart(); + m_InfoEndTime = m_DragScheduleInfo->dtEnd(); switch (mpressstatus) { case TOP: m_DragStatus = ChangeBegin; @@ -545,8 +554,11 @@ ShowSchedule(item); m_DragStatus = ChangeWhole; QMimeData *mimeData = new QMimeData(); - mimeData->setText(m_DragScheduleInfo.getTitleName()); - mimeData->setData("Info", ScheduleDataInfo::ScheduleToJsonStr(m_DragScheduleInfo).toUtf8()); + mimeData->setText(m_DragScheduleInfo->summary()); + QString strData; + DSchedule::toJsonString(m_DragScheduleInfo, strData); + //数据转换 + mimeData->setData("Info", strData.toUtf8()); if (m_Drag == nullptr) { m_Drag = new QDrag(this); @@ -587,7 +599,7 @@ updateInfo(); } //设置选中日程为无效日程 - setPressSelectInfo(ScheduleDataInfo()); + setPressSelectInfo(DSchedule::Ptr()); } break; case ChangeBegin: @@ -613,21 +625,33 @@ void DragInfoGraphicsView::mousePress(const QPoint &point) { - setPressSelectInfo(ScheduleDataInfo()); + setPressSelectInfo(DSchedule::Ptr()); //设置拖拽日程为无效日程 - m_DragScheduleInfo = ScheduleDataInfo(); + m_DragScheduleInfo = DSchedule::Ptr(); pressScheduleInit(); QGraphicsItem *listItem = itemAt(point); DragInfoItem *infoitem = dynamic_cast(listItem); - - if (infoitem != nullptr) { + //不满足拖拽条件的日程不进行拖拽事件 + if (infoitem) { setPressSelectInfo(infoitem->getData()); + m_PressScheduleInfo = infoitem->getData(); m_press = true; - DragInfoItem::setPressFlag(true); + if (isCanDragge(infoitem->getData())) { + //满足拖拽条件 + DragInfoItem::setPressFlag(true); + DragPressEvent(point, infoitem); + } else { + //不满足拖拽条件,只展示信息弹窗 + m_PressPos = point; + m_PressDate = getPosDate(point); + CalendarGlobalEnv::getGlobalEnv()->reviseValue(DDECalendar::CursorPointKey, mapToGlobal(point)); + ShowSchedule(infoitem); + } } else { + //没有日程信息,可滑动 emit signalScheduleShow(false); + DragPressEvent(point, infoitem); } - DragPressEvent(point, infoitem); this->scene()->update(); update(); } @@ -652,10 +676,11 @@ * @brief DragInfoGraphicsView::DeleteItem 删除日程 * @param info */ -void DragInfoGraphicsView::DeleteItem(const ScheduleDataInfo &info) +void DragInfoGraphicsView::DeleteItem(const DSchedule::Ptr &info) { + if (info.isNull()) return; //删除日程 - CScheduleOperation _scheduleOperation(this); + CScheduleOperation _scheduleOperation(info->scheduleTypeID(), this); _scheduleOperation.deleteSchedule(info); } @@ -663,7 +688,7 @@ * @brief DragInfoGraphicsView::setSelectSearchSchedule 设置选中搜索日程 * @param scheduleInfo */ -void DragInfoGraphicsView::setSelectSearchSchedule(const ScheduleDataInfo &scheduleInfo) +void DragInfoGraphicsView::setSelectSearchSchedule(const DSchedule::Ptr &scheduleInfo) { setPressSelectInfo(scheduleInfo); } @@ -698,22 +723,23 @@ } } -ScheduleDataInfo DragInfoGraphicsView::getScheduleInfo(const QDateTime &beginDate, const QDateTime &endDate) +DSchedule::Ptr DragInfoGraphicsView::getScheduleInfo(const QDateTime &beginDate, const QDateTime &endDate) { - ScheduleDataInfo info; - + DSchedule::Ptr info; + info.reset(new DSchedule()); if (beginDate.daysTo(endDate) > 0) { - info.setBeginDateTime(QDateTime(beginDate.date(), QTime(0, 0, 0))); - info.setEndDateTime(QDateTime(endDate.date(), QTime(23, 59, 59))); + info->setDtStart(QDateTime(beginDate.date(), QTime(0, 0, 0))); + info->setDtEnd(QDateTime(endDate.date(), QTime(23, 59, 59))); } else { - info.setBeginDateTime(QDateTime(endDate.date(), QTime(0, 0, 0))); - info.setEndDateTime(QDateTime(beginDate.date(), QTime(23, 59, 00))); + info->setDtStart(QDateTime(endDate.date(), QTime(0, 0, 0))); + info->setDtEnd(QDateTime(beginDate.date(), QTime(23, 59, 00))); } - info.setTitleName(tr("New Event")); - info.setAllDay(true); - info.setRemindData(RemindData(1, QTime(9, 0))); - info.setID(0); - info.setRecurID(0); + info->setSummary(tr("New Event")); + info->setAllDay(true); + //设置默认日程类型为工作 + info->setScheduleTypeID("107c369e-b13a-4d45-9ff3-de4eb3c0475b"); + //设置提醒规则 + info->setAlarmType(DSchedule::Alarm_15Hour_Front); return info; } @@ -780,8 +806,8 @@ void DragInfoGraphicsView::updateInfo() { //如果拖拽日程有效则更新为不是移动日程 - if (m_DragScheduleInfo.isValid() && m_DragScheduleInfo.getID() != 0) { - m_DragScheduleInfo.setIsMoveInfo(false); + if (m_DragScheduleInfo && m_DragScheduleInfo->isValid() && m_DragScheduleInfo->uid() != "0") { + m_DragScheduleInfo->setMoved(false); //设置选择日程状态 setPressSelectInfo(m_DragScheduleInfo); } @@ -798,13 +824,30 @@ m_rightShowRadius = rightShow; } +bool DragInfoGraphicsView::isCanDragge(const DSchedule::Ptr &info) +{ + if (info.isNull() || info->scheduleTypeID().isEmpty()) + return false; + //是否为节假日日程判断 + if (CScheduleOperation::isFestival(info)) + return false; + if (info->lunnar() && !QLocale::system().name().startsWith("zh_")) + return false; + //日程不可被修改 + if (CScheduleOperation::scheduleIsInvariant(info)) { + return false; + } + return true; +} + /** * @brief DragInfoGraphicsView::slotDeleteItem 删除日程 */ void DragInfoGraphicsView::slotDeleteItem() { //获取选中日程 - ScheduleDataInfo _pressSchedule = DragInfoItem::getPressSchedule(); + DSchedule::Ptr _pressSchedule = DragInfoItem::getPressSchedule(); + //根据焦点状态获取当前焦点的item CSceneBackgroundItem *backgroundItem = dynamic_cast(m_Scene->getCurrentFocusItem()); if (backgroundItem != nullptr) { @@ -816,12 +859,15 @@ } } - //判断是否有效,如果为有效日程且日程类型不为节日或纪念日则删除 - if (_pressSchedule.isValid() && _pressSchedule.getType() != 4) { - CScheduleOperation _scheduleOperation(this); + //判断是否有效,如果为有效日程且日程类型不为节日或纪念日或不可更改日程则删除 + //判断日程信息 + if (!_pressSchedule.isNull() && _pressSchedule->isValid() + && !CScheduleOperation::isFestival(_pressSchedule) + && !CScheduleOperation::scheduleIsInvariant(_pressSchedule)) { + CScheduleOperation _scheduleOperation(_pressSchedule->scheduleTypeID(), this); _scheduleOperation.deleteSchedule(_pressSchedule); //设置选择日程为无效日程 - setPressSelectInfo(ScheduleDataInfo()); + setPressSelectInfo(DSchedule::Ptr()); //设置拖拽日程为无效日程 m_DragScheduleInfo = DragInfoItem::getPressSchedule(); } @@ -853,13 +899,15 @@ DragInfoItem *infoitem = dynamic_cast(item); if (infoitem != nullptr) { //如果为节假日则退出不展示右击菜单 - if (infoitem->getData().getType() == 4) + if (CScheduleOperation::isFestival(infoitem->getData())) return; //快捷键调出右击菜单 m_Scene->setIsContextMenu(true); m_rightMenu->clear(); m_rightMenu->addAction(m_editAction); m_rightMenu->addAction(m_deleteAction); + //如果日程不可修改则设置删除无效 + m_deleteAction->setEnabled(!CScheduleOperation::scheduleIsInvariant(infoitem->getData())); QPointF itemPos = QPointF(infoitem->rect().x() + infoitem->rect().width() / 2, infoitem->rect().y() + infoitem->rect().height() / 2); QPointF scene_pos = infoitem->mapToScene(itemPos); QPointF view_pos = mapFromScene(scene_pos); @@ -898,7 +946,7 @@ */ void DragInfoGraphicsView::pressScheduleInit() { - m_PressScheduleInfo = ScheduleDataInfo(); + m_PressScheduleInfo = DSchedule::Ptr(); } QDate DragInfoGraphicsView::getCurrentDate() const diff -Nru dde-calendar-5.9.1/calendar-client/src/view/draginfographicsview.h dde-calendar-5.10.0/calendar-client/src/view/draginfographicsview.h --- dde-calendar-5.9.1/calendar-client/src/view/draginfographicsview.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/view/draginfographicsview.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,28 +1,12 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef DRAGINFOGRAPHICSVIEW_H #define DRAGINFOGRAPHICSVIEW_H #include "graphicsItem/draginfoitem.h" #include "../widget/touchgestureoperation.h" -#include "src/scheduledatainfo.h" +#include "dschedule.h" #include "cgraphicsscene.h" #include @@ -60,6 +44,9 @@ int getDragStatus() const; void setShowRadius(bool leftShow = false, bool rightShow = false); + //判断是否满足拖拽条件 + bool isCanDragge(const DSchedule::Ptr &info); + protected: void mousePressEvent(QMouseEvent *event) override; void mouseReleaseEvent(QMouseEvent *event) override; @@ -77,9 +64,9 @@ private: void slotCreate(); //设置点击选中日程 - void setPressSelectInfo(const ScheduleDataInfo &info); + void setPressSelectInfo(const DSchedule::Ptr &info); //拖拽更新日程信息 - void updateScheduleInfo(const ScheduleDataInfo &info); + void updateScheduleInfo(const DSchedule::Ptr &info); void DragPressEvent(const QPoint &pos, DragInfoItem *item); //鼠标左击释放数据处理 void mouseReleaseScheduleUpdate(); @@ -105,10 +92,11 @@ protected: //删除日程 - void DeleteItem(const ScheduleDataInfo &info); + void DeleteItem(const DSchedule::Ptr &info); + public: //设置搜索选中日程 - virtual void setSelectSearchSchedule(const ScheduleDataInfo &scheduleInfo); + virtual void setSelectSearchSchedule(const DSchedule::Ptr &scheduleInfo); //初始化点击日程 void pressScheduleInit(); QDate getCurrentDate() const; @@ -119,11 +107,11 @@ virtual void slotCreate(const QDateTime &date); //符合创建条件 virtual bool MeetCreationConditions(const QDateTime &date) = 0; - virtual void upDateInfoShow(const DragStatus &status = NONE, const ScheduleDataInfo &info = ScheduleDataInfo()) = 0; + virtual void upDateInfoShow(const DragStatus &status = NONE, const DSchedule::Ptr &info = DSchedule::Ptr()) = 0; virtual QDateTime getPosDate(const QPoint &p) = 0; - virtual void MoveInfoProcess(ScheduleDataInfo &info, const QPointF &pos) = 0; + virtual void MoveInfoProcess(DSchedule::Ptr &info, const QPointF &pos) = 0; virtual PosInItem getPosInItem(const QPoint &p, const QRectF &itemRect) = 0; - virtual ScheduleDataInfo getScheduleInfo(const QDateTime &beginDate, const QDateTime &endDate); + virtual DSchedule::Ptr getScheduleInfo(const QDateTime &beginDate, const QDateTime &endDate); virtual void ShowSchedule(DragInfoItem *infoitem); //设置主题 virtual void setTheMe(int type = 0); @@ -167,7 +155,7 @@ * @param isShow 是否显示 * @param out 显示的日程信息 */ - void signalScheduleShow(const bool isShow, const ScheduleDataInfo &out = ScheduleDataInfo()); + void signalScheduleShow(const bool isShow, const DSchedule::Ptr &out = DSchedule::Ptr()); //scene更新 void signalSceneUpdate(); void signalSwitchPrePage(); @@ -203,13 +191,13 @@ QDateTime m_MoveDate; QPoint m_PressPos; //保证月,周/日全天和非全天的拖拽日程为同一个 - static ScheduleDataInfo m_DragScheduleInfo; + static DSchedule::Ptr m_DragScheduleInfo; static bool m_hasUpdateMark; //拖拽后是否需要更新显示标志 QDateTime m_InfoBeginTime; QDateTime m_InfoEndTime; QDrag *m_Drag = nullptr; //点击的原始info - ScheduleDataInfo m_PressScheduleInfo; + DSchedule::Ptr m_PressScheduleInfo; QRectF m_PressRect; /** * @brief m_TouchBeginPoint 触摸开始坐标 @@ -229,7 +217,7 @@ * 1 拖拽确认,移动的时候触发点击事件 * 2 拖拽移动 */ - int m_touchDragMoveState; + int m_touchDragMoveState = 0; /** * @brief m_touchState 触摸滑动位置 */ diff -Nru dde-calendar-5.9.1/calendar-client/src/view/graphicsItem/calldayscheduleitem.cpp dde-calendar-5.10.0/calendar-client/src/view/graphicsItem/calldayscheduleitem.cpp --- dde-calendar-5.9.1/calendar-client/src/view/graphicsItem/calldayscheduleitem.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/view/graphicsItem/calldayscheduleitem.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "calldayscheduleitem.h" #include @@ -27,7 +11,7 @@ { } -bool CAllDayScheduleItem::hasSelectSchedule(const ScheduleDataInfo &info) +bool CAllDayScheduleItem::hasSelectSchedule(const DSchedule::Ptr &info) { return info == m_vScheduleInfo; } @@ -37,7 +21,8 @@ Q_UNUSED(isPixMap); m_font = DFontSizeManager::instance()->get(m_sizeType, m_font); painter->setRenderHints(QPainter::Antialiasing); - CSchedulesColor gdColor = CScheduleDataManage::getScheduleDataManage()->getScheduleColorByType(m_vScheduleInfo.getType()); + //根据日程类型获取类型颜色 + CSchedulesColor gdColor = CScheduleDataManage::getScheduleDataManage()->getScheduleColorByType(m_vScheduleInfo->scheduleTypeID()); QRectF drawrect = rect; QColor textcolor = CScheduleDataManage::getScheduleDataManage()->getTextColor(); @@ -45,7 +30,7 @@ //判断是否为选中日程 if (m_vScheduleInfo == m_pressInfo) { //判断当前日程是否为拖拽移动日程 - if (m_vScheduleInfo.getIsMoveInfo() == m_pressInfo.getIsMoveInfo()) { + if (m_vScheduleInfo->isMoved() == m_pressInfo->isMoved()) { m_vHighflag = true; } else { painter->setOpacity(0.4); @@ -82,7 +67,7 @@ painter->setFont(m_font); painter->setPen(textcolor); QFontMetrics fm = painter->fontMetrics(); - QString tSTitleName = m_vScheduleInfo.getTitleName(); + QString tSTitleName = m_vScheduleInfo->summary(); tSTitleName.replace("\n", ""); QString str = tSTitleName; QString tStr; diff -Nru dde-calendar-5.9.1/calendar-client/src/view/graphicsItem/calldayscheduleitem.h dde-calendar-5.10.0/calendar-client/src/view/graphicsItem/calldayscheduleitem.h --- dde-calendar-5.9.1/calendar-client/src/view/graphicsItem/calldayscheduleitem.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/view/graphicsItem/calldayscheduleitem.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,34 +1,19 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef CALLDAYSCHEDULEITEM_H #define CALLDAYSCHEDULEITEM_H #include "draginfoitem.h" +#include "dschedule.h" class CAllDayScheduleItem : public DragInfoItem { Q_OBJECT public: explicit CAllDayScheduleItem(QRectF rect, QGraphicsItem *parent = nullptr); - bool hasSelectSchedule(const ScheduleDataInfo &info); + bool hasSelectSchedule(const DSchedule::Ptr &info); protected: void paintBackground(QPainter *painter, const QRectF &rect, const bool isPixMap = false) override; diff -Nru dde-calendar-5.9.1/calendar-client/src/view/graphicsItem/cfocusitem.cpp dde-calendar-5.10.0/calendar-client/src/view/graphicsItem/cfocusitem.cpp --- dde-calendar-5.9.1/calendar-client/src/view/graphicsItem/cfocusitem.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/view/graphicsItem/cfocusitem.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "cfocusitem.h" #include "scheduledatamanage.h" diff -Nru dde-calendar-5.9.1/calendar-client/src/view/graphicsItem/cfocusitem.h dde-calendar-5.10.0/calendar-client/src/view/graphicsItem/cfocusitem.h --- dde-calendar-5.9.1/calendar-client/src/view/graphicsItem/cfocusitem.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/view/graphicsItem/cfocusitem.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef CFOCUSITEM_H #define CFOCUSITEM_H diff -Nru dde-calendar-5.9.1/calendar-client/src/view/graphicsItem/cmonthdayitem.cpp dde-calendar-5.10.0/calendar-client/src/view/graphicsItem/cmonthdayitem.cpp --- dde-calendar-5.9.1/calendar-client/src/view/graphicsItem/cmonthdayitem.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/view/graphicsItem/cmonthdayitem.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "cmonthdayitem.h" #include "constants.h" #include "scheduledatamanage.h" @@ -189,11 +173,11 @@ painter->setRenderHint(QPainter::Antialiasing); switch (m_DayStatus) { case H_WORK: { - QPixmap pixmap = DHiDPIHelper::loadNxPixmap(":/resources/icon/ban.svg"); + QPixmap pixmap = DHiDPIHelper::loadNxPixmap(":/icons/deepin/builtin/icons/dde_calendar_ban_32px.svg"); painter->drawPixmap(fillRectT.toRect(), pixmap); } break; case H_REST: { - QPixmap pixmap = DHiDPIHelper::loadNxPixmap(":/resources/icon/xiu.svg"); + QPixmap pixmap = DHiDPIHelper::loadNxPixmap(":/icons/deepin/builtin/icons/dde_calendar_xiu.svg"); painter->drawPixmap(fillRectT.toRect(), pixmap); } break; default: diff -Nru dde-calendar-5.9.1/calendar-client/src/view/graphicsItem/cmonthdayitem.h dde-calendar-5.10.0/calendar-client/src/view/graphicsItem/cmonthdayitem.h --- dde-calendar-5.9.1/calendar-client/src/view/graphicsItem/cmonthdayitem.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/view/graphicsItem/cmonthdayitem.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef CMONTHDAYITEM_H #define CMONTHDAYITEM_H diff -Nru dde-calendar-5.9.1/calendar-client/src/view/graphicsItem/cmonthscheduleitem.cpp dde-calendar-5.10.0/calendar-client/src/view/graphicsItem/cmonthscheduleitem.cpp --- dde-calendar-5.9.1/calendar-client/src/view/graphicsItem/cmonthscheduleitem.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/view/graphicsItem/cmonthscheduleitem.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "cmonthscheduleitem.h" #include @@ -48,14 +32,15 @@ qreal labelheight = rect.height(); m_font = DFontSizeManager::instance()->get(m_sizeType, m_font); int themetype = CScheduleDataManage::getScheduleDataManage()->getTheme(); - CSchedulesColor gdColor = CScheduleDataManage::getScheduleDataManage()->getScheduleColorByType(m_vScheduleInfo.getType()); + //根据类型获取颜色 + CSchedulesColor gdColor = CScheduleDataManage::getScheduleDataManage()->getScheduleColorByType(m_vScheduleInfo->scheduleTypeID()); QColor brushColor = gdColor.normalColor; QColor textcolor = CScheduleDataManage::getScheduleDataManage()->getTextColor(); //判断是否为选中日程 - if (m_vScheduleInfo == m_pressInfo) { + if (!m_vScheduleInfo.isNull() && m_vScheduleInfo == m_pressInfo) { //判断当前日程是否为拖拽移动日程 - if (m_vScheduleInfo.getIsMoveInfo() == m_pressInfo.getIsMoveInfo()) { + if (m_vScheduleInfo->isMoved() == m_pressInfo->isMoved()) { m_vHighflag = true; } else { painter->setOpacity(0.4); @@ -101,7 +86,7 @@ painter->setPen(textcolor); QFontMetrics fm = painter->fontMetrics(); - QString tSTitleName = m_vScheduleInfo.getTitleName(); + QString tSTitleName = m_vScheduleInfo->summary(); tSTitleName.replace("\n", ""); QString str = tSTitleName; //右侧偏移8 diff -Nru dde-calendar-5.9.1/calendar-client/src/view/graphicsItem/cmonthscheduleitem.h dde-calendar-5.10.0/calendar-client/src/view/graphicsItem/cmonthscheduleitem.h --- dde-calendar-5.9.1/calendar-client/src/view/graphicsItem/cmonthscheduleitem.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/view/graphicsItem/cmonthscheduleitem.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef CMONTHSCHEDULEITEM_H #define CMONTHSCHEDULEITEM_H diff -Nru dde-calendar-5.9.1/calendar-client/src/view/graphicsItem/cmonthschedulenumitem.cpp dde-calendar-5.10.0/calendar-client/src/view/graphicsItem/cmonthschedulenumitem.cpp --- dde-calendar-5.9.1/calendar-client/src/view/graphicsItem/cmonthschedulenumitem.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/view/graphicsItem/cmonthschedulenumitem.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "cmonthschedulenumitem.h" #include diff -Nru dde-calendar-5.9.1/calendar-client/src/view/graphicsItem/cmonthschedulenumitem.h dde-calendar-5.10.0/calendar-client/src/view/graphicsItem/cmonthschedulenumitem.h --- dde-calendar-5.9.1/calendar-client/src/view/graphicsItem/cmonthschedulenumitem.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/view/graphicsItem/cmonthschedulenumitem.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,28 +1,12 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef CMONTHSCHEDULENUMITEM_H #define CMONTHSCHEDULENUMITEM_H #include "cfocusitem.h" -#include "src/scheduledatainfo.h" +#include "dschedule.h" #include "scheduledaterangeinfo.h" #include diff -Nru dde-calendar-5.9.1/calendar-client/src/view/graphicsItem/cscenebackgrounditem.cpp dde-calendar-5.10.0/calendar-client/src/view/graphicsItem/cscenebackgrounditem.cpp --- dde-calendar-5.9.1/calendar-client/src/view/graphicsItem/cscenebackgrounditem.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/view/graphicsItem/cscenebackgrounditem.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "cscenebackgrounditem.h" #include diff -Nru dde-calendar-5.9.1/calendar-client/src/view/graphicsItem/cscenebackgrounditem.h dde-calendar-5.10.0/calendar-client/src/view/graphicsItem/cscenebackgrounditem.h --- dde-calendar-5.9.1/calendar-client/src/view/graphicsItem/cscenebackgrounditem.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/view/graphicsItem/cscenebackgrounditem.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef CSCENEBACKGROUNDITEM_H #define CSCENEBACKGROUNDITEM_H diff -Nru dde-calendar-5.9.1/calendar-client/src/view/graphicsItem/cweekdaybackgrounditem.cpp dde-calendar-5.10.0/calendar-client/src/view/graphicsItem/cweekdaybackgrounditem.cpp --- dde-calendar-5.9.1/calendar-client/src/view/graphicsItem/cweekdaybackgrounditem.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/view/graphicsItem/cweekdaybackgrounditem.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "cweekdaybackgrounditem.h" #include diff -Nru dde-calendar-5.9.1/calendar-client/src/view/graphicsItem/cweekdaybackgrounditem.h dde-calendar-5.10.0/calendar-client/src/view/graphicsItem/cweekdaybackgrounditem.h --- dde-calendar-5.9.1/calendar-client/src/view/graphicsItem/cweekdaybackgrounditem.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/view/graphicsItem/cweekdaybackgrounditem.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef CWEEKDAYBACKGROUNDITEM_H #define CWEEKDAYBACKGROUNDITEM_H diff -Nru dde-calendar-5.9.1/calendar-client/src/view/graphicsItem/draginfoitem.cpp dde-calendar-5.10.0/calendar-client/src/view/graphicsItem/draginfoitem.cpp --- dde-calendar-5.9.1/calendar-client/src/view/graphicsItem/draginfoitem.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/view/graphicsItem/draginfoitem.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "draginfoitem.h" #include @@ -25,9 +9,9 @@ #include bool DragInfoItem::m_press = false; -ScheduleDataInfo DragInfoItem::m_HoverInfo; -ScheduleDataInfo DragInfoItem::m_pressInfo; -QVector DragInfoItem::m_searchScheduleInfo; +DSchedule::Ptr DragInfoItem::m_HoverInfo; +DSchedule::Ptr DragInfoItem::m_pressInfo; +DSchedule::List DragInfoItem::m_searchScheduleInfo; DragInfoItem::DragInfoItem(QRectF rect, QGraphicsItem *parent) : CFocusItem(parent) @@ -59,12 +43,12 @@ } -void DragInfoItem::setData(const ScheduleDataInfo &vScheduleInfo) +void DragInfoItem::setData(const DSchedule::Ptr &vScheduleInfo) { m_vScheduleInfo = vScheduleInfo; } -ScheduleDataInfo DragInfoItem::getData() const +DSchedule::Ptr DragInfoItem::getData() const { return m_vScheduleInfo; } @@ -78,7 +62,7 @@ * @brief DragInfoItem::setPressSchedule 记录选中日程 * @param pressSchedule */ -void DragInfoItem::setPressSchedule(const ScheduleDataInfo &pressSchedule) +void DragInfoItem::setPressSchedule(const DSchedule::Ptr &pressSchedule) { m_pressInfo = pressSchedule; } @@ -87,7 +71,7 @@ * @brief DragInfoItem::getPressSchedule 获取选中日程 * @return */ -ScheduleDataInfo DragInfoItem::getPressSchedule() +DSchedule::Ptr DragInfoItem::getPressSchedule() { return m_pressInfo; } @@ -96,7 +80,7 @@ * @brief DragInfoItem::setSearchScheduleInfo 设置搜索日程新 * @param searchScheduleInfo */ -void DragInfoItem::setSearchScheduleInfo(const QVector &searchScheduleInfo) +void DragInfoItem::setSearchScheduleInfo(const DSchedule::List &searchScheduleInfo) { m_searchScheduleInfo = searchScheduleInfo; } @@ -151,7 +135,7 @@ void DragInfoItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event); - m_HoverInfo = ScheduleDataInfo(); + m_HoverInfo = DSchedule::Ptr(); update(); } diff -Nru dde-calendar-5.9.1/calendar-client/src/view/graphicsItem/draginfoitem.h dde-calendar-5.10.0/calendar-client/src/view/graphicsItem/draginfoitem.h --- dde-calendar-5.9.1/calendar-client/src/view/graphicsItem/draginfoitem.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/view/graphicsItem/draginfoitem.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,27 +1,11 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef DRAGINFOITEM_H #define DRAGINFOITEM_H #include "scheduledatamanage.h" -#include "src/scheduledatainfo.h" +#include "dschedule.h" #include "cfocusitem.h" #include @@ -41,8 +25,8 @@ public: explicit DragInfoItem(QRectF rect, QGraphicsItem *parent = nullptr); ~DragInfoItem() override; - void setData(const ScheduleDataInfo &vScheduleInfo); - ScheduleDataInfo getData() const; + void setData(const DSchedule::Ptr &vScheduleInfo); + DSchedule::Ptr getData() const; void setFont(DFontSizeManager::SizeType type); void setOffset(const int &offset); @@ -60,11 +44,11 @@ public: static void setPressFlag(const bool flag); //设置选中日程 - static void setPressSchedule(const ScheduleDataInfo &pressSchedule); + static void setPressSchedule(const DSchedule::Ptr &pressSchedule); //获取选中日程 - static ScheduleDataInfo getPressSchedule(); + static DSchedule::Ptr getPressSchedule(); //设置搜索日程 - static void setSearchScheduleInfo(const QVector &searchScheduleInfo); + static void setSearchScheduleInfo(const DSchedule::List &searchScheduleInfo); public slots: void animationFinished(); protected: @@ -75,7 +59,7 @@ virtual void paintBackground(QPainter *painter, const QRectF &rect, const bool isPixMap = false) = 0; protected: - ScheduleDataInfo m_vScheduleInfo; + DSchedule::Ptr m_vScheduleInfo; QFont m_font; bool m_vSelectflag = false; bool m_vHoverflag = false; @@ -88,9 +72,9 @@ QPropertyAnimation *m_properAnimationSecond = nullptr; QSequentialAnimationGroup *m_Group = nullptr; static bool m_press; - static ScheduleDataInfo m_HoverInfo; - static ScheduleDataInfo m_pressInfo; - static QVector m_searchScheduleInfo; + static DSchedule::Ptr m_HoverInfo; + static DSchedule::Ptr m_pressInfo; + static DSchedule::List m_searchScheduleInfo; }; #endif // DRAGINFOITEM_H diff -Nru dde-calendar-5.9.1/calendar-client/src/view/graphicsItem/scheduleitem.cpp dde-calendar-5.10.0/calendar-client/src/view/graphicsItem/scheduleitem.cpp --- dde-calendar-5.9.1/calendar-client/src/view/graphicsItem/scheduleitem.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/view/graphicsItem/scheduleitem.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,21 +1,7 @@ -/* - * Copyright (C) 2017 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: kirigaya - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "scheduleitem.h" #include "schedulecoormanage.h" #include "scheduledatamanage.h" @@ -40,7 +26,7 @@ , m_type(type) , m_totalNum(0) , m_transparentcolor("#000000") - , m_timeFormat(CalendarManager::getInstance()->getCalendarDateDataManage()->getTimeFormat()) + , m_timeFormat(CalendarManager::getInstance()->getTimeFormat()) { m_transparentcolor.setAlphaF(0.05); connect(CalendarManager::getInstance(), &CalendarManager::signalTimeFormatChanged, this, &CScheduleItem::timeFormatChanged); @@ -56,7 +42,7 @@ * @param date * @param totalNum */ -void CScheduleItem::setData(const ScheduleDataInfo &info, QDate date, int totalNum) +void CScheduleItem::setData(const DSchedule::Ptr &info, QDate date, int totalNum) { m_vScheduleInfo = info; m_totalNum = totalNum; @@ -69,7 +55,7 @@ * @param info * @return */ -bool CScheduleItem::hasSelectSchedule(const ScheduleDataInfo &info) +bool CScheduleItem::hasSelectSchedule(const DSchedule::Ptr &info) { return info == m_vScheduleInfo; } @@ -174,13 +160,14 @@ void CScheduleItem::paintBackground(QPainter *painter, const QRectF &rect, const bool isPixMap) { Q_UNUSED(isPixMap); - CSchedulesColor gdColor = CScheduleDataManage::getScheduleDataManage()->getScheduleColorByType(m_vScheduleInfo.getType()); + //根据日程类型获取颜色 + CSchedulesColor gdColor = CScheduleDataManage::getScheduleDataManage()->getScheduleColorByType(m_vScheduleInfo->scheduleTypeID()); QColor textPenColor = CScheduleDataManage::getScheduleDataManage()->getTextColor(); //判断是否为选中日程 if (m_vScheduleInfo == m_pressInfo) { //判断当前日程是否为拖拽移动日程 - if (m_vScheduleInfo.getIsMoveInfo() == m_pressInfo.getIsMoveInfo()) { + if (m_vScheduleInfo->isMoved() == m_pressInfo->isMoved()) { m_vHighflag = true; } else { painter->setOpacity(0.4); @@ -258,13 +245,13 @@ font = DFontSizeManager::instance()->get(DFontSizeManager::T8, font); //绘制日程起始时间 - if (m_vScheduleInfo.getBeginDateTime().date() == getDate()) { + if (m_vScheduleInfo->dtStart().date() == getDate()) { painter->save(); painter->setFont(font); painter->setPen(gdColor.orginalColor); - QTime stime = m_vScheduleInfo.getBeginDateTime().time(); - QString str = stime.toString("AP " + m_timeFormat); + QTime stime = m_vScheduleInfo->dtStart().time(); + QString str = stime.toString((CalendarManager::getInstance()->getTimeShowType() ? "AP " : "") + m_timeFormat); QFontMetrics fontMetrics(font); qreal drawTextWidth = rect.width() - m_offset * 2; @@ -311,7 +298,7 @@ splitText(font, textRect.width() - tMargin - 8, textRect.height() - 20, - m_vScheduleInfo.getTitleName(), + m_vScheduleInfo->summary(), liststr, fm); for (int i = 0; i < liststr.count(); i++) { diff -Nru dde-calendar-5.9.1/calendar-client/src/view/graphicsItem/scheduleitem.h dde-calendar-5.10.0/calendar-client/src/view/graphicsItem/scheduleitem.h --- dde-calendar-5.9.1/calendar-client/src/view/graphicsItem/scheduleitem.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/view/graphicsItem/scheduleitem.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,25 +1,11 @@ -/* - * Copyright (C) 2017 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: kirigaya - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef SCHEDULEITEM_H #define SCHEDULEITEM_H -#include "src/scheduledatainfo.h" +#include "dschedule.h" #include "draginfoitem.h" #include @@ -35,14 +21,14 @@ CScheduleItem(QRectF rect, QGraphicsItem *parent = nullptr, int type = 0); ~CScheduleItem() override; //设置显示数据 - void setData(const ScheduleDataInfo &info, QDate date, int totalNum); + void setData(const DSchedule::Ptr &info, QDate date, int totalNum); //是否含有选中日程 - bool hasSelectSchedule(const ScheduleDataInfo &info); + bool hasSelectSchedule(const DSchedule::Ptr &info); int getType() { return m_type; } - ScheduleDataInfo getData() const + DSchedule::Ptr getData() const { return m_vScheduleInfo; } diff -Nru dde-calendar-5.9.1/calendar-client/src/view/graphicsview.cpp dde-calendar-5.10.0/calendar-client/src/view/graphicsview.cpp --- dde-calendar-5.9.1/calendar-client/src/view/graphicsview.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/view/graphicsview.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,21 +1,7 @@ -/* - * Copyright (C) 2017 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: kirigaya - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "graphicsview.h" #include "graphicsItem/scheduleitem.h" #include "schedulecoormanage.h" @@ -67,7 +53,7 @@ connect(this->verticalScrollBar(), &QScrollBar::sliderPressed, this, &CGraphicsView::slotScrollBar); //如果为周视图 - if (m_viewType == 0) { + if (m_viewPos == WeekPos) { //设置显示右下角圆角 setShowRadius(false, true); } @@ -123,7 +109,7 @@ bool CGraphicsView::MeetCreationConditions(const QDateTime &date) { - return qAbs(date.daysTo(m_PressDate) < 7); + return qAbs(date.daysTo(m_PressDate)) < 7; } void CGraphicsView::updateHeight() @@ -138,28 +124,15 @@ scrollBarValueChangedSlot(); } -void CGraphicsView::setInfo(const QVector &info) +void CGraphicsView::setInfo(const DSchedule::List &info) { m_scheduleInfo = info; } -bool MScheduleTimeThan(const ScheduleDataInfo &s1, const ScheduleDataInfo &s2) -{ - if (s1.getBeginDateTime().date().daysTo(s1.getEndDateTime().date()) == s2.getBeginDateTime().date().daysTo(s2.getEndDateTime().date())) { - if (s1.getBeginDateTime() == s2.getBeginDateTime()) { - return s1.getBeginDateTime().secsTo(s1.getEndDateTime()) > s2.getBeginDateTime().secsTo(s2.getEndDateTime()); - } else { - return s1.getBeginDateTime() < s2.getBeginDateTime(); - } - } else { - return s1.getBeginDateTime().date().daysTo(s1.getEndDateTime().date()) > s2.getBeginDateTime().date().daysTo(s2.getEndDateTime().date()); - } -} - -void CGraphicsView::upDateInfoShow(const CGraphicsView::DragStatus &status, const ScheduleDataInfo &info) +void CGraphicsView::upDateInfoShow(const CGraphicsView::DragStatus &status, const DSchedule::Ptr &info) { clearSchedule(); - QVector vListData; + DSchedule::List vListData; vListData = m_scheduleInfo; switch (status) { @@ -179,29 +152,34 @@ vListData.append(info); break; } - QMap> m_InfoMap; + QMap m_InfoMap; QDate currentDate; qint64 count = m_beginDate.daysTo(m_endDate); qint64 beginoffset = 0, endoffset = 0; - QVector currentInfo; + DSchedule::List currentInfo; for (int i = 0; i <= count; ++i) { currentDate = m_beginDate.addDays(i); currentInfo.clear(); for (int j = 0; j < vListData.size(); ++j) { - beginoffset = vListData.at(j).getBeginDateTime().date().daysTo(currentDate); - endoffset = currentDate.daysTo(vListData.at(j).getEndDateTime().date()); + DSchedule::Ptr ptr = vListData.at(j); + if (ptr.isNull()) { + continue; + } + + beginoffset = ptr->dtStart().date().daysTo(currentDate); + endoffset = currentDate.daysTo(ptr->dtEnd().date()); if (beginoffset < 0 || endoffset < 0) { continue; } - if (vListData.at(j).getEndDateTime().date() == currentDate && vListData.at(j).getBeginDateTime().daysTo(vListData.at(j).getEndDateTime()) > 0 && vListData.at(j).getEndDateTime().time() == QTime(0, 0, 0)) { + if (ptr->dtEnd().date() == currentDate && ptr->dtStart().daysTo(ptr->dtEnd()) > 0 && ptr->dtEnd().time() == QTime(0, 0, 0)) { continue; } - currentInfo.append(vListData.at(j)); + currentInfo.append(ptr); } - std::sort(currentInfo.begin(), currentInfo.end(), MScheduleTimeThan); + std::sort(currentInfo.begin(), currentInfo.end()); if (currentInfo.size() > 0) { m_InfoMap[currentDate] = currentInfo; QList info; @@ -223,9 +201,10 @@ qWarning() << "week view create error,tNum -2 :" << index; index = 1; } - ScheduleDataInfo tdetaliinfo = info.at(m).vData.at(index); - tdetaliinfo.setTitleName("..."); - tdetaliinfo.setType(3); + DSchedule::Ptr tdetaliinfo(info.at(m).vData.at(index)->clone()); + tdetaliinfo->setSummary("1"); + //如果为"..."则设置类型为other,在获取颜色时会对其进行判断 + tdetaliinfo->setScheduleTypeID("other"); addScheduleItem(tdetaliinfo, currentDate, tNum, tNum, 1, m_viewType, m_sMaxNum); } else { @@ -260,28 +239,29 @@ DragInfoGraphicsView::ShowSchedule(infoitem); } -void CGraphicsView::MoveInfoProcess(ScheduleDataInfo &info, const QPointF &pos) +void CGraphicsView::MoveInfoProcess(DSchedule::Ptr &info, const QPointF &pos) { Q_UNUSED(pos); - if (!info.getAllDay()) { + if (!info->allDay()) { qint64 offset = m_PressDate.secsTo(m_MoveDate); - info.getBeginDateTime() = info.getBeginDateTime().addSecs(offset); - info.getEndDateTime() = info.getEndDateTime().addSecs(offset); + info->setDtStart(info->dtStart().addSecs(offset)); + info->setDtEnd(info->dtEnd().addSecs(offset)); } else { - info.setAllDay(false); - info.setRemindData(RemindData()); - info.getBeginDateTime() = m_MoveDate; - info.getEndDateTime() = m_MoveDate.addSecs(3600); + info->setAllDay(false); + //提醒规则 + info->setRRuleType(DSchedule::RRule_None); + info->setDtStart(m_MoveDate); + info->setDtEnd(m_MoveDate.addSecs(3600)); } upDateInfoShow(ChangeWhole, info); } -void CGraphicsView::addScheduleItem(const ScheduleDataInfo &info, QDate date, int index, int totalNum, int type, int viewtype, int maxnum) +void CGraphicsView::addScheduleItem(const DSchedule::Ptr &info, QDate date, int index, int totalNum, int type, int viewtype, int maxnum) { CScheduleItem *item = new CScheduleItem( - m_coorManage->getDrawRegion(date, info.getBeginDateTime(), - info.getEndDateTime(), index, totalNum, maxnum, + m_coorManage->getDrawRegion(date, info->dtStart(), + info->dtEnd(), index, totalNum, maxnum, viewtype), nullptr, type); if (type == 1) { @@ -296,10 +276,10 @@ * @brief CGraphicsView::setSelectSearchSchedule 设置搜索选中日程 * @param info */ -void CGraphicsView::setSelectSearchSchedule(const ScheduleDataInfo &info) +void CGraphicsView::setSelectSearchSchedule(const DSchedule::Ptr &info) { DragInfoGraphicsView::setSelectSearchSchedule(info); - setTime(info.getBeginDateTime().time()); + setTime(info->dtStart().time()); for (int i = 0; i < m_vScheduleItem.size(); ++i) { if (m_vScheduleItem.at(i)->getType() == 1) continue; @@ -323,19 +303,19 @@ m_updateDflag = true; } -void CGraphicsView::scheduleClassificationType(QVector &scheduleInfolist, QList &info) +void CGraphicsView::scheduleClassificationType(DSchedule::List &scheduleInfolist, QList &info) { - QVector schedulelist = scheduleInfolist; + DSchedule::List schedulelist = scheduleInfolist; if (schedulelist.isEmpty()) return; info.clear(); - std::sort(schedulelist.begin(), schedulelist.end(), MScheduleTimeThan); + std::sort(schedulelist.begin(), schedulelist.end()); QVector containIndex; for (int k = 0; k < schedulelist.count(); k++) { - QDateTime endTime = schedulelist.at(k).getEndDateTime(); - QDateTime begTime = schedulelist.at(k).getBeginDateTime(); + QDateTime endTime = schedulelist.at(k)->dtEnd(); + QDateTime begTime = schedulelist.at(k)->dtStart(); if (begTime.date().daysTo(endTime.date()) == 0 && begTime.time().secsTo(endTime.time()) < m_minTime) { endTime = begTime.addSecs(m_minTime); @@ -346,13 +326,13 @@ containIndex.clear(); for (int i = 0; i < info.count(); i++) { - if ((schedulelist.at(k).getBeginDateTime() >= info.at(i).begindate && schedulelist.at(k).getBeginDateTime() <= info.at(i).enddate) || (endTime >= info.at(i).begindate && endTime <= info.at(i).enddate)) { + if ((schedulelist.at(k)->dtStart() >= info.at(i).begindate && schedulelist.at(k)->dtStart() <= info.at(i).enddate) || (endTime >= info.at(i).begindate && endTime <= info.at(i).enddate)) { containIndex.append(i); } } if (containIndex.count() == 0) { ScheduleclassificationInfo firstschedule; - firstschedule.begindate = schedulelist.at(k).getBeginDateTime(); + firstschedule.begindate = schedulelist.at(k)->dtStart(); firstschedule.enddate = endTime; firstschedule.vData.append(schedulelist.at(k)); info.append(firstschedule); @@ -371,8 +351,8 @@ for (int i = containIndex.count() - 1; i > 0; --i) { info.removeAt(containIndex.at(i)); } - if (schedulelist.at(k).getBeginDateTime() < scheduleInfo.begindate) - scheduleInfo.begindate = schedulelist.at(k).getBeginDateTime(); + if (schedulelist.at(k)->dtStart() < scheduleInfo.begindate) + scheduleInfo.begindate = schedulelist.at(k)->dtStart(); if (endTime > scheduleInfo.enddate) scheduleInfo.enddate = endTime; scheduleInfo.vData.append(schedulelist.at(k)); @@ -401,6 +381,7 @@ return; } m_updateDflag = false; + //TODO: item->getData()中的scheduleType为"",不是正常日程,有崩溃风险,待分析解决 CMyScheduleView dlg(item->getData(), this); connect(&dlg, &CMyScheduleView::signalsEditorDelete, this, &CGraphicsView::slotDoubleEvent); dlg.exec(); @@ -420,13 +401,16 @@ void CGraphicsView::mouseMoveEvent(QMouseEvent *event) { - CScheduleItem *item = dynamic_cast(itemAt(event->pos())); + if (m_DragStatus == NONE) { + CScheduleItem *item = dynamic_cast(itemAt(event->pos())); - if (item != nullptr && item->getType() == 1) { - setCursor(Qt::ArrowCursor); - DGraphicsView::mouseMoveEvent(event); - return; + if (item != nullptr && item->getType() == 1) { + setCursor(Qt::ArrowCursor); + DGraphicsView::mouseMoveEvent(event); + return; + } } + DragInfoGraphicsView::mouseMoveEvent(event); } void CGraphicsView::slotDoubleEvent(int type) @@ -443,7 +427,6 @@ void CGraphicsView::slotUpdateScene() { - pressScheduleInit(); this->scene()->update(); } @@ -586,28 +569,30 @@ return MIDDLE; } -ScheduleDataInfo CGraphicsView::getScheduleInfo(const QDateTime &beginDate, const QDateTime &endDate) +DSchedule::Ptr CGraphicsView::getScheduleInfo(const QDateTime &beginDate, const QDateTime &endDate) { - ScheduleDataInfo info; + DSchedule::Ptr info(new DSchedule); if (beginDate.secsTo(endDate) > 0) { - info.getBeginDateTime() = beginDate; + info->setDtStart(beginDate); if (beginDate.secsTo(endDate) < DDECalendar::ThirtyMinutesWithSec) { - info.getEndDateTime() = beginDate.addSecs(DDECalendar::ThirtyMinutesWithSec); + info->setDtEnd(beginDate.addSecs(DDECalendar::ThirtyMinutesWithSec)); } else { - info.getEndDateTime() = endDate; + info->setDtEnd(endDate); } } else { if (endDate.secsTo(beginDate) < DDECalendar::ThirtyMinutesWithSec) { - info.getBeginDateTime() = beginDate.addSecs(-DDECalendar::ThirtyMinutesWithSec); + info->setDtStart(beginDate.addSecs(-DDECalendar::ThirtyMinutesWithSec)); } else { - info.getBeginDateTime() = endDate; + info->setDtStart(endDate); } - info.getEndDateTime() = beginDate; + info->setDtEnd(beginDate); } - info.setTitleName(tr("New Event")); - info.setAllDay(false); - info.setRemindData(RemindData(1, QTime(9, 0))); + info->setSummary(tr("New Event")); + info->setAllDay(false); + //设置默认日程类型为工作 + info->setScheduleTypeID("107c369e-b13a-4d45-9ff3-de4eb3c0475b"); + info->setAlarmType(DSchedule::Alarm_15Min_Front); return info; } diff -Nru dde-calendar-5.9.1/calendar-client/src/view/graphicsview.h dde-calendar-5.10.0/calendar-client/src/view/graphicsview.h --- dde-calendar-5.9.1/calendar-client/src/view/graphicsview.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/view/graphicsview.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,25 +1,11 @@ -/* - * Copyright (C) 2017 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: kirigaya - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef GRAPHICSVIEW_H #define GRAPHICSVIEW_H -#include "src/scheduledatainfo.h" +#include "dschedule.h" #include "draginfographicsview.h" #include "graphicsItem/cweekdaybackgrounditem.h" #include "cweekdaygraphicsview.h" @@ -36,7 +22,7 @@ typedef struct _tagScheduleclassificationInfo { QDateTime begindate; QDateTime enddate; - QVector vData; + DSchedule::List vData; } ScheduleclassificationInfo; @@ -55,10 +41,10 @@ } void updateHeight(); void setCurrentDate(const QDateTime ¤tDate); - void setInfo(const QVector &info); - void addScheduleItem(const ScheduleDataInfo &info, QDate date, int index, int totalNum, int type, int viewtype, int maxnum); + void setInfo(const DSchedule::List &info); + void addScheduleItem(const DSchedule::Ptr &info, QDate date, int index, int totalNum, int type, int viewtype, int maxnum); //设置搜索选中日程 - void setSelectSearchSchedule(const ScheduleDataInfo &info) override; + void setSelectSearchSchedule(const DSchedule::Ptr &info) override; void clearSchedule(); void setMinTime(const int &minTime) @@ -71,7 +57,7 @@ } void keepCenterOnScene(); - void scheduleClassificationType(QVector &scheduleInfolist, QList &info); + void scheduleClassificationType(DSchedule::List &scheduleInfolist, QList &info); void mouseDoubleClickEvent(QMouseEvent *event) override; void mousePressEvent(QMouseEvent *event) override; void mouseMoveEvent(QMouseEvent *event) override; @@ -103,12 +89,12 @@ protected: void slotCreate(const QDateTime &date) override; bool MeetCreationConditions(const QDateTime &date) override; - void upDateInfoShow(const DragStatus &status = NONE, const ScheduleDataInfo &info = ScheduleDataInfo()) override; + void upDateInfoShow(const DragStatus &status = NONE, const DSchedule::Ptr &info = DSchedule::Ptr()) override; QDateTime getPosDate(const QPoint &p) override; void ShowSchedule(DragInfoItem *infoitem) override; - void MoveInfoProcess(ScheduleDataInfo &info, const QPointF &pos) override; + void MoveInfoProcess(DSchedule::Ptr &info, const QPointF &pos) override; PosInItem getPosInItem(const QPoint &p, const QRectF &itemRect) override; - ScheduleDataInfo getScheduleInfo(const QDateTime &beginDate, const QDateTime &endDate) override; + DSchedule::Ptr getScheduleInfo(const QDateTime &beginDate, const QDateTime &endDate) override; bool IsEqualtime(const QDateTime &timeFirst, const QDateTime &timeSecond) override; bool JudgeIsCreate(const QPointF &pos) override; void RightClickToCreate(QGraphicsItem *listItem, const QPoint &pos) override; @@ -132,7 +118,7 @@ QTimer *m_timer = nullptr; QMutex m_Mutex; bool m_updateDflag = false; - QVector m_scheduleInfo; + DSchedule::List m_scheduleInfo; QDateTime m_currentDateTime; int m_minTime; //最小高度对应的最小时间 int m_sMaxNum = 4; diff -Nru dde-calendar-5.9.1/calendar-client/src/view/monthgraphiview.cpp dde-calendar-5.10.0/calendar-client/src/view/monthgraphiview.cpp --- dde-calendar-5.9.1/calendar-client/src/view/monthgraphiview.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/view/monthgraphiview.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "monthgraphiview.h" #include "../widget/monthWidget/monthscheduleview.h" #include "../dialog/scheduledlg.h" @@ -138,7 +122,7 @@ * @brief CMonthGraphicsview::setScheduleInfo 设置日程信息 * @param info */ -void CMonthGraphicsview::setScheduleInfo(const QMap> &info) +void CMonthGraphicsview::setScheduleInfo(const QMap &info) { m_schedulelistdata = info; updateInfo(); @@ -148,7 +132,7 @@ * @brief CMonthGraphicsview::setSelectSearchSchedule 设置选择搜索日程 * @param scheduleInfo */ -void CMonthGraphicsview::setSelectSearchSchedule(const ScheduleDataInfo &scheduleInfo) +void CMonthGraphicsview::setSelectSearchSchedule(const DSchedule::Ptr &scheduleInfo) { DragInfoGraphicsView::setSelectSearchSchedule(scheduleInfo); //获取所有的日程item @@ -171,7 +155,7 @@ * @brief CMonthGraphicsview::setSearchScheduleInfo 设置搜索日程信息 * @param searchScheduleInfo */ -void CMonthGraphicsview::setSearchScheduleInfo(const QVector &searchScheduleInfo) +void CMonthGraphicsview::setSearchScheduleInfo(const DSchedule::List &searchScheduleInfo) { DragInfoItem::setSearchScheduleInfo(searchScheduleInfo); this->scene()->update(); @@ -314,7 +298,7 @@ QTime(0, 0, 0)); } -void CMonthGraphicsview::upDateInfoShow(const CMonthGraphicsview::DragStatus &status, const ScheduleDataInfo &info) +void CMonthGraphicsview::upDateInfoShow(const CMonthGraphicsview::DragStatus &status, const DSchedule::Ptr &info) { switch (status) { case NONE: @@ -403,7 +387,11 @@ } } else { //双击新建日程 - slotCreate(QDateTime(Dayitem->getDate(), QTime(0, 0, 0))); + if (Dayitem->getDate().year() >= DDECalendar::QueryEarliestYear) { + if (Dayitem->getDate().year() <= DDECalendar::QueryLatestYear) { + slotCreate(QDateTime(Dayitem->getDate(), QTime(0, 0, 0))); + } + } } } } @@ -458,7 +446,7 @@ bool CMonthGraphicsview::MeetCreationConditions(const QDateTime &date) { - return qAbs(date.daysTo(m_PressDate) < 43); + return qAbs(date.daysTo(m_PressDate)) < 43; } bool CMonthGraphicsview::IsEqualtime(const QDateTime &timeFirst, const QDateTime &timeSecond) @@ -484,11 +472,11 @@ } } -void CMonthGraphicsview::MoveInfoProcess(ScheduleDataInfo &info, const QPointF &pos) +void CMonthGraphicsview::MoveInfoProcess(DSchedule::Ptr &info, const QPointF &pos) { qint64 offset = m_PressDate.daysTo(m_MoveDate); - info.setBeginDateTime(info.getBeginDateTime().addDays(offset)); - info.setEndDateTime(info.getEndDateTime().addDays(offset)); + info->setDtStart(info->dtStart().addDays(offset)); + info->setDtEnd(info->dtEnd().addDays(offset)); qreal y = 0; QRectF rect = this->sceneRect(); diff -Nru dde-calendar-5.9.1/calendar-client/src/view/monthgraphiview.h dde-calendar-5.10.0/calendar-client/src/view/monthgraphiview.h --- dde-calendar-5.9.1/calendar-client/src/view/monthgraphiview.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/view/monthgraphiview.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,29 +1,13 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef MONTHGRAPHIVIEW_H #define MONTHGRAPHIVIEW_H -#include "src/scheduledatainfo.h" -#include "src/lunardatastruct.h" -#include "src/dbusdatastruct.h" +#include "dschedule.h" +#include "huangliData/lunardatastruct.h" +#include "huangliData/dbusdatastruct.h" #include "draginfographicsview.h" #include "view/graphicsItem/cmonthdayitem.h" @@ -57,11 +41,12 @@ //设置是否显示农历信息 void setLunarVisible(bool visible); //设置日程信息 - void setScheduleInfo(const QMap > &info); + void setScheduleInfo(const QMap &info); //设置搜索选中日程 - void setSelectSearchSchedule(const ScheduleDataInfo &scheduleInfo) override; + void setSelectSearchSchedule(const DSchedule::Ptr &scheduleInfo) override; //设置搜索日程信息 - void setSearchScheduleInfo(const QVector &searchScheduleInfo); + void setSearchScheduleInfo(const DSchedule::List &searchScheduleInfo); + private: void updateSize(); void updateLunar(); @@ -87,12 +72,12 @@ //根据鼠标移动的距离判断是否创建日程 bool JudgeIsCreate(const QPointF &pos) override; void RightClickToCreate(QGraphicsItem *listItem, const QPoint &pos) override; - void MoveInfoProcess(ScheduleDataInfo &info, const QPointF &pos) override; + void MoveInfoProcess(DSchedule::Ptr &info, const QPointF &pos) override; QDateTime getDragScheduleInfoBeginTime(const QDateTime &moveDateTime) override; QDateTime getDragScheduleInfoEndTime(const QDateTime &moveDateTime) override; PosInItem getPosInItem(const QPoint &p, const QRectF &itemRect)override; QDateTime getPosDate(const QPoint &p)override; - void upDateInfoShow(const DragStatus &status = NONE, const ScheduleDataInfo &info = ScheduleDataInfo())override; + void upDateInfoShow(const DragStatus &status = NONE, const DSchedule::Ptr &info = DSchedule::Ptr()) override; /** * @brief slideEvent 触摸滑动事件处理 * @param startPoint 触摸开始坐标 @@ -111,6 +96,6 @@ QMap m_festivallist; int m_currentMonth; CMonthScheduleView *m_MonthScheduleView = nullptr; - QMap> m_schedulelistdata; + QMap m_schedulelistdata; }; #endif // MONTHGRAPHIVIEW_H diff -Nru dde-calendar-5.9.1/calendar-client/src/widget/calendarmainwindow.cpp dde-calendar-5.10.0/calendar-client/src/widget/calendarmainwindow.cpp --- dde-calendar-5.9.1/calendar-client/src/widget/calendarmainwindow.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/widget/calendarmainwindow.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,27 +1,14 @@ -/* - * Copyright (C) 2017 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: kirigaya - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "calendarmainwindow.h" #include "widget/yearWidget/yearwindow.h" #include "widget/monthWidget/monthwindow.h" #include "dbuscalendar_adaptor.h" #include "widget/weekWidget/weekwindow.h" #include "widget/dayWidget/daywindow.h" +#include "sidebarWidget/sidebarview.h" #include "colorWidget/colorpickerWidget.h" #include "scheduledatamanage.h" #include "myscheduleview.h" @@ -34,8 +21,12 @@ #include "ctitlewidget.h" #include "tabletconfig.h" #include "calendarglobalenv.h" +#include "settingWidget/userloginwidget.h" +#include "settingWidget/settingwidgets.h" #include "scheduletypeeditdlg.h" +#include "accountmanager.h" +#include "units.h" #include #include @@ -47,6 +38,8 @@ #include #include #include +#include +#include #include #include @@ -60,6 +53,11 @@ #include #include #include +#include +#include + +#include +#include DGUI_USE_NAMESPACE DWIDGET_USE_NAMESPACE @@ -72,6 +70,10 @@ const int Calendar_Default_Width = 860; //默认宽度 const int Calendar_Default_Height = 634; //默认高度 +//静态的翻译不会真的翻译,但是会更新ts文件 +//像static QString a = QObject::tr("hello"), a实际等于hello,但是ts会有hello这个词条 +//调用DSetingDialog时会用到上述场景 + Calendarmainwindow::Calendarmainwindow(int index, QWidget *w) : DMainWindow(w) , m_defaultIndex(index) @@ -79,6 +81,7 @@ setContentsMargins(QMargins(0, 0, 0, 0)); initUI(); initConnection(); + initData(); setMinimumSize(CalendarMWidth, CalendarMHeight); setWindowTitle(tr("Calendar")); new CalendarAdaptor(this); @@ -300,8 +303,8 @@ { if (job.isEmpty()) return; - ScheduleDataInfo out; - out = ScheduleDataInfo::JsonStrToSchedule(job); + DSchedule::Ptr out; + DSchedule::fromJsonString(out, job); //设置被选中 m_buttonBox->button(DDECalendar::CalendarDayWindow)->setChecked(true); @@ -310,14 +313,20 @@ //切换到日视图 m_stackWidget->setCurrentIndex(DDECalendar::CalendarDayWindow); //设置选择时间 - m_DayWindow->setSelectDate(out.getBeginDateTime().date()); + m_DayWindow->setSelectDate(out->dtStart().date()); //更新界面显示 m_DayWindow->updateData(); //设置非全天时间定位位置 - m_DayWindow->setTime(out.getBeginDateTime().time()); + m_DayWindow->setTime(out->dtStart().time()); //弹出编辑对话框 - CMyScheduleView dlg(out, this); - dlg.exec(); + if (m_dlg == Q_NULLPTR) { + m_dlg = new CMyScheduleView(out, this); + } else { + m_dlg->setSchedules(out); + m_dlg->updateFormat(); + } + if (m_dlg->isHidden()) + m_dlg->exec(); slotWUpdateSchedule(); } void Calendarmainwindow::initUI() @@ -339,7 +348,6 @@ setTabOrder(this->titlebar(), m_titleWidget); //设置状态栏焦点代理为标题窗口 this->titlebar()->setFocusProxy(m_titleWidget); - //this->titlebar()->setFocusProxy(titleWidget); this->titlebar()->setQuitMenuVisible(true);//先设置后,才可以获取menu内容。因为setQuitMenuVisible接口中进行了action的添加操作 QMenu *menuTitleBar = this->titlebar()->menu(); @@ -348,11 +356,16 @@ //menuTitleBar->addAction(pSetting); menuTitleBar->insertSeparator(menuTitleBar->actions()[0]); menuTitleBar->insertAction(menuTitleBar->actions()[0], pSetting); - connect(pSetting, &QAction::triggered, this, &Calendarmainwindow::slotOpenSettingDialog); + //添加隐私政策 + QAction *pPrivacy = new QAction(tr("Privacy Policy"), menuTitleBar); + menuTitleBar->insertSeparator(menuTitleBar->actions()[1]); + menuTitleBar->insertAction(menuTitleBar->actions()[1], pPrivacy); + connect(pPrivacy, &QAction::triggered, this, &Calendarmainwindow::slotShowPrivacy); + //接收设置按键焦点 - connect(m_titleWidget, &CTitleWidget::signalSetButtonFocus, [=] { + connect(m_titleWidget, &CTitleWidget::signalSetButtonFocus, [ = ] { m_setButtonFocus = true; }); connect(m_titleWidget, &CTitleWidget::signalSearchFocusSwitch, this, @@ -362,6 +375,13 @@ m_buttonBox = m_titleWidget->buttonBox(); m_newScheduleBtn = m_titleWidget->newScheduleBtn(); + QHBoxLayout *tMainLayout = new QHBoxLayout; + tMainLayout->setContentsMargins(10, 10, 10, 10); + tMainLayout->setSpacing(10); + + m_sidebarView = new SidebarView(this); + tMainLayout->addWidget(m_sidebarView, 1); + m_stackWidget = new AnimationStackedWidget(); m_stackWidget->setObjectName("StackedWidget"); m_stackWidget->setAccessibleName("StackedWidget"); @@ -369,11 +389,9 @@ m_stackWidget->setContentsMargins(0, 0, 0, 0); m_stackWidget->setDuration(250); createview(); - QHBoxLayout *tMainLayout = new QHBoxLayout; - tMainLayout->setMargin(0); - tMainLayout->setSpacing(0); - tMainLayout->setContentsMargins(0, 0, 0, 0); - tMainLayout->addWidget(m_stackWidget); + + tMainLayout->addWidget(m_stackWidget, 4); + m_contentBackground = new DFrame; m_contentBackground->setAccessibleName("ScheduleSearchWidgetBackgroundFrame"); m_contentBackground->setObjectName("ScheduleSearchWidgetBackgroundFrame"); @@ -391,12 +409,12 @@ QVBoxLayout *ssLayout = new QVBoxLayout; ssLayout->setMargin(0); ssLayout->setSpacing(0); - ssLayout->setContentsMargins(0, 10, 0, 10); - ssLayout->addWidget(m_scheduleSearchView); + ssLayout->addWidget(m_scheduleSearchView, 1); m_contentBackground->setLayout(ssLayout); - tMainLayout->addWidget(m_contentBackground); m_contentBackground->setVisible(false); + tMainLayout->addWidget(m_contentBackground); + DWidget *maincentralWidget = new DWidget(this); maincentralWidget->setAccessibleName("mainCentralWidget"); @@ -431,10 +449,9 @@ &Calendarmainwindow::slotSearchSelectSchedule); connect(m_scheduleSearchView, &CScheduleSearchView::signalScheduleHide, this, &Calendarmainwindow::setScheduleHide); - + connect(m_sidebarView, &SidebarView::signalScheduleHide, this, &Calendarmainwindow::setScheduleHide); connect(m_scheduleSearchView, &CScheduleSearchView::signalSelectCurrentItem, this, &Calendarmainwindow::slotSetSearchFocus); - //更新当前时间 connect(m_currentDateUpdateTimer, &QTimer::timeout, this, &Calendarmainwindow::slotCurrentDateUpdate); @@ -446,6 +463,16 @@ connect(m_newScheduleBtn, &DToolButton::clicked, this, &Calendarmainwindow::slotNewSchedule); connect(qApp, &QGuiApplication::applicationStateChanged, this, &Calendarmainwindow::slotapplicationStateChanged); + connect(m_titleWidget, &CTitleWidget::signalSidebarStatusChange, this, &Calendarmainwindow::slotSidebarStatusChange); + //signalAccountUpdate + connect(gAccountManager, &AccountManager::signalSyncNum, this, &Calendarmainwindow::slotShowSyncToast); + connect(gAccountManager, &AccountManager::signalAccountUpdate, this, &Calendarmainwindow::slotAccountUpdate); +} + +void Calendarmainwindow::initData() +{ + //根据配置设置侧边栏状态 + m_titleWidget->setSidebarStatus(gSetting->getUserSidebarStatus()); } /** @@ -485,20 +512,29 @@ } } -/** - * @brief Calendarmainwindow::setScheduleHide 隐藏提示框 - */ -void Calendarmainwindow::setScheduleHide() +void Calendarmainwindow::resizeView() { - m_yearwindow->slotSetScheduleHide(); - m_monthWindow->slotScheduleHide(); - m_weekWindow->slotScheduleHide(); - m_DayWindow->slotScheduleHide(); -} + //帐户列表窗口(A),视图窗口(B),搜索结果窗口(C) + //窗口由大变小先隐藏A,在隐藏B + //窗口由小变大先显示B,在显示A + //不能出现只显示A和C的情况 + + + //根据界面大小改变趋势设置侧边栏可显示状态 + //如果帐户列表窗口为显示状态 + if (m_titleWidget->getSidevarStatus()) { + //如果显示搜索窗口,若需要显示帐户列表则界面的最小尺寸需要984,否则为826 + int minWidth = m_opensearchflag ? 984 : 826 ; + + if (width() < minWidth) { + m_titleWidget->setSidebarCanDisplay(false); + m_sidebarView->setVisible(false); + } else if (width() > minWidth) { + m_titleWidget->setSidebarCanDisplay(true); + m_sidebarView->setVisible(true); + } + } -void Calendarmainwindow::resizeEvent(QResizeEvent *event) -{ - DMainWindow::resizeEvent(event); m_transparentFrame->resize(width(), height() - 50); if (width() < CalendarSwitchWidth) { @@ -507,19 +543,44 @@ m_titleWidget->setShowState(CTitleWidget::Title_State_Normal); } - if (width() < CalendarViewSwitchWidth) { + int sidWidth = 0; + if (!m_sidebarView->isHidden()) { + sidWidth = m_sidebarView->width(); + } + if (width() < CalendarViewSwitchWidth + sidWidth) { m_isNormalStateShow = false; m_stackWidget->setVisible(!m_contentBackground->isVisible()); - m_scheduleSearchViewMaxWidth = this->width(); + // 如果是隐藏的状态,不需要多减去sidewidth + sidWidth = sidWidth == 0 ? 0 : sidWidth + 10; + m_scheduleSearchViewMaxWidth = this->width() - sidWidth; } else { - m_scheduleSearchViewMaxWidth = qRound(0.2325 * width() + 0.5); + m_scheduleSearchViewMaxWidth = qRound(0.2325 * (width()) + 0.5); m_isNormalStateShow = true; m_stackWidget->setVisible(true); m_contentBackground->setVisible(m_opensearchflag); } - m_scheduleSearchView->setMaxWidth(m_scheduleSearchViewMaxWidth); - setSearchWidth(m_scheduleSearchViewMaxWidth); + // 额外减去20 是因为ui走查控件之间的space=10,两个间隔 + m_scheduleSearchView->setMaxWidth(m_scheduleSearchViewMaxWidth - 20); + setSearchWidth(m_scheduleSearchViewMaxWidth - 20); setScheduleHide(); +} + +/** + * @brief Calendarmainwindow::setScheduleHide 隐藏提示框 + */ +void Calendarmainwindow::setScheduleHide() +{ + m_yearwindow->slotSetScheduleHide(); + m_monthWindow->slotScheduleHide(); + m_weekWindow->slotScheduleHide(); + m_DayWindow->slotScheduleHide(); +} + +void Calendarmainwindow::resizeEvent(QResizeEvent *event) +{ + DMainWindow::resizeEvent(event); + + resizeView(); //保存窗口大小 CConfigSettings::getInstance()->setOption("base.windowWidth", event->size().width()); @@ -552,15 +613,11 @@ m_opensearchflag = true; } //如果为搜索状态 - if (m_opensearchflag) { - //根据显示显示状态,是否显示左侧视图窗口 - if (!m_isNormalStateShow) { - m_stackWidget->setVisible(false); - } - m_contentBackground->setVisible(true); - } + m_contentBackground->setVisible(m_opensearchflag); + m_scheduleSearchView->slotsetSearch(m_searchEdit->text()); updateHeight(); + resizeView(); } void Calendarmainwindow::slotStextChanged() @@ -579,6 +636,7 @@ m_contentBackground->setVisible(false); m_stackWidget->setVisible(true); m_opensearchflag = false; + resizeView(); } updateHeight(); } @@ -603,13 +661,11 @@ * @brief Calendarmainwindow::slotSearchSelectSchedule 单击搜索日程动画设置 * @param scheduleInfo */ -void Calendarmainwindow::slotSearchSelectSchedule(const ScheduleDataInfo &scheduleInfo) +void Calendarmainwindow::slotSearchSelectSchedule(const DSchedule::Ptr &scheduleInfo) { //如果小尺寸显示模式,在显示搜索窗口的时候,左侧视图会被隐藏 //如果点击一个搜索结果则隐藏搜索窗口,展示左侧视图 if (!m_isNormalStateShow) { - // CalendarGlobalEnv::getGlobalEnv()->registerKey("SearchItemEvent", "Keyboard"); - QVariant variant; CalendarGlobalEnv::getGlobalEnv()->getValueByKey("SearchItemEvent", variant); QString searchItemEvent = variant.toString(); @@ -623,9 +679,9 @@ CScheduleBaseWidget *_showWidget = dynamic_cast(m_stackWidget->currentWidget()); if (_showWidget) { //如果日程开始时间年份与选择时间年份不一样则切换年份显示 - bool changeYear = _showWidget->getSelectDate().year() != scheduleInfo.getBeginDateTime().date().year(); + bool changeYear = _showWidget->getSelectDate().year() != scheduleInfo->dtStart().date().year(); //设置选择时间 - if (_showWidget->setSelectDate(scheduleInfo.getBeginDateTime().date(), changeYear)) { + if (_showWidget->setSelectDate(scheduleInfo->dtStart().date(), changeYear)) { //更新显示数据 _showWidget->updateData(); //设置年份信息显示 @@ -753,6 +809,19 @@ } } +void Calendarmainwindow::slotSidebarStatusChange(bool status) +{ + //先显示再调整窗口大小 + m_sidebarView->setVisible(status); + if (status) { + //如果显示搜索窗口,若需要显示帐户列表则界面的最小尺寸需要984,否则为826 + int minWidth = m_opensearchflag ? 984 : 826 ; + if (width() < minWidth) { + resize(minWidth, height()); + } + } +} + void Calendarmainwindow::mouseMoveEvent(QMouseEvent *event) { //如果为平板模式则不可移动 @@ -774,8 +843,9 @@ void Calendarmainwindow::mousePressEvent(QMouseEvent *event) { - Q_UNUSED(event); setScheduleHide(); + if (event->button() & Qt::LeftButton) + m_startPos = event->pos(); } bool Calendarmainwindow::event(QEvent *event) @@ -816,67 +886,87 @@ void Calendarmainwindow::slotOpenSettingDialog() { - if (nullptr == m_dsdSetting) { - m_dsdSetting = new DSettingsDialog(this); - m_dsdSetting->setIcon(CDynamicIcon::getInstance()->getPixmap()); - m_dsdSetting->setFixedSize(682, 506); - m_dsdSetting->widgetFactory()->registerWidget("JobTypeListView", [](QObject *obj) -> QWidget * { - if (DSettingsOption *option = qobject_cast(obj)) { - Q_UNUSED(option) - JobTypeListView *lv = new JobTypeListView(); - lv->setObjectName("JobTypeListView"); - return lv; - } - return nullptr; - }); - QString strJson = QString(R"( - {"groups":[{"key":"setting_base","name":"Manage calendar","groups":[{"key":"event_types","name":"Event types","options":[{"key":"JobTypeListView","type":"JobTypeListView","name":"JobTypeListView","default":""}]}]}]} - )"); - - auto settings = Dtk::Core::DSettings::fromJson(strJson.toLatin1()); - //settings->setBackend(&backend); - m_dsdSetting->setObjectName("SettingDialog"); - - m_dsdSetting->updateSettings(settings); - //恢复默认设置按钮不显示 - m_dsdSetting->setResetVisible(false); - - //QList - QList lstwidget = m_dsdSetting->findChildren(); - if (lstwidget.size() > 0) { //accessibleName - for (QWidget *wid : lstwidget) { - if ("ContentWidgetForsetting_base.event_types" == wid->accessibleName()) { - JobTypeListView *view = m_dsdSetting->findChild("JobTypeListView"); - if (!view) - return; - DIconButton *addButton = new DIconButton(DStyle::SP_IncreaseElement, nullptr); - //跟UI沟通size设置为20*20 - addButton->setFixedSize(20, 20); - wid->layout()->addWidget(addButton); - //使addButton的右边距等于view的右边距 - int leftMargin = wid->layout()->contentsMargins().left(); - wid->layout()->setContentsMargins(leftMargin, 0, leftMargin, 0); - - addButton->setEnabled(view->canAdd()); - - //当日常类型超过上限时,更新button的状态 - connect(view, &JobTypeListView::signalAddStatusChanged, addButton, &DIconButton::setEnabled); - //新增类型 - connect(addButton, &DIconButton::clicked, this, [=] { - ScheduleTypeEditDlg a(m_dsdSetting); - a.exec(); - }); - } - if (wid->accessibleName().contains("DefaultWidgetAtContentRow")) { - //DefaultWidgetAtContentRow是设置对话框右边每一个option条目对应widget的accessibleName的前缀,所以如果后续有更多条目,需要做修改 - wid->layout()->setMargin(0); - } - } - } - } + m_dsdSetting = new CSettingDialog(this); //内容定位到顶端 m_dsdSetting->exec(); - //使用晚后释放 + //使用完后释放 delete m_dsdSetting; m_dsdSetting = nullptr; + gCalendarManager->updateData(); +} + +void Calendarmainwindow::slotShowPrivacy() +{ + QString url = ""; + QLocale locale; + QLocale::Country country = locale.country(); + bool isCommunityEdition = DSysInfo::isCommunityEdition(); + if (country == QLocale::China) { + if (isCommunityEdition) { + url = "https://www.deepin.org/zh/agreement/privacy/"; + } else { + url = "https://www.uniontech.com/agreement/privacy-cn"; + } + } else { + if (isCommunityEdition) { + url = "https://www.deepin.org/en/agreement/privacy/"; + } else { + url = "https://www.uniontech.com/agreement/privacy-en"; + } + } + QDesktopServices::openUrl(url); +} + +void Calendarmainwindow::removeSyncToast() +{ + QWidget *content = this->window()->findChild("_d_message_manager_content", Qt::FindDirectChildrenOnly); + if (nullptr == content) return; + for (DFloatingMessage *message : content->findChildren(QString(), Qt::FindDirectChildrenOnly)) { + content->layout()->removeWidget(message); + message->hide(); + message->deleteLater(); + } +} + +void Calendarmainwindow::slotShowSyncToast(int syncNum) +{ + //-1:正在刷新 0:正常 1:网络异常 2:服务器异常 3:存储已经满 + static int preSyncNum = -2; + if (preSyncNum != syncNum && syncNum == -1) { + preSyncNum = -1; + //同步中 + removeSyncToast(); + DMessageManager::instance()->sendMessage(this->window(), QIcon::fromTheme(":/icons/deepin/builtin/icons/dde_calendar_spinner_32px.svg"), tr("Syncing...")); + return; + } + // + if (preSyncNum == -1 && syncNum != -1) { + preSyncNum = -2; + switch (syncNum) { + case 0: { + //同步成功 + removeSyncToast(); + DMessageManager::instance()->sendMessage(this->window(), QIcon::fromTheme(":/icons/deepin/builtin/icons/dde_calendar_success_200px.png"), tr("Sync successful")); + break; + } + case 1: + case 2: + case 3: { + //同步失败 + removeSyncToast(); + DMessageManager::instance()->sendMessage(this->window(), QIcon::fromTheme(":/icons/deepin/builtin/icons/dde_calendar_fail_200px.png"), tr("Sync failed, please try later")); + break; + } + default: + break; + } + } +} + +void Calendarmainwindow::slotAccountUpdate() +{ + AccountItem::Ptr uidAccount = gUosAccountItem; + if (!uidAccount.isNull()) { + connect(uidAccount.get(), &AccountItem::signalSyncStateChange, this, &Calendarmainwindow::slotShowSyncToast); + } } diff -Nru dde-calendar-5.9.1/calendar-client/src/widget/calendarmainwindow.h dde-calendar-5.10.0/calendar-client/src/widget/calendarmainwindow.h --- dde-calendar-5.9.1/calendar-client/src/widget/calendarmainwindow.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/widget/calendarmainwindow.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,27 +1,13 @@ -/* - * Copyright (C) 2017 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: kirigaya - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later #ifndef CALENDARMAINWINDOW_H #define CALENDARMAINWINDOW_H -#include "src/scheduledatainfo.h" +#include "dschedule.h" #include "jobtypelistview.h" +#include "settingdialog.h" #include #include @@ -31,22 +17,27 @@ #include #include #include +#include #include #include #include #include #include +#include +#include DWIDGET_USE_NAMESPACE class CYearWindow; class CMonthWindow; class CWeekWindow; class CDayWindow; +class SidebarView; class CScheduleSearchView; class AnimationStackedWidget; class CScheduleDataManage; class CTitleWidget; +class CMyScheduleView; class Calendarmainwindow : public DMainWindow { @@ -67,8 +58,12 @@ private: void initUI(); void initConnection(); + void initData(); //创建视图 void createview(); + //重置界面大小 + void resizeView(); + void removeSyncToast(); protected: void resizeEvent(QResizeEvent *event) override; void mouseMoveEvent(QMouseEvent *event) override; @@ -89,7 +84,7 @@ void slotStextfocusChanged(bool onFocus); void slotSearchEdit(); //单击搜索日程动画设置 - void slotSearchSelectSchedule(const ScheduleDataInfo &scheduleInfo); + void slotSearchSelectSchedule(const DSchedule::Ptr &scheduleInfo); //添加视图阴影 void slotViewtransparentFrame(const bool isShow); //启用buttonbox @@ -99,11 +94,20 @@ //新建日程 void slotNewSchedule(); void slotOpenSettingDialog(); + //触发隐藏政策 + void slotShowPrivacy(); //快捷键删除选中日程 void slotDeleteitem(); //设置最大大小 void slotSetMaxSize(int size = 0); void slotSearchFocusSwitch(); + //帐户侧边栏状态发生改变事件 + void slotSidebarStatusChange(bool); + + //显示同步提示 + void slotShowSyncToast(int syncNum); + + void slotAccountUpdate(); private: DLabel *m_icon = nullptr; @@ -115,6 +119,7 @@ CWeekWindow *m_weekWindow = nullptr; CDayWindow *m_DayWindow = nullptr; CTitleWidget *m_titleWidget = nullptr; + SidebarView *m_sidebarView = nullptr; bool m_searchflag = false; CScheduleSearchView *m_scheduleSearchView = nullptr; DFrame *m_contentBackground = nullptr; @@ -125,12 +130,16 @@ QPropertyAnimation *m_animation = nullptr; QTimer *m_currentDateUpdateTimer = nullptr; DIconButton *m_newScheduleBtn {nullptr}; //全局的新建日程按钮 - DSettingsDialog *m_dsdSetting {nullptr}; + CSettingDialog *m_dsdSetting {nullptr}; JobTypeListView *m_jobTypeListView {nullptr}; //日历打开默认显示视图 int m_defaultIndex; bool m_setButtonFocus {false}; bool m_isNormalStateShow {true}; //是否为正常状态显示 + QPoint m_startPos; + + CMyScheduleView *m_dlg = Q_NULLPTR; + }; #endif // CALENDARMAINWINDOW_H diff -Nru dde-calendar-5.9.1/calendar-client/src/widget/cschedulebasewidget.cpp dde-calendar-5.10.0/calendar-client/src/widget/cschedulebasewidget.cpp --- dde-calendar-5.9.1/calendar-client/src/widget/cschedulebasewidget.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/widget/cschedulebasewidget.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,28 +1,16 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "cschedulebasewidget.h" +#include "monthbrefwidget.h" CalendarManager *CScheduleBaseWidget::m_calendarManager = nullptr; CScheduleBaseWidget::CScheduleBaseWidget(QWidget *parent) : QWidget(parent) { + m_dialogIconButton = new CDialogIconButton(this); + m_dialogIconButton->setFixedSize(QSize(16, 16)); + initConnect(); if (m_calendarManager == nullptr) { m_calendarManager = CalendarManager::getInstance(); //获取一年的日程信息 @@ -40,36 +28,46 @@ } } +void CScheduleBaseWidget::initConnect() +{ + connect(ScheduleManager::getInstace(), &ScheduleManager::signalScheduleUpdate, this, &CScheduleBaseWidget::slotScheduleUpdate); + connect(ScheduleManager::getInstace(), &ScheduleManager::signalSearchScheduleUpdate, this, &CScheduleBaseWidget::slotSearchedScheduleUpdate); +} + /** * @brief CScheduleBaseWidget::setSelectDate 设置选择时间 * @param selectDate */ -bool CScheduleBaseWidget::setSelectDate(const QDate &selectDate, const bool isSwitchYear) +bool CScheduleBaseWidget::setSelectDate(const QDate &selectDate, const bool isSwitchYear, const QWidget *widget) { - bool _result = false; //选择时间必须大于等于1900年 - if (selectDate.year() >= 1900) { - m_calendarManager->getCalendarDateDataManage()->setSelectDate(selectDate, isSwitchYear); + bool _result = false; //选择时间必须大于等于1900年小于2100年 + if (selectDate.year() >= 1900 && selectDate.year() <=2100) { + m_calendarManager->setSelectDate(selectDate, isSwitchYear); _result = true; //更新其它视图界面显示 for (int i = 0; i < m_calendarManager->getShowWidgetSize(); ++i) { //如果为当前视图则不更新 - if (m_calendarManager->getShowWidget(i) == this || m_calendarManager->getShowWidget(i) == nullptr) + if (m_calendarManager->getShowWidget(i) == nullptr || m_calendarManager->getShowWidget(i) == widget) continue; m_calendarManager->getShowWidget(i)->setYearData(); m_calendarManager->getShowWidget(i)->updateShowDate(); } - updateDBusData(); } return _result; } +bool CScheduleBaseWidget::setSelectDate(const QDate &selectDate, const QWidget *widget) +{ + return setSelectDate(selectDate, false, widget); +} + /** * @brief CScheduleBaseWidget::getSelectDate 获取选择时间 * @return */ -QDate CScheduleBaseWidget::getSelectDate() const +QDate CScheduleBaseWidget::getSelectDate() { - return m_calendarManager->getCalendarDateDataManage()->getSelectDate(); + return m_calendarManager->getSelectDate(); } /** @@ -78,7 +76,7 @@ */ void CScheduleBaseWidget::setCurrentDateTime(const QDateTime ¤tDate) { - m_calendarManager->getCalendarDateDataManage()->setCurrentDateTime(currentDate); + m_calendarManager->setCurrentDateTime(currentDate); } /** @@ -87,7 +85,7 @@ */ QDateTime CScheduleBaseWidget::getCurrendDateTime() const { - return m_calendarManager->getCalendarDateDataManage()->getCurrentDate(); + return m_calendarManager->getCurrentDate(); } /** @@ -106,7 +104,10 @@ { updateShowDate(); updateShowSchedule(); - updateShowLunar(); + //如果为中午环境则更新农历信息 + if ( getShowLunar() ) { + updateShowLunar(); + } updateSearchScheduleInfo(); } @@ -115,21 +116,20 @@ */ void CScheduleBaseWidget::updateDBusData() { - ShowDateRange _showDateRange = m_calendarManager->getCalendarDateDataManage()->getShowDateRange(); - //如果缓存中不包含开始或结束时间则更新dbus数据 - if (!m_calendarManager->getScheduleTask()->hasScheduleInfo(_showDateRange.startDate, _showDateRange.stopDate)) { - //获取日程开始和结束时间,考虑切换日视图会显示显示时间之外的时间所以前后多获取2个月日程数据。 - QDate _startDate = _showDateRange.startDate.addDays(-42); - QDate _stopDate = _showDateRange.stopDate.addDays(42); //getShowLunar() - //获取日程任务 - CScheduleTask *_task = m_calendarManager->getScheduleTask(); - if (_startDate.isValid() && _stopDate.isValid()) { - //更新日程信息 - _task->updateInfo(_startDate, _stopDate, getShowLunar()); - } else { - qWarning() << "startDate or stopDate Err!"; - } - } +// ShowDateRange _showDateRange = m_calendarManager->getShowDateRange(); +// //如果缓存中不包含开始或结束时间则更新dbus数据 +// if (!m_calendarManager->getScheduleTask()->hasScheduleInfo(_showDateRange.startDate, _showDateRange.stopDate)) { +// //获取日程开始和结束时间,考虑切换日视图会显示显示时间之外的时间所以前后多获取2个月日程数据。 +// QDate _startDate = _showDateRange.startDate.addDays(-42); +// QDate _stopDate = _showDateRange.stopDate.addDays(42); //getShowLunar() + +// if (_startDate.isValid() && _stopDate.isValid()) { +// //更新日程信息 +//// _task->updateInfo(_startDate, _stopDate, getShowLunar()); +// } else { +// qWarning() << "startDate or stopDate Err!"; +// } +// } } /** @@ -152,11 +152,20 @@ */ CaHuangLiDayInfo CScheduleBaseWidget::getLunarInfo() { - QMap _huangLiInfo = m_calendarManager->getScheduleTask()->getHuangLiInfo(getSelectDate(), getSelectDate()); - QMap::const_iterator interator = _huangLiInfo.constBegin(); - if (interator == _huangLiInfo.constEnd()) - return CaHuangLiDayInfo(); - m_lunarYear = QString("-%0%1年-").arg(interator.value().mGanZhiYear).arg(interator.value().mZodiac); - m_lunarDay = QString("-农历%0%1-").arg(interator.value().mLunarMonthName).arg(interator.value().mLunarDayName); - return interator.value(); + CaHuangLiDayInfo huangLiInfo = gLunarManager->getHuangLiDay(getSelectDate()); + m_lunarYear = QString("-%0%1年-").arg(huangLiInfo.mGanZhiYear).arg(huangLiInfo.mZodiac); + m_lunarDay = QString("-农历%0%1-").arg(huangLiInfo.mLunarMonthName).arg(huangLiInfo.mLunarDayName); + return huangLiInfo; +} + +void CScheduleBaseWidget::slotScheduleUpdate() +{ + updateShowSchedule(); + //刷新日程的同时也要刷新被搜索的日程,保证有搜索日程时显示正常 + updateSearchScheduleInfo(); +} + +void CScheduleBaseWidget::slotSearchedScheduleUpdate() +{ + updateSearchScheduleInfo(); } diff -Nru dde-calendar-5.9.1/calendar-client/src/widget/cschedulebasewidget.h dde-calendar-5.10.0/calendar-client/src/widget/cschedulebasewidget.h --- dde-calendar-5.9.1/calendar-client/src/widget/cschedulebasewidget.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/widget/cschedulebasewidget.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,27 +1,14 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef CSCHEDULEBASEWIDGET_H #define CSCHEDULEBASEWIDGET_H #include "calendarmanage.h" +#include "cdialogiconbutton.h" +#include "schedulemanager.h" +#include "lunarmanager.h" #include @@ -32,9 +19,10 @@ explicit CScheduleBaseWidget(QWidget *parent = nullptr); ~CScheduleBaseWidget(); //设置选择时间 - bool setSelectDate(const QDate &selectDate, const bool isSwitchYear = false); + static bool setSelectDate(const QDate &selectDate, const bool isSwitchYear = false, const QWidget *widget = nullptr); + bool setSelectDate(const QDate &selectDate, const QWidget *widget); //获取选择时间 - QDate getSelectDate() const; + static QDate getSelectDate(); //设置当前时间 virtual void setCurrentDateTime(const QDateTime ¤tDate); //获取当前时间 @@ -44,7 +32,7 @@ //更新所有数据,显示时间和日程数据 void updateData(); //更新dbus数据 - void updateDBusData(); + static void updateDBusData(); //更新界面搜索日程显示 virtual void updateSearchScheduleInfo(); //设置年显示 @@ -56,7 +44,7 @@ //更新农历信息显示 virtual void updateShowLunar() = 0; //设置选中搜索日程 - virtual void setSelectSearchScheduleInfo(const ScheduleDataInfo &info) = 0; + virtual void setSelectSearchScheduleInfo(const DSchedule::Ptr &info) = 0; //删除选中日程 virtual void deleteselectSchedule(); protected: @@ -65,10 +53,20 @@ signals: //切换视图信号 0:跳转上一个视图 1:月视图 2:周视图 3:日视图 void signalSwitchView(const int viewIndex = 0); + +public slots: + void slotScheduleUpdate(); + void slotSearchedScheduleUpdate(); + +private: + void initConnect(); + protected: static CalendarManager *m_calendarManager; QString m_lunarYear; QString m_lunarDay; + + CDialogIconButton *m_dialogIconButton = nullptr; //时间跳转控件 }; #endif // CSCHEDULEBASEWIDGET_H diff -Nru dde-calendar-5.9.1/calendar-client/src/widget/dayWidget/dayhuangliview.cpp dde-calendar-5.10.0/calendar-client/src/widget/dayWidget/dayhuangliview.cpp --- dde-calendar-5.9.1/calendar-client/src/widget/dayWidget/dayhuangliview.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/widget/dayWidget/dayhuangliview.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,21 +1,7 @@ -/* - * Copyright (C) 2017 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: kirigaya - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "dayhuangliview.h" #include "scheduledlg.h" @@ -74,9 +60,9 @@ painter.drawRoundedRect(fillRect, 12, 12); QPixmap pixmap; if (m_type == 0) - pixmap = DHiDPIHelper::loadNxPixmap(":/resources/icon/dde-yi.svg"); + pixmap = DHiDPIHelper::loadNxPixmap(":/icons/deepin/builtin/icons/dde_calendar_yi_32px.svg"); else { - pixmap = DHiDPIHelper::loadNxPixmap(":/resources/icon/dde-ji.svg"); + pixmap = DHiDPIHelper::loadNxPixmap(":/icons/deepin/builtin/icons/dde_calendar_ji_32px.svg"); } pixmap.setDevicePixelRatio(devicePixelRatioF()); painter.save(); @@ -88,12 +74,12 @@ painter.setFont(m_font); painter.setPen(m_textcolor); - int bw = m_leftMagin + 34; + int bw = m_leftMagin + 50; int bh = m_topMagin; int ss = 14; for (int i = 0; i < m_vHuangli.count(); i++) { int currentsw = m_vHuangli.at(i).count() * ss; - if (bw + currentsw + 6 > labelwidth) { + if (bw + currentsw + 15 >= labelwidth) { painter.drawText(QRect(bw, bh, labelwidth - bw, 21), Qt::AlignLeft, "..."); break; } else { diff -Nru dde-calendar-5.9.1/calendar-client/src/widget/dayWidget/dayhuangliview.h dde-calendar-5.10.0/calendar-client/src/widget/dayWidget/dayhuangliview.h --- dde-calendar-5.9.1/calendar-client/src/widget/dayWidget/dayhuangliview.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/widget/dayWidget/dayhuangliview.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,21 +1,7 @@ -/* - * Copyright (C) 2017 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: kirigaya - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef DAYHUANGLILABEL_H #define DAYHUANGLILABEL_H diff -Nru dde-calendar-5.9.1/calendar-client/src/widget/dayWidget/daymonthview.cpp dde-calendar-5.10.0/calendar-client/src/widget/dayWidget/daymonthview.cpp --- dde-calendar-5.9.1/calendar-client/src/widget/dayWidget/daymonthview.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/widget/dayWidget/daymonthview.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,44 +1,30 @@ -/* - * Copyright (C) 2015 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: kirigaya - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2015 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later #include "todaybutton.h" #include "scheduledatamanage.h" #include "daymonthview.h" #include "constants.h" #include "dayhuangliview.h" +#include "configsettings.h" +#include "calendarglobalenv.h" +#include "scheduledlg.h" #include #include #include #include -#include #include #include #include #include #include -#include -#include #include #include -#include +#include + DGUI_USE_NAMESPACE CDayMonthView::CDayMonthView(QWidget *parent) @@ -65,6 +51,7 @@ m_currentDate = currentDate; m_dayMonthWidget->setShowDate(showDate, selectDate, currentDate); updateDateShow(); + update(); } void CDayMonthView::setLunarVisible(bool visible) @@ -79,6 +66,7 @@ void CDayMonthView::setTheMe(int type) { + QColor todayColor = CScheduleDataManage::getScheduleDataManage()->getSystemActiveColor(); m_dayMonthWidget->setTheMe(type); if (type == 0 || type == 1) { DPalette aniPa = this->palette(); @@ -88,22 +76,10 @@ setBackgroundRole(DPalette::Background); setBColor(tbColor); - DPalette todayPa = m_today->palette(); - QColor todayColor = CScheduleDataManage::getScheduleDataManage()->getSystemActiveColor(); - todayPa.setColor(DPalette::ButtonText, todayColor); - todayPa.setColor(DPalette::Dark, Qt::white); - todayPa.setColor(DPalette::Light, Qt::white); - QColor sbColor("#002A57"); - sbColor.setAlphaF(0.05); - todayPa.setColor(DPalette::Shadow, sbColor); - m_today->setPalette(todayPa); QColor todayhover = "#000000"; todayhover.setAlphaF(0.1); QColor todaypress = "#000000"; todaypress.setAlphaF(0.2); - m_today->setBColor("#FFFFFF", todayhover, todaypress, "#FFFFFF", todayhover, todaypress); - m_today->setTColor(todayColor, "#001A2E", "#0081FF"); - m_today->setshadowColor(sbColor); DPalette prevPalette = m_prevButton->palette(); prevPalette.setColor(DPalette::Dark, QColor("#E6E6E6")); prevPalette.setColor(DPalette::Light, QColor("#E3E3E3")); @@ -148,18 +124,6 @@ setBackgroundRole(DPalette::Background); setBColor(tbColor); - DPalette todayPa = m_today->palette(); - QColor todayColor = CScheduleDataManage::getScheduleDataManage()->getSystemActiveColor(); - todayPa.setColor(DPalette::ButtonText, todayColor); - todayPa.setColor(DPalette::Light, "#484848"); - todayPa.setColor(DPalette::Dark, "#414141"); - QColor sbColor("#000000"); - sbColor.setAlphaF(0.05); - todayPa.setColor(DPalette::Shadow, sbColor); - m_today->setPalette(todayPa); - m_today->setBColor("#484848", "#727272", "#242424", "#414141", "#535353", "#282828"); - m_today->setTColor(todayColor, "#FFFFFF", "#0081FF"); - m_today->setshadowColor(sbColor); DPalette prevPalette = m_prevButton->palette(); prevPalette.setColor(DPalette::Dark, QColor("#484848")); prevPalette.setColor(DPalette::Light, QColor("#414141")); @@ -222,19 +186,10 @@ { m_today = new CTodayButton; m_today->setText(QCoreApplication::translate("today", "Today", "Today")); - m_today->setFixedSize(100, DDEDayCalendar::D_MLabelHeight); - DPalette todayPa = m_today->palette(); - QColor todayColor = CScheduleDataManage::getScheduleDataManage()->getSystemActiveColor(); - todayPa.setColor(DPalette::ButtonText, todayColor); - todayPa.setColor(DPalette::Dark, Qt::white); - todayPa.setColor(DPalette::Light, Qt::white); - QColor sbColor("#002A57"); - sbColor.setAlphaF(0.05); - todayPa.setColor(DPalette::Shadow, sbColor); + m_today->setFixedSize(80, DDEDayCalendar::D_MLabelHeight); QFont todayfont; todayfont.setPixelSize(DDECalendar::FontSizeFourteen); m_today->setFont(todayfont); - m_today->setPalette(todayPa); m_prevButton = new DIconButton(DStyle::SP_ArrowLeft, this); m_prevButton->setFixedSize(36, 36); @@ -265,8 +220,12 @@ m_upLayout->setSpacing(0); m_upLayout->setContentsMargins(22, 9, 0, 7); m_upLayout->addLayout(titleLayout); + + m_weekWidget = new CWeekWidget(); + m_weekWidget->setMaximumHeight(40); m_dayMonthWidget = new CDayMonthWidget(); - m_upLayout->addWidget(m_dayMonthWidget); + m_upLayout->addWidget(m_weekWidget, 1); + m_upLayout->addWidget(m_dayMonthWidget, 6); //中间部分 QVBoxLayout *midLayout = new QVBoxLayout; @@ -308,28 +267,28 @@ midLayout->addWidget(m_currentLuna); m_yiDownLayout = new QVBoxLayout; - m_yiDownLayout->setMargin(0); m_yiDownLayout->setSpacing(0); m_yiDownLayout->setContentsMargins(10, 5, 10, 0); hLabelF.setPixelSize(DDECalendar::FontSizeFourteen); m_yiLabel = new CDayHuangLiLabel(this); m_yiLabel->setbackgroundColor(QColor("#75C18E")); m_yiLabel->setTextInfo(QColor("#7B7B7B "), hLabelF); - m_yiLabel->setFixedSize(DDEDayCalendar::DHuangLiLabelWidth, DDEDayCalendar::DHuangLiLabelHeight); + m_yiLabel->setMinimumHeight(DDEDayCalendar::DHuangLiLabelHeight); + m_yiLabel->setMaximumHeight(DDEDayCalendar::DHuangLiLabelMaxHeight); m_yiLabel->setHuangLiText(QStringList()); - m_yiDownLayout->addWidget(m_yiLabel); + m_yiDownLayout->addWidget(m_yiLabel, 1); m_jiDownLayout = new QVBoxLayout; - m_jiDownLayout->setMargin(0); m_jiDownLayout->setSpacing(0); m_jiDownLayout->setContentsMargins(10, 10, 10, 10); m_jiLabel = new CDayHuangLiLabel(this); m_jiLabel->setbackgroundColor(QColor("#C17575")); m_jiLabel->setTextInfo(QColor("#7B7B7B "), hLabelF); - m_jiLabel->setFixedSize(DDEDayCalendar::DHuangLiLabelWidth, DDEDayCalendar::DHuangLiLabelHeight); + m_jiLabel->setMinimumHeight(DDEDayCalendar::DHuangLiLabelHeight); + m_jiLabel->setMaximumHeight(DDEDayCalendar::DHuangLiLabelMaxHeight); m_jiLabel->setHuangLiText(QStringList(), 1); - m_jiDownLayout->addWidget(m_jiLabel); + m_jiDownLayout->addWidget(m_jiLabel, 1); m_hhLayout = new QVBoxLayout; m_hhLayout->setMargin(0); @@ -338,15 +297,13 @@ m_hhLayout->addLayout(midLayout); m_splitline = new DHorizontalLine; + m_splitline->setMinimumHeight(2); - m_splitline->setFixedSize(241, 2); QHBoxLayout *hlineLayout = new QHBoxLayout; - hlineLayout->setMargin(0); hlineLayout->setSpacing(0); - hlineLayout->setContentsMargins(0, 0, 0, 3); - hlineLayout->addStretch(1); + hlineLayout->setContentsMargins(50, 0, 50, 5); hlineLayout->addWidget(m_splitline); - hlineLayout->addStretch(1); + m_hhLayout->addLayout(hlineLayout); m_hhLayout->addLayout(m_yiDownLayout); m_hhLayout->addLayout(m_jiDownLayout); @@ -401,28 +358,6 @@ emit signalChangeSelectDate(date); } -void CDayMonthView::resizeEvent(QResizeEvent *event) -{ - Q_UNUSED(event); - int leftMargin = qRound(width() * 0.0332 + 0.5); - int rightMargin = leftMargin; - int topMargin = qRound(height() * 0.0164 + 0.5); - int bottonMargin = topMargin; - m_upLayout->setContentsMargins(leftMargin, topMargin, rightMargin, bottonMargin); - m_splitline->setFixedWidth(qRound(0.6925 * width() + 0.5)); - - int hLeftMargin = qRound(width() * 0.026 + 0.5); - int hRightMargin = hLeftMargin; - int hTopMargin = qRound(height() * 0.01773 + 0.5); - int hBottonMargin = hTopMargin; - int lw = width() - hLeftMargin * 2; - int lh = qRound(height() * 0.0992); - m_yiLabel->setFixedSize(lw, lh); - m_yiDownLayout->setContentsMargins(hLeftMargin, qRound(hTopMargin * 0.5), hRightMargin, 0); - m_jiLabel->setFixedSize(lw, lh); - m_jiDownLayout->setContentsMargins(hLeftMargin, hTopMargin, hRightMargin, hBottonMargin); -} - void CDayMonthView::wheelEvent(QWheelEvent *event) { //如果是拖拽则退出 @@ -492,8 +427,8 @@ m_gridLayout->setMargin(0); m_gridLayout->setSpacing(0); m_dayNumFont.setPixelSize(DDECalendar::FontSizeTwelve); - for (int r = 0; r != 6; ++r) { - for (int c = 0; c != 7; ++c) { + for (int r = 0; r < 6; ++r) { + for (int c = 0; c < 7; ++c) { QWidget *cell = new QWidget; cell->installEventFilter(this); m_gridLayout->addWidget(cell, r, c, 1, 1); @@ -557,7 +492,6 @@ void CDayMonthWidget::paintCell(QWidget *cell) { const QRect rect = cell->rect(); - const int pos = m_cellList.indexOf(cell); const bool isSelectedCell = pos == m_selectedCell; const bool isCurrentDay = getCellDate(pos) == m_currentDate; @@ -612,21 +546,23 @@ if (m_vlineflag.count() == DDEDayCalendar::PainterCellNum) { if (m_vlineflag[pos]) { - painter.save(); - QPen pen; - pen.setWidth(2); - pen.setColor(m_ceventColor); - painter.setPen(pen); - painter.setBrush(QBrush(m_ceventColor)); - painter.setPen(Qt::NoPen); - int r = cell->width() * (4 / 25); - if (r < 4) { - r = 4; - } else if (r > 7) { - r = 7; + if (m_selectDate.month() == getCellDate(pos).month()) { + painter.save(); + QPen pen; + pen.setWidth(2); + pen.setColor(m_ceventColor); + painter.setPen(pen); + painter.setBrush(QBrush(m_ceventColor)); + painter.setPen(Qt::NoPen); + int r = int(cell->width() * 0.1); + if (r < 4) { + r = 4; + } else if (r > 7) { + r = 7; + } + painter.drawEllipse(cell->width() - r - 6, 4, r, r); + painter.restore(); } - painter.drawEllipse(cell->width() - r - 6, 4, r, r); - painter.restore(); } } } @@ -645,10 +581,66 @@ if (e->type() == QEvent::Paint) { paintCell(cell); } else if (e->type() == QEvent::MouseButtonPress) { + m_dayMouseState = 1; + } else if (e->type() == QEvent::MouseMove) { + if (m_dayMouseState == 1) { + m_dayMouseState = 2; + } + + if (2 == m_dayMouseState) { + QMouseEvent *mouseEvent = dynamic_cast(e); + + //如果m_dayCreateState为0需要判断是否离开了选择区域,否则不需要判断 + if (m_dayCreateState == 0 && !cell->rect().contains(mouseEvent->pos())) { + //如果离开选择日期区域则修改鼠标显示 + setCursor(Qt::ClosedHandCursor); + m_dayCreateState = 1; + } + + if (m_dayCreateState != 0) { + //根据是否在日历界面内设置鼠标形状和创建状态 + QPoint globalPoint = QCursor::pos(); + QWidget *widget = QApplication::activeWindow(); + // + if (widget != nullptr) { + QRect rect = widget->geometry(); + + if (rect.contains(globalPoint)) { + setCursor(Qt::ClosedHandCursor); + m_dayCreateState = 1; + } else { + setCursor(Qt::ForbiddenCursor); + m_dayCreateState = 2; + } + } + } + } + } else if (e->type() == QEvent::MouseButtonRelease) { QMouseEvent *mouseEvent = dynamic_cast(e); - if (mouseEvent->button() == Qt::LeftButton) { - cellClicked(cell); + // + if (m_dayCreateState == 1) { + //新建日程 + const int pos = m_cellList.indexOf(cell); + QDate date = m_showDays.at(pos); + //设置日程开始时间 + QDateTime _beginTime(date, QTime::currentTime()); + //新建日程对话框 + CScheduleDlg _scheduleDig(1, this, false); + //设置开始时间 + _scheduleDig.setDate(_beginTime); + _scheduleDig.exec(); + + } else { + //如果不在点击区域内则不跳转日期 + //跳转日期 + if (mouseEvent->button() == Qt::LeftButton && cell->rect().contains(mouseEvent->pos())) { + cellClicked(cell); + } } + + setCursor(Qt::ArrowCursor); + m_dayMouseState = 0; + m_dayCreateState = 0; } } return false; @@ -715,6 +707,8 @@ { QWidget::mousePressEvent(event); m_isFocus = false; + if (event->button() & Qt::LeftButton) + m_startPos = event->pos(); } void CDayMonthWidget::cellClicked(QWidget *cell) diff -Nru dde-calendar-5.9.1/calendar-client/src/widget/dayWidget/daymonthview.h dde-calendar-5.10.0/calendar-client/src/widget/dayWidget/daymonthview.h --- dde-calendar-5.9.1/calendar-client/src/widget/dayWidget/daymonthview.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/widget/dayWidget/daymonthview.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,25 +1,12 @@ -/* - * Copyright (C) 2017 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: kirigaya - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef DAYMONTHVIEW_H #define DAYMONTHVIEW_H #include "customframe.h" -#include "src/dbusdatastruct.h" +#include "huangliData/dbusdatastruct.h" +#include "cweekwidget.h" #include #include @@ -73,9 +60,9 @@ private: void changeSelectDate(const QDate &date); protected: - void resizeEvent(QResizeEvent *event) override; void wheelEvent(QWheelEvent *event) override; void paintEvent(QPaintEvent *e) override; + private: DIconButton *m_prevButton = nullptr; DIconButton *m_nextButton = nullptr; @@ -106,6 +93,8 @@ CDayMonthWidget *m_dayMonthWidget; const int m_radius = 8; bool m_searchflag = false; + + CWeekWidget *m_weekWidget = nullptr; //周视图显示区域 }; class CDayMonthWidget : public QWidget @@ -156,5 +145,13 @@ QColor m_ceventColor = "#FF5D00"; QFont m_dayNumFont; bool m_isFocus; + QPoint m_startPos; + + + //拖拽新建日程相关处理流程 + int m_dayMouseState = 0; //鼠标状态 0:原始状态,1:点击状态 2:移动状态 + int m_dayCreateState = 0; //创建日程状态 0:不创建 1:创建 2: 超出界面范围 + + }; #endif // YEARVIEW_H diff -Nru dde-calendar-5.9.1/calendar-client/src/widget/dayWidget/daywindow.cpp dde-calendar-5.10.0/calendar-client/src/widget/dayWidget/daywindow.cpp --- dde-calendar-5.9.1/calendar-client/src/widget/dayWidget/daywindow.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/widget/dayWidget/daywindow.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,21 +1,7 @@ -/* - * Copyright (C) 2015 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: kirigaya - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2015 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "daywindow.h" #include "constants.h" #include "customframe.h" @@ -27,6 +13,8 @@ #include #include +#include +#include DGUI_USE_NAMESPACE CDayWindow::CDayWindow(QWidget *parent) @@ -140,9 +128,9 @@ int w = m_scheduleView->width() - 72; m_scheduleView->setRange(w, 1032, getSelectDate(), getSelectDate()); //设置时间显示格式 - m_scheduleView->setTimeFormat(m_calendarManager->getCalendarDateDataManage()->getTimeFormat()); + m_scheduleView->setTimeFormat((m_calendarManager->getTimeShowType() ? "AP " : "") + m_calendarManager->getTimeFormat()); //获取需要显示的时间 - QVector _monthDate = m_calendarManager->getCalendarDateDataManage()->getMonthDate(getSelectDate().year(), getSelectDate().month()); + QVector _monthDate = m_calendarManager->getMonthDate(getSelectDate().year(), getSelectDate().month()); m_daymonthView->setShowDate(_monthDate, getSelectDate(), getCurrendDateTime().date()); //如果为中文环境则显示农历信息 if (getShowLunar()) @@ -156,24 +144,21 @@ void CDayWindow::updateShowSchedule() { //获取一天的日程信息 - QMap > _weekScheduleInfo = m_calendarManager->getScheduleTask()->getScheduleInfo(getSelectDate(), getSelectDate()); + QMap _weekScheduleInfo = gScheduleManager->getScheduleMap(getSelectDate(), getSelectDate()); //设置显示日程信息 m_scheduleView->setShowScheduleInfo(_weekScheduleInfo); //获取界面显示定位时间位置 setMakeTime(_weekScheduleInfo); - QMap _fullInfo = m_calendarManager->getScheduleTask()->getDateHasSchedule(); - //获取当前月是否包含日程情况 - QVector _monthDate = m_calendarManager->getCalendarDateDataManage()->getMonthDate(getSelectDate().year(), getSelectDate().month()); - QVector _monthFlag{}; - for (int i = 0; i < _monthDate.size(); ++i) { - if (_fullInfo.contains(_monthDate.at(i))) { - _monthFlag.append(_fullInfo[_monthDate.at(i)]); - } else { - _monthFlag.append(false); - } + + QSet scheduleDate = gScheduleManager->getAllScheduleDate(); + QVector monthFlag{}; + QVector monthDate = m_calendarManager->getMonthDate(getSelectDate().year(), getSelectDate().month()); + + for (QDate date : monthDate) { + monthFlag.push_back((scheduleDate.find(date) != scheduleDate.end())); } //设置日视图右侧月显示日期是否有日程 - m_daymonthView->setHasScheduleFlag(_monthFlag); + m_daymonthView->setHasScheduleFlag(monthFlag); } /** @@ -182,20 +167,25 @@ void CDayWindow::updateShowLunar() { CaHuangLiDayInfo _huangLiInfo = getLunarInfo(); - m_LunarLabel->setText(_huangLiInfo.mLunarMonthName + _huangLiInfo.mLunarDayName); + m_LunarLabel->setText(tr("Lunar") + _huangLiInfo.mLunarMonthName + _huangLiInfo.mLunarDayName); m_daymonthView->setHuangLiInfo(_huangLiInfo); } +void CDayWindow::updateSearchScheduleInfo() +{ + m_scheduleView->slotUpdateScene(); +} + /** * @brief CDayWindow::setSelectSearchScheduleInfo 设置选中日程 * @param info */ -void CDayWindow::setSelectSearchScheduleInfo(const ScheduleDataInfo &info) +void CDayWindow::setSelectSearchScheduleInfo(const DSchedule::Ptr &info) { - if (info.getAllDay()) { + if (info->allDay()) { setTime(); } else { - m_scheduleView->setTime(info.getBeginDateTime().time()); + m_scheduleView->setTime(info->dtStart().time()); } m_scheduleView->setSelectSchedule(info); @@ -240,6 +230,8 @@ ypa.setColor(DPalette::WindowText, QColor("#3B3B3B")); m_YearLabel->setPalette(ypa); titleLayout->addWidget(m_YearLabel); + m_dialogIconButton->setFocusPolicy(Qt::NoFocus); + titleLayout->addWidget(m_dialogIconButton); m_LunarLabel = new QLabel(); titleLayout->addSpacing(15); m_LunarLabel->setFixedHeight(DDEDayCalendar::D_YLabelHeight); @@ -281,8 +273,12 @@ leftMainLayout->setContentsMargins(0, 0, 0, 0); leftMainLayout->addLayout(leftLayout); leftMainLayout->addWidget(m_verline); - leftMainLayout->addWidget(m_daymonthView); + + leftMainLayout->setStretchFactor(leftLayout, 3); + leftMainLayout->setStretchFactor(m_verline, 1); + leftMainLayout->setStretchFactor(m_daymonthView, 2); + m_leftground = new CustomFrame(); m_leftground->setRoundState(true, true, true, true); m_leftground->setLayout(leftMainLayout); @@ -291,7 +287,6 @@ m_mainLayout = new QHBoxLayout; m_mainLayout->setMargin(0); m_mainLayout->setSpacing(0); - m_mainLayout->setContentsMargins(10, 10, 10, 10); m_mainLayout->addWidget(m_leftground); this->setLayout(m_mainLayout); @@ -309,17 +304,17 @@ * @brief CDayWindow::setMakeTime 界面显示定位时间位置 * @param info */ -void CDayWindow::setMakeTime(QMap > &info) +void CDayWindow::setMakeTime(QMap &info) { if (info.contains(getSelectDate())) { - QVector _scheduleVector = info[getSelectDate()]; + DSchedule::List _scheduleVector = info[getSelectDate()]; //设置当前第一个非全天默认时间 QDateTime firstscheduleBeginTime(getSelectDate().addDays(1), QTime(0, 0, 0)); //获取非全天日程 for (int i = 0 ; i < _scheduleVector.size(); ++i) { - if (!_scheduleVector.at(i).getAllDay()) { - if (firstscheduleBeginTime > _scheduleVector.at(i).getBeginDateTime()) { - firstscheduleBeginTime = _scheduleVector.at(i).getBeginDateTime(); + if (!_scheduleVector.at(i)->allDay()) { + if (firstscheduleBeginTime > _scheduleVector.at(i)->dtStart()) { + firstscheduleBeginTime = _scheduleVector.at(i)->dtStart(); } } } @@ -364,20 +359,6 @@ } } -void CDayWindow::resizeEvent(QResizeEvent *event) -{ - Q_UNUSED(event); - qreal dw = 0.4 * width(); - int dh = height() - 20; - - if (m_searchFlag) { - m_mainLayout->setContentsMargins(10, 10, 0, 10); - } else { - m_mainLayout->setContentsMargins(10, 10, 10, 10); - } - m_daymonthView->setFixedSize(qRound(dw), dh); -} - void CDayWindow::slotIsDragging(bool &isDragging) { isDragging = m_scheduleView->IsDragging(); diff -Nru dde-calendar-5.9.1/calendar-client/src/widget/dayWidget/daywindow.h dde-calendar-5.10.0/calendar-client/src/widget/dayWidget/daywindow.h --- dde-calendar-5.9.1/calendar-client/src/widget/dayWidget/daywindow.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/widget/dayWidget/daywindow.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,26 +1,12 @@ -/* - * Copyright (C) 2017 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: kirigaya - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef DAYWINDOW_H #define DAYWINDOW_H -#include "src/scheduledatainfo.h" -#include "src/dbusdatastruct.h" +#include "dschedule.h" +#include "huangliData/dbusdatastruct.h" #include "cschedulebasewidget.h" #include @@ -59,28 +45,31 @@ void updateShowSchedule() override; //更新显示农历信息 void updateShowLunar() override; + //更新界面搜索日程显示 + void updateSearchScheduleInfo() override; //设置选中搜索日程 - void setSelectSearchScheduleInfo(const ScheduleDataInfo &info) override; + void setSelectSearchScheduleInfo(const DSchedule::Ptr &info) override; //删除选中日程 void deleteselectSchedule() override; private: void initUI(); void initConnection(); //获取界面显示定位时间位置 - void setMakeTime(QMap > &info); + void setMakeTime(QMap &info); public slots: void slotScheduleHide(); //更新选择时间 void slotChangeSelectDate(const QDate &date); -protected: - void resizeEvent(QResizeEvent *event) override; + private slots: void slotIsDragging(bool &isDragging); //切换选择时间 void slotSwitchPrePage(); //切换选择时间 void slotSwitchNextPage(); - +signals: + //拖拽结束信号 + void signalNewSlot(); private: CDayMonthView *m_daymonthView = nullptr; CustomFrame *m_leftground = nullptr; diff -Nru dde-calendar-5.9.1/calendar-client/src/widget/monthWidget/monthdayview.cpp dde-calendar-5.10.0/calendar-client/src/widget/monthWidget/monthdayview.cpp --- dde-calendar-5.9.1/calendar-client/src/widget/monthWidget/monthdayview.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/widget/monthWidget/monthdayview.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,25 +1,11 @@ -/* - * Copyright (C) 2015 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: kirigaya - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2015 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later #include "monthdayview.h" #include "scheduledatamanage.h" #include "constants.h" +#include "units.h" #include #include @@ -276,7 +262,7 @@ { int itemindex = getMousePosItem(point); if (!(itemindex < 0)) { - if (m_MonthItem.at(itemindex)->getDate().year() < DDECalendar::QueryEarliestYear) { + if (!withinTimeFrame(m_MonthItem.at(itemindex)->getDate())) { return; } CMonthRect::setSelectRect(m_MonthItem.at(itemindex)); @@ -401,7 +387,7 @@ { m_selectColor = CScheduleDataManage::getScheduleDataManage()->getSystemActiveColor(); - if (m_Date.year() < DDECalendar::QueryEarliestYear) + if ( !withinTimeFrame(m_Date)) return; const bool isCurrentDay = (m_Date.month() == QDate::currentDate().month() && m_Date.year() == QDate::currentDate().year()); diff -Nru dde-calendar-5.9.1/calendar-client/src/widget/monthWidget/monthdayview.h dde-calendar-5.10.0/calendar-client/src/widget/monthWidget/monthdayview.h --- dde-calendar-5.9.1/calendar-client/src/widget/monthWidget/monthdayview.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/widget/monthWidget/monthdayview.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,21 +1,7 @@ -/* - * Copyright (C) 2015 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: kirigaya - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2015 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef MONTHDAYVIEW_H #define MONTHDAYVIEW_H diff -Nru dde-calendar-5.9.1/calendar-client/src/widget/monthWidget/monthscheduleview.cpp dde-calendar-5.10.0/calendar-client/src/widget/monthWidget/monthscheduleview.cpp --- dde-calendar-5.9.1/calendar-client/src/widget/monthWidget/monthscheduleview.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/widget/monthWidget/monthscheduleview.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,21 +1,7 @@ -/* - * Copyright (C) 2017 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: kirigaya - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "monthscheduleview.h" #include "monthview.h" #include "schedulectrldlg.h" @@ -61,7 +47,7 @@ m_cNum = static_cast(((m_height - m_topMargin - m_bottomMargin) / 6.0 + 0.5 - schedule_Item_Y) / (itemHeight + 1)); } -void CMonthScheduleView::setData(QMap > &data, int currentMonth) +void CMonthScheduleView::setData(QMap &data, int currentMonth) { m_data = data; m_currentMonth = currentMonth; @@ -96,7 +82,7 @@ if (m_data.count() != DDEMonthCalendar::ItemSizeOfMonthDay || m_cNum < 1) return; //开始结束时间 - QMap >::iterator _iter = m_data.begin(); + QMap::iterator _iter = m_data.begin(); QDate begindate = _iter.key(); _iter += (m_data.size() - 1); QDate enddate = _iter.key(); @@ -132,7 +118,7 @@ return m_scheduleShowItem; } -void CMonthScheduleView::updateDate(const ScheduleDataInfo &info) +void CMonthScheduleView::updateDate(const DSchedule::Ptr &info) { for (int i = 0; i < m_weekSchedule.size(); ++i) { if (m_weekSchedule.at(i)->addData(info)) { @@ -145,7 +131,7 @@ } } -void CMonthScheduleView::changeDate(const ScheduleDataInfo &info) +void CMonthScheduleView::changeDate(const DSchedule::Ptr &info) { for (int i = 0; i < m_weekSchedule.size(); ++i) { m_weekSchedule.at(i)->changeDate(info); @@ -154,7 +140,7 @@ } } -void CMonthScheduleView::updateDate(const int row, const ScheduleDataInfo &info) +void CMonthScheduleView::updateDate(const int row, const DSchedule::Ptr &info) { for (int i = 0; i < m_weekSchedule.size(); ++i) { if (row == i) { @@ -182,7 +168,7 @@ void CMonthScheduleView::createScheduleItemWidget(MScheduleDateRangeInfo info, int cNum, QVector &scheduleShowItem) { - ScheduleDataInfo gd = info.tData; + DSchedule::Ptr gd = info.tData; QPoint pos; int fw; int fh; @@ -253,7 +239,7 @@ { } -void CWeekScheduleView::setData(QMap > &data, const QDate &startDate, const QDate &stopDate) +void CWeekScheduleView::setData(QMap &data, const QDate &startDate, const QDate &stopDate) { //显示一周的日程 Q_ASSERT(startDate.daysTo(stopDate) == 6); @@ -262,8 +248,17 @@ endDate = stopDate; for (int i = 0 ; i <= beginDate.daysTo(endDate); ++i) { for (int j = 0; j < data[beginDate.addDays(i)].size(); ++j) { - if (!m_ScheduleInfo.contains(data[beginDate.addDays(i)].at(j))) { - m_ScheduleInfo.append(data[beginDate.addDays(i)].at(j)); + bool have = false; + DSchedule::Ptr info = data[beginDate.addDays(i)].at(j); + //过滤重复日程 + for (DSchedule::Ptr p : m_ScheduleInfo) { + if (p == info) { + have = true; + break; + } + } + if (!have) { + m_ScheduleInfo.append(info); } } } @@ -272,9 +267,9 @@ updateSchedule(true); } -bool CWeekScheduleView::addData(const ScheduleDataInfo &info) +bool CWeekScheduleView::addData(const DSchedule::Ptr &info) { - if (info.getBeginDateTime().date().daysTo(endDate) >= 0 && beginDate.daysTo(info.getEndDateTime().date()) >= 0) { + if (info->dtStart().date().daysTo(endDate) >= 0 && beginDate.daysTo(info->dtEnd().date()) >= 0) { clearItem(); updateSchedule(false, info); return true; @@ -283,7 +278,7 @@ return false; } -void CWeekScheduleView::changeDate(const ScheduleDataInfo &info) +void CWeekScheduleView::changeDate(const DSchedule::Ptr &info) { int index = m_ScheduleInfo.indexOf(info); @@ -303,9 +298,9 @@ setMaxNum(); } -void CWeekScheduleView::updateSchedule(const bool isNormalDisplay, const ScheduleDataInfo &info) +void CWeekScheduleView::updateSchedule(const bool isNormalDisplay, const DSchedule::Ptr &info) { - QVector schedulev; + DSchedule::List schedulev; schedulev.clear(); schedulev = m_ScheduleInfo; if (isNormalDisplay) { @@ -320,8 +315,8 @@ for (int i = 0; i < schedulev.size(); ++i) { //日程时间重新标定 - tbegindate = schedulev.at(i).getBeginDateTime().date(); - tenddate = schedulev.at(i).getEndDateTime().date(); + tbegindate = schedulev.at(i)->dtStart().date(); + tenddate = schedulev.at(i)->dtEnd().date(); if (tenddate < beginDate || tbegindate > endDate) continue; @@ -457,7 +452,7 @@ } } -void CWeekScheduleView::addShowSchedule(const int &startPos, const int &endPos, const int &addRow, const ScheduleDataInfo &addInfo) +void CWeekScheduleView::addShowSchedule(const int &startPos, const int &endPos, const int &addRow, const DSchedule::Ptr &addInfo) { MScheduleDateRangeInfo scheduleInfo; //设置显示的开始日期 diff -Nru dde-calendar-5.9.1/calendar-client/src/widget/monthWidget/monthscheduleview.h dde-calendar-5.10.0/calendar-client/src/widget/monthWidget/monthscheduleview.h --- dde-calendar-5.9.1/calendar-client/src/widget/monthWidget/monthscheduleview.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/widget/monthWidget/monthscheduleview.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,25 +1,11 @@ -/* - * Copyright (C) 2017 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: kirigaya - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef MONTHSCHEDULEVIEW_H #define MONTHSCHEDULEVIEW_H -#include "src/scheduledatainfo.h" +#include "dschedule.h" #include "scheduledaterangeinfo.h" #include "graphicsItem/draginfoitem.h" #include "graphicsItem/cmonthscheduleitem.h" @@ -38,7 +24,7 @@ explicit CMonthScheduleView(QWidget *parent, QGraphicsScene *scene); ~CMonthScheduleView() override; void setallsize(int w, int h, int left, int top, int buttom, int itemHeight = 22); - void setData(QMap > &data, int currentMonth); + void setData(QMap &data, int currentMonth); void updateData(); void updateHeight(); QVector getScheduleShowItem() const; @@ -46,14 +32,14 @@ { return m_ItemHeight; } - void updateDate(const ScheduleDataInfo &info); - void changeDate(const ScheduleDataInfo &info); - void updateDate(const int row, const ScheduleDataInfo &info); + void updateDate(const DSchedule::Ptr &info); + void changeDate(const DSchedule::Ptr &info); + void updateDate(const int row, const DSchedule::Ptr &info); signals: void signalsUpdateSchedule(int id = 0); void signalsCurrentScheduleDate(QDate date); void signalUpdateUI(int type); - void signalPressScheduleShow(const bool isShow, const ScheduleDataInfo &out = ScheduleDataInfo()); + void signalPressScheduleShow(const bool isShow, const DSchedule::Ptr &out = DSchedule::Ptr()); public slots: void slotFontChange(); private: @@ -63,7 +49,7 @@ void computePos(int cNum, QDate bgeindate, QDate enddate, QPoint &pos, int &fw, int &fh); private: - QMap > m_data; + QMap m_data; int m_cNum = 2; //日程层数 int m_currentMonth = 0; QDate m_beginDate; @@ -88,9 +74,9 @@ ~CWeekScheduleView() override; public: - void setData(QMap > &data, const QDate &startDate, const QDate &stopDate); - bool addData(const ScheduleDataInfo &info); - void changeDate(const ScheduleDataInfo &info); + void setData(QMap &data, const QDate &startDate, const QDate &stopDate); + bool addData(const DSchedule::Ptr &info); + void changeDate(const DSchedule::Ptr &info); void setHeight(const int ScheduleHeight, const int dayHeight); QVector getMScheduleInfo() const { @@ -100,7 +86,7 @@ { return m_scheduleShowItem; } - void updateSchedule(const bool isNormalDisplay, const ScheduleDataInfo &info = ScheduleDataInfo()); + void updateSchedule(const bool isNormalDisplay, const DSchedule::Ptr &info = DSchedule::Ptr()); void clearItem(); private: void setMaxNum(); @@ -113,11 +99,12 @@ * @param addRow 需要添加的行 * @param addInfo 添加的日程 */ - void addShowSchedule(const int &startPos, const int &endPos, const int &addRow, const ScheduleDataInfo &addInfo); + void addShowSchedule(const int &startPos, const int &endPos, const int &addRow, const DSchedule::Ptr &addInfo); + private: QVector m_scheduleShowItem; QVector m_MScheduleInfo; - QVector m_ScheduleInfo; + DSchedule::List m_ScheduleInfo; QVector m_ColumnScheduleCount; int m_ScheduleHeight = 0; int m_DayHeight = 0; diff -Nru dde-calendar-5.9.1/calendar-client/src/widget/monthWidget/monthview.cpp dde-calendar-5.10.0/calendar-client/src/widget/monthWidget/monthview.cpp --- dde-calendar-5.9.1/calendar-client/src/widget/monthWidget/monthview.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/widget/monthWidget/monthview.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,21 +1,6 @@ -/* - * Copyright (C) 2015 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: kirigaya - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2015 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later #include "monthview.h" #include "scheduledlg.h" @@ -58,7 +43,6 @@ m_mainLayout = new QVBoxLayout; m_mainLayout->setMargin(0); m_mainLayout->setSpacing(0); - m_mainLayout->setContentsMargins(10, 0, 0, 10); m_mainLayout->addWidget(m_weekIndicator); m_mainLayout->addWidget(m_monthGraphicsView); @@ -73,20 +57,20 @@ { } -void CMonthView::setSelectSchedule(const ScheduleDataInfo &scheduleInfo) +void CMonthView::setSelectSchedule(const DSchedule::Ptr &scheduleInfo) { m_monthGraphicsView->setSelectSearchSchedule(scheduleInfo); } -void CMonthView::slotScheduleRemindWidget(const bool isShow, const ScheduleDataInfo &out) +void CMonthView::slotScheduleRemindWidget(const bool isShow, const DSchedule::Ptr &out) { if (isShow) { //获取当前鼠标位置 QVariant variant; CalendarGlobalEnv::getGlobalEnv()->getValueByKey(DDECalendar::CursorPointKey, variant); QPoint remindPos = variant.value(); - CSchedulesColor gdColor = CScheduleDataManage::getScheduleDataManage()->getScheduleColorByType( - out.getType()); + //根据类型获取颜色 + CSchedulesColor gdColor = CScheduleDataManage::getScheduleDataManage()->getScheduleColorByType(out->scheduleTypeID()); m_remindWidget->setData(out, gdColor); //获取屏幕大小 QRect desktopRect = QApplication::desktop()->rect(); @@ -107,12 +91,8 @@ void CMonthView::resizeEvent(QResizeEvent *event) { DWidget::resizeEvent(event); - int leftMargin = 10; - int topMargin = 10; - m_leftMargin = leftMargin; - m_topMargin = topMargin; - m_mainLayout->setContentsMargins(leftMargin, topMargin, 0, 10); - m_weekIndicator->setFixedSize(width() - leftMargin, static_cast(height() * 0.1042 + 0.5)); + QMargins margins = m_mainLayout->contentsMargins(); + m_weekIndicator->setFixedSize(width() - margins.left(), static_cast(height() * 0.1042 + 0.5)); } void CMonthView::mousePressEvent(QMouseEvent *event) @@ -172,7 +152,7 @@ * @brief CMonthView::setScheduleInfo 设置显示日程 * @param scheduleInfo */ -void CMonthView::setScheduleInfo(const QMap > &scheduleInfo) +void CMonthView::setScheduleInfo(const QMap &scheduleInfo) { m_monthGraphicsView->setScheduleInfo(scheduleInfo); } @@ -181,7 +161,7 @@ * @brief CMonthView::setSearchScheduleInfo 设置搜索日程 * @param searchScheduleInfo */ -void CMonthView::setSearchScheduleInfo(const QVector &searchScheduleInfo) +void CMonthView::setSearchScheduleInfo(const DSchedule::List &searchScheduleInfo) { m_monthGraphicsView->setSearchScheduleInfo(searchScheduleInfo); } @@ -214,18 +194,19 @@ m_monthGraphicsView->setLunarVisible(visible); } -ScheduleDataInfo CMonthView::getScheduleInfo(const QDate &beginDate, const QDate &endDate) +DSchedule::Ptr CMonthView::getScheduleInfo(const QDate &beginDate, const QDate &endDate) { - ScheduleDataInfo info; + DSchedule::Ptr info; + info.reset(new DSchedule()); if (beginDate.daysTo(endDate) > 0) { - info.setBeginDateTime(QDateTime(beginDate, QTime(0, 0, 0))); - info.setEndDateTime(QDateTime(endDate, QTime(23, 59, 59))); + info->setDtStart(QDateTime(beginDate, QTime(0, 0, 0))); + info->setDtEnd(QDateTime(endDate, QTime(23, 59, 59))); } else { - info.setBeginDateTime(QDateTime(endDate, QTime(0, 0, 0))); - info.setEndDateTime(QDateTime(beginDate, QTime(23, 59, 00))); + info->setDtStart(QDateTime(endDate, QTime(0, 0, 0))); + info->setDtEnd(QDateTime(beginDate, QTime(23, 59, 00))); } - info.setTitleName(tr("New Event")); - info.setAllDay(true); - info.setRemindData(RemindData(1, QTime(9, 0))); + info->setSummary(tr("New Event")); + info->setAllDay(true); + info->setAlarmType(DSchedule::Alarm_15Hour_Front); return info; } diff -Nru dde-calendar-5.9.1/calendar-client/src/widget/monthWidget/monthview.h dde-calendar-5.10.0/calendar-client/src/widget/monthWidget/monthview.h --- dde-calendar-5.9.1/calendar-client/src/widget/monthWidget/monthview.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/widget/monthWidget/monthview.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,21 +1,6 @@ -/* - * Copyright (C) 2015 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: kirigaya - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2015 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later #ifndef MONTHVIEW_H #define MONTHVIEW_H @@ -23,7 +8,7 @@ #include "monthweekview.h" #include "scheduleRemindWidget.h" #include "monthgraphiview.h" -#include "src/scheduledatainfo.h" +#include "dschedule.h" #include @@ -58,9 +43,9 @@ //设置班休信息 void setFestival(const QMap &festivalInfo); //设置显示日程 - void setScheduleInfo(const QMap > &scheduleInfo); + void setScheduleInfo(const QMap &scheduleInfo); //设置搜索日程 - void setSearchScheduleInfo(const QVector &searchScheduleInfo); + void setSearchScheduleInfo(const DSchedule::List &searchScheduleInfo); //设置当前时间 void setCurrentDate(const QDate ¤tDate); void setRemindWidgetTimeFormat(QString timeformat); @@ -81,14 +66,14 @@ * @brief setSelectSchedule 设置选择的日程 * @param scheduleInfo 日程信息 */ - void setSelectSchedule(const ScheduleDataInfo &scheduleInfo); + void setSelectSchedule(const DSchedule::Ptr &scheduleInfo); public slots: /** * @brief slotScheduleRemindWidget 日程浮框 * @param isShow 是否显示日程浮框 * @param out 日程信息 */ - void slotScheduleRemindWidget(const bool isShow, const ScheduleDataInfo &out = ScheduleDataInfo()); + void slotScheduleRemindWidget(const bool isShow, const DSchedule::Ptr &out = DSchedule::Ptr()); signals: /** * @brief signalAngleDelta 发送滚动信号滚动相对量 @@ -113,7 +98,8 @@ bool event(QEvent *event) override; private: - ScheduleDataInfo getScheduleInfo(const QDate &beginDate, const QDate &endDate); + DSchedule::Ptr getScheduleInfo(const QDate &beginDate, const QDate &endDate); + private: CMonthGraphicsview *m_monthGraphicsView = nullptr; QVector m_showDate; @@ -123,8 +109,6 @@ int m_firstWeekDay = 0; QAction *m_createAction = nullptr; // 创建日程 QVBoxLayout *m_mainLayout = nullptr; - int m_leftMargin = 0; - int m_topMargin = 0; bool m_sflag = true; ScheduleRemindWidget *m_remindWidget = nullptr; diff -Nru dde-calendar-5.9.1/calendar-client/src/widget/monthWidget/monthweekview.cpp dde-calendar-5.10.0/calendar-client/src/widget/monthWidget/monthweekview.cpp --- dde-calendar-5.9.1/calendar-client/src/widget/monthWidget/monthweekview.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/widget/monthWidget/monthweekview.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,21 +1,6 @@ -/* - * Copyright (C) 2017 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: kirigaya - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later #include "monthweekview.h" #include "scheduledatamanage.h" diff -Nru dde-calendar-5.9.1/calendar-client/src/widget/monthWidget/monthweekview.h dde-calendar-5.10.0/calendar-client/src/widget/monthWidget/monthweekview.h --- dde-calendar-5.9.1/calendar-client/src/widget/monthWidget/monthweekview.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/widget/monthWidget/monthweekview.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,21 +1,6 @@ -/* - * Copyright (C) 2017 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: kirigaya - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later #ifndef MONTHWEEKVIEW_H #define MONTHWEEKVIEW_H diff -Nru dde-calendar-5.9.1/calendar-client/src/widget/monthWidget/monthwindow.cpp dde-calendar-5.10.0/calendar-client/src/widget/monthWidget/monthwindow.cpp --- dde-calendar-5.9.1/calendar-client/src/widget/monthWidget/monthwindow.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/widget/monthWidget/monthwindow.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,21 +1,7 @@ -/* - * Copyright (C) 2015 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: kirigaya - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2015 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "monthwindow.h" #include "monthview.h" #include "monthdayview.h" @@ -64,22 +50,7 @@ void CMonthWindow::setTheMe(int type) { if (type == 0 || type == 1) { - QColor todayColor = CScheduleDataManage::getScheduleDataManage()->getSystemActiveColor(); - DPalette todayPa = m_today->palette(); - todayPa.setColor(DPalette::ButtonText, todayColor); - todayPa.setColor(DPalette::Dark, Qt::white); - todayPa.setColor(DPalette::Light, Qt::white); - QColor sbColor("#002A57"); - sbColor.setAlphaF(0.05); - todayPa.setColor(DPalette::Shadow, sbColor); - m_today->setPalette(todayPa); - QColor todayhover = "#000000"; - todayhover.setAlphaF(0.1); - QColor todaypress = "#000000"; - todaypress.setAlphaF(0.2); - m_today->setBColor("#FFFFFF", todayhover, todaypress, "#FFFFFF", todayhover, todaypress); - m_today->setTColor(todayColor, "#001A2E", "#0081FF"); - m_today->setshadowColor(sbColor); + DPalette pa = m_YearLabel->palette(); pa.setColor(DPalette::WindowText, QColor("#3B3B3B")); @@ -96,19 +67,7 @@ m_gridWidget->setPalette(gpa); m_gridWidget->setBackgroundRole(DPalette::Background); } else if (type == 2) { - QColor todayColor = CScheduleDataManage::getScheduleDataManage()->getSystemActiveColor(); - DPalette todayPa = m_today->palette(); - todayPa.setColor(DPalette::ButtonText, todayColor); - todayPa.setColor(DPalette::Light, "#484848"); - todayPa.setColor(DPalette::Dark, "#414141"); - QColor sbColor("#000000"); - sbColor.setAlphaF(0.05); - todayPa.setColor(DPalette::Shadow, sbColor); - m_today->setPalette(todayPa); - - m_today->setBColor("#484848", "#727272", "#242424", "#414141", "#535353", "#282828"); - m_today->setTColor(todayColor, "#FFFFFF", "#0081FF"); - m_today->setshadowColor(sbColor); + DPalette pa = m_YearLabel->palette(); pa.setColor(DPalette::WindowText, QColor("#C0C6D4")); @@ -149,14 +108,14 @@ void CMonthWindow::updateShowDate(const bool isUpdateBar) { setYearData(); - const QDate _selectDate = m_calendarManager->getCalendarDateDataManage()->getSelectDate(); - Qt::DayOfWeek _firstWeek = m_calendarManager->getCalendarDateDataManage()->getWeekFirstDay(); + const QDate _selectDate = m_calendarManager->getSelectDate(); + Qt::DayOfWeek _firstWeek = m_calendarManager->getFirstDayOfWeek(); m_monthView->setFirstWeekday(_firstWeek); - QVector _monthShowData = m_calendarManager->getCalendarDateDataManage()->getMonthDate(_selectDate.year(), _selectDate.month()); + QVector _monthShowData = m_calendarManager->getMonthDate(_selectDate.year(), _selectDate.month()); m_startDate = _monthShowData.first(); m_stopDate = _monthShowData.last(); m_monthView->setShowDate(_monthShowData); - m_monthView->setRemindWidgetTimeFormat(m_calendarManager->getCalendarDateDataManage()->getTimeFormat()); + m_monthView->setRemindWidgetTimeFormat((m_calendarManager->getTimeShowType() ? "AP " : "") + m_calendarManager->getTimeFormat()); if (isUpdateBar) m_monthDayView->setSelectDate(_selectDate); //设置12个月份显示 //如果为中文环境则显示班休和农历信息 @@ -183,8 +142,18 @@ */ void CMonthWindow::updateShowSchedule() { - QMap > _monthScheduleInfo = m_calendarManager->getScheduleTask()->getScheduleInfo(m_startDate, m_stopDate); - m_monthView->setScheduleInfo(_monthScheduleInfo); + QMap map = gScheduleManager->getScheduleMap(m_startDate, m_stopDate); + //因获取的日程中只有有日程的项,数量不等于开始时间到结束时间的天数, + //但是视图显示要求数量为开始时间到结束时间的天数,所以在没有日程的时间中添加空日期列表 + QDate date = m_startDate; + QDate eDate = m_stopDate.addDays(1); + while (date != eDate) { + if (!map.contains(date)) { + map[date] = DSchedule::List(); + } + date = date.addDays(1); + } + m_monthView->setScheduleInfo(map); } /** @@ -194,9 +163,9 @@ { getLunarInfo(); m_YearLunarLabel->setText(m_lunarYear); - QMap _monthFestivalInfo = m_calendarManager->getScheduleTask()->getFestivalInfo(m_startDate, m_stopDate); + QMap _monthFestivalInfo = gLunarManager->getFestivalInfoDateMap(m_startDate, m_stopDate); m_monthView->setFestival(_monthFestivalInfo); - QMap _monthHuangLiInfo = m_calendarManager->getScheduleTask()->getHuangLiInfo(m_startDate, m_stopDate); + QMap _monthHuangLiInfo = gLunarManager->getHuangLiDayMap(m_startDate, m_stopDate); m_monthView->setHuangLiInfo(_monthHuangLiInfo); } @@ -206,15 +175,14 @@ void CMonthWindow::updateSearchScheduleInfo() { //获取搜索日程信息 - QVector _searchSchedule = m_calendarManager->getScheduleTask()->getSearchScheduleInfoVector(); - m_monthView->setSearchScheduleInfo(_searchSchedule); + m_monthView->setSearchScheduleInfo(gScheduleManager->getAllSearchedScheduleList()); } /** * @brief CMonthWindow::setSelectSearchScheduleInfo 设置选中日程 * @param info */ -void CMonthWindow::setSelectSearchScheduleInfo(const ScheduleDataInfo &info) +void CMonthWindow::setSelectSearchScheduleInfo(const DSchedule::Ptr &info) { m_monthView->setSelectSchedule(info); } @@ -261,20 +229,11 @@ m_today = new CTodayButton; m_today->setText(QCoreApplication::translate("today", "Today", "Today")); m_today->setFixedSize(DDEMonthCalendar::MTodayWindth, DDEMonthCalendar::MTodayHeight); - QColor todayColor = CScheduleDataManage::getScheduleDataManage()->getSystemActiveColor(); - DPalette todayPa = m_today->palette(); - todayPa.setColor(DPalette::ButtonText, todayColor); - todayPa.setColor(DPalette::Dark, Qt::white); - todayPa.setColor(DPalette::Light, Qt::white); - - QColor sbColor("#002A57"); - sbColor.setAlphaF(0.05); - todayPa.setColor(DPalette::Shadow, sbColor); + QFont todayfont; todayfont.setWeight(QFont::Medium); todayfont.setPixelSize(DDECalendar::FontSizeFourteen); m_today->setFont(todayfont); - m_today->setPalette(todayPa); m_YearLabel = new QLabel(); m_YearLabel->setFixedHeight(DDEMonthCalendar::M_YLabelHeight); m_YearLunarLabel = new QLabel(); @@ -299,14 +258,16 @@ QHBoxLayout *yeartitleLayout = new QHBoxLayout; yeartitleLayout->setMargin(0); yeartitleLayout->setSpacing(0); - yeartitleLayout->setContentsMargins(21, 20, 8, 10); + yeartitleLayout->addSpacing(10); yeartitleLayout->addWidget(m_YearLabel); + yeartitleLayout->addWidget(m_dialogIconButton); QHBoxLayout *yeartitleLayout1 = new QHBoxLayout; yeartitleLayout1->setMargin(0); yeartitleLayout1->setSpacing(0); - yeartitleLayout1->setContentsMargins(14, 9, 0, 7); + yeartitleLayout1->addWidget(m_YearLunarLabel); + yeartitleLayout->addSpacing(6); yeartitleLayout->addLayout(yeartitleLayout1); yeartitleLayout->addStretch(); @@ -327,7 +288,11 @@ hhLayout->setSpacing(0); hhLayout->setMargin(0); - hhLayout->addLayout(yeartitleLayout); + //头部控件统一高度为 M_YTopHeight + QWidget *top = new QWidget(this); + top->setFixedHeight(DDEMonthCalendar::M_YTopHeight); + top->setLayout(yeartitleLayout); + hhLayout->addWidget(top); m_gridWidget = new DWidget(); m_gridWidget->setContentsMargins(0, 0, 0, 0); m_gridWidget->setAutoFillBackground(true); @@ -338,13 +303,11 @@ m_tMainLayout = new QHBoxLayout; m_tMainLayout->setMargin(0); m_tMainLayout->setSpacing(0); - m_tMainLayout->setContentsMargins(0, 0, 10, 0); m_tMainLayout->addLayout(hhLayout); QVBoxLayout *ssLayout = new QVBoxLayout; ssLayout->setMargin(0); ssLayout->setSpacing(0); - ssLayout->setContentsMargins(0, 10, 0, 10); m_tMainLayout->addLayout(ssLayout); this->setLayout(m_tMainLayout); @@ -373,13 +336,23 @@ void CMonthWindow::slideMonth(bool next) { slotScheduleHide(); - if (next) { - setSelectDate(getSelectDate().addMonths(-1), true); - } else { - setSelectDate(getSelectDate().addMonths(1), true); - } - //更新日程 - updateShowDate(); + + if (m_isSwitchStatus) + return; + + m_isSwitchStatus = true; + + QTimer::singleShot(5, [this, next]() { + if (next) { + setSelectDate(getSelectDate().addMonths(-1), true); + } else { + setSelectDate(getSelectDate().addMonths(1), true); + } + //更新日程 + updateShowDate(); + + m_isSwitchStatus = false; + }); } /** @@ -440,11 +413,6 @@ { qreal dw = width() * 0.5023 + 0.5; int dh = 36; - if (m_searchFlag) { - m_tMainLayout->setContentsMargins(0, 0, 0, 0); - } else { - m_tMainLayout->setContentsMargins(0, 0, 10, 0); - } m_monthDayView->setFixedSize(qRound(dw), dh); QWidget::resizeEvent(event); } diff -Nru dde-calendar-5.9.1/calendar-client/src/widget/monthWidget/monthwindow.h dde-calendar-5.10.0/calendar-client/src/widget/monthWidget/monthwindow.h --- dde-calendar-5.9.1/calendar-client/src/widget/monthWidget/monthwindow.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/widget/monthWidget/monthwindow.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,21 +1,7 @@ -/* - * Copyright (C) 2017 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: kirigaya - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef MONTHWINDOW_H #define MONTHWINDOW_H @@ -59,7 +45,7 @@ //更新界面搜索日程显示 void updateSearchScheduleInfo() override; //设置选中搜索日程 - void setSelectSearchScheduleInfo(const ScheduleDataInfo &info) override; + void setSelectSearchScheduleInfo(const DSchedule::Ptr &info) override; //设置是否显示搜索界面 void setSearchWFlag(bool flag); //删除选中日程 @@ -111,6 +97,7 @@ QSpacerItem *m_spaceitem = nullptr; DWidget *m_gridWidget = nullptr; bool m_searchFlag = false; + bool m_isSwitchStatus = false; QHBoxLayout *m_tMainLayout = nullptr; }; diff -Nru dde-calendar-5.9.1/calendar-client/src/widget/schedulesearchview.cpp dde-calendar-5.10.0/calendar-client/src/widget/schedulesearchview.cpp --- dde-calendar-5.9.1/calendar-client/src/widget/schedulesearchview.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/widget/schedulesearchview.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,21 +1,7 @@ -/* - * Copyright (C) 2017 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: kirigaya - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "schedulesearchview.h" #include "schedulectrldlg.h" #include "myscheduleview.h" @@ -47,7 +33,7 @@ CScheduleSearchItem::CScheduleSearchItem(QWidget *parent) : DLabel(parent) , m_rightMenu(new DMenu(this)) - , m_timeFormat(CalendarManager::getInstance()->getCalendarDateDataManage()->getTimeFormat()) + , m_timeFormat(CalendarManager::getInstance()->getTimeFormat()) { //设置对象名称和辅助显示名称 this->setObjectName("CScheduleDataItem"); @@ -88,7 +74,7 @@ m_timefont = font; } -void CScheduleSearchItem::setData(ScheduleDataInfo vScheduleInfo, QDate date) +void CScheduleSearchItem::setData(DSchedule::Ptr vScheduleInfo, QDate date) { m_ScheduleInfo = vScheduleInfo; m_date = date; @@ -154,7 +140,7 @@ void CScheduleSearchItem::slotDelete() { //删除日程 - CScheduleOperation _scheduleOperation(this); + CScheduleOperation _scheduleOperation(m_ScheduleInfo->scheduleTypeID(), this); bool _isDelete = _scheduleOperation.deleteSchedule(m_ScheduleInfo); //删除日程后,将焦点设置给父类 if (_isDelete) { @@ -182,7 +168,7 @@ //选中该item时才可以使用快捷键 if (m_tabFocus) { //节日日程不能使用 - if (m_ScheduleInfo.getType() == DDECalendar::FestivalTypeID) + if (CScheduleOperation::isFestival(m_ScheduleInfo)) return; m_rightMenu->clear(); m_rightMenu->addAction(m_editAction); @@ -198,8 +184,8 @@ void CScheduleSearchItem::paintEvent(QPaintEvent *e) { Q_UNUSED(e); - int labelwidth = width() - 2; - int labelheight = height() - 2; + int labelRightX = width() - 2; //绘制区域x方向右边界坐标点 + int labelBottomY = height(); //绘制区域y方向下边界坐标点 QPainter painter(this); QColor bColor = m_Backgroundcolor; QColor textcolor = m_tTextColor; @@ -225,50 +211,44 @@ painter.save(); painter.setRenderHint(QPainter::Antialiasing); // 反锯齿; painter.setBrush(QBrush(bColor)); - if (m_tabFocus) { - //设置焦点绘制的pen - QPen pen; - pen.setColor(CScheduleDataManage::getScheduleDataManage()->getSystemActiveColor()); - pen.setWidth(2); - painter.setPen(pen); - } else - painter.setPen(Qt::NoPen); + painter.setPen(Qt::NoPen); + QPainterPath painterPath; - painterPath.moveTo(m_radius, m_borderframew); + painterPath.moveTo(m_radius, m_borderframewY); if (m_roundtype == 1 || m_roundtype == 3) { - painterPath.arcTo(QRect(m_borderframew, m_borderframew, m_radius * 2, m_radius * 2), 90, 90); + painterPath.arcTo(QRect(m_borderframewX, m_borderframewY, m_radius * 2, m_radius * 2), 90, 90); } else { - painterPath.lineTo(m_borderframew, m_borderframew); - painterPath.lineTo(m_borderframew, m_radius); + painterPath.lineTo(m_borderframewX, m_borderframewY); + painterPath.lineTo(m_borderframewX, m_radius); } - painterPath.lineTo(1, labelheight - m_radius); + painterPath.lineTo(m_borderframewX, labelBottomY - m_radius); if (m_roundtype == 1 || m_roundtype == 2) { - painterPath.arcTo(QRect(m_borderframew, labelheight - m_radius * 2, m_radius * 2, m_radius * 2), 180, 90); + painterPath.arcTo(QRect(m_borderframewX, labelBottomY - m_radius * 2, m_radius * 2, m_radius * 2), 180, 90); } else { - painterPath.lineTo(m_borderframew, labelheight); - painterPath.lineTo(m_radius, labelheight); + painterPath.lineTo(m_borderframewX, labelBottomY); + painterPath.lineTo(m_radius, labelBottomY); } - painterPath.lineTo(labelwidth - m_radius, labelheight); + painterPath.lineTo(labelRightX - m_radius, labelBottomY); if (m_roundtype == 1 || m_roundtype == 2) { - painterPath.arcTo(QRect(labelwidth - m_radius * 2, labelheight - m_radius * 2, m_radius * 2, m_radius * 2), 270, 90); + painterPath.arcTo(QRect(labelRightX - m_radius * 2, labelBottomY - m_radius * 2, m_radius * 2, m_radius * 2), 270, 90); } else { - painterPath.lineTo(labelwidth, labelheight); - painterPath.lineTo(labelwidth, labelheight - m_radius); + painterPath.lineTo(labelRightX, labelBottomY); + painterPath.lineTo(labelRightX, labelBottomY - m_radius); } - painterPath.lineTo(labelwidth, m_radius); + painterPath.lineTo(labelRightX, m_radius); if (m_roundtype == 1 || m_roundtype == 3) { - painterPath.arcTo(QRect(labelwidth - m_radius * 2, m_borderframew, m_radius * 2, m_radius * 2), 0, 90); + painterPath.arcTo(QRect(labelRightX - m_radius * 2, m_borderframewY, m_radius * 2, m_radius * 2), 0, 90); } else { - painterPath.lineTo(labelwidth, m_borderframew); - painterPath.lineTo(labelwidth - m_radius, m_borderframew); + painterPath.lineTo(labelRightX, m_borderframewY); + painterPath.lineTo(labelRightX - m_radius, m_borderframewY); } - painterPath.lineTo(m_radius, m_borderframew); + painterPath.lineTo(m_radius, m_borderframewY); painterPath.closeSubpath(); painter.drawPath(painterPath); painter.restore(); @@ -278,24 +258,26 @@ QString datestr; - datestr = m_ScheduleInfo.getBeginDateTime().toString(m_timeFormat) - + "-" + m_ScheduleInfo.getEndDateTime().toString(m_timeFormat); + datestr = m_ScheduleInfo->dtStart().toString(m_timeFormat) + + "-" + m_ScheduleInfo->dtEnd().toString(m_timeFormat); int flag = Qt::AlignLeft | Qt::AlignVCenter; - if (m_ScheduleInfo.getAllDay()) { + if (m_ScheduleInfo->allDay()) { datestr = tr("All Day"); } - painter.drawText(QRect(12, 8, m_durationSize, labelheight - 16), flag, datestr); + painter.drawText(QRect(12, 8, m_durationSize, labelBottomY - 16), flag, datestr); painter.save(); - const CSchedulesColor &gdColor = CScheduleDataManage::getScheduleDataManage()->getScheduleColorByType(m_ScheduleInfo.getType()); - bColor = gdColor.orginalColor; + DScheduleType::Ptr type = gScheduleManager->getScheduleTypeByScheduleId(m_ScheduleInfo->scheduleTypeID()); + if (nullptr != type) { + bColor = type->typeColor().colorCode(); + } QPen pen(bColor); pen.setWidth(2); painter.setPen(pen); //由于绘制的矩形大小的改变,所以需要调整起始和截止y坐标 - painter.drawLine(m_durationSize + 17, 2, m_durationSize + 17, labelheight - 1); + painter.drawLine(m_durationSize + 17, m_borderframewY, m_durationSize + 17, labelBottomY); painter.restore(); painter.setFont(m_tFont); @@ -303,8 +285,8 @@ QString ellipsis = "..."; QFontMetrics fm = painter.fontMetrics(); //整个label宽度-文字起始位置 - int tilenameW = labelwidth - (m_durationSize + 26); - QString tSTitleName = m_ScheduleInfo.getTitleName(); + int tilenameW = labelRightX - m_borderframewX - (m_durationSize + 26); + QString tSTitleName = m_ScheduleInfo->summary(); tSTitleName.replace("\n", ""); QString str = tSTitleName; QString tStr; @@ -323,15 +305,28 @@ if (tStr != str) { tStr = tStr + "..."; } + this->setToolTip(str); + painter.drawText(QRect(m_durationSize + 17 + 9, 6, tilenameW, labelBottomY), Qt::AlignLeft, tStr); + + //存在焦点时绘制边框 + if (m_tabFocus) { + painter.setPen(Qt::NoPen); + // 设置画刷颜色 + painter.setBrush(CScheduleDataManage::getScheduleDataManage()->getSystemActiveColor()); + QPainterPath path; + int w = 2; //边框宽度 + path.addRect(m_borderframewX, m_borderframewY, labelRightX - m_borderframewX, labelBottomY - m_borderframewY); + path.addRect(m_borderframewX + w, m_borderframewY + w, labelRightX - 2 * w - m_borderframewX, labelBottomY - 2 * w - m_borderframewY); + painter.drawPath(path); + } - painter.drawText(QRect(m_durationSize + 17 + 9, 6, tilenameW, labelheight), Qt::AlignLeft, tStr); painter.end(); } void CScheduleSearchItem::contextMenuEvent(QContextMenuEvent *event) { Q_UNUSED(event); - - if (m_ScheduleInfo.getType() == DDECalendar::FestivalTypeID) + //判断是否为节假日日程 + if (CScheduleOperation::isFestival(m_ScheduleInfo)) return; //在有些环境中弹出右击菜单不会触发leaveEvent,主动更新leave对应的事件处理 m_mouseStatus = M_NONE; @@ -339,7 +334,11 @@ m_rightMenu->clear(); m_rightMenu->addAction(m_editAction); m_rightMenu->addAction(m_deleteAction); + //不可修改的日程删除按钮无效 + m_deleteAction->setEnabled(!CScheduleOperation::scheduleIsInvariant(m_ScheduleInfo)); m_rightMenu->exec(QCursor::pos()); + //恢复按钮状态 + m_deleteAction->setEnabled(true); } void CScheduleSearchItem::mouseDoubleClickEvent(QMouseEvent *event) @@ -407,7 +406,7 @@ if (!CalendarGlobalEnv::getGlobalEnv()->registerKey("SearchItemEvent", "Keyboard")) { CalendarGlobalEnv::getGlobalEnv()->reviseValue("SearchItemEvent", "Keyboard"); } - emit signalSelectSchedule(m_ScheduleInfo); + emit signalSelectSchedule(m_ScheduleInfo); emit signalSelectCurrentItem(this, false); m_tabFocus = true; } @@ -419,12 +418,13 @@ void CScheduleSearchItem::focusOutEvent(QFocusEvent *e) { - //只针对tab的情况生效 - if (e->reason() == Qt::TabFocusReason) + //只针对tab的情况生效 + if (e->reason() == Qt::TabFocusReason){ emit signalSelectCurrentItem(this, true); - DLabel::focusOutEvent(e); - m_tabFocusBeforeActive = m_tabFocus; - m_tabFocus = false; + } + DLabel::focusOutEvent(e); + m_tabFocusBeforeActive = m_tabFocus; + m_tabFocus = false; } void CScheduleSearchItem::keyPressEvent(QKeyEvent *event) @@ -445,7 +445,6 @@ : DWidget(parent) { QVBoxLayout *layout = new QVBoxLayout; - layout->setMargin(0); layout->setSpacing(0); m_gradientItemList = new CScheduleListWidget(parent); m_gradientItemList->setAlternatingRowColors(true); @@ -460,8 +459,7 @@ m_labellist.clear(); connect(m_gradientItemList, &CScheduleListWidget::signalListWidgetClicked, this, &CScheduleSearchView::slotListWidgetClicked); - CScheduleTask *_scheduleTask = CalendarManager::getInstance()->getScheduleTask(); - connect(_scheduleTask, &CScheduleTask::jobsUpdate, this, &CScheduleSearchView::updateSearch); + connect(gScheduleManager, &ScheduleManager::signalSearchScheduleUpdate, this, &CScheduleSearchView::slotScearedScheduleUpdate); } CScheduleSearchView::~CScheduleSearchView() @@ -516,7 +514,7 @@ m_labellist.clear(); m_gradientItemList->clear(); //清空搜索数据 - CalendarManager::getInstance()->getScheduleTask()->clearSearchScheduleInfo(); + gScheduleManager->clearSearchSchedule(); } void CScheduleSearchView::setMaxWidth(const int w) @@ -547,7 +545,7 @@ { currentDItemIndex = m_scheduleSearchItem.indexOf(m_selectItem); //如果存在该item且为节日日程不可操作 - if (currentDItemIndex >= 0 && m_selectItem->getData().getType() != DDECalendar::FestivalTypeID) { + if (currentDItemIndex >= 0 && !CScheduleOperation::isFestival(m_selectItem->getData())) { m_selectItem->slotDelete(); } } @@ -561,29 +559,30 @@ //是否搜索到日程标志 hasScheduleShow = true; - for (int i = 0; i < m_gradientItemList->count(); i++) { - QListWidgetItem *item11 = m_gradientItemList->takeItem(i); - m_gradientItemList->removeItemWidget(item11); - delete item11; - item11 = nullptr; + //清空列表之前先断开信号响应 + for(auto widget : m_scheduleSearchItem){ + if(nullptr != widget){ + widget->disconnect(); + } } + m_gradientItemList->clear(); m_labellist.clear(); m_scheduleSearchItem.clear(); //找最近日程 QDate tCurrentData = QDate::currentDate(); //搜索日程过滤排序 - QMap > m_showData; + QMap m_showData; qint64 offset = 1000; QDate topdate = tCurrentData; - QMap >::const_iterator _iterator = m_vlistData.constBegin(); - QVector _showInfo{}; + QMap::const_iterator _iterator = m_vlistData.constBegin(); + DSchedule::List _showInfo {}; for (; _iterator != m_vlistData.constEnd(); ++_iterator) { qint64 d = qAbs(_iterator.key().daysTo(tCurrentData)); _showInfo.clear(); for (int i = 0 ; i < _iterator.value().size(); ++i) { //如果开始时间日期为显示日期则显示,跨天日程只显示一个 - if (_iterator.value().at(i).getBeginDateTime().date() == _iterator.key() || _iterator == m_vlistData.constBegin()) { + if (_iterator.value().at(i)->dtStart().date() == _iterator.key() || _iterator == m_vlistData.constBegin()) { _showInfo.append(_iterator.value().at(i)); } } @@ -599,7 +598,7 @@ } } tCurrentData = topdate; - QMap >::const_iterator _showIterator = m_showData.constBegin(); + QMap::const_iterator _showIterator = m_showData.constBegin(); for (; _showIterator != m_showData.constEnd(); ++_showIterator) { //创建显示日期项 QListWidgetItem *dateItem = createItemWidget(_showIterator.key()); @@ -623,6 +622,7 @@ hasScheduleShow = false; QListWidgetItem *listItem = new QListWidgetItem(m_gradientItemList); DLabel *gwi = new DLabel(); + gwi->setWordWrap(true); QFont font; font.setPixelSize(DDECalendar::FontSizeTwenty); gwi->setAlignment(Qt::AlignCenter); @@ -668,9 +668,9 @@ } } -void CScheduleSearchView::createItemWidget(ScheduleDataInfo info, QDate date, int rtype) +void CScheduleSearchView::createItemWidget(DSchedule::Ptr info, QDate date, int rtype) { - ScheduleDataInfo &gd = info; + DSchedule::Ptr &gd = info; CScheduleSearchItem *gwi = new CScheduleSearchItem(this); QFont font; @@ -681,7 +681,7 @@ font.setPixelSize(DDECalendar::FontSizeTwelve); gwi->setTimeC(m_btimecolor, font); - gwi->setFixedSize(m_maxWidth - 25, 35); + gwi->setFixedSize(m_maxWidth - 15, 35); gwi->setData(gd, date); gwi->setRoundtype(rtype); //将搜索到的日程添加到容器 @@ -690,7 +690,7 @@ connect(gwi, &CScheduleSearchItem::signalSelectCurrentItem, this, &CScheduleSearchView::slotSelectCurrentItem); QListWidgetItem *listItem = new QListWidgetItem; - listItem->setSizeHint(QSize(m_maxWidth - 25, 36)); //每次改变Item的高度 + listItem->setSizeHint(QSize(m_maxWidth - 15, 36)); //每次改变Item的高度 listItem->setFlags(Qt::ItemIsTristate); m_gradientItemList->addItem(listItem); m_gradientItemList->setItemWidget(listItem, gwi); @@ -709,14 +709,14 @@ if (date == QDate::currentDate()) { gwi->setText(CScheduleDataManage::getScheduleDataManage()->getSystemActiveColor(), font); } - gwi->setFixedSize(m_maxWidth - 25, 35); + gwi->setFixedSize(m_maxWidth - 15, 35); gwi->setDate(date); connect(gwi, &CScheduleSearchDateItem::signalLabelScheduleHide, this, &CScheduleSearchView::signalScheduleHide); QListWidgetItem *listItem = new QListWidgetItem; - listItem->setSizeHint(QSize(m_maxWidth - 25, 36)); //每次改变Item的高度 + listItem->setSizeHint(QSize(m_maxWidth - 15, 36)); //每次改变Item的高度 listItem->setFlags(Qt::ItemIsTristate); m_gradientItemList->addItem(listItem); m_gradientItemList->setItemWidget(listItem, gwi); @@ -741,11 +741,16 @@ } QDateTime eDate = date.addMonths(6); //查询搜索 - m_vlistData = CalendarManager::getInstance()->getScheduleTask()->getSearchScheduleInfo(str, bDate, eDate); + gScheduleManager->searchSchedule(str, bDate, eDate); +} + +void CScheduleSearchView::slotScearedScheduleUpdate() +{ + m_vlistData = gScheduleManager->getAllSearchedScheduleMap(); updateDateShow(); } -void CScheduleSearchView::slotSelectSchedule(const ScheduleDataInfo &scheduleInfo) +void CScheduleSearchView::slotSelectSchedule(const DSchedule::Ptr &scheduleInfo) { emit signalSelectSchedule(scheduleInfo); } @@ -772,7 +777,7 @@ if (item == m_gradientItemList->itemWidget(cItem)) { m_selectItem = item; //设置选中的item为最上面一个 - m_gradientItemList->scrollToItem(m_gradientItemList->item(i), QAbstractItemView::PositionAtTop); + m_gradientItemList->scrollToItem(cItem, QAbstractItemView::PositionAtTop); if (i == m_gradientItemList->count() - 1 && itemFocusOut && !keyPressUP) { //最后一个item,发送信号将焦点传递给搜索框 emit signalSelectCurrentItem(); @@ -805,8 +810,8 @@ } if (m_gradientItemList->count() == 1) { QListWidgetItem *item11 = m_gradientItemList->item(0); - item11->setSizeHint(QSize(m_maxWidth, qRound(height() * 0.7978))); //每次改变Item的高度 - m_labellist.at(0)->setFixedSize(m_maxWidth, qRound(height() * 0.7978)); + item11->setSizeHint(QSize(m_maxWidth - 20, qRound(height() * 0.7978))); //每次改变Item的高度 + m_labellist.at(0)->setFixedSize(m_maxWidth - 20, qRound(height() * 0.7978)); m_labellist.at(0)->update(); } if (m_gradientItemList->count() > 1) { @@ -922,12 +927,13 @@ grabGesture(Qt::PanGesture); //日程类型发生改变,刷新界面 - JobTypeInfoManager::instance()->addToNoticeBill(this->viewport(), "update"); + connect(gAccountManager, &AccountManager::signalScheduleTypeUpdate, [&]() { + this->viewport()->update(); + }); } CScheduleListWidget::~CScheduleListWidget() { - JobTypeInfoManager::instance()->removeFromNoticeBill(this->viewport()); } void CScheduleListWidget::mousePressEvent(QMouseEvent *event) @@ -955,7 +961,9 @@ painter.setPen(Qt::NoPen); painter.setBrush(_outBorderColor); - const qreal _outWidth = 10; +// const qreal _outWidth = 10; + //不需要outwidth + const qreal _outWidth = 0; const qreal _rectX = this->width() - _outWidth; QPainterPath _showPath; _showPath.moveTo(_rectX - _radios, 0); diff -Nru dde-calendar-5.9.1/calendar-client/src/widget/schedulesearchview.h dde-calendar-5.10.0/calendar-client/src/widget/schedulesearchview.h --- dde-calendar-5.9.1/calendar-client/src/widget/schedulesearchview.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/widget/schedulesearchview.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,25 +1,12 @@ -/* - * Copyright (C) 2017 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: kirigaya - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef SCHEDULESEARCHVIEW_H #define SCHEDULESEARCHVIEW_H -#include "src/scheduledatainfo.h" +#include "dschedule.h" +#include "schedulemanager.h" #include #include @@ -48,18 +35,19 @@ bool getScheduleStatus(); void deleteSchedule(); signals: - void signalSelectSchedule(const ScheduleDataInfo &scheduleInfo); + void signalSelectSchedule(const DSchedule::Ptr &scheduleInfo); void signalScheduleHide(); void signalSelectCurrentItem(); void signalSchotCutClicked(); public slots: //需要搜索日程关键字 void slotsetSearch(QString str); - void slotSelectSchedule(const ScheduleDataInfo &scheduleInfo); + void slotSelectSchedule(const DSchedule::Ptr &scheduleInfo); //更新搜索信息 void updateSearch(); void slotSelectCurrentItem(CScheduleSearchItem *item, bool itemFocusOut); void slotListWidgetClicked(); + void slotScearedScheduleUpdate(); protected: void resizeEvent(QResizeEvent *event) override; @@ -69,12 +57,12 @@ private: void updateDateShow(); - void createItemWidget(ScheduleDataInfo info, QDate date, int rtype); + void createItemWidget(DSchedule::Ptr info, QDate date, int rtype); QListWidgetItem *createItemWidget(QDate date); private: CScheduleListWidget *m_gradientItemList = nullptr; //下拉列表窗 bool m_widgetFlag; - QMap > m_vlistData; + QMap m_vlistData; QVector m_labellist; int m_type; QDate m_currentDate; @@ -120,18 +108,18 @@ void setBackgroundColor(QColor color1); void setText(QColor tColor, QFont font); void setTimeC(QColor tColor, QFont font); - void setData(ScheduleDataInfo vScheduleInfo, QDate date); + void setData(DSchedule::Ptr vScheduleInfo, QDate date); void setRoundtype(int rtype); void setTheMe(int type = 0); void setDurationSize(QFont font); - const ScheduleDataInfo &getData() const + const DSchedule::Ptr &getData() const { return m_ScheduleInfo; } signals: void signalsDelete(CScheduleSearchItem *item); void signalsEdit(CScheduleSearchItem *item); - void signalSelectSchedule(const ScheduleDataInfo &scheduleInfo); + void signalSelectSchedule(const DSchedule::Ptr &scheduleInfo); void signalSelectCurrentItem(CScheduleSearchItem *item, bool focusOutStatus); public slots: void slotEdit(); @@ -156,7 +144,7 @@ QColor timeColor; QColor textColor; }; - ScheduleDataInfo m_ScheduleInfo; + DSchedule::Ptr m_ScheduleInfo; QAction *m_editAction = nullptr; QAction *m_deleteAction = nullptr; QColor m_Backgroundcolor; @@ -171,7 +159,8 @@ DMenu *m_rightMenu = nullptr; int m_roundtype = 1; const int m_radius = 8; - const int m_borderframew = 1; + const int m_borderframewX = 1; //绘制区域起始位置x坐标点 + const int m_borderframewY = 0; //绘制区域起始位置y坐标点 QString m_timeFormat = "hh:mm"; int m_durationSize = 0; bool m_tabFocus {false}; diff -Nru dde-calendar-5.9.1/calendar-client/src/widget/settingWidget/settingwidgets.cpp dde-calendar-5.10.0/calendar-client/src/widget/settingWidget/settingwidgets.cpp --- dde-calendar-5.9.1/calendar-client/src/widget/settingWidget/settingwidgets.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/widget/settingWidget/settingwidgets.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,101 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "settingwidgets.h" +#include "accountmanager.h" +#include "calendarmanage.h" +#include "units.h" + +#include +#include +#include + +#include + +DWIDGET_USE_NAMESPACE +using namespace SettingWidget; + +SettingWidgets::SettingWidgets(QWidget *parent) : QObject(parent) +{ +} + + +SyncTagRadioButton::SyncTagRadioButton(QWidget *parent) + : QWidget(parent) +{ +} + +bool SyncTagRadioButton::isChecked() +{ + return m_checked; +} + +void SyncTagRadioButton::setChecked(bool checked) +{ + if (m_checked == checked) + return; + + m_checked = checked; + update(); +} + +void SyncTagRadioButton::paintEvent(QPaintEvent *event) +{ + Q_UNUSED(event) + QPainter painter(this); + QIcon icon = DStyle::standardIcon(this->style(), m_checked ? DStyle::SP_IndicatorChecked : DStyle::SP_IndicatorUnchecked); + int y = (this->height() - 16) / 2; + int x = (this->width() - 16) / 2; + icon.paint(&painter, QRect(x, y, 16, 16), Qt::AlignCenter, isEnabled() ? QIcon::Normal : QIcon::Disabled); +} + +void SyncTagRadioButton::mouseReleaseEvent(QMouseEvent *event) +{ + QWidget::mouseReleaseEvent(event); + setChecked(!m_checked); + emit clicked(isChecked()); +} + +void CalendarSettingSettings::removeGroup(const QString &groupName, const QString &groupName2) +{ + int index = this->indexOf(*this, groupName); + if (index < 0) + return; + CalendarSettingGroups &groups = this->operator[](index)._groups; + { + int index = indexOf(groups, groupName2); + if (index < 0) + return; + groups.removeAt(index); + } + if (groups.isEmpty()) { + this->removeAt(index); + } +} + +void CalendarSettingSettings::removeGroup(const QString &groupName) +{ + int index = this->indexOf(*this, groupName); + if (index < 0) + return; + this->removeAt(index); +} + +int CalendarSettingSettings::indexOf(const CalendarSettingGroups &groups, const QString groupName) +{ + for (int k = 0; k < groups.count(); k++) { + if (groups[k]._key == groupName) + return k; + } + return -1; +} + +int CalendarSettingSettings::indexOf(const CalendarSettingSettings &groups, const QString groupName) +{ + for (int k = 0; k < groups.count(); k++) { + if (groups[k]._key == groupName) + return k; + } + return -1; +} diff -Nru dde-calendar-5.9.1/calendar-client/src/widget/settingWidget/settingwidgets.h dde-calendar-5.10.0/calendar-client/src/widget/settingWidget/settingwidgets.h --- dde-calendar-5.9.1/calendar-client/src/widget/settingWidget/settingwidgets.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/widget/settingWidget/settingwidgets.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,177 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef SETTINGWIDGETS_H +#define SETTINGWIDGETS_H + +#include "jobtypelistview.h" + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +DWIDGET_USE_NAMESPACE + + +namespace SettingWidget{ + struct CalendarSettingOption{ + CalendarSettingOption(){} + CalendarSettingOption(const std::initializer_list &list){ + int index = 0; + for(auto d : list) { + if(0 == index) _key = d; + if(1 == index) _name = d; + if(2 == index) _type = d; + if(3 == index) _default = d; + if(4 == index) _text = d; + index ++; + } + } + + QJsonObject toJson(){ + QJsonObject obj; + obj.insert("key", _key); + obj.insert("type", _type); + obj.insert("name", _name); + obj.insert("default", _default); + obj.insert("text", _text); + return obj; + } + + QString _key; + QString _type; + QString _name; + QString _default; + QString _text; + }; + struct CalendarSettingOptions : public QList{ + CalendarSettingOptions(){} + CalendarSettingOptions(const std::initializer_list &list){ + for(auto d : list) + append(d); + } + QJsonArray tojson() + { + QJsonArray arr; + for(auto option: *this) { + arr.append(option.toJson()); + } + return arr; + } + }; + + struct CalendarSettingGroup{ + QString _key; + QString _name; + CalendarSettingOptions _options; + QJsonObject toJson(){ + QJsonObject obj; + obj.insert("key", _key); + obj.insert("name", _name); + obj.insert("options", _options.tojson()); + return obj; + } + }; + + struct CalendarSettingGroups : public QList + { + CalendarSettingGroups(){} + CalendarSettingGroups(const std::initializer_list &list){ + for(auto d : list) + append(d); + } + QJsonArray toJson() + { + QJsonArray arr; + for(auto group: *this) { + arr.append(group.toJson()); + } + return arr; + } + }; + + struct CalendarSettingSetting { + QString _key; + QString _name; + CalendarSettingGroups _groups; + QJsonObject toJson() { + + QJsonObject obj; + obj.insert("key", _key); + obj.insert("name", _name); + obj.insert("groups", _groups.toJson()); + return obj; + } + }; + + struct CalendarSettingSettings : public QList + { + CalendarSettingSettings(){} + CalendarSettingSettings(const std::initializer_list &list){ + for(auto d : list) + append(d); + } + QJsonArray toJson() + { + QJsonArray arr; + for(auto setting: *this) { + arr.append(setting.toJson()); + } + return arr; + } + + void removeGroup(const QString &groupName, const QString &groupName2); + void removeGroup(const QString &groupName); + int indexOf(const CalendarSettingGroups &groups, const QString groupName); + int indexOf(const CalendarSettingSettings &groups, const QString groupName); + }; + + + /** + * @brief The SyncTagRadioButton class 实现checkstate效果的类 + */ + class SyncTagRadioButton : public QWidget + { + Q_OBJECT + public: + SyncTagRadioButton(QWidget *parent = nullptr); + + bool isChecked(); + + /** + * @brief setChecked 是否选中 + */ + void setChecked(bool checked); + + signals: + void clicked(bool checked); + + protected: + void paintEvent(QPaintEvent *event) override; + void mouseReleaseEvent(QMouseEvent *event) override; + + private: + bool m_checked = true; + }; +}//~CalendarSetting + + +class SettingWidgets : public QObject +{ + Q_OBJECT +public: + + explicit SettingWidgets(QWidget *parent = nullptr); + +}; + +#endif // SETTINGWIDGETS_H diff -Nru dde-calendar-5.9.1/calendar-client/src/widget/settingWidget/userloginwidget.cpp dde-calendar-5.10.0/calendar-client/src/widget/settingWidget/userloginwidget.cpp --- dde-calendar-5.9.1/calendar-client/src/widget/settingWidget/userloginwidget.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/widget/settingWidget/userloginwidget.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,158 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "userloginwidget.h" +#include "accountmanager.h" +#include "doanetworkdbus.h" +#include +#include +#include +#include +#include + +UserloginWidget::UserloginWidget(QWidget *parent) + : QWidget(parent) + , m_loginStatus(false) +{ + initView(); + initConnect(); + slotAccountUpdate(); +} + +UserloginWidget::~UserloginWidget() +{ + +} + +void UserloginWidget::initView() +{ + m_userNameLabel = new DLabel(); + m_userNameLabel->setElideMode(Qt::ElideMiddle); + m_userNameLabel->setTextFormat(Qt::PlainText); + m_buttonImg = new DIconButton(this); + m_buttonLogin = new QPushButton(this); + m_buttonLoginOut = new QPushButton(this); + m_buttonLogin->setFixedSize(98, 36); + m_buttonLoginOut->setFixedSize(98, 36); + QHBoxLayout *layout = new QHBoxLayout(this); + const QIcon &icon = QIcon::fromTheme("dde_calendar_account"); + m_buttonImg->setIcon(icon); + m_buttonImg->setIconSize(QSize(36, 36)); + m_buttonImg->setStyleSheet("border:0px solid;"); + layout->setContentsMargins(0, 0, 0, 0); + layout->addWidget(m_buttonImg); + layout->addSpacing(5); + layout->addWidget(m_userNameLabel); + layout->addStretch(); + m_buttonLogin->setText(tr("Sign In", "button")); + m_buttonLoginOut->setText(tr("Sign Out", "button")); + m_buttonLoginOut->hide(); + layout->addWidget(m_buttonLogin); + layout->addWidget(m_buttonLoginOut); + this->layout()->setAlignment(Qt::AlignLeft); + m_ptrDoaNetwork = new DOANetWorkDBus(this); + if (m_ptrDoaNetwork->getNetWorkState() == DOANetWorkDBus::NetWorkState::Active) { + m_buttonLoginOut->setEnabled(true); + m_buttonLogin->setEnabled(true); + } else { + m_buttonLogin->setEnabled(false); + m_buttonLoginOut->setEnabled(false); + } + + m_networkManager = new QNetworkAccessManager(this); +} + +void UserloginWidget::initConnect() +{ + connect(m_buttonLogin, &QPushButton::clicked, this, &UserloginWidget::slotLoginBtnClicked); + connect(m_buttonLoginOut, &QPushButton::clicked, this, &UserloginWidget::slotLogoutBtnClicked); + connect(gAccountManager, &AccountManager::signalAccountUpdate, this, &UserloginWidget::slotAccountUpdate); + connect(m_networkManager, &QNetworkAccessManager::finished, this, &UserloginWidget::slotReplyPixmapLoad); + connect(m_ptrDoaNetwork, &DOANetWorkDBus::sign_NetWorkChange, this, &UserloginWidget::slotNetworkStateChange); +} + +QPixmap UserloginWidget::pixmapToRound(const QPixmap &src, int radius) +{ + QSize size(2 * radius, 2 * radius); + QPixmap pic(size); + pic.fill(Qt::transparent); + + QPainterPath painterPath; + painterPath.addEllipse(QRect(0, 0, pic.width(), pic.height())); + + QPainter painter(&pic); + painter.setRenderHint(QPainter::Antialiasing); + painter.setClipPath(painterPath); + + painter.drawPixmap(0, 0, src.scaled(size)); + pic.setDevicePixelRatio(devicePixelRatioF()); + + return pic; +} + +void UserloginWidget::slotNetworkStateChange(DOANetWorkDBus::NetWorkState state) +{ + if (DOANetWorkDBus::NetWorkState::Disconnect == state) { + m_buttonLogin->setEnabled(false); + m_buttonLoginOut->setEnabled(false); + } else if (DOANetWorkDBus::NetWorkState::Active == state) { + m_buttonLoginOut->setEnabled(true); + m_buttonLogin->setEnabled(true); + } +} + +void UserloginWidget::slotLoginBtnClicked() +{ + gAccountManager->login(); +} + +void UserloginWidget::slotLogoutBtnClicked() +{ + gAccountManager->loginout(); +} + +void UserloginWidget::slotAccountUpdate() +{ + if (gUosAccountItem) { + //账户为登录状态 + m_buttonLogin->hide(); + m_buttonLoginOut->show(); + DAccount::Ptr account = gUosAccountItem->getAccount(); + m_userNameLabel->setText(account->accountName()); + m_userNameLabel->setToolTip("

    " + account->accountName().toHtmlEscaped()); + // 这里的url一定要带上http://头的, 跟在浏览器里输入其它链接不太一样,浏览器里面会自动转的,这里需要手动加上。 + m_networkManager->get(QNetworkRequest(account->avatar())); + } else { + //账户为未登录状态 + m_buttonLoginOut->hide(); + m_buttonLogin->show(); + m_userNameLabel->setText(""); + m_userNameLabel->setToolTip(""); + m_buttonImg->setIcon(QIcon::fromTheme("dde_calendar_account")); + } +} + +void UserloginWidget::slotReplyPixmapLoad(QNetworkReply *reply) +{ + QPixmap pixmap; + //因自定义头像路径拿到的不是真实路径,需要从请求头中拿取到真实路径再次发起请求 + QUrl url = reply->header(QNetworkRequest::LocationHeader).toUrl(); + if (url.url().isEmpty()) { + pixmap.loadFromData(reply->readAll()); + } else { + m_networkManager->get(QNetworkRequest(url.url())); + } + + if (!pixmap.isNull()) { + m_buttonImg->setIcon(pixmapToRound(pixmap, 32)); + } +} + +QPair UserloginWidget::createloginButton(QObject *obj) +{ + auto option = qobject_cast(obj); + + QPair optionWidget = DSettingsWidgetFactory::createStandardItem(QByteArray(), option, new UserloginWidget()); + return optionWidget; +} diff -Nru dde-calendar-5.9.1/calendar-client/src/widget/settingWidget/userloginwidget.h dde-calendar-5.10.0/calendar-client/src/widget/settingWidget/userloginwidget.h --- dde-calendar-5.9.1/calendar-client/src/widget/settingWidget/userloginwidget.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/widget/settingWidget/userloginwidget.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,54 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef USERLOGIN_H +#define USERLOGIN_H + +#include "dsettingsdialog.h" +#include "doanetworkdbus.h" +#include +#include +#include +#include +DWIDGET_USE_NAMESPACE + +//配置界面账户登录部件 +class UserloginWidget: public QWidget +{ + Q_OBJECT +public: + explicit UserloginWidget(QWidget *parent = nullptr); + virtual ~UserloginWidget(); + + static QPair createloginButton(QObject *obj); + +signals: + +public slots: + void slotLoginBtnClicked(); + void slotLogoutBtnClicked(); + void slotAccountUpdate(); + //网络图片请求完成事件 + void slotReplyPixmapLoad(QNetworkReply *); + // 网络状态发生改变 + void slotNetworkStateChange(DOANetWorkDBus::NetWorkState state); + + +private: + void initView(); + void initConnect(); + + QPixmap pixmapToRound(const QPixmap &src, int radius); +private: + bool m_loginStatus; + bool m_isManualQuit = false; + DLabel *m_userNameLabel = nullptr; + DIconButton *m_buttonImg = nullptr; + QPushButton *m_buttonLogin = nullptr; + QPushButton *m_buttonLoginOut = nullptr; + QNetworkAccessManager *m_networkManager; + DOANetWorkDBus * m_ptrDoaNetwork; +}; + +#endif // USERLOGIN_H diff -Nru dde-calendar-5.9.1/calendar-client/src/widget/sidebarWidget/sidebarcalendarwidget.cpp dde-calendar-5.10.0/calendar-client/src/widget/sidebarWidget/sidebarcalendarwidget.cpp --- dde-calendar-5.9.1/calendar-client/src/widget/sidebarWidget/sidebarcalendarwidget.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/widget/sidebarWidget/sidebarcalendarwidget.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,337 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "sidebarcalendarwidget.h" +#include "cschedulebasewidget.h" +#include "constants.h" +#include "units.h" + +#include +#include + +QDate SidebarCalendarKeyButton::m_selectedData = QDate(); +QDate SidebarCalendarKeyButton::m_displayedMonth = QDate(); + + +SidebarCalendarWidget::SidebarCalendarWidget(QWidget *parent) : QWidget(parent) +{ + initView(); + initConnection(); + initData(); +} + +void SidebarCalendarWidget::initView() +{ + m_dateLabel = new QLabel(); + QFont font = m_dateLabel->font(); + font.setPixelSize(DDECalendar::FontSizeTwelve); + m_dateLabel->setFont(font); + m_nextPage = new QPushButton(); + m_previousPage = new QPushButton(); + m_nextPage->setIcon(DStyle().standardIcon(QStyle::SP_ArrowRight)); + m_previousPage->setIcon(DStyle().standardIcon(QStyle::SP_ArrowLeft)); + m_nextPage->setFixedSize(20, 20); + m_previousPage->setFixedSize(20, 20); + m_nextPage->setIconSize(QSize(10,10)); + m_previousPage->setIconSize(QSize(10,10)); + m_nextPage->setFlat(true); + m_previousPage->setFlat(true); + + m_nextPage->setFocusPolicy(Qt::NoFocus); + m_previousPage->setFocusPolicy(Qt::NoFocus); + + QHBoxLayout *headLayout = new QHBoxLayout(); + headLayout->setMargin(0); + headLayout->setAlignment(Qt::AlignCenter); + headLayout->addWidget(m_previousPage); + headLayout->addWidget(m_dateLabel); + headLayout->addWidget(m_nextPage); + + m_headWidget = new QWidget(this); + m_headWidget->setLayout(headLayout); + m_headWidget->setMinimumHeight(30); + + m_weekWidget = new CWeekWidget(this); + m_weekWidget->setAutoFontSizeByWindow(false); + m_weekWidget->setFirstDay(Qt::Sunday); + + m_keyWidget = new QWidget(this); + m_keyLayout = new QGridLayout(); + m_keyLayout->setMargin(0); + m_keyLayout->setSpacing(0); + m_keyWidget->setLayout(m_keyLayout); + //循坏实例化6*7个日期按键 + for (int i = 0; i < 42; ++i) { + SidebarCalendarKeyButton *button = new SidebarCalendarKeyButton(); + button->setFocusPolicy(Qt::NoFocus); + m_keyButtonList.push_back(button); + m_keyLayout->addWidget(button, i/7, i%7, 1, 1, Qt::AlignCenter); + connect(button, &SidebarCalendarKeyButton::signaClicked, this, &SidebarCalendarWidget::slotKeyButtonClicked); + } + + QVBoxLayout *mainLayout = new QVBoxLayout(this); + mainLayout->setMargin(0); + this->setLayout(mainLayout); + mainLayout->addSpacing(6); + mainLayout->addWidget(m_headWidget); + mainLayout->addWidget(m_weekWidget, 1); + mainLayout->addWidget(m_keyWidget, 6); +} + +/** + * @brief SidebarCalendarWidget::initConnection + * 初始化信号链接 + */ +void SidebarCalendarWidget::initConnection() +{ + connect(m_nextPage, &QPushButton::clicked, this, &SidebarCalendarWidget::slotNextPageClicked); + connect(m_previousPage, &QPushButton::clicked, this, &SidebarCalendarWidget::slotPreviousPageClicked); + connect(CalendarManager::getInstance(), &CalendarManager::sigNotifySidebarFirstDayChanged, this, &SidebarCalendarWidget::slotFirstDayChanged); +} + +/** + * @brief SidebarCalendarWidget::initData + * 初始化数据 + */ +void SidebarCalendarWidget::initData() +{ + m_firstday = CalendarManager::getInstance()->getFirstDayOfWeek(); + QDate date = QDate::currentDate(); + setDate(date); +} + +/** + * @brief SidebarCalendarWidget::setDate + * 设置显示的日期 + * @param date 将被选择显示的日期 + */ +void SidebarCalendarWidget::setDate(QDate& date) +{ + SidebarCalendarKeyButton::setSelectedDate(date); + setKeyDate(date); +} + +/** + * @brief SidebarCalendarWidget::setKeyDate + * 根据选中的日期设置按钮显示的日期范围 + * @param date 待显示的月日期 + */ +void SidebarCalendarWidget::setKeyDate(QDate date) +{ + if(!withinTimeFrame(date)){ + return; + } + QString fd = ""; + fd.append("yyyy").append(tr("Y")).append("MM").append(tr("M")); + m_dateLabel->setText(date.toString(fd)); + SidebarCalendarKeyButton::setDisplayedMonth(date); + + //获取当月第一天 + date = QDate(date.year(), date.month(), 1); +// int firstday = CalendarManager::getInstance()->getFirstDayOfWeek(); + int day = date.dayOfWeek(); + //计算当前月日历第一天该显示的时间 + date = date.addDays(-(day - m_firstday + 7) % 7); + for (SidebarCalendarKeyButton* btn : m_keyButtonList) { + btn->setDate(date); + date = date.addDays(1); + } + update(); +} + +/** + * @brief SidebarCalendarWidget::slotKeyButtonClicked + * 日期按键点击事件 + * @param keyButton 事件发送者 + */ +void SidebarCalendarWidget::slotKeyButtonClicked(SidebarCalendarKeyButton* keyButton) +{ + QDate date = keyButton->getSelectedDate(); + if(!withinTimeFrame(date)){ + return; + } + if (date.year() ==keyButton->getDisplayedMonth().year() && date.month() == keyButton->getDisplayedMonth().month()) { + //未切换月份,只刷新界面显示 + update(); + } else { + //已切换月份,重新设置选中的日期 + setDate(date); + } + CScheduleBaseWidget::setSelectDate(date); +} + +/** + * @brief SidebarCalendarWidget::slotNextPageClicked + * 下一页切换事件 + */ +void SidebarCalendarWidget::slotNextPageClicked() +{ + //设置显示月份日期 + QDate date = SidebarCalendarKeyButton::getDisplayedMonth().addMonths(+1); + //设置显示的日期范围 + setKeyDate(date); +} + +/** + * @brief SidebarCalendarWidget::slotPreviousPageClicked + * 上一页切换事件 + */ +void SidebarCalendarWidget::slotPreviousPageClicked() +{ + //设置显示月份日期 + QDate date = SidebarCalendarKeyButton::getDisplayedMonth().addMonths(-1); + //设置显示的日期范围 + setKeyDate(date); +} + +void SidebarCalendarWidget::slotFirstDayChanged(int value) +{ + m_firstday = value; + setKeyDate(SidebarCalendarKeyButton::getSelectedDate()); +} + +SidebarCalendarKeyButton::SidebarCalendarKeyButton(QWidget *parent) + : QPushButton(parent) +{ + setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + setMinimumSize(QSize(10, 10)); +} + +/** + * @brief SidebarCalendarKeyButton::setSelectedDate + * 设置被选中的日期 + * @param date 将被选中的日期 + */ +void SidebarCalendarKeyButton::setSelectedDate(const QDate& date) +{ + m_selectedData = date; +} + +/** + * @brief SidebarCalendarKeyButton::getSelectedDate + * @return 当前被选中的日期 + */ +QDate SidebarCalendarKeyButton::getSelectedDate() +{ + return m_selectedData; +} + +/** + * @brief SidebarCalendarKeyButton::setDisplayedMonth + * 设置显示的月份 + * @param date 将显示的月份日期 + */ +void SidebarCalendarKeyButton::setDisplayedMonth(const QDate& date) +{ + m_displayedMonth = date; +} + +/** + * @brief SidebarCalendarKeyButton::getDisplayedMonth + * @return 当前显示的月份日期 + */ +QDate SidebarCalendarKeyButton::getDisplayedMonth() +{ + return m_displayedMonth; +} + +/** + * @brief SidebarCalendarKeyButton::setDate + * 设置被显示的日期 + * @param date 将被显示的日期 + */ +void SidebarCalendarKeyButton::setDate(const QDate& date) +{ + this->m_displayedDate = date; + update(); +} + +/** + * @brief SidebarCalendarKeyButton::getDate + * @return 当前显示的日期 + */ +QDate SidebarCalendarKeyButton::getDate() +{ + return m_displayedDate; +} + +/** + * @brief SidebarCalendarKeyButton::click + * 点击事件 + */ +void SidebarCalendarKeyButton::click() +{ + if(!withinTimeFrame(m_displayedDate)){ + return; + } + m_selectedData = m_displayedDate; + emit signaClicked(this); +} + +void SidebarCalendarKeyButton::mousePressEvent(QMouseEvent *event) +{ + //判断鼠标左键按下事件 + if (event->button() == Qt::LeftButton) { + this->pressed = true; + } + QWidget::mousePressEvent(event); +} + +void SidebarCalendarKeyButton::mouseReleaseEvent(QMouseEvent *event) +{ + //判断鼠标左键释放事件 + if (pressed && event->button() == Qt::LeftButton && rect().contains(event->pos())) { + click(); + pressed = false; + } else if (event->button() == Qt::LeftButton) { + pressed = false; + } + + QWidget::mouseReleaseEvent(event); +} + +void SidebarCalendarKeyButton::mouseMoveEvent(QMouseEvent *event) +{ + //判断鼠标左键移动事件 + if (event->button() == Qt::LeftButton && rect().contains(event->pos())) { + pressed = true; + } else if (event->button() == Qt::LeftButton) { + pressed = false; + } +} + +void SidebarCalendarKeyButton::paintEvent(QPaintEvent *event) +{ + QPainter painter(this); + painter.setRenderHint(QPainter::Antialiasing); + + + qreal w = this->width(); + qreal h = this->height(); + const qreal r = w > h ? h: w; + QRectF rectf(qRound((w-r)/2), qRound((h-r)/2), r, r); //绘制区域 + + QFont font; + font.setPixelSize(DDECalendar::FontSizeTwelve); + painter.setFont(font); + + if (m_displayedDate == m_selectedData && withinTimeFrame(m_displayedDate)) { + painter.setPen(Qt::NoPen); + painter.setBrush(DApplicationHelper::instance()->palette(this).highlight()); + //绘制高亮背景 + painter.drawEllipse(rectf); + //设置高亮下的字体颜色 + painter.setPen(DApplicationHelper::instance()->palette(this).highlightedText().color()); + } else if (!(m_displayedDate.year() == m_displayedMonth.year() && m_displayedDate.month() == m_displayedMonth.month())){ + //设置正常显示状态下的字体颜色 + painter.setOpacity(0.3); + } + //获取待绘制的文字 + QString text = QString::number(m_displayedDate.day()); + + //绘制文字 + painter.drawText(rectf, text, QTextOption(Qt::AlignCenter)); + QWidget::paintEvent(event); +} + diff -Nru dde-calendar-5.9.1/calendar-client/src/widget/sidebarWidget/sidebarcalendarwidget.h dde-calendar-5.10.0/calendar-client/src/widget/sidebarWidget/sidebarcalendarwidget.h --- dde-calendar-5.9.1/calendar-client/src/widget/sidebarWidget/sidebarcalendarwidget.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/widget/sidebarWidget/sidebarcalendarwidget.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,109 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef SIDEBARCALENDARWIDGET_H +#define SIDEBARCALENDARWIDGET_H + +#include "cweekwidget.h" + +#include +#include +#include +#include +#include + +DWIDGET_USE_NAMESPACE + +class SidebarCalendarKeyButton; +//小日历类 +class SidebarCalendarWidget : public QWidget +{ + Q_OBJECT +public: + explicit SidebarCalendarWidget(QWidget *parent = nullptr); + //设置选中的日期 + void setDate(QDate&); + +signals: + +public slots: + //日期按键点击事件 + void slotKeyButtonClicked(SidebarCalendarKeyButton*); + //下一页按钮点击事件 + void slotNextPageClicked(); + //上一页按钮点击事件 + void slotPreviousPageClicked(); + //一周首日更新 + void slotFirstDayChanged(int value); + +private: + void initView(); + void initConnection(); + void initData(); + + //根据选中的日期设置按钮显示的日期范围 date:选中的日期 + void setKeyDate(QDate date); + +private: + + QWidget* m_headWidget = nullptr; //头部控件 + CWeekWidget* m_weekWidget = nullptr; //周显示区域控件 + QWidget* m_keyWidget = nullptr; //日期按钮区域控件 + QGridLayout* m_keyLayout = nullptr; //按钮布局 + + QLabel* m_dateLabel = nullptr; //头部日期显示label + DPushButton* m_nextPage = nullptr; //下一页切换按键 + DPushButton* m_previousPage = nullptr; //上一页切换按键 + + QList m_keyButtonList; //所有的日期按钮控件 + + int m_firstday = Qt::Sunday; +}; + + +//日历按键类 +class SidebarCalendarKeyButton : public QPushButton +{ + Q_OBJECT +public: + explicit SidebarCalendarKeyButton(QWidget *parent = nullptr); + + //设置当前按钮显示的日期 + void setDate(const QDate&); + //获取当前按钮显示的日期 + QDate getDate(); + +signals: + //点击事件信号 + void signaClicked(SidebarCalendarKeyButton*); + +public slots: + void click(); + +private: + //设置被选中的日期 + static void setSelectedDate(const QDate&); + //获取当前被选中的日期 + static QDate getSelectedDate(); + //设置显示的月份日期 + static void setDisplayedMonth(const QDate&); + //获取当前显示的月份日期 + static QDate getDisplayedMonth(); + +protected: + void paintEvent(QPaintEvent *event) override; + void mousePressEvent(QMouseEvent *event) override; + void mouseReleaseEvent(QMouseEvent *event) override; + void mouseMoveEvent(QMouseEvent *event) override; + +private: + static QDate m_selectedData; //被选中的日期 + static QDate m_displayedMonth; //显示的月份日期 + QDate m_displayedDate; //当前显示的日期 + bool pressed = false; //是否按下 + + friend SidebarCalendarWidget; +}; + +#endif // SIDEBARCALENDARWIDGET_H diff -Nru dde-calendar-5.9.1/calendar-client/src/widget/sidebarWidget/sidebaritemwidget.cpp dde-calendar-5.10.0/calendar-client/src/widget/sidebarWidget/sidebaritemwidget.cpp --- dde-calendar-5.9.1/calendar-client/src/widget/sidebarWidget/sidebaritemwidget.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/widget/sidebarWidget/sidebaritemwidget.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,311 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "sidebaritemwidget.h" +#include "accountmanager.h" +#include +#include +#include +#include +#include + +SidebarItemWidget::SidebarItemWidget(QWidget *parent) + : QWidget(parent) +{ + setFixedWidth(170); +} + +SidebarItemWidget *SidebarItemWidget::getAccountItemWidget(AccountItem::Ptr ptr) +{ + return new SidebarAccountItemWidget(ptr); +} + +/** + * @brief SidebarItemWidget::getLocalWidget + * 获取子层本地日程item控件,有复选框 + * @param info 本地日程类型 + * @return 子层选项控件 + */ +SidebarItemWidget *SidebarItemWidget::getTypeItemWidget(DScheduleType::Ptr ptr) +{ + return new SidebarTypeItemWidget(ptr); +} + +/** + * @brief SidebarItemWidget::setSelectStatus + * 设置选中状态 + * @param status 将被设置的状态 + */ +void SidebarItemWidget::setSelectStatus(bool status) +{ + if (status == m_selectStatus && m_item && status == m_item->isExpanded()) { + return; + } + m_selectStatus = status; + //根据控件类型设置响应控件状态 + updateStatus(); + + if (m_item && m_item->isExpanded() != status) { + //设置列表展开状态 + m_item->setExpanded(status); + } + emit signalStatusChange(m_selectStatus, m_id); +} + +/** + * @brief SidebarItemWidget::getSelectStatus + * 获取当前状态 + * @return + */ +bool SidebarItemWidget::getSelectStatus() +{ + return m_selectStatus; +} + +/** + * @brief SidebarItemWidget::switchState + * 切换状态 + */ +void SidebarItemWidget::switchState() +{ + setSelectStatus(!m_selectStatus); +} + +/** + * @brief SidebarItemWidget::setItem + * 设置关联的item + * @param item 待关联的item + */ +void SidebarItemWidget::setItem(QTreeWidgetItem *item) +{ + m_item = item; +} + +QTreeWidgetItem *SidebarItemWidget::getTreeItem() +{ + return m_item; +} + +void SidebarItemWidget::mouseDoubleClickEvent(QMouseEvent *event) +{ + Q_UNUSED(event) + switchState(); +} + +void SidebarItemWidget::mouseReleaseEvent(QMouseEvent *) +{ + //屏蔽鼠标释放事件,解决双击时触发重复事件的问题 +} + +SidebarTypeItemWidget::SidebarTypeItemWidget(DScheduleType::Ptr ptr, QWidget *parent) + : SidebarItemWidget(parent) + , m_scheduleType(ptr) +{ + initView(); + m_id = m_scheduleType->accountID(); +} + +void SidebarTypeItemWidget::initView() +{ + QHBoxLayout *vLayout = new QHBoxLayout(this); + vLayout->setContentsMargins(5, 0, 0, 0); + vLayout->setSpacing(0); + m_checkBox = new QCheckBox(this); + QPalette palette = m_checkBox->palette(); + palette.setBrush(QPalette::Highlight, QColor(m_scheduleType->getColorCode())); + m_checkBox->setPalette(palette); + m_checkBox->setFocusPolicy(Qt::NoFocus); + setSelectStatus((m_scheduleType->showState() == DScheduleType::Show)); + connect(m_checkBox, &QCheckBox::clicked, this, [this]() { + setSelectStatus(m_checkBox->isChecked()); + }); + + m_titleLabel = new DLabel(this); + m_titleLabel->setFixedHeight(30); + DFontSizeManager::instance()->bind(m_titleLabel, DFontSizeManager::T6); + m_titleLabel->setElideMode(Qt::ElideRight); + //设置初始字体大小 + DFontSizeManager::instance()->setFontGenericPixelSize(static_cast(DFontSizeManager::fontPixelSize(QFont()))); + QFont labelF = DFontSizeManager::instance()->t6(); + labelF.setWeight(QFont::Normal); + m_titleLabel->setFont(labelF); + m_titleLabel->setAlignment(Qt::AlignLeft | Qt::AlignVCenter); + m_titleLabel->setText(m_scheduleType->displayName()); + m_titleLabel->setToolTip(m_scheduleType->displayName()); + + vLayout->addSpacing(2); + vLayout->addWidget(m_checkBox); + vLayout->addWidget(m_titleLabel, 1); + this->setLayout(vLayout); + + setFixedHeight(40); +} + +void SidebarTypeItemWidget::updateStatus() +{ + AccountItem::Ptr account = gAccountManager->getAccountItemByAccountId(m_scheduleType->accountID()); + if (account) { + if (m_selectStatus != (m_scheduleType->showState() == DScheduleType::Show)) { + m_scheduleType->setShowState(m_selectStatus ? DScheduleType::Show : DScheduleType::Hide); + account->updateScheduleTypeShowState(m_scheduleType); + } + m_checkBox->setChecked(m_selectStatus); + } +} + +SidebarAccountItemWidget::SidebarAccountItemWidget(AccountItem::Ptr ptr, QWidget *parent) + : SidebarItemWidget(parent) + , m_accountItem(ptr) +{ + initView(); + initConnect(); +} + +void SidebarAccountItemWidget::initView() +{ + QHBoxLayout *hLayout = new QHBoxLayout(this); + hLayout->setMargin(0); + hLayout->setSpacing(0); + m_headIconButton = new DIconButton(this); + m_headIconButton->setFlat(true); + m_headIconButton->setFixedSize(16, 16); + m_headIconButton->setIconSize(QSize(10, 10)); + m_headIconButton->setIcon(DStyle::SP_ArrowRight); + + m_headIconButton->setFocusPolicy(Qt::NoFocus); + connect(m_headIconButton, &DIconButton::clicked, this, [this]() { + setSelectStatus(!m_selectStatus); + }); + m_ptrDoaNetwork = new DOANetWorkDBus(this); + m_titleLabel = new DLabel(this); + m_titleLabel->setFixedHeight(30); + DFontSizeManager::instance()->bind(m_titleLabel, DFontSizeManager::T6); + m_titleLabel->setElideMode(Qt::ElideMiddle); + //设置初始字体大小 + DFontSizeManager::instance()->setFontGenericPixelSize(static_cast(DFontSizeManager::fontPixelSize(QFont()))); + QFont labelF = DFontSizeManager::instance()->t6(); + labelF.setWeight(QFont::Normal); + m_titleLabel->setFont(labelF); + m_titleLabel->setAlignment(Qt::AlignLeft | Qt::AlignVCenter); + m_titleLabel->setTextFormat(Qt::PlainText); + m_titleLabel->setText(m_accountItem->getAccount()->accountName()); + m_titleLabel->setToolTip("

    " + m_accountItem->getAccount()->accountName().toHtmlEscaped()); + + m_syncIconButton = new DIconButton(this); + m_syncIconButton->setIcon(QIcon(":/icons/deepin/builtin/icons/icon_refresh.svg")); + m_syncIconButton->setFixedSize(QSize(20, 20)); + qreal ratio = qApp->devicePixelRatio(); + if (ratio == 1){ + m_syncIconButton->setIconSize(QSize(10, 10)); + } + m_syncIconButton->setFocusPolicy(Qt::NoFocus); + + m_warningLabel = new DLabel(); + m_warningLabel->setFixedSize(QSize(20, 20)); + m_warningLabel->setPixmap(QIcon(":/icons/deepin/builtin/icons/dde_calendar_warning_light_32px.svg").pixmap(18, 18)); + + hLayout->addWidget(m_headIconButton); + hLayout->addWidget(m_titleLabel, 1); + hLayout->addWidget(m_syncIconButton); + hLayout->addWidget(m_warningLabel); + //给控件右部留出足够的距离,防止被滚动条覆盖无法被点击事件 + hLayout->addSpacing(15); + + this->setLayout(hLayout); + if (m_accountItem->getAccount()->accountType() == DAccount::Account_UnionID) { + resetRearIconButton(); + } else { + //尾部控件隐藏 + m_syncIconButton->hide(); + m_warningLabel->hide(); + } + setFixedHeight(36); +} + +void SidebarAccountItemWidget::initConnect() +{ + connect(m_syncIconButton, &DIconButton::clicked, this, &SidebarAccountItemWidget::slotRearIconClicked); + connect(m_accountItem.data(), &AccountItem::signalSyncStateChange, this, &SidebarAccountItemWidget::slotSyncStatusChange); + connect(gAccountManager, &AccountManager::signalAccountStateChange, this, &SidebarAccountItemWidget::slotAccountStateChange); + connect(m_ptrDoaNetwork, &DOANetWorkDBus::sign_NetWorkChange, this, &SidebarAccountItemWidget::slotNetworkStateChange); +} + +void SidebarAccountItemWidget::slotNetworkStateChange(DOANetWorkDBus::NetWorkState state) +{ + //控件不显示则不处理 + if (!m_accountItem || m_accountItem->getAccount()->accountType() != DAccount::Account_UnionID) { + return; + } + if (DOANetWorkDBus::NetWorkState::Disconnect == state) { + m_syncIconButton->hide(); + m_warningLabel->show(); + QString msg = m_accountItem->getSyncMsg(DAccount::AccountSyncState::Sync_NetworkAnomaly); + m_warningLabel->setToolTip(msg); + } else if (DOANetWorkDBus::NetWorkState::Active == state) { + m_warningLabel->hide(); + if (m_accountItem->isCanSyncSetting() || m_accountItem->isCanSyncShedule()) { + m_syncIconButton->show(); + } else { + m_syncIconButton->hide(); + } + } +} + +void SidebarAccountItemWidget::resetRearIconButton() +{ + //控件不显示则不处理 + if (m_accountItem->getAccount()->accountType() != DAccount::Account_UnionID) { + return; + } + + if (m_accountItem) { + if (m_accountItem->getAccount()->syncState() == 0) { + m_warningLabel->hide(); + if (m_accountItem->isCanSyncSetting() || m_accountItem->isCanSyncShedule()) { + m_syncIconButton->show(); + } else { + m_syncIconButton->hide(); + } + } else { + m_syncIconButton->hide(); + m_warningLabel->show(); + QString msg = m_accountItem->getSyncMsg(m_accountItem->getAccount()->syncState()); + m_warningLabel->setToolTip(msg); + } + } +} + +AccountItem::Ptr SidebarAccountItemWidget::getAccountItem() +{ + return m_accountItem; +} + +void SidebarAccountItemWidget::updateStatus() +{ + m_accountItem->setAccountExpandStatus(m_selectStatus); + if (m_selectStatus) { + m_headIconButton->setIcon(DStyle::SP_ArrowDown); + } else { + m_headIconButton->setIcon(DStyle::SP_ArrowRight); + } +} + +//尾部图标控件点击事件 +void SidebarAccountItemWidget::slotRearIconClicked() +{ + gAccountManager->downloadByAccountID(m_accountItem->getAccount()->accountID()); +} + +//同步状态改变事件 +void SidebarAccountItemWidget::slotSyncStatusChange(DAccount::AccountSyncState state) +{ + m_accountItem->getAccount()->setSyncState(state); + resetRearIconButton(); +} + +void SidebarAccountItemWidget::slotAccountStateChange() +{ + resetRearIconButton(); +} + diff -Nru dde-calendar-5.9.1/calendar-client/src/widget/sidebarWidget/sidebaritemwidget.h dde-calendar-5.10.0/calendar-client/src/widget/sidebarWidget/sidebaritemwidget.h --- dde-calendar-5.9.1/calendar-client/src/widget/sidebarWidget/sidebaritemwidget.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/widget/sidebarWidget/sidebaritemwidget.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,120 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef ITEMWIDGET_H +#define ITEMWIDGET_H + +#include "scheduledatamanage.h" +#include "dscheduletype.h" +#include "accountitem.h" + +#include +#include +#include +#include +#include +#include +#include +#include "doanetworkdbus.h" + +DWIDGET_USE_NAMESPACE + +class SidebarItemWidget : public QWidget +{ + Q_OBJECT +public: + + SidebarItemWidget(QWidget *parent = nullptr); + + //获取顶层item控件,有箭头 + static SidebarItemWidget *getAccountItemWidget(AccountItem::Ptr); + //获取子层本地日程item控件,有复选框 + static SidebarItemWidget *getTypeItemWidget(DScheduleType::Ptr); + + //设置选中状态 + void setSelectStatus(bool); + //获取当前状态 + bool getSelectStatus(); + //切换状态 + void switchState(); + //设置item + void setItem(QTreeWidgetItem *); + + QTreeWidgetItem* getTreeItem(); + +signals: + //状态改变信号 + void signalStatusChange(bool status, QString id = ""); + +public slots: + + +protected: + void mouseDoubleClickEvent(QMouseEvent *event) override; + void mouseReleaseEvent(QMouseEvent *event) override; + virtual void updateStatus() = 0; + +protected: + QString m_title = ""; //标题 + QString m_id = ""; //数据id + bool m_selectStatus = false; //选中状态 + QTreeWidgetItem *m_item = nullptr; //关联的item +}; + +class SidebarTypeItemWidget : public SidebarItemWidget +{ + Q_OBJECT +public: + SidebarTypeItemWidget(DScheduleType::Ptr, QWidget *parent = nullptr); + +protected: + void initView(); + void updateStatus() override; + +private: + DScheduleType::Ptr m_scheduleType; + + DIconButton *m_rearIconButton = nullptr; //尾部icon控件 + QCheckBox *m_checkBox = nullptr; //复选框 + DLabel *m_titleLabel = nullptr; //标题显示区域 +}; + +class SidebarAccountItemWidget : public SidebarItemWidget +{ + Q_OBJECT +public: + SidebarAccountItemWidget(AccountItem::Ptr, QWidget *parent = nullptr); + + AccountItem::Ptr getAccountItem(); + +signals: + + +public slots: + //尾部图标控件点击事件 + void slotRearIconClicked(); + //同步状态改变事件 + void slotSyncStatusChange(DAccount::AccountSyncState); + //帐户同步状态发生改变 + void slotAccountStateChange(); + // 网络状态发生改变 + void slotNetworkStateChange(DOANetWorkDBus::NetWorkState state); + +protected: + void initView(); + void initConnect(); + void updateStatus() override; + void resetRearIconButton(); + +private: + AccountItem::Ptr m_accountItem; + + DIconButton *m_syncIconButton = nullptr; //尾部同步控件 + DLabel *m_warningLabel = nullptr; //尾部异常警告控件 + DIconButton *m_headIconButton = nullptr; //头部展开控件 + DLabel *m_titleLabel = nullptr; //标题显示区域 + DOANetWorkDBus * m_ptrDoaNetwork; +}; + +#endif // ITEMWIDGET_H diff -Nru dde-calendar-5.9.1/calendar-client/src/widget/sidebarWidget/sidebartreewidgetitemdelegate.cpp dde-calendar-5.10.0/calendar-client/src/widget/sidebarWidget/sidebartreewidgetitemdelegate.cpp --- dde-calendar-5.9.1/calendar-client/src/widget/sidebarWidget/sidebartreewidgetitemdelegate.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/widget/sidebarWidget/sidebartreewidgetitemdelegate.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,50 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "sidebartreewidgetitemdelegate.h" + +#include +#include +#include + +SideBarTreeWidgetItemDelegate::SideBarTreeWidgetItemDelegate() +{ + +} + +void SideBarTreeWidgetItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const +{ + if (!index.isValid()) { + QStyledItemDelegate::paint(painter, option, index); + return; + } + + painter->setRenderHint(QPainter::Antialiasing); + + QStyleOptionViewItem opt = option; + + QRect rect = opt.rect; + QPainterPath path, clipPath; + switch (opt.viewItemPosition) { + case QStyleOptionViewItem::OnlyOne: { + // 左间距 + rect.setX(rect.x() + 8); + // 右间距 + rect.setWidth(rect.width() - 8); + } break; + default: { + QStyledItemDelegate::paint(painter, option, index); + return; + } + } + + //绘制圆角 + int radius = 8; + clipPath.addRoundedRect(rect, radius, radius); + painter->setClipPath(clipPath); + + if (option.state & QStyle::State_MouseOver) { + painter->fillRect(painter->clipBoundingRect(), option.palette.midlight()); + } +} diff -Nru dde-calendar-5.9.1/calendar-client/src/widget/sidebarWidget/sidebartreewidgetitemdelegate.h dde-calendar-5.10.0/calendar-client/src/widget/sidebarWidget/sidebartreewidgetitemdelegate.h --- dde-calendar-5.9.1/calendar-client/src/widget/sidebarWidget/sidebartreewidgetitemdelegate.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/widget/sidebarWidget/sidebartreewidgetitemdelegate.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,21 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef SIDEBARTREEWIDGETITEMDELEGATE_H +#define SIDEBARTREEWIDGETITEMDELEGATE_H + +#include + +class SideBarTreeWidgetItemDelegate : public QStyledItemDelegate +{ + Q_OBJECT + +public: + SideBarTreeWidgetItemDelegate(); + + void paint(QPainter *painter, const QStyleOptionViewItem &option, + const QModelIndex &index) const override; +}; + +#endif // SIDEBARTREEWIDGETITEMDELEGATE_H diff -Nru dde-calendar-5.9.1/calendar-client/src/widget/sidebarWidget/sidebarview.cpp dde-calendar-5.10.0/calendar-client/src/widget/sidebarWidget/sidebarview.cpp --- dde-calendar-5.9.1/calendar-client/src/widget/sidebarWidget/sidebarview.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/widget/sidebarWidget/sidebarview.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,266 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "sidebarview.h" +#include "calendarmanage.h" +#include "widget/monthWidget/monthdayview.h" +#include "widget/dayWidget/daymonthview.h" +#include +#include + +SidebarView::SidebarView(QWidget *parent) : QWidget(parent) +{ + initView(); + initConnection(); + //初始化数据 + initData(); +} + +/** + * @brief SidebarView::initView + * 初始化视图 + */ +void SidebarView::initView() +{ + QVBoxLayout *vLayout = new QVBoxLayout(this); + vLayout->setContentsMargins(0, 8, 0, 10); + vLayout->setSpacing(0); + + m_treeWidget = new QTreeWidget(); + delegate = new SideBarTreeWidgetItemDelegate; + + // 设置底色透明,否则展开/收起出现背景色 + QPalette pal = m_treeWidget->palette(); + pal.setBrush(QPalette::Background, QBrush(QColor(255, 255, 255, 0))); + m_treeWidget->setPalette(pal); + + m_treeWidget->setItemDelegate(delegate); + m_treeWidget->setHeaderHidden(true); + m_treeWidget->setColumnCount(1); + m_treeWidget->setExpandsOnDoubleClick(false); + m_treeWidget->setSelectionMode(QAbstractItemView::NoSelection); //屏蔽item选择效果 + m_treeWidget->setFrameStyle(QFrame::NoFrame); //去除边框 + m_treeWidget->setIndentation(0); //设置item前间距为0 + m_treeWidget->setFocusPolicy(Qt::NoFocus); + m_calendarWidget = new SidebarCalendarWidget(this); + m_calendarWidget->setFixedHeight(220); +// m_calendarWidget->setFixedSize(180, 220); + + DPushButton *btn = new DPushButton; + btn->setFocusPolicy(Qt::NoFocus); + btn->setFixedHeight(1); + vLayout->addWidget(m_treeWidget, 1); + vLayout->addWidget(btn); + vLayout->addWidget(m_calendarWidget, 1); + + setLayout(vLayout); + setFixedWidth(180); +} + +void SidebarView::initConnection() +{ + //监听日程类型更新事件 + connect(gAccountManager, &AccountManager::signalAccountUpdate, this, &SidebarView::slotAccountUpdate); + connect(gAccountManager, &AccountManager::signalScheduleTypeUpdate, this, &SidebarView::slotScheduleTypeUpdate); + connect(gAccountManager, &AccountManager::signalLogout, this, &SidebarView::signalLogout); +} + +/** + * @brief SidebarView::initData + * 初始化数据 + */ +void SidebarView::initData() +{ + m_treeWidget->clear(); + + initLocalAccountItem(); + initUnionAccountItem(); + //刷新列表展开状态 + initExpandStatus(); +} + +/** + * @brief SidebarView::initExpandStatus + * 初始化列表展开状态 + */ +void SidebarView::initExpandStatus() +{ + //初始化列表展开状态 + QList itemWidget; + itemWidget << m_localItemWidget << m_unionItemWidget; + for (SidebarAccountItemWidget *widget : itemWidget) { + if (widget != nullptr) { + //先进行一次反的展开状态目的是解决使用widget填充item时添加列表项后最后一项的widget没有隐藏问题 + bool ret = widget->getAccountItem()->getAccount()->isExpandDisplay(); + widget->getTreeItem()->setExpanded(!ret); + widget->setSelectStatus(ret); + } + } +} + +/** + * @brief SidebarView::initLocalAccountItem + * 初始化本地账户列表 + */ +void SidebarView::initLocalAccountItem() +{ + if (nullptr != m_localItemWidget) { +// m_localItemWidget->deleteLater(); + delete m_localItemWidget; + m_localItemWidget = nullptr; + } + QSharedPointer localAccount = gAccountManager->getLocalAccountItem(); + if (nullptr == localAccount) { + return; + } + QTreeWidgetItem *localItem = new QTreeWidgetItem(); + m_treeWidget->addTopLevelItem(localItem); + QString localName = localAccount->getAccount()->accountName(); + + m_localItemWidget = new SidebarAccountItemWidget(localAccount); + m_treeWidget->setItemWidget(localItem, 0, m_localItemWidget); + m_localItemWidget->setItem(localItem); +} + +/** + * @brief SidebarView::initUnionAccountItem + * 初始化unionID账户列表 + */ +void SidebarView::initUnionAccountItem() +{ + QSharedPointer unionAccount = gAccountManager->getUnionAccountItem(); + if (nullptr == unionAccount) { + return; + } + + QTreeWidgetItem *unionItem = new QTreeWidgetItem(); + m_treeWidget->addTopLevelItem(unionItem); + QString unionName = unionAccount->getAccount()->accountName(); + m_unionItemWidget = new SidebarAccountItemWidget(unionAccount); + m_treeWidget->setItemWidget(unionItem, 0, m_unionItemWidget); + unionItem->setToolTip(0,unionName); + m_unionItemWidget->setItem(unionItem); +} + +/** + * @brief SidebarView::resetLocalChildItem + * 重置日程类型选项 + * @param parentItemWidget 父列表控件 + */ +void SidebarView::resetJobTypeChildItem(SidebarAccountItemWidget *parentItemWidget) +{ + if (nullptr == parentItemWidget) { + return; + } + QTreeWidgetItem *parentItem = parentItemWidget->getTreeItem(); + int itemChildrenCounts = parentItem->childCount(); + while(itemChildrenCounts--) + { + QTreeWidgetItem * child = parentItem->child(itemChildrenCounts); //index从大到小区做删除处理 + parentItem->removeChild(child); + delete child; + child = nullptr; + } + + DScheduleType::List typeList = parentItemWidget->getAccountItem()->getScheduleTypeList(); + QTreeWidgetItem *item; + for (DScheduleType::Ptr p : typeList) { + if (nullptr != p) { + item = new QTreeWidgetItem(parentItemWidget->getTreeItem()); + item->setTextAlignment(0, Qt::AlignVCenter | Qt::AlignLeft); + item->setSizeHint(0, QSize(220, 40)); + parentItem->addChild(item); + SidebarItemWidget *widget = new SidebarTypeItemWidget(p, this); + m_treeWidget->setItemWidget(item, 0, widget); + connect(widget,&SidebarItemWidget::signalStatusChange,this,[&](bool status, QString id){ + Q_UNUSED(id) + Q_UNUSED(status) + emit signalScheduleHide(); + }); + } + } + //刷新列表项位置,主要用于解决初始添加时最后一项显示位置和其他项位置不一致问题 + resetTreeItemPos(parentItemWidget->getTreeItem()); +} + +/** + * @brief SidebarView::resetTreeItemPos + * 刷新列表项位置,主要用于解决初始添加时最后一项显示位置和其他项位置不一致问题 + */ +void SidebarView::resetTreeItemPos(QTreeWidgetItem *item) +{ + if (nullptr == item) { + return; + } + QWidget* ptmpWidget = nullptr; + ptmpWidget = m_treeWidget->itemWidget(item, 0); + int x = ptmpWidget->x(); + QTreeWidgetItem *ptmp = nullptr; + for(int i = 0; i < item->childCount(); i++) + { + ptmp = item->child(i); + ptmpWidget = m_treeWidget->itemWidget(ptmp, 0); + ptmpWidget->move(x, ptmpWidget->y()); + } +} + +/** + * @brief SidebarView::slotAccountUpdate + * 账户更新事件 + */ +void SidebarView::slotAccountUpdate() +{ + initData(); +} + +/** + * @brief SidebarView::slotScheduleTypeUpdate + * 日程类型更新事件 + */ +void SidebarView::slotScheduleTypeUpdate() +{ + //初始化列表数据 + resetJobTypeChildItem(m_localItemWidget); + resetJobTypeChildItem(m_unionItemWidget); + //刷新列表展开状态 + initExpandStatus(); +} + +/** + * @brief SidebarView::signalLogout + * 帐户退出事件 + * @param accountType + */ +void SidebarView::signalLogout(DAccount::Type accountType) +{ + //先清空列表 + m_treeWidget->clear(); + if (DAccount::Account_UnionID == accountType){ + if (m_unionItemWidget) { + //清空数据 + m_unionItemWidget->getAccountItem().reset(nullptr); + m_unionItemWidget->deleteLater(); + m_unionItemWidget = nullptr; + } + //重新加载另一个帐户的数据 + initLocalAccountItem(); + resetJobTypeChildItem(m_localItemWidget); + } +} + +void SidebarView::paintEvent(QPaintEvent *event) +{ + //绘制背景 + QPainter painter(this); + painter.setRenderHint(QPainter::Antialiasing); + painter.setPen(Qt::NoPen); + painter.setBrush(palette().color(QPalette::Base)); + int radius = 8; + //绘制圆角 + painter.drawRoundedRect(0, 0, width(), height(), radius, radius); + //绘制右侧直角 + painter.drawRect(radius, 0, width() - radius, height()); + + QWidget::paintEvent(event); +} diff -Nru dde-calendar-5.9.1/calendar-client/src/widget/sidebarWidget/sidebarview.h dde-calendar-5.10.0/calendar-client/src/widget/sidebarWidget/sidebarview.h --- dde-calendar-5.9.1/calendar-client/src/widget/sidebarWidget/sidebarview.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/widget/sidebarWidget/sidebarview.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,62 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef SIDEBARVIEW_H +#define SIDEBARVIEW_H + +#include "sidebarcalendarwidget.h" +#include "sidebaritemwidget.h" +#include "accountmanager.h" +#include +#include +#include +#include "sidebartreewidgetitemdelegate.h" + +class SidebarView : public QWidget +{ + Q_OBJECT +public: + explicit SidebarView(QWidget *parent = nullptr); + +signals: + void signalScheduleHide(); +public slots: + //账户更新事件 + void slotAccountUpdate(); + //日程类型更新事件 + void slotScheduleTypeUpdate(); + //帐户登出信号 + void signalLogout(DAccount::Type); + +protected: + void paintEvent(QPaintEvent *event) override; + +private: + void initView(); + void initConnection(); + //初始化数据 + void initData(); + //初始化列表展开状态 + void initExpandStatus(); + //初始化本地账户列表 + void initLocalAccountItem(); + //初始化union账户列表 + void initUnionAccountItem(); + + //重置日程类型item + void resetJobTypeChildItem(SidebarAccountItemWidget *parentItemWidget); + //重置item位置 + void resetTreeItemPos(QTreeWidgetItem *item); + +private: + QTreeWidget *m_treeWidget = nullptr; //树结构 + SidebarAccountItemWidget* m_localItemWidget = nullptr; + SidebarAccountItemWidget* m_unionItemWidget = nullptr; + + SidebarCalendarWidget *m_calendarWidget = nullptr; //小日历 + + SideBarTreeWidgetItemDelegate *delegate = nullptr; +}; + +#endif // SIDEBARVIEW_H diff -Nru dde-calendar-5.9.1/calendar-client/src/widget/touchgestureoperation.cpp dde-calendar-5.10.0/calendar-client/src/widget/touchgestureoperation.cpp --- dde-calendar-5.9.1/calendar-client/src/widget/touchgestureoperation.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/widget/touchgestureoperation.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "touchgestureoperation.h" #include diff -Nru dde-calendar-5.9.1/calendar-client/src/widget/touchgestureoperation.h dde-calendar-5.10.0/calendar-client/src/widget/touchgestureoperation.h --- dde-calendar-5.9.1/calendar-client/src/widget/touchgestureoperation.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/widget/touchgestureoperation.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,24 +1,7 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ #ifndef TOUCHGESTUREOPERATION_H #define TOUCHGESTUREOPERATION_H diff -Nru dde-calendar-5.9.1/calendar-client/src/widget/weekWidget/weekheadview.cpp dde-calendar-5.10.0/calendar-client/src/widget/weekWidget/weekheadview.cpp --- dde-calendar-5.9.1/calendar-client/src/widget/weekWidget/weekheadview.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/widget/weekWidget/weekheadview.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,21 +1,6 @@ -/* - * Copyright (C) 2015 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: kirigaya - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2015 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later #include "weekheadview.h" #include "customframe.h" @@ -34,6 +19,7 @@ #include #include #include +#include DGUI_USE_NAMESPACE CWeekHeadView::CWeekHeadView(QWidget *parent) diff -Nru dde-calendar-5.9.1/calendar-client/src/widget/weekWidget/weekheadview.h dde-calendar-5.10.0/calendar-client/src/widget/weekWidget/weekheadview.h --- dde-calendar-5.9.1/calendar-client/src/widget/weekWidget/weekheadview.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/widget/weekWidget/weekheadview.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,28 +1,13 @@ -/* - * Copyright (C) 2015 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: kirigaya - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2015 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later #ifndef WEEKHEADVIEW_H #define WEEKHEADVIEW_H #include "constants.h" #include "../touchgestureoperation.h" -#include "src/dbusdatastruct.h" +#include "huangliData/dbusdatastruct.h" #include #include diff -Nru dde-calendar-5.9.1/calendar-client/src/widget/weekWidget/weekview.cpp dde-calendar-5.10.0/calendar-client/src/widget/weekWidget/weekview.cpp --- dde-calendar-5.9.1/calendar-client/src/widget/weekWidget/weekview.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/widget/weekWidget/weekview.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,25 +1,11 @@ -/* - * Copyright (C) 2015 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: kirigaya - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2015 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later #include "weekview.h" #include "scheduledatamanage.h" #include "constants.h" +#include "units.h" #include #include @@ -324,7 +310,7 @@ if (cell && m_cellList.contains(cell)) { const int pos = m_cellList.indexOf(cell); //获取每个cell的时间,如果小于1900年则过滤显示和点击操作 - if (m_days[pos].year() < DDECalendar::QueryEarliestYear) + if (!withinTimeFrame( m_days[pos])) return false; if (e->type() == QEvent::Paint) { paintCell(cell); diff -Nru dde-calendar-5.9.1/calendar-client/src/widget/weekWidget/weekview.h dde-calendar-5.10.0/calendar-client/src/widget/weekWidget/weekview.h --- dde-calendar-5.9.1/calendar-client/src/widget/weekWidget/weekview.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/widget/weekWidget/weekview.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,21 +1,7 @@ -/* - * Copyright (C) 2015 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: kirigaya - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2015 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef WEEKVIEW_H #define WEEKVIEW_H diff -Nru dde-calendar-5.9.1/calendar-client/src/widget/weekWidget/weekwindow.cpp dde-calendar-5.10.0/calendar-client/src/widget/weekWidget/weekwindow.cpp --- dde-calendar-5.9.1/calendar-client/src/widget/weekWidget/weekwindow.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/widget/weekWidget/weekwindow.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,21 +1,7 @@ -/* - * Copyright (C) 2015 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: kirigaya - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2015 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "weekwindow.h" #include "scheduleview.h" #include "constants.h" @@ -68,19 +54,11 @@ { m_today->setText(QCoreApplication::translate("today", "Today", "Today")); m_today->setFixedSize(DDEWeekCalendar::WTodayWindth, DDEWeekCalendar::WTodayHeight); - DPalette todayPa = m_today->palette(); - QColor todayColor = CScheduleDataManage::getScheduleDataManage()->getSystemActiveColor(); - todayPa.setColor(DPalette::ButtonText, todayColor); - todayPa.setColor(DPalette::Dark, Qt::white); - todayPa.setColor(DPalette::Light, Qt::white); - QColor sbColor("#002A57"); - sbColor.setAlphaF(0.05); - todayPa.setColor(DPalette::Shadow, sbColor); + QFont todayfont; todayfont.setWeight(QFont::Medium); todayfont.setPixelSize(DDECalendar::FontSizeFourteen); m_today->setFont(todayfont); - m_today->setPalette(todayPa); //新建年份label m_YearLabel = new QLabel(); m_YearLabel->setFixedHeight(DDEWeekCalendar::W_YLabelHeight); @@ -96,7 +74,7 @@ m_YearLunarLabel = new QLabel(this); m_YearLunarLabel->setFixedSize(DDEWeekCalendar::W_YLunatLabelWindth, DDEWeekCalendar::W_YLunatLabelHeight); - m_weekview = new CWeekView(&CalendarDateDataManager::getWeekNumOfYear, this); + m_weekview = new CWeekView(&CalendarManager::getWeekNumOfYear, this); m_weekLabel = new QLabel(); m_weekLabel->setFixedHeight(DDEWeekCalendar::W_YLabelHeight); @@ -121,14 +99,15 @@ QHBoxLayout *yeartitleLayout = new QHBoxLayout; yeartitleLayout->setMargin(0); yeartitleLayout->setSpacing(0); - yeartitleLayout->setContentsMargins(21, 20, 8, 0); + yeartitleLayout->addSpacing(10); yeartitleLayout->addWidget(m_YearLabel); + yeartitleLayout->addWidget(m_dialogIconButton); QHBoxLayout *yeartitleLayout1 = new QHBoxLayout; yeartitleLayout1->setMargin(0); yeartitleLayout1->setSpacing(0); - yeartitleLayout1->setContentsMargins(14, 9, 0, 7); yeartitleLayout1->addWidget(m_YearLunarLabel); + yeartitleLayout->addSpacing(6); yeartitleLayout->addLayout(yeartitleLayout1); yeartitleLayout->addStretch(); @@ -160,27 +139,23 @@ m_mainHLayout = new QVBoxLayout; m_mainHLayout->setMargin(0); m_mainHLayout->setSpacing(0); - m_mainHLayout->setContentsMargins(8, 20, 0, 9); - m_mainHLayout->addWidget(m_weekHeadView); - m_mainHLayout->addWidget(m_scheduleView); + m_mainHLayout->addWidget(m_weekHeadView, 1); + m_mainHLayout->addWidget(m_scheduleView, 9); QVBoxLayout *hhLayout = new QVBoxLayout; hhLayout->setMargin(0); hhLayout->setSpacing(0); - hhLayout->setContentsMargins(0, 0, 0, 0); - hhLayout->addLayout(yeartitleLayout); + //头部控件统一高度为 M_YTopHeight + QWidget *top = new QWidget(this); + top->setFixedHeight(DDEMonthCalendar::M_YTopHeight); + top->setLayout(yeartitleLayout); + hhLayout->addWidget(top); hhLayout->addLayout(m_mainHLayout); m_tMainLayout = new QHBoxLayout; m_tMainLayout->setMargin(0); m_tMainLayout->setSpacing(0); - m_tMainLayout->setContentsMargins(0, 0, 10, 0); m_tMainLayout->addLayout(hhLayout); - QVBoxLayout *ssLayout = new QVBoxLayout; - ssLayout->setMargin(0); - ssLayout->setSpacing(0); - ssLayout->setContentsMargins(0, 0, 0, 10); - m_tMainLayout->addLayout(ssLayout); this->setLayout(m_tMainLayout); setTabOrder(m_weekview, m_today); @@ -218,22 +193,7 @@ void CWeekWindow::setTheMe(int type) { if (type == 0 || type == 1) { - DPalette todayPa = m_today->palette(); - QColor todayColor = CScheduleDataManage::getScheduleDataManage()->getSystemActiveColor(); - todayPa.setColor(DPalette::ButtonText, todayColor); - todayPa.setColor(DPalette::Dark, Qt::white); - todayPa.setColor(DPalette::Light, Qt::white); - QColor sbColor("#002A57"); - sbColor.setAlphaF(0.05); - todayPa.setColor(DPalette::Shadow, sbColor); - m_today->setPalette(todayPa); - QColor todayhover = "#000000"; - todayhover.setAlphaF(0.1); - QColor todaypress = "#000000"; - todaypress.setAlphaF(0.2); - m_today->setBColor("#FFFFFF", todayhover, todaypress, "#FFFFFF", todayhover, todaypress); - m_today->setTColor(todayColor, "#001A2E", "#0081FF"); - m_today->setshadowColor(sbColor); + //返回今天按钮的背景色 m_todayframe->setBColor(Qt::white); DPalette pa = m_YearLabel->palette(); @@ -250,18 +210,7 @@ m_weekLabel->setPalette(wpa); m_weekLabel->setForegroundRole(DPalette::WindowText); } else if (type == 2) { - DPalette todayPa = m_today->palette(); - QColor todayColor = CScheduleDataManage::getScheduleDataManage()->getSystemActiveColor(); - todayPa.setColor(DPalette::ButtonText, todayColor); - todayPa.setColor(DPalette::Dark, "#414141"); - todayPa.setColor(DPalette::Light, "#484848"); - QColor sbColor("#000000"); - sbColor.setAlphaF(0.05); - todayPa.setColor(DPalette::Shadow, sbColor); - m_today->setPalette(todayPa); - m_today->setBColor("#484848", "#727272", "#242424", "#414141", "#535353", "#282828"); - m_today->setTColor(todayColor, "#FFFFFF", "#0081FF"); - m_today->setshadowColor(sbColor); + //设置返回今天按钮的背景色 QColor bColor = "#FFFFFF"; bColor.setAlphaF(0.05); @@ -336,7 +285,7 @@ void CWeekWindow::updateShowDate(const bool isUpdateBar) { setYearData(); - QVector _weekShowData = m_calendarManager->getCalendarDateDataManage()->getWeekDate(getSelectDate()); + QVector _weekShowData = m_calendarManager->getWeekDate(getSelectDate()); m_weekHeadView->setWeekDay(_weekShowData, getSelectDate()); //获取一周的开始结束时间 m_startDate = _weekShowData.first(); @@ -347,7 +296,7 @@ } //设置全天和非全天显示时间范围 m_scheduleView->setRange(m_startDate, m_stopDate); - m_scheduleView->setTimeFormat(m_calendarManager->getCalendarDateDataManage()->getTimeFormat()); + m_scheduleView->setTimeFormat((m_calendarManager->getTimeShowType() ? "AP " : "") + m_calendarManager->getTimeFormat()); //是否更新显示周数窗口 if (isUpdateBar) { m_weekview->setCurrent(getCurrendDateTime()); @@ -364,8 +313,7 @@ */ void CWeekWindow::updateShowSchedule() { - QMap > _weekScheduleInfo = m_calendarManager->getScheduleTask()->getScheduleInfo(m_startDate, m_stopDate); - m_scheduleView->setShowScheduleInfo(_weekScheduleInfo); + m_scheduleView->setShowScheduleInfo(gScheduleManager->getScheduleMap(m_startDate, m_stopDate)); } /** @@ -375,15 +323,20 @@ { getLunarInfo(); m_YearLunarLabel->setText(m_lunarYear); - QMap _weekHuangLiInfo = m_calendarManager->getScheduleTask()->getHuangLiInfo(m_startDate, m_stopDate); - m_weekHeadView->setHunagLiInfo(_weekHuangLiInfo); + QMap weekHuangLiInfo = gLunarManager->getHuangLiDayMap(m_startDate, m_stopDate); + m_weekHeadView->setHunagLiInfo(weekHuangLiInfo); +} + +void CWeekWindow::updateSearchScheduleInfo() +{ + m_scheduleView->slotUpdateScene(); } /** * @brief CWeekWindow::setSelectSearchScheduleInfo 设置选中搜索日程 * @param info */ -void CWeekWindow::setSelectSearchScheduleInfo(const ScheduleDataInfo &info) +void CWeekWindow::setSelectSearchScheduleInfo(const DSchedule::Ptr &info) { m_scheduleView->setSelectSchedule(info); } @@ -433,7 +386,15 @@ */ void CWeekWindow::slotprev() { - switchDate(getSelectDate().addDays(-7)); + if (m_isSwitchStatus) + return; + + m_isSwitchStatus = true; + + QTimer::singleShot(5, [this]() { + switchDate(getSelectDate().addDays(-7)); + m_isSwitchStatus = false; + }); } /** @@ -441,7 +402,15 @@ */ void CWeekWindow::slotnext() { - switchDate(getSelectDate().addDays(7)); + if (m_isSwitchStatus) + return; + + m_isSwitchStatus = true; + + QTimer::singleShot(5, [this]() { + switchDate(getSelectDate().addDays(7)); + m_isSwitchStatus = false; + }); } /** @@ -507,18 +476,8 @@ */ void CWeekWindow::resizeEvent(QResizeEvent *event) { - qreal headH = height() * 0.0924 + 0.5; qreal dw = width() * 0.4186 + 0.5; int dh = 36; - int winframe = 10; - m_mainHLayout->setContentsMargins(10, 20, 0, 10); - - if (m_searchFlag) { - m_tMainLayout->setContentsMargins(0, 0, 0, 0); - } else { - winframe += 10; - m_tMainLayout->setContentsMargins(0, 0, 10, 0); - } //添加1个按钮的宽度 36。原来m_weekview 不包含前后按钮(若加2个按钮的宽度,会导致窗口缩小的时候按钮显示不全) if (!m_searchFlag) { @@ -526,7 +485,6 @@ } else { m_weekview->setFixedSize(qRound(dw - 100 + 36), dh); } - m_weekHeadView->setFixedSize(width() - winframe, qRound(headH)); QWidget::resizeEvent(event); } diff -Nru dde-calendar-5.9.1/calendar-client/src/widget/weekWidget/weekwindow.h dde-calendar-5.10.0/calendar-client/src/widget/weekWidget/weekwindow.h --- dde-calendar-5.9.1/calendar-client/src/widget/weekWidget/weekwindow.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/widget/weekWidget/weekwindow.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,26 +1,12 @@ -/* - * Copyright (C) 2017 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: kirigaya - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef WEEKWINDOW_H #define WEEKWINDOW_H #include "customframe.h" -#include "src/scheduledatainfo.h" +#include "dschedule.h" #include "cschedulebasewidget.h" #include @@ -66,8 +52,10 @@ void updateShowSchedule() override; //更新显示农历信息 void updateShowLunar() override; + //更新界面搜索日程显示 + void updateSearchScheduleInfo() override; //设置选中搜索日程 - void setSelectSearchScheduleInfo(const ScheduleDataInfo &info) override; + void setSelectSearchScheduleInfo(const DSchedule::Ptr &info) override; //删除选中日程 void deleteselectSchedule() override; signals: @@ -123,6 +111,7 @@ QString m_searchText; QHBoxLayout *m_tMainLayout = nullptr; bool m_searchFlag = false; + bool m_isSwitchStatus = false; QDate m_startDate; QDate m_stopDate; }; diff -Nru dde-calendar-5.9.1/calendar-client/src/widget/yearWidget/yearscheduleview.cpp dde-calendar-5.10.0/calendar-client/src/widget/yearWidget/yearscheduleview.cpp --- dde-calendar-5.9.1/calendar-client/src/widget/yearWidget/yearscheduleview.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/widget/yearWidget/yearscheduleview.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,26 +1,14 @@ -/* - * Copyright (C) 2017 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: kirigaya - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "yearscheduleview.h" #include "scheduledlg.h" #include "scheduledatamanage.h" #include "constants.h" +#include "schedulemanager.h" +#include "cscheduleoperation.h" #include #include @@ -39,12 +27,12 @@ { } -bool YScheduleDateThan(const ScheduleDataInfo &s1, const ScheduleDataInfo &s2) +bool YScheduleDateThan(const DSchedule::Ptr &s1, const DSchedule::Ptr &s2) { - QDate bDate1 = s1.getBeginDateTime().date(); - QDate eDate1 = s1.getEndDateTime().date(); - QDate bDate2 = s2.getBeginDateTime().date(); - QDate eDate2 = s2.getEndDateTime().date(); + QDate bDate1 = s1->dtStart().date(); + QDate eDate1 = s1->dtEnd().date(); + QDate bDate2 = s2->dtStart().date(); + QDate eDate2 = s2->dtEnd().date(); if (bDate1 != eDate1 && bDate2 == eDate2) { return true; @@ -53,27 +41,31 @@ } else if (bDate1 != eDate1 && bDate2 != eDate2) { return bDate1 < bDate2; } else { - if (s1.getBeginDateTime() == s2.getBeginDateTime()) { - return s1.getTitleName() < s2.getTitleName(); + if (s1->dtStart() == s2->dtStart()) { + return s1->summary() < s2->summary(); } else { - return s1.getBeginDateTime() < s2.getBeginDateTime(); + return s1->dtStart() < s2->dtStart(); } } } -bool YScheduleDaysThan(const ScheduleDataInfo &s1, const ScheduleDataInfo &s2) +bool YScheduleDaysThan(const DSchedule::Ptr &s1, const DSchedule::Ptr &s2) { - return s1.getBeginDateTime().date().daysTo(s1.getEndDateTime().date()) > s2.getBeginDateTime().date().daysTo(s2.getEndDateTime().date()); + return s1->dtStart().date().daysTo(s1->dtEnd().date()) > s2->dtStart().date().daysTo(s2->dtEnd().date()); } -void CYearScheduleView::setData(QVector &vListData) +void CYearScheduleView::setData(DSchedule::List &vListData) { - QVector valldayListData, vDaylistdata; + DSchedule::List valldayListData, vDaylistdata; for (int i = 0; i < vListData.count(); i++) { - if (vListData.at(i).getAllDay()) { - valldayListData.append(vListData.at(i)); + DSchedule::Ptr ptr = vListData.at(i); + if (ptr.isNull()) { + continue; + } + if (ptr->allDay()) { + valldayListData.append(ptr); } else { - vDaylistdata.append(vListData.at(i)); + vDaylistdata.append(ptr); } } @@ -83,9 +75,10 @@ std::sort(vDaylistdata.begin(), vDaylistdata.end(), YScheduleDateThan); for (int i = 0; i < valldayListData.count(); i++) { - QVector::iterator iter = valldayListData.begin(); - if (valldayListData.at(i).getType() == DDECalendar::FestivalTypeID) { - ScheduleDataInfo moveDate; + DSchedule::List::iterator iter = valldayListData.begin(); + //如果为节假日日程 + if (CScheduleOperation::isFestival(valldayListData.at(i))) { + DSchedule::Ptr moveDate; moveDate = valldayListData.at(i); valldayListData.removeAt(i); valldayListData.insert(iter, moveDate); @@ -97,18 +90,19 @@ m_vlistData.append(vDaylistdata); if (m_vlistData.size() > DDEYearCalendar::YearScheduleListMaxcount) { - QVector vTListData; + DSchedule::List vTListData; for (int i = 0; i < 4; i++) { - if (m_vlistData.at(i).getBeginDateTime().date() != m_vlistData.at(i).getEndDateTime().date() && !m_vlistData.at(i).getAllDay()) { - if (m_vlistData.at(i).getBeginDateTime().date() != m_currentDate) { - m_vlistData[i].setAllDay(true); + if (m_vlistData.at(i)->dtStart().date() != m_vlistData.at(i)->dtEnd().date() && !m_vlistData.at(i)->allDay()) { + if (m_vlistData.at(i)->dtStart().date() != m_currentDate) { + m_vlistData[i]->setAllDay(true); } } vTListData.append(m_vlistData.at(i)); } - ScheduleDataInfo info; - info.setTitleName("......"); - info.setID(-1); + DSchedule::Ptr info; + info.reset(new DSchedule()); + info->setSummary("......"); + info->setUid("-1"); vTListData.append(info); m_vlistData = vTListData; } @@ -209,27 +203,30 @@ } } -void CYearScheduleView::paintItem(QPainter &painter, ScheduleDataInfo info, int index) +void CYearScheduleView::paintItem(QPainter &painter, DSchedule::Ptr info, int index) { int labelwidth = width() - 30; int bHeight = index * 29 + 10; int labelheight = 28; - ScheduleDataInfo &gd = info; - CSchedulesColor gdColor = CScheduleDataManage::getScheduleDataManage()->getScheduleColorByType(gd.getType()); + DSchedule::Ptr &gd = info; - if (gd.getID() == -1) { + if (info->uid() == "-1") { QString str = "..."; - painter.save(); painter.setPen(m_btimecolor); painter.setFont(m_textfont); painter.drawText(QRect(25, bHeight, labelwidth - 80, labelheight - 2), Qt::AlignLeft | Qt::AlignVCenter, str); painter.restore(); } else { - if (info.getID() != -1) { + if (info->uid() != "-1") { //圆点m_solocolor + QColor gdColor; + DScheduleType::Ptr type = gScheduleManager->getScheduleTypeByScheduleId(info->scheduleTypeID()); + if (nullptr != type) { + gdColor = type->getColorCode(); + } painter.save(); - painter.setBrush(QBrush(gdColor.orginalColor)); + painter.setBrush(QBrush(gdColor)); painter.setPen(Qt::NoPen); painter.drawEllipse(QRect(25, bHeight + (labelheight - 8) / 2, 8, 8)); painter.restore(); @@ -241,7 +238,7 @@ painter.setPen(m_btTextColor); painter.setFont(m_textfont); QFontMetrics fm = painter.fontMetrics(); - QString tSTitleName = gd.getTitleName(); + QString tSTitleName = gd->summary(); tSTitleName.replace("\n", ""); str = tSTitleName; int tilenameW = labelwidth - 80; @@ -262,18 +259,18 @@ painter.restore(); - if (info.getID() != -1) { + if (info->uid() != "-1") { //右边时间 painter.save(); painter.setPen(m_btimecolor); painter.setFont(m_textfont); - if (info.getAllDay()) { + if (info->allDay()) { str = tr("All Day"); } else { - if (m_currentDate > info.getBeginDateTime().date()) { + if (m_currentDate > info->dtStart().date()) { str = tr("All Day"); } else { - str = info.getBeginDateTime().time().toString(m_timeFormat); + str = info->dtStart().time().toString(m_timeFormat); } } painter.drawText(QRect(width() - 70, bHeight, 57, labelheight - 2), Qt::AlignRight | Qt::AlignVCenter, str); @@ -307,7 +304,7 @@ this->setContent(yearscheduleview); } -void CYearScheduleOutView::setData(QVector &vListData) +void CYearScheduleOutView::setData(DSchedule::List &vListData) { list_count = vListData.size(); yearscheduleview->setData(vListData); @@ -372,7 +369,7 @@ //跳转到周视图 } else { //如果日程类型不为节假日或纪念日则显示编辑框 - if (scheduleinfoList.at(currentIndex).getType() != DDECalendar::FestivalTypeID) { + if (!CScheduleOperation::isFestival(scheduleinfoList.at(currentIndex))) { //因为提示框会消失,所以设置CScheduleDlg的父类为主窗口 CScheduleDlg dlg(0, qobject_cast(this->parent())); dlg.setData(scheduleinfoList.at(currentIndex)); diff -Nru dde-calendar-5.9.1/calendar-client/src/widget/yearWidget/yearscheduleview.h dde-calendar-5.10.0/calendar-client/src/widget/yearWidget/yearscheduleview.h --- dde-calendar-5.9.1/calendar-client/src/widget/yearWidget/yearscheduleview.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/widget/yearWidget/yearscheduleview.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,25 +1,11 @@ -/* - * Copyright (C) 2017 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: kirigaya - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef YEARSCHEDULEVIEW_H #define YEARSCHEDULEVIEW_H -#include "src/scheduledatainfo.h" +#include "dschedule.h" #include #include @@ -43,12 +29,12 @@ * @brief setData 设置日程信息,并全天日程置于非全天日程之前 * @param vListData 日程信息 */ - void setData(QVector &vListData); + void setData(DSchedule::List &vListData); /** * @brief getlistdate 获取日程信息 * @return 日程信息 */ - QVector getlistdate() + DSchedule::List getlistdate() { return m_vlistData; } @@ -97,14 +83,14 @@ * @param info 日程信息 * @param index 日程的索引 */ - void paintItem(QPainter &painter, ScheduleDataInfo info, int index); + void paintItem(QPainter &painter, DSchedule::Ptr info, int index); /** * @brief paintItem */ void paintItem(QPainter &painter); private: - QVector m_vlistData; + DSchedule::List m_vlistData; QDate m_currentDate; QColor m_btimecolor = "#526A7F"; QColor m_btTextColor = "#414D68"; @@ -126,7 +112,7 @@ * @brief setData 设置日程信息 * @param vListData 日程信息 */ - void setData(QVector &vListData); + void setData(DSchedule::List &vListData); /** * @brief clearData 清楚数据 */ @@ -156,7 +142,7 @@ void signalupdateschedule(); private: CYearScheduleView *yearscheduleview = nullptr; - QVector scheduleinfoList; + DSchedule::List scheduleinfoList; QDate currentdate; int list_count = 0; protected: diff -Nru dde-calendar-5.9.1/calendar-client/src/widget/yearWidget/yearview.cpp dde-calendar-5.10.0/calendar-client/src/widget/yearWidget/yearview.cpp --- dde-calendar-5.9.1/calendar-client/src/widget/yearWidget/yearview.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/widget/yearWidget/yearview.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,26 +1,10 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later #include "yearview.h" #include "constants.h" +#include "configsettings.h" #include #include @@ -63,6 +47,9 @@ m_currentMouth->show(); m_currentMouth->installEventFilter(this); + m_weekWidget = new CWeekWidget(this); +// m_weekWidget->setMinimumHeight(20); + m_monthView = new MonthBrefWidget(this); connect(m_monthView, &MonthBrefWidget::signalPressDate, @@ -75,7 +62,8 @@ m_hhLayout = new QVBoxLayout; m_hhLayout->addLayout(separatorLineLayout); - m_hhLayout->addWidget(m_monthView); + m_hhLayout->addWidget(m_weekWidget, 1); + m_hhLayout->addWidget(m_monthView, 6); m_hhLayout->setMargin(0); m_hhLayout->setSpacing(0); m_hhLayout->setContentsMargins(13, 10, 10, 10); @@ -117,36 +105,37 @@ m_bnormalColor.setAlphaF(0.05); m_currentMouth->setTextColor(QColor("#BF1D63")); } - m_monthView->setTheMe(type); QColor monthcolor = Qt::white; monthcolor.setAlphaF(0); m_currentMouth->setBColor(monthcolor); } -void CYearView::setShowDate(const QDate &showMonth, const QVector &showDate) +void CYearView::setShowMonthDate(const QDate &showMonth) { - m_showMonth = showMonth; - m_currentMouth->setTextStr(QLocale::system().monthName(m_showMonth.month(), QLocale::ShortFormat)); - m_days = showDate; - m_monthView->setDate(m_showMonth.month(), showDate); + m_showMonthDate = QDate(showMonth.year(), showMonth.month(), 1); + m_currentMouth->setTextStr(QLocale::system().monthName(m_showMonthDate.month(), QLocale::ShortFormat)); + m_monthView->setShowMonthDate(m_showMonthDate); } -/** - * @brief CYearView::setHasScheduleFlag 设置日期是否含有日程标志 - * @param hasScheduleFlag - */ -void CYearView::setHasScheduleFlag(const QVector &hasScheduleFlag) +//获取显示的月 +QDate CYearView::getShowMonthDate() { - m_monthView->setLintFlag(hasScheduleFlag); + return m_showMonthDate; } /** - * @brief CYearView::setHasSearchScheduleFlag 设置日期是否含有搜索日程 - * @param hasSearchScheduleFlag + * @brief CYearView::setHasScheduleSet + * @param hasScheduleSet + * 设置含有日程的集合 */ -void CYearView::setHasSearchScheduleFlag(const QVector &hasSearchScheduleFlag) +void CYearView::setHasScheduleSet(const QSet &hasScheduleSet) +{ + m_monthView->setHasScheduleDateSet(hasScheduleSet); +} + +void CYearView::setHasSearchScheduleSet(const QSet &hasScheduleSet) { - m_monthView->setSearchScheduleFlag(hasSearchScheduleFlag); + m_monthView->setHasSearchScheduleSet(hasScheduleSet); } /** @@ -157,10 +146,9 @@ */ bool CYearView::getStartAndStopDate(QDate &startDate, QDate &stopDate) { - if (m_days.isEmpty()) - return false; - startDate = m_days.first(); - stopDate = m_days.last(); + startDate = m_showMonthDate; + stopDate = m_showMonthDate.addMonths(1); + stopDate = stopDate.addDays(-1); return true; } @@ -176,7 +164,7 @@ if (cell == m_currentMouth) { if (e->type() == QEvent::MouseButtonDblClick) { - emit signalMousePress(m_showMonth, 2); + emit signalMousePress(m_showMonthDate, 2); } } return false; diff -Nru dde-calendar-5.9.1/calendar-client/src/widget/yearWidget/yearview.h dde-calendar-5.10.0/calendar-client/src/widget/yearWidget/yearview.h --- dde-calendar-5.9.1/calendar-client/src/widget/yearWidget/yearview.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/widget/yearWidget/yearview.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,29 +1,14 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef YEARVIEW_H #define YEARVIEW_H #include "customframe.h" #include "monthbrefwidget.h" #include "scheduledatamanage.h" +#include "cweekwidget.h" #include @@ -42,12 +27,14 @@ explicit CYearView(QWidget *parent = nullptr); //根据系统主题类型,设置颜色 void setTheMe(int type = 0); - //设置显示时间 - void setShowDate(const QDate &showMonth, const QVector &showDate); - //设置日期是否含有日程标志 - void setHasScheduleFlag(const QVector &hasScheduleFlag); - //设置日期是否含有搜索日程 - void setHasSearchScheduleFlag(const QVector &hasSearchScheduleFlag); + //设置显示的月 + void setShowMonthDate(const QDate &showMonth); + //获取显示的月 + QDate getShowMonthDate(); + //设置含有日程的日期集合 + void setHasScheduleSet(const QSet &hasScheduleSet); + //设置含有搜索日程的日期集合 + void setHasSearchScheduleSet(const QSet &hasScheduleSet); //获取这个月开始结束时间 bool getStartAndStopDate(QDate &startDate, QDate &stopDate); signals: @@ -63,19 +50,18 @@ void slotDoubleClickDate(const QDate &date); //鼠标单击日期,显示日程浮框 void slotPressClickDate(const QDate &date); -private: +protected: //过滤器,双击年视图下的月份跳转到月视图。 bool eventFilter(QObject *o, QEvent *e) override; -protected: //更新月份框的高度 void resizeEvent(QResizeEvent *event) override; -protected: //绘制每个月的背景 void paintEvent(QPaintEvent *e) override; + private: CustomFrame *m_currentMouth = nullptr; QVector m_days{}; - QDate m_showMonth; + QDate m_showMonthDate; QFont m_momthFont; QColor m_currentDayTextColor = "#2ca7f8"; QColor m_weekendsTextColor = Qt::black; @@ -86,7 +72,7 @@ QColor m_bnormalColor = "#FFFFFF"; const int m_radius = 8; const int m_borderframew = 0; - QVector m_vlineflag; //节假日和日程标识 MonthBrefWidget *m_monthView = nullptr; + CWeekWidget *m_weekWidget = nullptr; //周显示区域 }; #endif // YEARVIEW_H diff -Nru dde-calendar-5.9.1/calendar-client/src/widget/yearWidget/yearwindow.cpp dde-calendar-5.10.0/calendar-client/src/widget/yearWidget/yearwindow.cpp --- dde-calendar-5.9.1/calendar-client/src/widget/yearWidget/yearwindow.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/widget/yearWidget/yearwindow.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,6 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later #include "yearwindow.h" #include "yearview.h" @@ -113,13 +96,6 @@ { Q_UNUSED(event); m_topWidget->setGeometry(0, 0, this->width(), DDEMonthCalendar::M_YTopHeight); - if (m_searchFlag) { - m_tMainLayout->setContentsMargins(10, 0, 2, 0); - m_topWidget->setContentsMargins(10, 0, 2, 0); - } else { - m_tMainLayout->setContentsMargins(10, 0, 10, 0); - m_topWidget->setContentsMargins(10, 0, 10, 0); - } } void CYearWindow::mouseMoveEvent(QMouseEvent *event) @@ -331,15 +307,14 @@ QHBoxLayout *yeartitleLayout = new QHBoxLayout; yeartitleLayout->setMargin(0); yeartitleLayout->setSpacing(0); - yeartitleLayout->setContentsMargins(11, 12, 8, 10); + yeartitleLayout->addSpacing(10); yeartitleLayout->addWidget(m_yearLabel); + yeartitleLayout->addWidget(m_dialogIconButton); QHBoxLayout *yeartitleLayout1 = new QHBoxLayout; yeartitleLayout1->setMargin(0); yeartitleLayout1->setSpacing(0); - yeartitleLayout1->setContentsMargins(4, 9, 0, 7); yeartitleLayout1->addWidget(m_yearLunarLabel); - yeartitleLayout1->addSpacing(390); yeartitleLayout1->addStretch(); yeartitleLayout1->addWidget(m_yearLunarDayLabel, 0, Qt::AlignVCenter); @@ -361,6 +336,7 @@ m_todayFrame->setLayout(todaylayout); yeartitleLayout1->addSpacing(10); yeartitleLayout1->addWidget(m_todayFrame); + yeartitleLayout->addSpacing(6); yeartitleLayout->addLayout(yeartitleLayout1); m_firstYearWidget = new YearFrame(); @@ -387,7 +363,7 @@ m_tMainLayout = new QVBoxLayout; m_tMainLayout->setMargin(0); m_tMainLayout->setSpacing(0); - m_tMainLayout->setContentsMargins(10, 0, 10, 0); + m_tMainLayout->setContentsMargins(0, 0, 0, 0); m_tMainLayout->addLayout(hhLayout); this->setLayout(m_tMainLayout); @@ -487,9 +463,8 @@ void CYearWindow::updateShowDate(const bool isUpdateBar) { Q_UNUSED(isUpdateBar); - QMap > _yearShowData = m_calendarManager->getCalendarDateDataManage()->getYearDate(); - m_scheduleView->setTimeFormat(m_calendarManager->getCalendarDateDataManage()->getTimeFormat()); - m_yearWidget->setShowDate(getSelectDate(), _yearShowData); + m_scheduleView->setTimeFormat((m_calendarManager->getTimeShowType()?"AP ":"") + m_calendarManager->getTimeFormat()); + m_yearWidget->setShowDate(getSelectDate()); } /** @@ -498,8 +473,8 @@ void CYearWindow::updateShowSchedule() { //获取显示日期中是否包含日程信息标志 - QMap _fullInfo = m_calendarManager->getScheduleTask()->getDateHasSchedule(); - m_yearWidget->setDateHasScheduleSign(_fullInfo); + m_yearWidget->setDateHasScheduleSign(ScheduleManager::getInstace()->getAllScheduleDate()); + } /** @@ -507,6 +482,7 @@ */ void CYearWindow::updateShowLunar() { + //获取农历信息 getLunarInfo(); m_yearWidget->setLunarYearDate(m_lunarYear); //如果正在切换则退出 @@ -521,15 +497,14 @@ void CYearWindow::updateSearchScheduleInfo() { //获取搜索日程信息 - QMap > _searchSchedule = m_calendarManager->getScheduleTask()->getSearchScheduleInfo(); - m_yearWidget->setSearchSchedule(_searchSchedule); + m_yearWidget->setSearchSchedule(gScheduleManager->getAllSearchedScheduleDate()); } /** * @brief CYearWindow::setSelectSearchScheduleInfo 设置选中搜索日程 * @param info */ -void CYearWindow::setSelectSearchScheduleInfo(const ScheduleDataInfo &info) +void CYearWindow::setSelectSearchScheduleInfo(const DSchedule::Ptr &info) { Q_UNUSED(info); } @@ -547,7 +522,11 @@ */ void CYearWindow::slotprev() { - switchYear(-1); + QDate minYear = getSelectDate(); + if (minYear.year() > 1900) + { + switchYear(-1); + } } /** @@ -555,7 +534,11 @@ */ void CYearWindow::slotnext() { - switchYear(1); + QDate maxYear = getSelectDate(); + if (maxYear.year() < 2100) + { + switchYear(1); + } } /** @@ -585,28 +568,26 @@ if (m_StackedWidget->IsRunning()) return; _selectData = _selectData.addYears(offsetYear); - //设置选择时间,如果成功则切换 - if (setSelectDate(_selectData, true)) { - int index = m_StackedWidget->currentIndex(); - //当前选中的monthview的index - int currentYearViewIndex = qobject_cast(m_StackedWidget->widget(index))->getViewFocusIndex(); - index = qAbs(index + offsetYear) % 2; - m_yearWidget = qobject_cast(m_StackedWidget->widget(index)); - //设置年视图翻页后选中的monthview - m_yearWidget->setViewFocus(currentYearViewIndex); - //获取一年的显示时间 - QMap > _yearShowData = m_calendarManager->getCalendarDateDataManage()->getYearDate(); - //设置显示时间 - m_yearWidget->setShowDate(getSelectDate(), _yearShowData); - updateData(); - if (offsetYear > 0) { - //下一年 - m_StackedWidget->setNext(); - } else { - //上一年 - m_StackedWidget->setPre(); - } + //获取当前显示控件的位置 + int index = m_StackedWidget->currentIndex(); + //当前选中的monthview的index + int currentYearViewIndex = qobject_cast(m_StackedWidget->widget(index))->getViewFocusIndex(); + index = qAbs(index + offsetYear) % 2; + m_yearWidget = qobject_cast(m_StackedWidget->widget(index)); + //设置年视图翻页后选中的monthview + m_yearWidget->setViewFocus(currentYearViewIndex); + //设置显示时间 + m_yearWidget->setShowDate(_selectData); + updateData(); + if (offsetYear > 0) { + //下一年 + m_StackedWidget->setNext(); + } else { + //上一年 + m_StackedWidget->setPre(); } + //切换试图开始后再进行时间切换 + setSelectDate(_selectData); } /** @@ -633,6 +614,7 @@ if (getShowLunar()) { m_yearLabel->setText(QString::number(getSelectDate().year()) + tr("Y")); //获取农历信息 + //获取农历信息 getLunarInfo(); //显示农历信息 setLunarShow(); @@ -652,17 +634,15 @@ if (!selectDate.isValid()) return; //设置选择时间 - setSelectDate(selectDate); + setSelectDate(selectDate, this); setYearData(); switch (pressType) { case 0: { // 0:单击 - QVector _scheduleInfo {}; + DSchedule::List _scheduleInfo {}; //获取选择日期的日程信息 - QMap > showInfo = m_calendarManager->getScheduleTask()->getScheduleInfo(selectDate, selectDate); - if (showInfo.begin() != showInfo.end()) { - _scheduleInfo = showInfo.begin().value(); - } + _scheduleInfo = gScheduleManager->getScheduleByDay(selectDate); + m_scheduleView->setCurrentDate(selectDate); m_scheduleView->setData(_scheduleInfo); //使用设置的显示坐标 @@ -677,6 +657,7 @@ m_scheduleView->setDirection(DArrowRectangle::ArrowRight); m_scheduleView->show(pos22.x() - 10, pos22.y()); } + update(); break; } case 1: { @@ -721,7 +702,6 @@ QGridLayout *gridLayout = new QGridLayout; gridLayout->setMargin(0); gridLayout->setSpacing(8); - gridLayout->setContentsMargins(0, 0, 0, 0); for (int i = 0; i < 3; i++) { for (int j = 0; j < 4; j++) { @@ -778,11 +758,9 @@ QVBoxLayout *hhLayout = new QVBoxLayout; hhLayout->setMargin(0); hhLayout->setSpacing(0); - hhLayout->setContentsMargins(0, 0, 0, 0); hhLayout->addWidget(m_topWidget); hhLayout->addLayout(gridLayout); this->setLayout(hhLayout); - setContentsMargins(0, 0, 0, 10); } YearFrame::~YearFrame() @@ -795,16 +773,14 @@ * @param selectDate 选择的时间 * @param showDate 需要显示一年的时间 */ -void YearFrame::setShowDate(const QDate &selectDate, const QMap > &showDate) +void YearFrame::setShowDate(const QDate &selectDate) { - //判断是否显示12个月 - Q_ASSERT(showDate.size() == 12); - m_selectDate = selectDate; - QDate _showMonth(m_selectDate.year(), 1, 1); + QDate _showMonth(selectDate.year(), 1, 1); for (int i = 0; i < DDEYearCalendar::FrameSizeOfEveryYear; i++) { QDate _setShowMonth = _showMonth.addMonths(i); - m_monthViewList.at(i)->setShowDate(_setShowMonth, showDate[i + 1]); + m_monthViewList.at(i)->setShowMonthDate(_setShowMonth); } + m_selectDate = selectDate; //更新显示界面 update(); //设置年份显示 @@ -824,27 +800,25 @@ * @brief YearFrame::setDateHasScheduleSign 设置日期是否存在日程 * @param hasSchedule */ -void YearFrame::setDateHasScheduleSign(const QMap &hasSchedule) +void YearFrame::setDateHasScheduleSign(const QSet &hasSchedule) { QDate _startDate; QDate _stopDate; QDate _getDate; qint64 _offset = 0; - QVector _hasScheduleVector{}; + QSet _hasScheduleSet{}; for (int i = 0; i < m_monthViewList.size(); ++i) { //如果时间有效 if (m_monthViewList.at(i)->getStartAndStopDate(_startDate, _stopDate)) { _offset = _startDate.daysTo(_stopDate) + 1; - _hasScheduleVector.clear(); + _hasScheduleSet.clear(); for (int j = 0 ; j < _offset; ++j) { _getDate = _startDate.addDays(j); if (hasSchedule.contains(_getDate)) { - _hasScheduleVector.append(hasSchedule[_getDate]); - } else { - _hasScheduleVector.append(false); + _hasScheduleSet.insert(_getDate); } } - m_monthViewList.at(i)->setHasScheduleFlag(_hasScheduleVector); + m_monthViewList.at(i)->setHasScheduleSet(_hasScheduleSet); } } } @@ -895,30 +869,29 @@ * @brief YearFrame::setSearchSchedule 设置搜索日程 * @param searchInfo */ -void YearFrame::setSearchSchedule(const QMap > &searchInfo) +void YearFrame::setSearchSchedule(const QSet &hasSchedule) { QDate _startDate; QDate _stopDate; QDate _getDate; qint64 _offset = 0; - QVector _hasSearchScheduleVector{}; + QSet _hasSearchScheduleSet{}; for (int i = 0; i < m_monthViewList.size(); ++i) { //如果时间有效 if (m_monthViewList.at(i)->getStartAndStopDate(_startDate, _stopDate)) { _offset = _startDate.daysTo(_stopDate) + 1; - _hasSearchScheduleVector.clear(); + _hasSearchScheduleSet.clear(); for (int j = 0 ; j < _offset; ++j) { _getDate = _startDate.addDays(j); - if (searchInfo.contains(_getDate) && searchInfo[_getDate].size() > 0) { - _hasSearchScheduleVector.append(true); - } else { - _hasSearchScheduleVector.append(false); + if (hasSchedule.contains(_getDate)) { + _hasSearchScheduleSet.insert(_getDate); } } - m_monthViewList.at(i)->setHasSearchScheduleFlag(_hasSearchScheduleVector); + m_monthViewList.at(i)->setHasSearchScheduleSet(_hasSearchScheduleSet); } } + } /** diff -Nru dde-calendar-5.9.1/calendar-client/src/widget/yearWidget/yearwindow.h dde-calendar-5.10.0/calendar-client/src/widget/yearWidget/yearwindow.h --- dde-calendar-5.9.1/calendar-client/src/widget/yearWidget/yearwindow.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-client/src/widget/yearWidget/yearwindow.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef YEARWINDOW_H #define YEARWINDOW_H @@ -80,7 +64,7 @@ //更新界面搜索日程显示 void updateSearchScheduleInfo() override; //设置选中搜索日程 - void setSelectSearchScheduleInfo(const ScheduleDataInfo &info) override; + void setSelectSearchScheduleInfo(const DSchedule::Ptr &info) override; signals: /** * @brief signalsWUpdateShcedule @@ -155,15 +139,15 @@ explicit YearFrame(DWidget *parent = nullptr); ~YearFrame() override; //设置显示时间 - void setShowDate(const QDate &selectDate, const QMap > &showDate); + void setShowDate(const QDate &selectDate); //设置阴历年显示 void setLunarYearDate(const QString &lunar = ""); //设置日期是否存在日程 - void setDateHasScheduleSign(const QMap &hasSchedule); + void setDateHasScheduleSign(const QSet &hasSchedule); //设置不同主题颜色 void setTheMe(int type = 0); //设置搜索日程 - void setSearchSchedule(const QMap > &searchInfo); + void setSearchSchedule(const QSet &hasSchedule); void setViewFocus(int index); int getViewFocusIndex(); private: diff -Nru dde-calendar-5.9.1/calendar-common/CMakeLists.txt dde-calendar-5.10.0/calendar-common/CMakeLists.txt --- dde-calendar-5.9.1/calendar-common/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-common/CMakeLists.txt 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,34 @@ +cmake_minimum_required(VERSION 3.7) +project(commondata) + +# Find the library +find_package(PkgConfig REQUIRED) +find_package(Qt5 COMPONENTS + Core + DBus + Sql +REQUIRED) + +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_INCLUDE_CURRENT_DIR ON) +set(CMAKE_AUTOMOC ON) + +#安全编译参数 +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-protector-strong -D_FORTITY_SOURCE=1 -z noexecstack -pie -fPIC -z lazy") + +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src) +aux_source_directory(src BASESTRUCT_SRCS) +aux_source_directory(src/huangliData BASESTRUCT_SRCS_HUANGLI) +link_libraries(${Qt5CORE_LIBRARIES} ${Qt5DBus_LIBRARIES}) + +add_library(${PROJECT_NAME} STATIC ${BASESTRUCT_SRCS} ${BASESTRUCT_SRCS_HUANGLI}) +target_include_directories(${PROJECT_NAME} PUBLIC ../3rdparty/kcalendarcore/src) + +target_link_libraries(${PROJECT_NAME} + Qt5::Core + Qt5::DBus + Qt5::Sql + kcalendarcore + ) + + diff -Nru dde-calendar-5.9.1/calendar-common/src/commondef.h dde-calendar-5.10.0/calendar-common/src/commondef.h --- dde-calendar-5.9.1/calendar-common/src/commondef.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-common/src/commondef.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,14 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef COMMONDEF_H +#define COMMONDEF_H + +#include +#include + +const QString CalendarServiceName = "com.deepin.dataserver.Calendar"; +const QString CalendarPath = "/com/deepin/dataserver/Calendar"; + +#endif // COMMONDEF_H diff -Nru dde-calendar-5.9.1/calendar-common/src/compatibledata.cpp dde-calendar-5.10.0/calendar-common/src/compatibledata.cpp --- dde-calendar-5.9.1/calendar-common/src/compatibledata.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-common/src/compatibledata.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,249 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "compatibledata.h" +#include "units.h" +#include "icalformat.h" + +#include +#include +#include +#include +#include +#include + +const QMap mTypeMap {{1, "107c369e-b13a-4d45-9ff3-de4eb3c0475b"}, {2, "24cf3ae3-541d-487f-83df-f068416b56b6"}, {3, "403bf009-2005-4679-9c76-e73d9f83a8b4"}}; + +/** + * @brief JobToObject 将Job转换成QJsonObject + * @param job Job结构体 + * @return QJsonObject + */ +QJsonObject JobToObject(const DSchedule::Ptr &job) +{ + QJsonObject obj; + + obj.insert("ID", job->compatibleID()); + obj.insert("Type", DDE_Calendar::getOldTypeIDByNewTypeID(job->scheduleTypeID())); + obj.insert("Title", job->summary()); + obj.insert("Description", job->description()); + obj.insert("AllDay", job->allDay()); + obj.insert("Start", dtToString(job->dtStart())); + obj.insert("End", dtToString(job->dtEnd())); + obj.insert("RRule", job->recurrence()->defaultRRule()->rrule()); + obj.insert("Remind", DDE_Calendar::getOldRemindByAlarm(job->getAlarmType())); + + //将QString类型转换为QJsonArray类型,方便前端解析 + QJsonArray _ignoreJsonArray; + for (int i = 0; i < job->recurrence()->exDateTimes().count(); i++) { + _ignoreJsonArray.append(dtToString(job->recurrence()->exDateTimes().at(i))); + } + obj.insert("Ignore", _ignoreJsonArray); + //TODO: + obj.insert("RecurID", 0); + + return obj; +} + +QString DDE_Calendar::getNewTypeIDByOldTypeID(int oldTypeID) +{ + if (mTypeMap.contains(oldTypeID)) { + return mTypeMap.value(oldTypeID); + } else { + return mTypeMap.value(3); + } +} + +int DDE_Calendar::getOldTypeIDByNewTypeID(const QString &newTypeID) +{ + int oldTypeID = 0; + QMap::const_iterator constIter = mTypeMap.constBegin(); + + for (; constIter != mTypeMap.constEnd(); ++constIter) { + if (constIter.value() == newTypeID) { + oldTypeID = constIter.key(); + break; + } + } + return oldTypeID == 0 ? 3 : oldTypeID; +} + +QString DDE_Calendar::getExternalSchedule(const DSchedule::Map &scheduleMap) +{ + QString strJson; + QJsonDocument doc; + QJsonArray jsonarr; + DSchedule::Map::const_iterator constIter = scheduleMap.constBegin(); + for (; constIter != scheduleMap.constEnd(); ++constIter) { + QJsonObject obj; + QJsonArray jobsJsonArr; + QJsonObject objjob; + obj.insert("Date", constIter.key().toString("yyyy-MM-dd")); + foreach (DSchedule::Ptr schedule, constIter.value()) { + objjob = JobToObject(schedule); + jobsJsonArr.append(objjob); + } + obj.insert("Jobs", jobsJsonArr); + jsonarr.append(obj); + } + doc.setArray(jsonarr); + strJson = QString::fromUtf8(doc.toJson(QJsonDocument::Compact)); + return strJson; +} + +void DDE_Calendar::setAlarmByOldRemind(const DSchedule::Ptr &schedule, const QString &remind) +{ + //提醒规则 + QStringList strList = remind.split(";", QString::SkipEmptyParts); + + int remindNum = strList.at(0).toInt(); + //小于0表示不提醒 + if (remindNum >= 0) { + KCalendarCore::Alarm::Ptr alarm = KCalendarCore::Alarm::Ptr(new KCalendarCore::Alarm(schedule.data())); + alarm->setEnabled(true); + alarm->setType(KCalendarCore::Alarm::Display); + alarm->setDisplayAlarm(schedule->summary()); + + if (schedule->allDay()) { + //提前多少秒 + int offset = 0; + if (strList.size() > 1) { + QTime time = QTime::fromString(strList.at(1), "hh:mm"); + offset = time.hour() * 60 * 60 + time.second() * 60; + } + KCalendarCore::Duration duration(-(24 * 60 * 60 * remindNum - offset)); + alarm->setStartOffset(duration); + } else { + KCalendarCore::Duration duration(-(60 * remindNum)); + alarm->setStartOffset(duration); + } + schedule->addAlarm(alarm); + } +} + +QString DDE_Calendar::getOldRemindByAlarm(const DSchedule::AlarmType &alarmType) +{ + QString _resultStr {""}; + switch (alarmType) { + case DSchedule::Alarm_Begin: + _resultStr = "0"; + break; + case DSchedule::Alarm_15Min_Front: + _resultStr = "15"; + break; + case DSchedule::Alarm_30Min_Front: + _resultStr = "30"; + break; + case DSchedule::Alarm_1Hour_Front: + _resultStr = "60"; + break; + case DSchedule::Alarm_1Day_Front: + _resultStr = "1440"; + break; + case DSchedule::Alarm_2Day_Front: + _resultStr = "2880"; + break; + case DSchedule::Alarm_1Week_Front: + _resultStr = "10080"; + break; + case DSchedule::Alarm_9Hour_After: + //日程当天9点(全天) + _resultStr = "0;09:00"; + break; + case DSchedule::Alarm_15Hour_Front: + //一天前(全天),为日程开始前15小时 + _resultStr = "1;09:00"; + break; + case DSchedule::Alarm_39Hour_Front: + //2天前(全天),为日程开始前39小时 + _resultStr = "2;09:00"; + break; + case DSchedule::Alarm_159Hour_Front: + //一周前(全天),为日程开始前159小时 + _resultStr = "7;09:00"; + break; + default: + break; + } + return _resultStr; +} + +DSchedule::Ptr DDE_Calendar::getScheduleByExported(const QString &scheduleStr) +{ + QJsonParseError json_error; + QJsonDocument jsonDoc(QJsonDocument::fromJson(scheduleStr.toLocal8Bit(), &json_error)); + + if (json_error.error != QJsonParseError::NoError) { + return nullptr; + } + QJsonObject rootObj = jsonDoc.object(); + DSchedule::Ptr schedule(new DSchedule); + + //日程是否为全天 + if (rootObj.contains("AllDay")) { + schedule->setAllDay(rootObj.value("AllDay").toBool()); + } + //日程提醒规则 + if (rootObj.contains("Remind")) { + DDE_Calendar::setAlarmByOldRemind(schedule, rootObj.value("Remind").toString()); + } + //日程标题 + if (rootObj.contains("Title")) { + schedule->setSummary(rootObj.value("Title").toString()); + } + //日程描述 + if (rootObj.contains("Description")) { + schedule->setDescription(rootObj.value("Description").toString()); + } + //日程类型 + if (rootObj.contains("Type")) { + schedule->setScheduleTypeID(DDE_Calendar::getNewTypeIDByOldTypeID(rootObj.value("Type").toInt())); + } + //日程开始时间 + if (rootObj.contains("Start")) { + schedule->setDtStart(dtFromString(rootObj.value("Start").toString())); + } + //日程结束时间 + if (rootObj.contains("End")) { + schedule->setDtEnd(dtFromString(rootObj.value("End").toString())); + } + // //日程重复ID + // if (rootObj.contains("RecurID")) { + // _resultSchedule.setRecurID(rootObj.value("RecurID").toInt()); + // } + //日程重复规则 + if (rootObj.contains("RRule")) { + DDE_Calendar::setRRuleByOldRRule(schedule, rootObj.value("RRule").toString()); + } + //重复日程忽略日期集 + if (rootObj.contains("Ignore")) { + DDE_Calendar::setExDate(schedule, rootObj.value("Ignore").toArray()); + } + return schedule; +} + +void DDE_Calendar::setRRuleByOldRRule(const DSchedule::Ptr &schedule, const QString &rrule) +{ + //重复规则 + KCalendarCore::Recurrence *recurrence = schedule->recurrence(); + KCalendarCore::ICalFormat ical; + KCalendarCore::RecurrenceRule *rule = new KCalendarCore::RecurrenceRule; + + if (ical.fromString(rule, rrule)) { + recurrence->addRRule(rule); + } +} + +void DDE_Calendar::setExDate(const DSchedule::Ptr &schedule, const QJsonArray &ignore) +{ + KCalendarCore::Recurrence *recurrence = schedule->recurrence(); + + foreach (auto ignoreTime, ignore) { + if (schedule->allDay()) { + recurrence->addExDate(dtFromString(ignoreTime.toString()).date()); + } else { + recurrence->addExDateTime(dtFromString(ignoreTime.toString())); + } + } +} diff -Nru dde-calendar-5.9.1/calendar-common/src/compatibledata.h dde-calendar-5.10.0/calendar-common/src/compatibledata.h --- dde-calendar-5.9.1/calendar-common/src/compatibledata.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-common/src/compatibledata.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,29 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef COMPATIBLEDATA_H +#define COMPATIBLEDATA_H + +#include "dschedule.h" + +#include + +namespace DDE_Calendar { +//通过旧的日程id获取新的日程id +QString getNewTypeIDByOldTypeID(int oldTypeID); +int getOldTypeIDByNewTypeID(const QString &newTypeID); + +DSchedule::Ptr getScheduleByExported(const QString &scheduleStr); + +// +void setAlarmByOldRemind(const DSchedule::Ptr &schedule, const QString &remind); +void setRRuleByOldRRule(const DSchedule::Ptr &schedule, const QString &rrule); +void setExDate(const DSchedule::Ptr &schedule, const QJsonArray &ignore); +QString getOldRemindByAlarm(const DSchedule::AlarmType &alarmType); + +//将新的日程数据转换为旧的查询数据({"Date":"",Jobs:["",""]}) +QString getExternalSchedule(const DSchedule::Map &scheduleMap); +} // namespace DDE_Calendar + +#endif // COMPATIBLEDATA_H diff -Nru dde-calendar-5.9.1/calendar-common/src/daccount.cpp dde-calendar-5.10.0/calendar-common/src/daccount.cpp --- dde-calendar-5.9.1/calendar-common/src/daccount.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-common/src/daccount.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,401 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "daccount.h" + +#include "units.h" + +#include +#include +#include +#include + +DAccount::DAccount(DAccount::Type type) + : m_displayName("") + , m_accountID("") + , m_accountName("") + , m_dbName("") + , m_dbusPath("") + , m_accountType(type) + , m_avatar("") + , m_description("") + , m_syncTag(0) + , m_accountState(Account_Invalid) + , m_syncState(Sync_Normal) + , m_syncFreq(SyncFreq_15Mins) + , m_intervalTime(0) + , m_isExpandDisplay(true) +{ +} + +QString DAccount::displayName() const +{ + return m_displayName; +} + +void DAccount::setDisplayName(const QString &displayName) +{ + m_displayName = displayName; +} + +QString DAccount::accountID() const +{ + return m_accountID; +} + +void DAccount::setAccountID(const QString &accountID) +{ + m_accountID = accountID; +} + +QString DAccount::accountName() const +{ + return m_accountName; +} + +void DAccount::setAccountName(const QString &accountName) +{ + m_accountName = accountName; +} + +QString DAccount::dbusPath() const +{ + return m_dbusPath; +} + +void DAccount::setDbusPath(const QString &dbusPath) +{ + m_dbusPath = dbusPath; +} + +DAccount::Type DAccount::accountType() const +{ + return m_accountType; +} + +void DAccount::setAccountType(const Type &accountType) +{ + m_accountType = accountType; +} + +bool DAccount::isExpandDisplay() const +{ + return m_isExpandDisplay; +} + +void DAccount::setIsExpandDisplay(bool isExpandDisplay) +{ + m_isExpandDisplay = isExpandDisplay; +} + +bool DAccount::isNetWorkAccount() +{ + return m_accountType != Type::Account_Local; +} + +int DAccount::syncTag() const +{ + return m_syncTag; +} + +void DAccount::setSyncTag(int syncTag) +{ + m_syncTag = syncTag; +} + +DAccount::AccountSyncState DAccount::syncState() const +{ + return m_syncState; +} + +void DAccount::setSyncState(AccountSyncState syncState) +{ + m_syncState = syncState; +} + +QString DAccount::avatar() const +{ + return m_avatar; +} + +void DAccount::setAvatar(const QString &avatar) +{ + m_avatar = avatar; +} + +QString DAccount::description() const +{ + return m_description; +} + +void DAccount::setDescription(const QString &description) +{ + m_description = description; +} + +QDateTime DAccount::dtCreate() const +{ + return m_dtCreate; +} + +void DAccount::setDtCreate(const QDateTime &dtCreate) +{ + m_dtCreate = dtCreate; +} + +QDateTime DAccount::dtDelete() const +{ + return m_dtDelete; +} + +void DAccount::setDtDelete(const QDateTime &dtDelete) +{ + m_dtDelete = dtDelete; +} + +QDateTime DAccount::dtUpdate() const +{ + return m_dtUpdate; +} + +void DAccount::setDtUpdate(const QDateTime &dtUpdate) +{ + m_dtUpdate = dtUpdate; +} + +bool DAccount::toJsonString(const DAccount::Ptr &account, QString &jsonStr) +{ + if (account.isNull()) { + qWarning() << "hold a reference to a null pointer."; + return false; + } + QJsonObject rootObj; + rootObj.insert("accountID", account->accountID()); + rootObj.insert("displayName", account->displayName()); + rootObj.insert("accountName", account->accountName()); + rootObj.insert("dbusPath", account->dbusPath()); + rootObj.insert("dbusInterface", account->dbusInterface()); + rootObj.insert("type", account->accountType()); + rootObj.insert("avatar", account->avatar()); + rootObj.insert("description", account->description()); + rootObj.insert("syncTag", account->syncTag()); + rootObj.insert("accountState", int(account->accountState())); + rootObj.insert("syncState", account->syncState()); + rootObj.insert("dtCreate", dtToString(account->dtCreate())); + rootObj.insert("dbName", account->dbName()); + rootObj.insert("isExpandDisplay", account->isExpandDisplay()); + rootObj.insert("dtLastSync", dtToString(account->dtLastSync())); + rootObj.insert("syncFreq", syncFreqToJsonString(account)); + QJsonDocument jsonDoc; + jsonDoc.setObject(rootObj); + jsonStr = QString::fromUtf8(jsonDoc.toJson(QJsonDocument::Compact)); + return true; +} + +bool DAccount::fromJsonString(Ptr &account, const QString &jsonStr) +{ + if (account.isNull()) { + account = DAccount::Ptr(new DAccount); + } + + QJsonParseError jsonError; + QJsonDocument jsonDoc(QJsonDocument::fromJson(jsonStr.toLocal8Bit(), &jsonError)); + if (jsonError.error != QJsonParseError::NoError) { + qWarning() << "error:" << jsonError.errorString(); + return false; + } + QJsonObject rootObj = jsonDoc.object(); + if (rootObj.contains("accountID")) { + account->setAccountID(rootObj.value("accountID").toString()); + } + if (rootObj.contains("displayName")) { + account->setDisplayName(rootObj.value("displayName").toString()); + } + if (rootObj.contains("accountName")) { + account->setAccountName(rootObj.value("accountName").toString()); + } + if (rootObj.contains("dbusPath")) { + account->setDbusPath(rootObj.value("dbusPath").toString()); + } + if (rootObj.contains("dbusInterface")) { + account->setDbusInterface(rootObj.value("dbusInterface").toString()); + } + + if (rootObj.contains("type")) { + account->setAccountType(static_cast(rootObj.value("type").toInt())); + } + if (rootObj.contains("avatar")) { + account->setAvatar(rootObj.value("avatar").toString()); + } + if (rootObj.contains("description")) { + account->setDescription(rootObj.value("description").toString()); + } + if (rootObj.contains("syncTag")) { + account->setSyncTag(rootObj.value("syncTag").toInt()); + } + if (rootObj.contains("accountState")) { + account->setAccountState(static_cast(rootObj.value("accountState").toInt())); + } + if (rootObj.contains("syncState")) { + account->setSyncState(static_cast(rootObj.value("syncState").toInt())); + } + if (rootObj.contains("dtCreate")) { + account->setDtCreate(dtFromString(rootObj.value("dtCreate").toString())); + } + if (rootObj.contains("dbName")) { + account->setDbName(rootObj.value("dbName").toString()); + } + if (rootObj.contains("isExpandDisplay")) { + account->setIsExpandDisplay(rootObj.value("isExpandDisplay").toBool()); + } + if (rootObj.contains("dtLastSync")) { + account->setDtLastSync(dtFromString(rootObj.value("dtLastSync").toString())); + } + + if (rootObj.contains("syncFreq")) { + syncFreqFromJsonString(account, rootObj.value("syncFreq").toString()); + } + + return true; +} + +bool DAccount::toJsonListString(const DAccount::List &accountList, QString &jsonStr) +{ + QJsonArray jsArr; + foreach (auto account, accountList) { + QJsonObject jsonAccount; + QString strAccount; + toJsonString(account, strAccount); + jsonAccount.insert("account", strAccount); + jsArr.append(jsonAccount); + } + QJsonObject jsObj; + jsObj.insert("accounts", jsArr); + QJsonDocument jsonDoc; + jsonDoc.setObject(jsObj); + jsonStr = QString::fromUtf8(jsonDoc.toJson(QJsonDocument::Compact)); + return true; +} + +bool DAccount::fromJsonListString(List &accountList, const QString &jsonStr) +{ + QJsonParseError jsonError; + QJsonDocument jsonDoc(QJsonDocument::fromJson(jsonStr.toLocal8Bit(), &jsonError)); + if (jsonError.error != QJsonParseError::NoError) { + qWarning() << "error:" << jsonError.errorString(); + return false; + } + QJsonObject rootObj = jsonDoc.object(); + if (rootObj.contains("accounts")) { + QJsonArray jsArr = rootObj.value("accounts").toArray(); + foreach (auto ja, jsArr) { + QJsonObject jsObj = ja.toObject(); + DAccount::Ptr account = DAccount::Ptr(new DAccount); + QString strAcc = jsObj.value("account").toString(); + if (fromJsonString(account, strAcc)) { + accountList.append(account); + } else { + qWarning() << "format failed:" << strAcc; + } + } + } + return true; +} + +QString DAccount::dbName() const +{ + return m_dbName; +} + +void DAccount::setDbName(const QString &dbName) +{ + m_dbName = dbName; +} + +QString DAccount::cloudPath() const +{ + return m_cloudPath; +} + +void DAccount::setCloudPath(const QString &cloudPath) +{ + m_cloudPath = cloudPath; +} + +DAccount::SyncFreqType DAccount::syncFreq() const +{ + return m_syncFreq; +} + +void DAccount::setSyncFreq(SyncFreqType syncFreq) +{ + m_syncFreq = syncFreq; +} + +int DAccount::intervalTime() const +{ + return m_intervalTime; +} + +void DAccount::setIntervalTime(int intervalTime) +{ + m_intervalTime = intervalTime; +} + +QString DAccount::dbusInterface() const +{ + return m_dbusInterface; +} + +void DAccount::setDbusInterface(const QString &dbusInterface) +{ + m_dbusInterface = dbusInterface; +} + +DAccount::AccountStates DAccount::accountState() const +{ + return m_accountState; +} + +void DAccount::setAccountState(const AccountStates &accountState) +{ + m_accountState = accountState; +} + +QDateTime DAccount::dtLastSync() const +{ + return m_dtLastSync; +} + +void DAccount::setDtLastSync(const QDateTime &dtLastSync) +{ + m_dtLastSync = dtLastSync; +} + +QString DAccount::syncFreqToJsonString(const DAccount::Ptr &account) +{ + QJsonObject rootObj; + rootObj.insert("syncFreq", account->syncFreq()); + rootObj.insert("m_intervalTime", account->intervalTime()); + QJsonDocument jsonDoc; + jsonDoc.setObject(rootObj); + return QString::fromUtf8(jsonDoc.toJson(QJsonDocument::Compact)); +} + +void DAccount::syncFreqFromJsonString(const DAccount::Ptr &account, const QString &syncFreqStr) +{ + QJsonParseError jsonError; + QJsonDocument jsonDoc(QJsonDocument::fromJson(syncFreqStr.toLocal8Bit(), &jsonError)); + if (jsonError.error != QJsonParseError::NoError) { + qWarning() << "error:" << jsonError.errorString(); + return; + } + QJsonObject rootObj = jsonDoc.object(); + if (rootObj.contains("syncFreq")) { + account->setSyncFreq(SyncFreqType(rootObj.value("syncFreq").toInt())); + } + if (rootObj.contains("m_intervalTime")) { + account->setIntervalTime(rootObj.value("m_intervalTime").toInt()); + } +} diff -Nru dde-calendar-5.9.1/calendar-common/src/daccount.h dde-calendar-5.10.0/calendar-common/src/daccount.h --- dde-calendar-5.9.1/calendar-common/src/daccount.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-common/src/daccount.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,145 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef DACCOUNT_H +#define DACCOUNT_H + +#include +#include +#include + +//帐户信息 +class DAccount +{ +public: + enum Type { + Account_Local, //本地帐户 + Account_UnionID, //union id 帐户 + Account_CalDav //caldav通用协议帐户 + }; + + enum AccountState { + Account_Invalid = 0x1, //无效 + Account_Open = 0x2, //日历同步总开关开启 + Account_Calendar = 0x4, //同步日程 + Account_Setting = 0x8, //同步通用设置 + }; + Q_DECLARE_FLAGS(AccountStates, AccountState) + + enum AccountSyncState { + Sync_Normal = 0, //正常 + Sync_NetworkAnomaly, //网络异常 + Sync_ServerException, //服务器异常 + Sync_StorageFull, //存储已满 + }; + + enum SyncFreqType { + SyncFreq_Maunal, //手动同步 + SyncFreq_15Mins, + SyncFreq_30Mins, + SyncFreq_1hour, + SyncFreq_24hour, + }; + + typedef QSharedPointer Ptr; + typedef QVector List; + + explicit DAccount(Type type = Account_Local); + QString displayName() const; + void setDisplayName(const QString &displayName); + + QString accountID() const; + void setAccountID(const QString &accountID); + + QString accountName() const; + void setAccountName(const QString &accountName); + + QString dbusPath() const; + void setDbusPath(const QString &dbusPath); + + Type accountType() const; + void setAccountType(const Type &accountTyep); + + bool isExpandDisplay() const; + void setIsExpandDisplay(bool isExpandDisplay); + + bool isNetWorkAccount(); + + int syncTag() const; + void setSyncTag(int syncTag); + + AccountSyncState syncState() const; + void setSyncState(AccountSyncState syncState); + + QString avatar() const; + void setAvatar(const QString &avatar); + + QString description() const; + void setDescription(const QString &description); + + QDateTime dtCreate() const; + void setDtCreate(const QDateTime &dtCreate); + + QDateTime dtDelete() const; + void setDtDelete(const QDateTime &dtDelete); + + QDateTime dtUpdate() const; + void setDtUpdate(const QDateTime &dtUpdate); + + static bool toJsonString(const DAccount::Ptr &account, QString &jsonStr); + static bool fromJsonString(DAccount::Ptr &account, const QString &jsonStr); + static bool toJsonListString(const DAccount::List &accountList, QString &jsonStr); + static bool fromJsonListString(DAccount::List &accountList, const QString &jsonStr); + + QString dbName() const; + void setDbName(const QString &dbName); + + QString cloudPath() const; + void setCloudPath(const QString &cloudPath); + + SyncFreqType syncFreq() const; + void setSyncFreq(SyncFreqType syncFreq); + + int intervalTime() const; + void setIntervalTime(int intervalTime); + + QString dbusInterface() const; + void setDbusInterface(const QString &dbusInterface); + + AccountStates accountState() const; + void setAccountState(const AccountStates &accountState); + + QDateTime dtLastSync() const; + void setDtLastSync(const QDateTime &dtLastSync); + + static QString syncFreqToJsonString(const DAccount::Ptr &account); + static void syncFreqFromJsonString(const DAccount::Ptr &account, const QString &syncFreqStr); + +private: + QString m_displayName; //显示名称 + QString m_accountID; //帐户id + QString m_accountName; //帐户名称 + QString m_dbName; //对应的数据库名称 + QString m_dbusPath; //dbus路径 + QString m_dbusInterface; //dbus接口 + Type m_accountType; //帐户类型 + QString m_avatar; //头像 + QString m_description; //描述 + int m_syncTag; //同步标识,用来与云端标识比对 + AccountStates m_accountState; //帐户状态 + AccountSyncState m_syncState; //同步状态 + QDateTime m_dtCreate; + QDateTime m_dtDelete; + QDateTime m_dtUpdate; + QDateTime m_dtLastSync; //最后一次同步时间 + QString m_cloudPath; + SyncFreqType m_syncFreq; //同步频率 + int m_intervalTime; //当同步频率为自定义时,才有效,单位(min) + + bool m_isExpandDisplay; //左侧帐户列表信息是否展开显示 +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(DAccount::AccountStates) + +#endif // DACCOUNT_H diff -Nru dde-calendar-5.9.1/calendar-common/src/dcalendargeneralsettings.cpp dde-calendar-5.10.0/calendar-common/src/dcalendargeneralsettings.cpp --- dde-calendar-5.9.1/calendar-common/src/dcalendargeneralsettings.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-common/src/dcalendargeneralsettings.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,77 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "dcalendargeneralsettings.h" + +#include +#include +#include +#include + +DCalendarGeneralSettings::DCalendarGeneralSettings() + : m_firstDayOfWeek(Qt::Sunday) + , m_timeShowType(TwentyFour) +{ +} + +DCalendarGeneralSettings::DCalendarGeneralSettings(const DCalendarGeneralSettings &setting) + : m_firstDayOfWeek(setting.firstDayOfWeek()) + , m_timeShowType(setting.timeShowType()) +{ +} + +DCalendarGeneralSettings *DCalendarGeneralSettings::clone() const +{ + return new DCalendarGeneralSettings(*this); +} + +Qt::DayOfWeek DCalendarGeneralSettings::firstDayOfWeek() const +{ + return m_firstDayOfWeek; +} + +void DCalendarGeneralSettings::setFirstDayOfWeek(const Qt::DayOfWeek &firstDayOfWeek) +{ + m_firstDayOfWeek = firstDayOfWeek; +} + +DCalendarGeneralSettings::TimeShowType DCalendarGeneralSettings::timeShowType() const +{ + return m_timeShowType; +} + +void DCalendarGeneralSettings::setTimeShowType(const TimeShowType &timeShowType) +{ + m_timeShowType = timeShowType; +} + +void DCalendarGeneralSettings::toJsonString(const Ptr &cgSet, QString &jsonStr) +{ + QJsonObject rootObject; + rootObject.insert("firstDayOfWeek", cgSet->firstDayOfWeek()); + rootObject.insert("TimeShowType", cgSet->timeShowType()); + QJsonDocument jsonDoc; + jsonDoc.setObject(rootObject); + jsonStr = QString::fromUtf8(jsonDoc.toJson(QJsonDocument::Compact)); +} + +bool DCalendarGeneralSettings::fromJsonString(Ptr &cgSet, const QString &jsonStr) +{ + QJsonParseError jsonError; + QJsonDocument jsonDoc(QJsonDocument::fromJson(jsonStr.toLocal8Bit(), &jsonError)); + if (jsonError.error != QJsonParseError::NoError) { + qWarning() << "error:" << jsonError.errorString(); + return false; + } + + QJsonObject rootObj = jsonDoc.object(); + if (rootObj.contains("firstDayOfWeek")) { + cgSet->setFirstDayOfWeek(static_cast(rootObj.value("firstDayOfWeek").toInt())); + } + + if (rootObj.contains("TimeShowType")) { + cgSet->setTimeShowType(static_cast(rootObj.value("TimeShowType").toInt())); + } + return true; +} diff -Nru dde-calendar-5.9.1/calendar-common/src/dcalendargeneralsettings.h dde-calendar-5.10.0/calendar-common/src/dcalendargeneralsettings.h --- dde-calendar-5.9.1/calendar-common/src/dcalendargeneralsettings.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-common/src/dcalendargeneralsettings.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,45 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef DCALENDARGENERALSETTINGS_H +#define DCALENDARGENERALSETTINGS_H + +#include +#include +#include + +/** + * @brief The DCalendarGeneralSettings class + * 日历通用设置 + */ +class DCalendarGeneralSettings +{ +public: + enum TimeShowType { + TwentyFour = 0, //24 + Twelve, //12 + }; + + typedef QSharedPointer Ptr; + + DCalendarGeneralSettings(); + DCalendarGeneralSettings(const DCalendarGeneralSettings &setting); + + DCalendarGeneralSettings *clone() const; + + Qt::DayOfWeek firstDayOfWeek() const; + void setFirstDayOfWeek(const Qt::DayOfWeek &firstDayOfWeek); + + TimeShowType timeShowType() const; + void setTimeShowType(const TimeShowType &timeShowType); + + static void toJsonString(const DCalendarGeneralSettings::Ptr &cgSet, QString &jsonStr); + static bool fromJsonString(DCalendarGeneralSettings::Ptr &cgSet, const QString &jsonStr); + +private: + Qt::DayOfWeek m_firstDayOfWeek; //一周首日 + TimeShowType m_timeShowType; +}; + +#endif // DCALENDARGENERALSETTINGS_H diff -Nru dde-calendar-5.9.1/calendar-common/src/dschedule.cpp dde-calendar-5.10.0/calendar-common/src/dschedule.cpp --- dde-calendar-5.9.1/calendar-common/src/dschedule.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-common/src/dschedule.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,397 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "dschedule.h" + +#include "icalformat.h" +#include "memorycalendar.h" +#include "units.h" + +#include + +#define Duration_Min 60 +#define Duration_Hour 60 * 60 +#define Duration_Day 24 * 60 * 60 +#define Duration_Week 7 * 24 * 60 * 60 + +DSchedule::DSchedule() + : KCalendarCore::Event() + , m_fileName("") + , m_scheduleTypeID("") + , m_compatibleID(0) +{ +} + +DSchedule::DSchedule(const DSchedule &schedule) + : KCalendarCore::Event(schedule) + , m_fileName("") + , m_scheduleTypeID("") + , m_compatibleID(0) +{ + this->setScheduleTypeID(schedule.scheduleTypeID()); +} + +DSchedule::DSchedule(const KCalendarCore::Event &event) + : KCalendarCore::Event(event) + , m_fileName("") + , m_scheduleTypeID("") + , m_compatibleID(0) +{ +} + +DSchedule *DSchedule::clone() const +{ + return new DSchedule(*this); +} + +QString DSchedule::scheduleTypeID() const +{ + return m_scheduleTypeID; +} + +void DSchedule::setScheduleTypeID(const QString &typeID) +{ + m_scheduleTypeID = typeID; +} + +bool DSchedule::isMoved() +{ + return this->m_moved; +} + +void DSchedule::setMoved(bool moved) +{ + this->m_moved = moved; +} + +bool DSchedule::isValid() const +{ + //TODO:添加判断日程是否有效 + return true; +} + +bool DSchedule::isMultiDay() const +{ + //如果日期不一致则为跨天日程 + return dtStart().date() != dtEnd().date(); +} + +bool DSchedule::operator==(const DSchedule &schedule) const +{ + return this->instanceIdentifier() == schedule.instanceIdentifier(); +} + +bool operator<(const DSchedule::Ptr &s1, const DSchedule::Ptr &s2) +{ + if (s1.isNull() || s2.isNull()) { + return false; + } + return *s1.data() < *s2.data(); +} + +bool DSchedule::operator<(const DSchedule &schedule) const +{ + if (this->allDay() != schedule.allDay()) { + return this->allDay() > schedule.allDay(); + } + if (this->dtStart() != schedule.dtStart()) { + return this->dtStart() < schedule.dtStart(); + } + if (this->created() != schedule.created()) { + return this->created() < schedule.created(); + } + if (this->summary() != schedule.summary()) { + return this->summary() < schedule.summary(); + } + return true; +} + +void DSchedule::setAlarmType(const DSchedule::AlarmType &alarmType) +{ + //如果提醒规则没有变化则退出 + if (alarmType == getAlarmType()) { + return; + } + + //清除提醒规则 + this->clearAlarms(); + //如果为从不则退出 + if (alarmType == AlarmType::Alarm_None || alarmType == AlarmType::Alarm_AllDay_None) + return; + + QMap alarmMap = getAlarmMap(); + QMap::const_iterator iter = alarmMap.constBegin(); + for (; iter != alarmMap.constEnd(); ++iter) { + if (iter.value() == alarmType) { + KCalendarCore::Alarm::Ptr alarm = KCalendarCore::Alarm::Ptr(new KCalendarCore::Alarm(this)); + alarm->setEnabled(true); + alarm->setType(KCalendarCore::Alarm::Display); + alarm->setDisplayAlarm(this->summary()); + KCalendarCore::Duration duration(iter.key()); + alarm->setStartOffset(duration); + addAlarm(alarm); + break; + } + } +} + +DSchedule::AlarmType DSchedule::getAlarmType() +{ + AlarmType alarmType = allDay() ? Alarm_AllDay_None : Alarm_None; + KCalendarCore::Alarm::List alarmList = this->alarms(); + if (alarmList.size() > 0) { + KCalendarCore::Duration duration = alarmList.at(0)->startOffset(); + QMap alarmMap = getAlarmMap(); + if (alarmMap.contains(duration.asSeconds())) { + alarmType = alarmMap[duration.asSeconds()]; + } + } + return alarmType; +} + +void DSchedule::setRRuleType(const DSchedule::RRuleType &rtype) +{ + if (getRRuleType() == rtype) + return; + clearRecurrence(); + + QString rules; + switch (rtype) { + case RRule_Year: + rules = "FREQ=YEARLY"; + break; + case RRule_Month: + rules = "FREQ=MONTHLY"; + break; + case RRule_Week: + rules = "FREQ=WEEKLY"; + break; + case RRule_Work: + rules = "FREQ=DAILY;BYDAY=MO,TU,WE,TH,FR"; + break; + case RRule_Day: + rules = "FREQ=DAILY"; + break; + default: + rules = ""; + break; + } + if (!rules.isEmpty()) { + KCalendarCore::Recurrence *recurrence = this->recurrence(); + KCalendarCore::RecurrenceRule *rrule = new KCalendarCore::RecurrenceRule(); + + KCalendarCore::ICalFormat ical; + if (ical.fromString(rrule, rules)) { + recurrence->addRRule(rrule); + } + } +} + +DSchedule::RRuleType DSchedule::getRRuleType() +{ + RRuleType rtype = RRule_None; + if (this->recurs()) { + KCalendarCore::RecurrenceRule *rrule = this->recurrence()->defaultRRuleConst(); + switch (rrule->recurrenceType()) { + case KCalendarCore::RecurrenceRule::rYearly: { + rtype = RRule_Year; + } break; + case KCalendarCore::RecurrenceRule::rMonthly: { + rtype = RRule_Month; + } break; + case KCalendarCore::RecurrenceRule::rWeekly: { + rtype = RRule_Week; + } break; + case KCalendarCore::RecurrenceRule::rDaily: { + if (rrule->rrule().contains("BYDAY=MO,TU,WE,TH,FR")) { + rtype = RRule_Work; + } else { + rtype = RRule_Day; + } + } break; + default: + rtype = RRule_None; + break; + } + } + return rtype; +} + +int DSchedule::numberOfRepetitions(const Ptr &scheudle, const QDateTime &datetime) +{ + return scheudle->recurrence()->durationTo(datetime); +} + +bool DSchedule::fromJsonString(DSchedule::Ptr &schedule, const QString &json) +{ + if (schedule.isNull()) { + schedule = DSchedule::Ptr(new DSchedule); + } + QJsonParseError jsonError; + QJsonDocument jsonDoc(QJsonDocument::fromJson(json.toLocal8Bit(), &jsonError)); + if (jsonError.error != QJsonParseError::NoError) { + qWarning() << "error:" << jsonError.errorString(); + return false; + } + bool resBool = false; + QJsonObject rootObj = jsonDoc.object(); + if (rootObj.contains("schedule")) { + QString str = rootObj.value("schedule").toString(); + if (fromIcsString(schedule, str)) { + if (rootObj.contains("type")) { + schedule->setScheduleTypeID(rootObj.value("type").toString()); + } + if (rootObj.contains("compatibleID")) { + schedule->setcompatibleID(rootObj.value("compatibleID").toInt()); + } + resBool = true; + } + } + return resBool; +} + +bool DSchedule::toJsonString(const DSchedule::Ptr &schedule, QString &json) +{ + if (schedule.isNull()) { + qWarning() << "hold a reference to a null pointer."; + return false; + } + QJsonObject rootObject; + rootObject.insert("type", schedule->scheduleTypeID()); + rootObject.insert("schedule", toIcsString(schedule)); + rootObject.insert("compatibleID", schedule->compatibleID()); + QJsonDocument jsonDoc; + jsonDoc.setObject(rootObject); + json = QString::fromUtf8(jsonDoc.toJson(QJsonDocument::Compact)); + return true; +} + +bool DSchedule::fromIcsString(Ptr &schedule, const QString &string) +{ + bool resBool = false; + KCalendarCore::ICalFormat icalformat; + QTimeZone timezone = QDateTime::currentDateTime().timeZone(); + KCalendarCore::MemoryCalendar::Ptr _cal(new KCalendarCore::MemoryCalendar(timezone)); + if (icalformat.fromString(_cal, string)) { + KCalendarCore::Event::List eventList = _cal->events(); + if (eventList.size() > 0) { + schedule = DSchedule::Ptr(new DSchedule(*eventList.at(0).data())); // eventList.at(0).staticCast(); + resBool = true; + } + } + return resBool; +} + +QString DSchedule::toIcsString(const DSchedule::Ptr &schedule) +{ + KCalendarCore::ICalFormat icalformat; + KCalendarCore::MemoryCalendar::Ptr _cal(new KCalendarCore::MemoryCalendar(nullptr)); + _cal->addEvent(schedule); + return icalformat.toString(_cal.staticCast()); +} + +QMap DSchedule::fromMapString(const QString &json) +{ + QMap scheduleMap; + QJsonParseError jsonError; + QJsonDocument jsonDoc(QJsonDocument::fromJson(json.toLocal8Bit(), &jsonError)); + if (jsonError.error != QJsonParseError::NoError) { + qWarning() << "error:" << jsonError.errorString(); + return scheduleMap; + } + QJsonArray rootArray = jsonDoc.array(); + QDate date; + foreach (auto jsonValue, rootArray) { + QJsonObject jsonObj = jsonValue.toObject(); + if (jsonObj.contains("Date")) { + date = dateFromString(jsonObj.value("Date").toString()); + } + if (jsonObj.contains("schedule")) { + QJsonArray jsonArray = jsonObj.value("schedule").toArray(); + foreach (auto scheduleValue, jsonArray) { + QString scheduleStr = scheduleValue.toString(); + DSchedule::Ptr schedule = DSchedule::Ptr(new DSchedule); + DSchedule::fromJsonString(schedule, scheduleStr); + scheduleMap[date].append(schedule); + } + } + } + return scheduleMap; +} + +QString DSchedule::toMapString(const QMap &scheduleMap) +{ + QJsonArray rootArray; + QMap::const_iterator iter = scheduleMap.constBegin(); + for (; iter != scheduleMap.constEnd(); ++iter) { + QJsonObject jsonObj; + jsonObj.insert("Date", dateToString(iter.key())); + QJsonArray jsonArray; + foreach (auto &schedule, iter.value()) { + QString scheduleStr; + DSchedule::toJsonString(schedule, scheduleStr); + jsonArray.append(scheduleStr); + } + jsonObj.insert("schedule", jsonArray); + rootArray.append(jsonObj); + } + QJsonDocument jsonDoc; + jsonDoc.setArray(rootArray); + return QString::fromUtf8(jsonDoc.toJson(QJsonDocument::Compact)); +} + +bool operator==(const DSchedule::Ptr &s1, const DSchedule::Ptr &s2) +{ + return s1.isNull() || s2.isNull() ? s1.isNull() && s2.isNull() : s1->instanceIdentifier() == s2->instanceIdentifier(); +} + +QMap DSchedule::getAlarmMap() +{ + static QMap alarmMap { + {0, Alarm_Begin}, + {-15 * Duration_Min, Alarm_15Min_Front}, + {-30 * Duration_Min, Alarm_30Min_Front}, + {-Duration_Hour, Alarm_1Hour_Front}, + {-Duration_Day, Alarm_1Day_Front}, + {-Duration_Day * 2, Alarm_2Day_Front}, + {-Duration_Week, Alarm_1Week_Front}, + {9 * Duration_Hour, Alarm_9Hour_After}, + {-15 * Duration_Hour, Alarm_15Hour_Front}, + {-39 * Duration_Hour, Alarm_39Hour_Front}, + {-159 * Duration_Hour, Alarm_159Hour_Front}}; + return alarmMap; +} + +QString DSchedule::fileName() const +{ + return m_fileName; +} + +void DSchedule::setFileName(const QString &fileName) +{ + m_fileName = fileName; +} + +int DSchedule::compatibleID() const +{ + return m_compatibleID; +} + +void DSchedule::setcompatibleID(int compatibleID) +{ + m_compatibleID = compatibleID; +} + +QDebug operator<<(QDebug debug, const DSchedule &scheduleJsonData) +{ + QDebugStateSaver saver(debug); + debug.noquote() << "dtStart:" << dtToString(scheduleJsonData.dtStart()) + << " ,dtEnd:" << dtToString(scheduleJsonData.dtEnd()) + << " ,dtCreate:" << dtToString(scheduleJsonData.created()) + << " ,summary:" << scheduleJsonData.summary() + << " ,scheduleTypeID:" << scheduleJsonData.scheduleTypeID() + << ",Uid:" << scheduleJsonData.uid() + << " ,rrule:" << scheduleJsonData.recurrence()->defaultRRule()->rrule(); + return debug; +} diff -Nru dde-calendar-5.9.1/calendar-common/src/dschedule.h dde-calendar-5.10.0/calendar-common/src/dschedule.h --- dde-calendar-5.9.1/calendar-common/src/dschedule.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-common/src/dschedule.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,119 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef DSCHEDULE_H +#define DSCHEDULE_H + +#include "event.h" + +#include +#include +#include + +//日程信息 +class DSchedule : public KCalendarCore::Event +{ +public: + //提醒规则 + enum AlarmType { + Alarm_None, //从不 + Alarm_Begin, //日程开始时 + Alarm_15Min_Front, //提前15分钟 + Alarm_30Min_Front, //提前30分钟 + Alarm_1Hour_Front, //提前1小时 + Alarm_1Day_Front, //提前1天 + Alarm_2Day_Front, //提前2天 + Alarm_1Week_Front, //提前1周 + Alarm_AllDay_None, //全天从不 + Alarm_9Hour_After, //日程当天9点(全天) + Alarm_15Hour_Front, //一天前(全天),为日程开始前15小时 + Alarm_39Hour_Front, //2天前(全天),为日程开始前39小时 + Alarm_159Hour_Front, //一周前(全天),为日程开始前159小时 + }; + + //重复规则 + enum RRuleType { + RRule_None, //从不 + RRule_Day, //每天 + RRule_Work, //每工作日 + RRule_Week, //每周 + RRule_Month, //每月 + RRule_Year, //每年 + }; + + typedef QSharedPointer Ptr; + typedef QVector List; + typedef QMap Map; + typedef QMap::Iterator Iter; + + DSchedule(); + DSchedule(const DSchedule &schedule); + DSchedule(const KCalendarCore::Event &event); + + DSchedule *clone() const override; + + QString scheduleTypeID() const; + void setScheduleTypeID(const QString &typeID); + + //为了与旧数据兼容处理(与联系人交互中使用的是自增ID作为日程的ID) + int dbID() const; + void setDbID(int id); + + bool isMoved(); + void setMoved(bool moved); + + bool isValid() const; + + //是否是跨天的 + bool isMultiDay() const; + + bool operator==(const DSchedule &schedule) const; + + bool operator<(const DSchedule &schedule) const; + + void setAlarmType(const AlarmType &alarmType); + AlarmType getAlarmType(); + + //设置重复规则,若有重复规则,规则的截止次数或日期通过RecurrenceRule::duration 判断为永不,结束与次数还是结束与日期 + void setRRuleType(const RRuleType &rtype); + RRuleType getRRuleType(); + + //重复日程相对于原始日程重复的次数,若为第一个日程则返回0 + static int numberOfRepetitions(const DSchedule::Ptr &scheudle, const QDateTime &datetime); + + static bool fromJsonString(DSchedule::Ptr &schedule, const QString &json); + static bool toJsonString(const DSchedule::Ptr &schedule, QString &json); + + static bool fromIcsString(DSchedule::Ptr &schedule, const QString &string); + static QString toIcsString(const DSchedule::Ptr &schedule); + + // + static QMap fromMapString(const QString &json); + static QString toMapString(const QMap &scheduleMap); + +private: + QMap getAlarmMap(); + +public: + //日程信息调试打印 + friend QDebug operator<<(QDebug debug, const DSchedule &scheduleJsonData); + friend bool operator==(const DSchedule::Ptr &s1, const DSchedule::Ptr &s2); + friend bool operator<(const DSchedule::Ptr &s1, const DSchedule::Ptr &s2); + + QString fileName() const; + void setFileName(const QString &fileName); + + //为了与旧数据兼容处理(与联系人交互中使用的是自增ID作为日程的ID) + int compatibleID() const; + void setcompatibleID(int compatibleID); + +private: + QString m_fileName; //日程对应文件名称 + //日程类型 + QString m_scheduleTypeID; + bool m_moved = false; + int m_compatibleID; //为了与旧数据兼容处理(与联系人交互中使用的是自增ID作为日程的ID) +}; + +#endif // DSCHEDULE_H diff -Nru dde-calendar-5.9.1/calendar-common/src/dschedulequerypar.cpp dde-calendar-5.10.0/calendar-common/src/dschedulequerypar.cpp --- dde-calendar-5.9.1/calendar-common/src/dschedulequerypar.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-common/src/dschedulequerypar.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,146 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "dschedulequerypar.h" + +#include "units.h" + +#include +#include +#include + +DScheduleQueryPar::DScheduleQueryPar() + : m_key("") + , m_queryTop(1) + , m_rruleType(RRule_None) + , m_queryType(Query_None) +{ +} + +QDateTime DScheduleQueryPar::dtStart() const +{ + return m_dtStart; +} + +void DScheduleQueryPar::setDtStart(const QDateTime &dtStart) +{ + m_dtStart = dtStart; +} + +QDateTime DScheduleQueryPar::dtEnd() const +{ + return m_dtEnd; +} + +void DScheduleQueryPar::setDtEnd(const QDateTime &dtEnd) +{ + m_dtEnd = dtEnd; +} + +QString DScheduleQueryPar::key() const +{ + return m_key; +} + +void DScheduleQueryPar::setKey(const QString &key) +{ + m_key = key; +} + +DScheduleQueryPar::Ptr DScheduleQueryPar::fromJsonString(const QString &queryStr) +{ + QJsonParseError jsonError; + QJsonDocument jsonDoc(QJsonDocument::fromJson(queryStr.toLocal8Bit(), &jsonError)); + if (jsonError.error != QJsonParseError::NoError) { + qWarning() << "error:" << jsonError.errorString() << " queryStr:" << queryStr; + return nullptr; + } + DScheduleQueryPar::Ptr queryPar = DScheduleQueryPar::Ptr(new DScheduleQueryPar); + QJsonObject rootObj = jsonDoc.object(); + if (rootObj.contains("key")) { + queryPar->setKey(rootObj.value("key").toString()); + } + if (rootObj.contains("dtStart")) { + queryPar->setDtStart(dtFromString(rootObj.value("dtStart").toString())); + } + if (rootObj.contains("dtEnd")) { + queryPar->setDtEnd(dtFromString(rootObj.value("dtEnd").toString())); + } + QueryType qType = Query_None; + if (rootObj.contains("queryType")) { + qType = static_cast(rootObj.value("queryType").toInt()); + queryPar->setQueryType(qType); + } + switch (qType) { + case Query_Top: { + if (rootObj.contains("queryTop")) { + queryPar->setQueryTop(rootObj.value("queryTop").toInt()); + } + } break; + case Query_RRule: { + if (rootObj.contains("queryRRule")) { + queryPar->setRruleType(static_cast(rootObj.value("queryRRule").toInt())); + } + } + default: + break; + } + return queryPar; +} + +QString DScheduleQueryPar::toJsonString(const DScheduleQueryPar::Ptr &queryPar) +{ + if (queryPar.isNull()) { + qWarning() << "hold a reference to a null pointer."; + return QString(); + } + QJsonObject jsonObj; + jsonObj.insert("key", queryPar->key()); + jsonObj.insert("dtStart", dtToString(queryPar->dtStart())); + jsonObj.insert("dtEnd", dtToString(queryPar->dtEnd())); + jsonObj.insert("queryType", queryPar->queryType()); + switch (queryPar->queryType()) { + case Query_Top: + jsonObj.insert("queryTop", queryPar->queryTop()); + break; + case Query_RRule: + jsonObj.insert("queryRRule", queryPar->rruleType()); + break; + default: + break; + } + QJsonDocument jsonDoc; + jsonDoc.setObject(jsonObj); + return QString::fromUtf8(jsonDoc.toJson(QJsonDocument::Compact)); +} + +DScheduleQueryPar::QueryType DScheduleQueryPar::queryType() const +{ + return m_queryType; +} + +void DScheduleQueryPar::setQueryType(const QueryType &queryType) +{ + m_queryType = queryType; +} + +int DScheduleQueryPar::queryTop() const +{ + return m_queryTop; +} + +void DScheduleQueryPar::setQueryTop(int queryTop) +{ + m_queryTop = queryTop; +} + +DScheduleQueryPar::RRuleType DScheduleQueryPar::rruleType() const +{ + return m_rruleType; +} + +void DScheduleQueryPar::setRruleType(const RRuleType &rruleType) +{ + m_rruleType = rruleType; +} diff -Nru dde-calendar-5.9.1/calendar-common/src/dschedulequerypar.h dde-calendar-5.10.0/calendar-common/src/dschedulequerypar.h --- dde-calendar-5.9.1/calendar-common/src/dschedulequerypar.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-common/src/dschedulequerypar.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,66 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef DSCHEDULEQUERYPAR_H +#define DSCHEDULEQUERYPAR_H + +#include +#include +#include + +//查询日程相关参数 +class DScheduleQueryPar +{ +public: + typedef QSharedPointer Ptr; + + enum QueryType { + Query_None, + Query_RRule, //查询重复规则 + Query_Top, //查询前多少个 + Query_ScheduleID //查询日程ID + }; + + enum RRuleType { + RRule_None, //从不 + RRule_Day, //每天 + RRule_Work, //每工作日 + RRule_Week, //每周 + RRule_Month, //每月 + RRule_Year, //每年 + }; + + DScheduleQueryPar(); + + QDateTime dtStart() const; + void setDtStart(const QDateTime &dtStart); + + QDateTime dtEnd() const; + void setDtEnd(const QDateTime &dtEnd); + + QString key() const; + void setKey(const QString &key); + + static DScheduleQueryPar::Ptr fromJsonString(const QString &queryStr); + static QString toJsonString(const DScheduleQueryPar::Ptr &queryPar); + + QueryType queryType() const; + void setQueryType(const QueryType &queryType); + + int queryTop() const; + void setQueryTop(int queryTop); + + RRuleType rruleType() const; + void setRruleType(const RRuleType &rruleType); + +private: + QString m_key; //查询关键字,如果查询类型为日程ID,则表示日程ID + int m_queryTop; //查询范围内前多少个日程 + RRuleType m_rruleType; //查询对应重复规则的日程 + QueryType m_queryType; //查询的类型 + QDateTime m_dtStart; //查询的起始时间 + QDateTime m_dtEnd; //查询的截止时间 +}; + +#endif // DSCHEDULEQUERYPAR_H diff -Nru dde-calendar-5.9.1/calendar-common/src/dscheduletype.cpp dde-calendar-5.10.0/calendar-common/src/dscheduletype.cpp --- dde-calendar-5.9.1/calendar-common/src/dscheduletype.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-common/src/dscheduletype.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,436 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "dscheduletype.h" + +#include "daccount.h" +#include "units.h" + +#include +#include +#include +#include + +DScheduleType::DScheduleType() + : DScheduleType("") +{ +} + +DScheduleType::DScheduleType(const QString &accountID) + : m_accountID(accountID) + , m_typeID("") + , m_typeName("") + , m_displayName("") + , m_typePath("") + , m_typeColor(DTypeColor()) + , m_description("") + , m_privilege(None) + , m_showState(Show) + , m_deleted(0) + , m_syncTag(0) +{ +} + +QString DScheduleType::accountID() const +{ + return m_accountID; +} + +void DScheduleType::setAccountID(const QString &accountID) +{ + m_accountID = accountID; +} + +DScheduleType::Privileges DScheduleType::privilege() const +{ + return m_privilege; +} + +void DScheduleType::setPrivilege(const Privileges &privilege) +{ + m_privilege = privilege; +} + +DTypeColor DScheduleType::typeColor() const +{ + return m_typeColor; +} + +void DScheduleType::setTypeColor(const DTypeColor &typeColor) +{ + m_typeColor = typeColor; +} + +void DScheduleType::setColorID(const QString &colorID) +{ + m_typeColor.setColorID(colorID); +} + +QString DScheduleType::getColorID() const +{ + return m_typeColor.colorID(); +} + +void DScheduleType::setColorCode(const QString &colorCode) +{ + m_typeColor.setColorCode(colorCode); +} + +QString DScheduleType::getColorCode() const +{ + return m_typeColor.colorCode(); +} + +QString DScheduleType::typeID() const +{ + return m_typeID; +} + +void DScheduleType::setTypeID(const QString &typeID) +{ + m_typeID = typeID; +} + +QString DScheduleType::displayName() const +{ + return m_displayName; +} + +void DScheduleType::setDisplayName(const QString &displayName) +{ + m_displayName = displayName; +} + +DScheduleType::ShowState DScheduleType::showState() const +{ + return m_showState; +} + +void DScheduleType::setShowState(const ShowState &showState) +{ + m_showState = showState; +} + +QString DScheduleType::typeName() const +{ + return m_typeName; +} + +void DScheduleType::setTypeName(const QString &typeName) +{ + m_typeName = typeName; +} + +QString DScheduleType::typePath() const +{ + return m_typePath; +} + +void DScheduleType::setTypePath(const QString &typePath) +{ + m_typePath = typePath; +} + +QString DScheduleType::description() const +{ + return m_description; +} + +void DScheduleType::setDescription(const QString &description) +{ + m_description = description; +} + +QDateTime DScheduleType::dtCreate() const +{ + return m_dtCreate; +} + +void DScheduleType::setDtCreate(const QDateTime &dtCreate) +{ + m_dtCreate = dtCreate; +} + +QDateTime DScheduleType::dtUpdate() const +{ + return m_dtUpdate; +} + +void DScheduleType::setDtUpdate(const QDateTime &dtUpdate) +{ + m_dtUpdate = dtUpdate; +} + +QDateTime DScheduleType::dtDelete() const +{ + return m_dtDelete; +} + +void DScheduleType::setDtDelete(const QDateTime &dtDelete) +{ + m_dtDelete = dtDelete; +} + +int DScheduleType::deleted() const +{ + return m_deleted; +} + +void DScheduleType::setDeleted(int deleted) +{ + m_deleted = deleted; +} + +bool DScheduleType::fromJsonString(DScheduleType::Ptr &scheduleType, const QString &jsonStr) +{ + if (scheduleType.isNull()) { + scheduleType = DScheduleType::Ptr(new DScheduleType); + } + //反序列化 + QJsonParseError jsonError; + QJsonDocument jsonDoc(QJsonDocument::fromJson(jsonStr.toLocal8Bit(), &jsonError)); + if (jsonError.error != QJsonParseError::NoError) { + qWarning() << "error:" << jsonError.errorString(); + return false; + } + QJsonObject rootObj = jsonDoc.object(); + if (rootObj.contains("accountID")) { + scheduleType->setAccountID(rootObj.value("accountID").toString()); + } + + if (rootObj.contains("typeID")) { + scheduleType->setTypeID(rootObj.value("typeID").toString()); + } + + if (rootObj.contains("typeName")) { + scheduleType->setTypeName(rootObj.value("typeName").toString()); + } + + if (rootObj.contains("displayName")) { + scheduleType->setDisplayName(rootObj.value("displayName").toString()); + } + + if (rootObj.contains("typePath")) { + scheduleType->setTypePath(rootObj.value("typePath").toString()); + } + + if (rootObj.contains("TypeColor")) { + QJsonObject colorObject = rootObj.value("TypeColor").toObject(); + DTypeColor typeColor; + if (colorObject.contains("colorID")) { + typeColor.setColorID(colorObject.value("colorID").toString()); + } + if (colorObject.contains("colorCode")) { + typeColor.setColorCode(colorObject.value("colorCode").toString()); + } + if (colorObject.contains("privilege")) { + typeColor.setPrivilege(static_cast(colorObject.value("privilege").toInt())); + } + scheduleType->setTypeColor(typeColor); + } + + if (rootObj.contains("description")) { + scheduleType->setDescription(rootObj.value("description").toString()); + } + + if (rootObj.contains("privilege")) { + scheduleType->setPrivilege(static_cast(rootObj.value("privilege").toInt())); + } + + if (rootObj.contains("dtCreate")) { + scheduleType->setDtCreate(QDateTime::fromString(rootObj.value("dtCreate").toString(), Qt::ISODate)); + } + + if (rootObj.contains("dtDelete")) { + scheduleType->setDtDelete(QDateTime::fromString(rootObj.value("dtDelete").toString(), Qt::ISODate)); + } + + if (rootObj.contains("dtUpdate")) { + scheduleType->setDtUpdate(QDateTime::fromString(rootObj.value("dtUpdate").toString(), Qt::ISODate)); + } + + if (rootObj.contains("showState")) { + scheduleType->setShowState(static_cast(rootObj.value("showState").toInt())); + } + + if (rootObj.contains("isDeleted")) { + scheduleType->setDeleted(rootObj.value("isDeleted").toInt()); + } + return true; +} + +bool DScheduleType::toJsonString(const DScheduleType::Ptr &scheduleType, QString &jsonStr) +{ + if (scheduleType.isNull()) { + qWarning() << "hold a reference to a null pointer."; + return false; + } + //序列化 + QJsonObject rootObject; + rootObject.insert("accountID", scheduleType->accountID()); + rootObject.insert("typeID", scheduleType->typeID()); + rootObject.insert("typeName", scheduleType->typeName()); + rootObject.insert("displayName", scheduleType->displayName()); + rootObject.insert("typePath", scheduleType->typePath()); + //类型颜色信息 + QJsonObject colorObject; + colorObject.insert("colorID", scheduleType->typeColor().colorID()); + colorObject.insert("colorCode", scheduleType->typeColor().colorCode()); + colorObject.insert("privilege", scheduleType->typeColor().privilege()); + rootObject.insert("TypeColor", colorObject); + + rootObject.insert("description", scheduleType->description()); + rootObject.insert("privilege", int(scheduleType->privilege())); + rootObject.insert("dtCreate", dtToString(scheduleType->dtCreate())); + rootObject.insert("dtDelete", dtToString(scheduleType->dtDelete())); + rootObject.insert("dtUpdate", dtToString(scheduleType->dtUpdate())); + rootObject.insert("showState", scheduleType->showState()); + rootObject.insert("isDeleted", scheduleType->deleted()); + + QJsonDocument jsonDoc; + jsonDoc.setObject(rootObject); + jsonStr = QString::fromUtf8(jsonDoc.toJson(QJsonDocument::Compact)); + return true; +} + +bool DScheduleType::fromJsonListString(DScheduleType::List &stList, const QString &jsonStr) +{ + QJsonParseError jsonError; + QJsonDocument jsonDoc(QJsonDocument::fromJson(jsonStr.toLocal8Bit(), &jsonError)); + if (jsonError.error != QJsonParseError::NoError) { + qWarning() << "error:" << jsonError.errorString(); + return false; + } + QJsonObject rootObj = jsonDoc.object(); + if (rootObj.contains("scheduleType")) { + QJsonArray jsonArray = rootObj.value("scheduleType").toArray(); + for (auto ja : jsonArray) { + QJsonObject typeObject = ja.toObject(); + DScheduleType::Ptr scheduleType = DScheduleType::Ptr(new DScheduleType); + if (typeObject.contains("accountID")) { + scheduleType->setAccountID(typeObject.value("accountID").toString()); + } + + if (typeObject.contains("typeID")) { + scheduleType->setTypeID(typeObject.value("typeID").toString()); + } + + if (typeObject.contains("typeName")) { + scheduleType->setTypeName(typeObject.value("typeName").toString()); + } + + if (typeObject.contains("displayName")) { + scheduleType->setDisplayName(typeObject.value("displayName").toString()); + } + + if (typeObject.contains("typePath")) { + scheduleType->setTypePath(typeObject.value("typePath").toString()); + } + + if (typeObject.contains("TypeColor")) { + QJsonObject colorObject = typeObject.value("TypeColor").toObject(); + DTypeColor typeColor; + if (colorObject.contains("colorID")) { + typeColor.setColorID(colorObject.value("colorID").toString()); + } + if (colorObject.contains("colorCode")) { + typeColor.setColorCode(colorObject.value("colorCode").toString()); + } + if (colorObject.contains("privilege")) { + typeColor.setPrivilege(static_cast(colorObject.value("privilege").toInt())); + } + scheduleType->setTypeColor(typeColor); + } + + if (typeObject.contains("description")) { + scheduleType->setDescription(typeObject.value("description").toString()); + } + + if (typeObject.contains("privilege")) { + scheduleType->setPrivilege(static_cast(typeObject.value("privilege").toInt())); + } + + if (typeObject.contains("dtCreate")) { + scheduleType->setDtCreate(QDateTime::fromString(typeObject.value("dtCreate").toString(), Qt::ISODate)); + } + + if (typeObject.contains("dtDelete")) { + scheduleType->setDtDelete(QDateTime::fromString(typeObject.value("dtDelete").toString(), Qt::ISODate)); + } + + if (typeObject.contains("dtUpdate")) { + scheduleType->setDtUpdate(QDateTime::fromString(typeObject.value("dtUpdate").toString(), Qt::ISODate)); + } + + if (typeObject.contains("showState")) { + scheduleType->setShowState(static_cast(typeObject.value("showState").toInt())); + } + + if (typeObject.contains("isDeleted")) { + scheduleType->setDeleted(typeObject.value("isDeleted").toInt()); + } + stList.append(scheduleType); + } + } + return true; +} + +bool DScheduleType::toJsonListString(const DScheduleType::List &stList, QString &jsonStr) +{ + //序列化 + QJsonObject rootObject; + QJsonArray jsonArray; + + for (auto &scheduleType : stList) { + QJsonObject typeObject; + typeObject.insert("accountID", scheduleType->accountID()); + typeObject.insert("typeID", scheduleType->typeID()); + typeObject.insert("typeName", scheduleType->typeName()); + typeObject.insert("displayName", scheduleType->displayName()); + typeObject.insert("typePath", scheduleType->typePath()); + //类型颜色信息 + QJsonObject colorObject; + colorObject.insert("colorID", scheduleType->typeColor().colorID()); + colorObject.insert("colorCode", scheduleType->typeColor().colorCode()); + colorObject.insert("privilege", scheduleType->typeColor().privilege()); + typeObject.insert("TypeColor", colorObject); + + typeObject.insert("description", scheduleType->description()); + typeObject.insert("privilege", int(scheduleType->privilege())); + typeObject.insert("dtCreate", dtToString(scheduleType->dtCreate())); + typeObject.insert("dtDelete", dtToString(scheduleType->dtDelete())); + typeObject.insert("dtUpdate", dtToString(scheduleType->dtUpdate())); + typeObject.insert("showState", scheduleType->showState()); + typeObject.insert("isDeleted", scheduleType->deleted()); + jsonArray.append(typeObject); + } + rootObject.insert("scheduleType", jsonArray); + QJsonDocument jsonDoc; + jsonDoc.setObject(rootObject); + jsonStr = QString::fromUtf8(jsonDoc.toJson(QJsonDocument::Compact)); + return true; +} + +int DScheduleType::syncTag() const +{ + return m_syncTag; +} + +void DScheduleType::setSyncTag(int syncTag) +{ + m_syncTag = syncTag; +} + +bool operator<(const DScheduleType::Ptr &st1, const DScheduleType::Ptr &st2) +{ + //权限不一致权限小的排在前面 + if (st1->privilege() != st2->privilege()) { + return st1->privilege() < st2->privilege(); + } + //权限一一致的创建时间早的排在前面 + if (st1->dtCreate() != st2->dtCreate()) { + return st1->dtCreate() < st2->dtCreate(); + } + return true; +} diff -Nru dde-calendar-5.9.1/calendar-common/src/dscheduletype.h dde-calendar-5.10.0/calendar-common/src/dscheduletype.h --- dde-calendar-5.9.1/calendar-common/src/dscheduletype.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-common/src/dscheduletype.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,115 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef DSCHEDULEYPE_H +#define DSCHEDULEYPE_H + +#include "dtypecolor.h" + +#include +#include +#include +#include +#include + +class DAccount; +//日程类型 +class DScheduleType +{ +public: + enum Privilege { + None = 0x0, //不可读不可写 + Read = 0x1, //可读 + Write = 0x2, //可编辑 + Delete = 0x4, //可删除 + System = Read, //系统权限 + User = Read | Write | Delete, //用户权限 + }; + Q_DECLARE_FLAGS(Privileges, Privilege) + + enum ShowState { + Hide, //日程隐藏 + Show, //日程显示 + }; + + typedef QSharedPointer Ptr; + typedef QVector List; + + DScheduleType(); + explicit DScheduleType(const QString &accountID); + QString accountID() const; + void setAccountID(const QString &accountID); + + Privileges privilege() const; + void setPrivilege(const Privileges &privilege); + + DTypeColor typeColor() const; + void setTypeColor(const DTypeColor &typeColor); + + void setColorID(const QString &colorID); + QString getColorID() const; + void setColorCode(const QString &colorCode); + QString getColorCode() const; + + QString typeID() const; + void setTypeID(const QString &typeID); + + QString displayName() const; + void setDisplayName(const QString &displayName); + + ShowState showState() const; + void setShowState(const ShowState &showState); + + QString typeName() const; + void setTypeName(const QString &typeName); + + QString typePath() const; + void setTypePath(const QString &typePath); + + QString description() const; + void setDescription(const QString &description); + + QDateTime dtCreate() const; + void setDtCreate(const QDateTime &dtCreate); + + QDateTime dtUpdate() const; + void setDtUpdate(const QDateTime &dtUpdate); + + QDateTime dtDelete() const; + void setDtDelete(const QDateTime &dtDelete); + + int deleted() const; + void setDeleted(int deleted); + + static bool fromJsonString(DScheduleType::Ptr &scheduleType, const QString &jsonStr); + static bool toJsonString(const DScheduleType::Ptr &scheduleType, QString &jsonStr); + static bool fromJsonListString(DScheduleType::List &stList, const QString &jsonStr); + static bool toJsonListString(const DScheduleType::List &stList, QString &jsonStr); + + int syncTag() const; + void setSyncTag(int syncTag); + + friend bool operator<(const DScheduleType::Ptr &st1, const DScheduleType::Ptr &st2); + +private: + QString m_accountID; + QString m_typeID; + QString m_typeName; //类型名称 + QString m_displayName; //类型显示名称 + QString m_typePath; //类型云端路径 + DTypeColor m_typeColor; //相关颜色信息 + QString m_description; //类型相关描述 + Privileges m_privilege; //类型权限 + QDateTime m_dtCreate; //创建时间 + QDateTime m_dtUpdate; //更新时间 + QDateTime m_dtDelete; //删除时间 + ShowState m_showState; //类型下日程显示状态 + int m_deleted; //是否被删除 + int m_syncTag; //同步标识 +}; + +Q_DECLARE_METATYPE(DScheduleType) +Q_DECLARE_OPERATORS_FOR_FLAGS(DScheduleType::Privileges) + +#endif // DSCHEDULEYPE_H diff -Nru dde-calendar-5.9.1/calendar-common/src/dtypecolor.cpp dde-calendar-5.10.0/calendar-common/src/dtypecolor.cpp --- dde-calendar-5.9.1/calendar-common/src/dtypecolor.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-common/src/dtypecolor.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,135 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "dtypecolor.h" + +#include "units.h" + +#include +#include +#include +#include + +DTypeColor::DTypeColor() + : m_colorID("") + , m_colorCode("") + , m_privilege(PriUser) +{ +} + +DTypeColor::DTypeColor(const DTypeColor &typeColor) + : m_colorID(typeColor.colorID()) + , m_colorCode(typeColor.colorCode()) + , m_privilege(typeColor.privilege()) + , m_dtCreate(typeColor.dtCreate()) +{ +} + +QString DTypeColor::colorCode() const +{ + return m_colorCode; +} + +void DTypeColor::setColorCode(const QString &colorCode) +{ + m_colorCode = colorCode; +} + +QString DTypeColor::colorID() const +{ + return m_colorID; +} + +void DTypeColor::setColorID(const QString &colorID) +{ + m_colorID = colorID; +} + +DTypeColor::Privilege DTypeColor::privilege() const +{ + return m_privilege; +} + +void DTypeColor::setPrivilege(const Privilege &privilege) +{ + m_privilege = privilege; +} + +bool DTypeColor::isSysColorInfo() +{ + return this->privilege() == PriSystem; +} + +bool DTypeColor::operator!=(const DTypeColor &color) const +{ + return this->colorID() != color.colorID() || this->colorCode() != this->colorCode() || this->privilege() != this->privilege(); +} + +DTypeColor::List DTypeColor::fromJsonString(const QString &colorJson) +{ + DTypeColor::List colorList; + QJsonParseError jsonError; + QJsonDocument jsonDoc(QJsonDocument::fromJson(colorJson.toLocal8Bit(), &jsonError)); + if (jsonError.error != QJsonParseError::NoError) { + qWarning() << "error:" << jsonError.errorString(); + return colorList; + } + QJsonArray rootArr = jsonDoc.array(); + foreach (auto json, rootArr) { + QJsonObject colorObj = json.toObject(); + DTypeColor::Ptr typeColor = DTypeColor::Ptr(new DTypeColor); + if (colorObj.contains("colorID")) { + typeColor->setColorID(colorObj.value("colorID").toString()); + } + if (colorObj.contains("colorCode")) { + typeColor->setColorCode(colorObj.value("colorCode").toString()); + } + if (colorObj.contains("privilege")) { + typeColor->setPrivilege(static_cast(colorObj.value("privilege").toInt())); + } + if (colorObj.contains("dtCreate")) { + typeColor->setDtCreate(dtFromString(colorObj.value("dtCreate").toString())); + } + colorList.append(typeColor); + } + return colorList; +} + +QString DTypeColor::toJsonString(const DTypeColor::List &colorList) +{ + QJsonArray rootArr; + foreach (auto color, colorList) { + QJsonObject colorObj; + colorObj.insert("colorID", color->colorID()); + colorObj.insert("colorCode", color->colorCode()); + colorObj.insert("privilege", color->privilege()); + colorObj.insert("dtCreate", dtToString(color->dtCreate())); + rootArr.append(colorObj); + } + QJsonDocument jsonDoc; + jsonDoc.setArray(rootArr); + return QString::fromUtf8(jsonDoc.toJson(QJsonDocument::Compact)); +} + +QDateTime DTypeColor::dtCreate() const +{ + return m_dtCreate; +} + +void DTypeColor::setDtCreate(const QDateTime &dtCreate) +{ + m_dtCreate = dtCreate; +} + +bool operator<(const DTypeColor::Ptr &tc1, const DTypeColor::Ptr &tc2) +{ + if (tc1->privilege() != tc2->privilege()) { + return tc1->privilege() < tc2->privilege(); + } + + if (tc1->dtCreate() != tc2->dtCreate()) { + return tc1->dtCreate() < tc2->dtCreate(); + } + return true; +} diff -Nru dde-calendar-5.9.1/calendar-common/src/dtypecolor.h dde-calendar-5.10.0/calendar-common/src/dtypecolor.h --- dde-calendar-5.9.1/calendar-common/src/dtypecolor.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-common/src/dtypecolor.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,61 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef DTYPECOLOR_H +#define DTYPECOLOR_H + +#include +#include +#include +#include + +/** + * @brief The DTypeColor class + * 类型颜色 + */ +class DTypeColor +{ +public: + //用户自定义的可读可编辑 + //系统默认只读 + enum Privilege { + PriSystem = 1, //系统默认 + PriUser = 7 //用户自定义 + }; + + typedef QSharedPointer Ptr; + typedef QVector List; + + DTypeColor(); + DTypeColor(const DTypeColor &typeColor); + + QString colorCode() const; + void setColorCode(const QString &colorCode); + + QString colorID() const; + void setColorID(const QString &colorID); + + Privilege privilege() const; + void setPrivilege(const Privilege &privilege); + + bool isSysColorInfo(); + + bool operator!=(const DTypeColor &color) const; + + static List fromJsonString(const QString &colorJson); + static QString toJsonString(const List &colorList); + + QDateTime dtCreate() const; + void setDtCreate(const QDateTime &dtCreate); + + friend bool operator<(const DTypeColor::Ptr &tc1, const DTypeColor::Ptr &tc2); + +private: + QString m_colorID; + QString m_colorCode; //颜色码 + Privilege m_privilege; + QDateTime m_dtCreate; +}; + +#endif // DTYPECOLOR_H diff -Nru dde-calendar-5.9.1/calendar-common/src/huangliData/dbusdatastruct.cpp dde-calendar-5.10.0/calendar-common/src/huangliData/dbusdatastruct.cpp --- dde-calendar-5.9.1/calendar-common/src/huangliData/dbusdatastruct.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-common/src/huangliData/dbusdatastruct.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,317 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "dbusdatastruct.h" + +#include +#include +#include + +void CaLunarDayInfo::registerMetaType() +{ + qRegisterMetaType(); + qDBusRegisterMetaType(); +} + +QDebug operator<<(QDebug argument, const CaLunarDayInfo &what) +{ + argument << what.mGanZhiYear << what.mGanZhiMonth << what.mGanZhiDay; + argument << what.mLunarMonthName << what.mLunarDayName; + argument << what.mLunarLeapMonth; + argument << what.mZodiac << what.mTerm; + argument << what.mSolarFestival << what.mLunarFestival; + argument << what.mWorktime; + + return argument; +} + +QDBusArgument &operator<<(QDBusArgument &argument, const CaLunarDayInfo &what) +{ + argument.beginStructure(); + argument << what.mGanZhiYear << what.mGanZhiMonth << what.mGanZhiDay; + argument << what.mLunarMonthName << what.mLunarDayName; + argument << what.mLunarLeapMonth; + argument << what.mZodiac << what.mTerm; + argument << what.mSolarFestival << what.mLunarFestival; + argument << what.mWorktime; + argument.endStructure(); + + return argument; +} + +const QDBusArgument &operator>>(const QDBusArgument &argument, CaLunarDayInfo &what) +{ + argument.beginStructure(); + argument >> what.mGanZhiYear >> what.mGanZhiMonth >> what.mGanZhiDay; + argument >> what.mLunarMonthName >> what.mLunarDayName; + argument >> what.mLunarLeapMonth; + argument >> what.mZodiac >> what.mTerm; + argument >> what.mSolarFestival >> what.mLunarFestival; + argument >> what.mWorktime; + argument.endStructure(); + + return argument; +} + +void CaLunarMonthInfo::registerMetaType() +{ + qRegisterMetaType(); + qDBusRegisterMetaType(); +} + +QDebug operator<<(QDebug argument, const CaLunarMonthInfo &what) +{ + argument << what.mFirstDayWeek << what.mDays; + argument << what.mCaLunarDayInfo; + + return argument; +} + +QDBusArgument &operator<<(QDBusArgument &argument, const CaLunarMonthInfo &what) +{ + argument.beginStructure(); + argument << what.mFirstDayWeek << what.mDays; + argument << what.mCaLunarDayInfo; + argument.endStructure(); + + return argument; +} + +const QDBusArgument &operator>>(const QDBusArgument &argument, CaLunarMonthInfo &what) +{ + argument.beginStructure(); + argument >> what.mFirstDayWeek >> what.mDays; + argument >> what.mCaLunarDayInfo; + argument.endStructure(); + + return argument; +} + +void CaHuangLiDayInfo::registerMetaType() +{ + qRegisterMetaType(); + qDBusRegisterMetaType(); +} + +QString CaHuangLiDayInfo::toJson() +{ + QJsonDocument doc; + QJsonObject obj; + + obj.insert("Suit", mSuit); + obj.insert("Avoid", mAvoid); + obj.insert("Worktime", mWorktime); + obj.insert("LunarFestival", mLunarFestival); + obj.insert("SolarFestival", mSolarFestival); + obj.insert("Term", mTerm); + obj.insert("Zodiac", mZodiac); + obj.insert("LunarLeapMonth", mLunarLeapMonth); + obj.insert("LunarDayName", mLunarDayName); + obj.insert("LunarMonthName", mLunarMonthName); + obj.insert("GanZhiDay", mGanZhiDay); + obj.insert("GanZhiMonth", mGanZhiMonth); + obj.insert("GanZhiYear", mGanZhiYear); + + doc.setObject(obj); + QString strJson = QString::fromUtf8(doc.toJson(QJsonDocument::Compact)); + return strJson; +} + +void CaHuangLiDayInfo::strJsonToInfo(const QString &strJson, bool &isVaild) +{ + isVaild = true; + QJsonParseError json_error; + QJsonDocument jsonDoc(QJsonDocument::fromJson(strJson.toLocal8Bit(), &json_error)); + if (json_error.error != QJsonParseError::NoError) { + isVaild = false; + return ; + } + QJsonObject rootObj = jsonDoc.object(); + jsonObjectToInfo(rootObj); +} + +void CaHuangLiDayInfo::jsonObjectToInfo(const QJsonObject &jsonObject) +{ + //因为是预先定义好的JSON数据格式,所以这里可以这样读取int + if (jsonObject.contains("Suit")) { + this->mSuit = jsonObject.value("Suit").toString(); + } + if (jsonObject.contains("Avoid")) { + this->mAvoid = jsonObject.value("Avoid").toString(); + } + if (jsonObject.contains("Worktime")) { + this->mWorktime = jsonObject.value("Worktime").toInt(); + } + if (jsonObject.contains("LunarFestival")) { + this->mLunarFestival = jsonObject.value("LunarFestival").toString(); + } + if (jsonObject.contains("SolarFestival")) { + this->mSolarFestival = jsonObject.value("SolarFestival").toString(); + } + if (jsonObject.contains("Term")) { + this->mTerm = jsonObject.value("Term").toString(); + } + if (jsonObject.contains("Zodiac")) { + this->mZodiac = jsonObject.value("Zodiac").toString(); + } + if (jsonObject.contains("LunarLeapMonth")) { + this->mLunarLeapMonth = jsonObject.value("LunarLeapMonth").toInt(); + } + if (jsonObject.contains("LunarDayName")) { + this->mLunarDayName = jsonObject.value("LunarDayName").toString(); + } + if (jsonObject.contains("LunarMonthName")) { + this->mLunarMonthName = jsonObject.value("LunarMonthName").toString(); + } + if (jsonObject.contains("GanZhiDay")) { + this->mGanZhiDay = jsonObject.value("GanZhiDay").toString(); + } + if (jsonObject.contains("GanZhiMonth")) { + this->mGanZhiMonth = jsonObject.value("GanZhiMonth").toString(); + } + if (jsonObject.contains("GanZhiYear")) { + this->mGanZhiYear = jsonObject.value("GanZhiYear").toString(); + } +} + +QDebug operator<<(QDebug argument, const CaHuangLiDayInfo &what) +{ + argument << what.mSuit << what.mAvoid; + argument << what.mWorktime; + argument << what.mLunarFestival << what.mSolarFestival; + argument << what.mTerm << what.mZodiac; + argument << what.mLunarLeapMonth; + argument << what.mLunarDayName << what.mLunarMonthName; + argument << what.mGanZhiDay << what.mGanZhiMonth << what.mGanZhiYear; + return argument; +} + +QDBusArgument &operator<<(QDBusArgument &argument, const CaHuangLiDayInfo &what) +{ + argument.beginStructure(); + argument << what.mSuit << what.mAvoid; + argument << what.mWorktime; + argument << what.mLunarFestival << what.mSolarFestival; + argument << what.mTerm << what.mZodiac; + argument << what.mLunarLeapMonth; + argument << what.mLunarDayName << what.mLunarMonthName; + argument << what.mGanZhiDay << what.mGanZhiMonth << what.mGanZhiYear; + argument.endStructure(); + return argument; +} + +const QDBusArgument &operator>>(const QDBusArgument &argument, CaHuangLiDayInfo &what) +{ + argument.beginStructure(); + argument >> what.mSuit >> what.mAvoid; + argument >> what.mWorktime; + argument >> what.mLunarFestival >> what.mSolarFestival; + argument >> what.mTerm >> what.mZodiac; + argument >> what.mLunarLeapMonth; + argument >> what.mLunarDayName >> what.mLunarMonthName; + argument >> what.mGanZhiDay >> what.mGanZhiMonth >> what.mGanZhiYear; + argument.endStructure(); + return argument; +} + +void CaHuangLiMonthInfo::registerMetaType() +{ + qRegisterMetaType(); + qDBusRegisterMetaType(); +} + +QString CaHuangLiMonthInfo::toJson() +{ + QJsonArray daysarr; + QJsonDocument doc; + QJsonObject obj; + obj.insert("Days", mDays); + obj.insert("FirstDayWeek", mFirstDayWeek); + foreach (CaHuangLiDayInfo dayinfo, mCaLunarDayInfo) { + QJsonObject dayobj; + dayobj.insert("Suit", dayinfo.mSuit); + dayobj.insert("Avoid", dayinfo.mAvoid); + dayobj.insert("Worktime", dayinfo.mWorktime); + dayobj.insert("LunarFestival", dayinfo.mLunarFestival); + dayobj.insert("SolarFestival", dayinfo.mSolarFestival); + dayobj.insert("Term", dayinfo.mTerm); + dayobj.insert("Zodiac", dayinfo.mZodiac); + dayobj.insert("LunarLeapMonth", dayinfo.mLunarLeapMonth); + dayobj.insert("LunarDayName", dayinfo.mLunarDayName); + dayobj.insert("LunarMonthName", dayinfo.mLunarMonthName); + dayobj.insert("GanZhiDay", dayinfo.mGanZhiDay); + dayobj.insert("GanZhiMonth", dayinfo.mGanZhiMonth); + dayobj.insert("GanZhiYear", dayinfo.mGanZhiYear); + daysarr.append(dayobj); + } + obj.insert("Datas", daysarr); + doc.setObject(obj); + QString strJson = QString::fromUtf8(doc.toJson(QJsonDocument::Compact)); + return strJson; +} + +void CaHuangLiMonthInfo::strJsonToInfo(const QString &strJson, bool &isVaild) +{ + isVaild = true; + QJsonParseError json_error; + QJsonDocument jsonDoc(QJsonDocument::fromJson(strJson.toLocal8Bit(), &json_error)); + + if (json_error.error != QJsonParseError::NoError) { + isVaild = false; + return; + } + + QJsonObject rootObj = jsonDoc.object(); + + //因为是预先定义好的JSON数据格式,所以这里可以这样读取 + if (rootObj.contains("Days")) { + this->mDays = rootObj.value("Days").toInt(); + } + if (rootObj.contains("FirstDayWeek")) { + this->mFirstDayWeek = rootObj.value("FirstDayWeek").toInt(); + } + if (rootObj.contains("Datas")) { + QJsonArray subArray = rootObj.value("Datas").toArray(); + for (int i = 0; i < subArray.size(); i++) { + QJsonObject subObj = subArray.at(i).toObject(); + CaHuangLiDayInfo huangliday; + huangliday.jsonObjectToInfo(subObj); + this->mCaLunarDayInfo.append(huangliday); + } + } +} + +void CaHuangLiMonthInfo::clear() +{ + this->mDays = 0; + this->mCaLunarDayInfo.clear(); +} + +QDebug operator<<(QDebug argument, const CaHuangLiMonthInfo &what) +{ + argument << what.mDays << what.mFirstDayWeek; + argument << what.mCaLunarDayInfo; + + return argument; +} + +QDBusArgument &operator<<(QDBusArgument &argument, const CaHuangLiMonthInfo &what) +{ + argument.beginStructure(); + argument << what.mDays << what.mFirstDayWeek; + argument << what.mCaLunarDayInfo; + argument.endStructure(); + + return argument; +} + +const QDBusArgument &operator>>(const QDBusArgument &argument, CaHuangLiMonthInfo &what) +{ + argument.beginStructure(); + argument >> what.mDays >> what.mFirstDayWeek; + argument >> what.mCaLunarDayInfo; + argument.endStructure(); + + return argument; +} diff -Nru dde-calendar-5.9.1/calendar-common/src/huangliData/dbusdatastruct.h dde-calendar-5.10.0/calendar-common/src/huangliData/dbusdatastruct.h --- dde-calendar-5.9.1/calendar-common/src/huangliData/dbusdatastruct.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-common/src/huangliData/dbusdatastruct.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,139 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef DBUSDATASTRUCT_H +#define DBUSDATASTRUCT_H + +#include +#include + +class CaLunarDayInfo +{ +public: + CaLunarDayInfo() + : mGanZhiYear("") + , mGanZhiMonth("") + , mGanZhiDay("") + , mLunarMonthName("") + , mLunarDayName("") + , mLunarLeapMonth(0) + , mZodiac("") + , mTerm("") + , mSolarFestival("") + , mLunarFestival("") + , mWorktime(0) + { + } + + static void registerMetaType(); + + friend QDebug operator<<(QDebug argument, const CaLunarDayInfo &what); + friend QDBusArgument &operator<<(QDBusArgument &argument, const CaLunarDayInfo &what); + friend const QDBusArgument &operator>>(const QDBusArgument &argument, CaLunarDayInfo &what); + +public: + QString mGanZhiYear; // 农历年的干支 + QString mGanZhiMonth; // 农历月的干支 + QString mGanZhiDay; // 农历日的干支 + QString mLunarMonthName; // 农历月名 + QString mLunarDayName; // 农历日名 + qint32 mLunarLeapMonth; // 未使用 + QString mZodiac; // 农历年的生肖 + QString mTerm; // 农历节气 + QString mSolarFestival; // 公历节日 + QString mLunarFestival; // 农历节日 + qint32 mWorktime; // 未使用 +}; + +class CaLunarMonthInfo +{ +public: + CaLunarMonthInfo() + : mFirstDayWeek(0) + , mDays(0) + { + } + + static void registerMetaType(); + + friend QDebug operator<<(QDebug argument, const CaLunarMonthInfo &what); + friend QDBusArgument &operator<<(QDBusArgument &argument, const CaLunarMonthInfo &what); + friend const QDBusArgument &operator>>(const QDBusArgument &argument, CaLunarMonthInfo &what); + +public: + qint32 mFirstDayWeek; + qint32 mDays; + QList mCaLunarDayInfo; +}; + +class CaHuangLiDayInfo +{ +public: + CaHuangLiDayInfo() + : mGanZhiYear("") + , mGanZhiMonth("") + , mGanZhiDay("") + , mLunarMonthName("") + , mLunarDayName("") + , mLunarLeapMonth(0) + , mZodiac("") + , mTerm("") + , mSolarFestival("") + , mLunarFestival("") + , mWorktime(0) + , mSuit("") + , mAvoid("") + { + } + static void registerMetaType(); + friend QDebug operator<<(QDebug argument, const CaHuangLiDayInfo &what); + friend QDBusArgument &operator<<(QDBusArgument &argument, const CaHuangLiDayInfo &what); + friend const QDBusArgument &operator>>(const QDBusArgument &argument, CaHuangLiDayInfo &what); + QString toJson(); + void strJsonToInfo(const QString &strJson, bool &isVaild); + void jsonObjectToInfo(const QJsonObject &jsonObject); +public: + QString mGanZhiYear; //年干支 + QString mGanZhiMonth; //月干支 + QString mGanZhiDay; //日干支 + QString mLunarMonthName; //农历月名称 + QString mLunarDayName; //农历日名称 + qint32 mLunarLeapMonth; //闰月 + QString mZodiac; //生肖 + QString mTerm; //农历节气 + QString mSolarFestival; //阳历节日 + QString mLunarFestival; //农历节日 + qint32 mWorktime; //未使用 + QString mSuit; //黄历宜 + QString mAvoid; //黄历忌 +}; + +class CaHuangLiMonthInfo +{ +public: + CaHuangLiMonthInfo() + : mFirstDayWeek(0) + , mDays(0) + { + } + static void registerMetaType(); + + friend QDebug operator<<(QDebug argument, const CaHuangLiMonthInfo &what); + friend QDBusArgument &operator<<(QDBusArgument &argument, const CaHuangLiMonthInfo &what); + friend const QDBusArgument &operator>>(const QDBusArgument &argument, CaHuangLiMonthInfo &what); + QString toJson(); + void strJsonToInfo(const QString &strJson, bool &isVaild); + void clear(); +public: + qint32 mFirstDayWeek; //第一天所在周 + qint32 mDays; //每月天数 + QVector mCaLunarDayInfo; +}; + +Q_DECLARE_METATYPE(CaLunarDayInfo) +Q_DECLARE_METATYPE(CaLunarMonthInfo) +Q_DECLARE_METATYPE(CaHuangLiDayInfo) +Q_DECLARE_METATYPE(CaHuangLiMonthInfo) + +#endif // DBUSDATASTRUCT_H diff -Nru dde-calendar-5.9.1/calendar-common/src/huangliData/lunardatastruct.cpp dde-calendar-5.10.0/calendar-common/src/huangliData/lunardatastruct.cpp --- dde-calendar-5.9.1/calendar-common/src/huangliData/lunardatastruct.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-common/src/huangliData/lunardatastruct.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,5 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "lunardatastruct.h" diff -Nru dde-calendar-5.9.1/calendar-common/src/huangliData/lunardatastruct.h dde-calendar-5.10.0/calendar-common/src/huangliData/lunardatastruct.h --- dde-calendar-5.9.1/calendar-common/src/huangliData/lunardatastruct.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-common/src/huangliData/lunardatastruct.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,32 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef LUNARDATASTRUCT_H +#define LUNARDATASTRUCT_H +#include +#include +#include + +typedef struct HuangLi { + qint64 ID = 0; // `json:"id"` // format: ("%s%02s%02s", year, month, day) + QString Avoid {}; // `json:"avoid"` + QString Suit {}; //`json:"suit"` +} stHuangLi; + +typedef struct _tagHolidayInfo { + QDate date; + char status {}; +} HolidayInfo; + +typedef struct _tagFestivalInfo { + QString ID {}; + QString FestivalName {}; + QString description {}; + QString Rest {}; + int month = 0; + int year = 0; + QVector listHoliday {}; +} FestivalInfo; + +#endif // LUNARDATASTRUCT_H diff -Nru dde-calendar-5.9.1/calendar-common/src/units.cpp dde-calendar-5.10.0/calendar-common/src/units.cpp --- dde-calendar-5.9.1/calendar-common/src/units.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-common/src/units.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,65 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "units.h" + +#include +#include +#include + +QString dtToString(const QDateTime &dt) +{ + QTime _offsetTime = QTime(0, 0).addSecs(dt.timeZone().offsetFromUtc(dt)); + return QString("%1+%2").arg(dt.toString("yyyy-MM-ddThh:mm:ss")).arg(_offsetTime.toString("hh:mm")); +} + +QDateTime dtConvert(const QDateTime &datetime) +{ + QDateTime dt = datetime; + dt.setOffsetFromUtc(dt.offsetFromUtc()); + return dt; +} + +QDateTime dtFromString(const QString &st) +{ + QDateTime &&dtSt = QDateTime::fromString(st, Qt::ISODate); + //转换为本地时区 + return QDateTime(dtSt.date(),dtSt.time()); +} + +QString getDBPath() +{ + return getHomeConfigPath().append("/deepin/dde-calendar-service"); +} + +QDate dateFromString(const QString &date) +{ + return QDate::fromString(date, Qt::ISODate); +} + +QString dateToString(const QDate &date) +{ + return date.toString("yyyy-MM-dd"); +} + +bool isChineseEnv() +{ + return QLocale::system().name().startsWith("zh_"); +} + +QString getHomeConfigPath() +{ + //根据环境变量获取config目录 + QString configPath = QString(qgetenv("XDG_CONFIG_HOME")); + if(configPath.trimmed().isEmpty()) { + configPath = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation); + } + return configPath; +} + +bool withinTimeFrame(const QDate &date) +{ + return date.isValid() && (date.year() >= 1900 && date.year() <=2100); +} + diff -Nru dde-calendar-5.9.1/calendar-common/src/units.h dde-calendar-5.10.0/calendar-common/src/units.h --- dde-calendar-5.9.1/calendar-common/src/units.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-common/src/units.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,51 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef UNITS_H +#define UNITS_H + +#include +#include +#include + +const QString serviceBaseName = "com.deepin.dataserver.Calendar"; +const QString serviceBasePath = "/com/deepin/dataserver/Calendar"; +#define accountServiceInterface "com.deepin.dataserver.Calendar.Account" + +static const QMap GTypeColor = { + {"0cecca8a-291b-46e2-bb92-63a527b77d46", "#FF5E97"}, + {"10af78a1-3c25-4744-91db-6fbe5e88083b", "#FF9436"}, + {"263d6c79-32b6-4b00-bf0d-741e50a9550f", "#FFDC00"}, + {"35e70047-98bb-49b9-8ad8-02d1c942f5d0", "#5BDD80"}, + {"406fc0df-87ce-4b3f-b1bc-65d89d791dbc", "#00B99B"}, + {"5bf13e88-e99f-4975-80a8-149fe0a315e3", "#4293FF"}, + {"6cfd1459-1085-47e9-8ca6-379d47ec319a", "#5D51FF"}, + {"70080e96-e68d-40af-9cca-2f41021f6142", "#A950FF"}, + {"8ac5c8bb-55ce-4264-8b0a-5d32116cf983", "#717171"}}; + +QString dtToString(const QDateTime &dt); +QDateTime dtFromString(const QString &st); + +QString dateToString(const QDate &date); +QDate dateFromString(const QString &date); + +//获取新数据库路径 +QString getDBPath(); + +//是否为中文环境 +bool isChineseEnv(); + +//获取家配置目录 +QString getHomeConfigPath(); + +//时间转换 +QDateTime dtConvert(const QDateTime &datetime); + +//是否在显示时间范围内1900-2100 +bool withinTimeFrame(const QDate &date); + +//TODO:获取系统版本(专业版,社区版等) + + +#endif // UNITS_H diff -Nru dde-calendar-5.9.1/calendar-service/assets/data/com.dde.calendarserver.calendar.service dde-calendar-5.10.0/calendar-service/assets/data/com.dde.calendarserver.calendar.service --- dde-calendar-5.9.1/calendar-service/assets/data/com.dde.calendarserver.calendar.service 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/assets/data/com.dde.calendarserver.calendar.service 2023-04-07 06:02:09.000000000 +0000 @@ -5,7 +5,7 @@ [Service] Type = simple -ExecStart = /bin/bash -c "dbus-send --session --print-reply --dest=com.deepin.dataserver.Calendar /com/deepin/dataserver/Calendar com.deepin.dataserver.Calendar.updateRemindJob boolean:false" +ExecStart = /bin/bash -c "dbus-send --session --print-reply --dest=com.deepin.dataserver.Calendar /com/deepin/dataserver/Calendar/AccountManager com.deepin.dataserver.Calendar.AccountManager.updateRemindJob boolean:false" [Install] WantedBy=user-session.target \ No newline at end of file Binary files /tmp/tmpsgbh6un_/K5SEN4W3x8/dde-calendar-5.9.1/calendar-service/assets/data/huangli.db and /tmp/tmpsgbh6un_/_fqUKjDi_9/dde-calendar-5.10.0/calendar-service/assets/data/huangli.db differ diff -Nru dde-calendar-5.9.1/calendar-service/assets/dde-calendar-service.desktop dde-calendar-5.10.0/calendar-service/assets/dde-calendar-service.desktop --- dde-calendar-5.9.1/calendar-service/assets/dde-calendar-service.desktop 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/assets/dde-calendar-service.desktop 2023-04-07 06:02:09.000000000 +0000 @@ -1,5 +1,5 @@ [Desktop Entry] -Exec=/bin/bash -c "dbus-send --session --print-reply --dest=com.deepin.dataserver.Calendar /com/deepin/dataserver/Calendar com.deepin.dataserver.Calendar.updateRemindJob boolean:true" +Exec=/bin/bash -c "dbus-send --session --print-reply --dest=com.deepin.dataserver.Calendar /com/deepin/dataserver/Calendar/AccountManager com.deepin.dataserver.Calendar.AccountManager.updateRemindJob boolean:true" Name=dde-calendar-service NoDisplay=true Terminal=false diff -Nru dde-calendar-5.9.1/calendar-service/CMakeLists.txt dde-calendar-5.10.0/calendar-service/CMakeLists.txt --- dde-calendar-5.9.1/calendar-service/CMakeLists.txt 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/CMakeLists.txt 2023-04-07 06:02:09.000000000 +0000 @@ -32,13 +32,15 @@ Qt5::DBus Qt5::Sql ${DtkCore_LIBRARIES} + commondata + -lpthread ) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src) SUBDIRLIST(all_src ${CMAKE_CURRENT_SOURCE_DIR}/src) -#Include all app own subdirectorys +#Include all app own subdirectories foreach(subdir ${all_src}) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/${subdir}) endforeach() @@ -46,21 +48,42 @@ #添加资源文件 QT5_ADD_RESOURCES(CALENDARSERVICE_SRCS ${APP_QRC}) -include_directories(../calendar-basicstruct/) #后端程序自动退出宏控制 +if (NOT (CMAKE_BUILD_TYPE MATCHES Debug)) add_definitions(-DCALENDAR_SERVICE_AUTO_EXIT) +endif() add_executable(${PROJECT_NAME} ${CALENDARSERVICE_SRCS}) -target_link_libraries(${PROJECT_NAME} ${LINK_LIBS} basestruct) +target_include_directories(${PROJECT_NAME} PUBLIC ${DtkWidget_INCLUDE_DIRS} ${OBJECT_BINARY_DIR} ../calendar-common/src) -set(CMAKE_INSTALL_PREFIX /usr) +target_link_libraries(${PROJECT_NAME} + ${LINK_LIBS} + ) + +#根据环境修改dbus服务文件 +if(DEFINED ENV{PREFIX}) + set(APP_DBUS_SERVICE +"[D-BUS Service] +Name=com.deepin.dataserver.Calendar +Exec=/usr/bin/ll-cli run org.dde.calendar --exec /opt/apps/org.dde.calendar/files/lib/deepin-daemon/dde-calendar-service +") + message("${APP_DBUS_SERVICE}") + file(WRITE ${APP_SERVICE} "${APP_DBUS_SERVICE}") + + set(CMAKE_INSTALL_PREFIX $ENV{PREFIX}) +else() + set(CMAKE_INSTALL_PREFIX /usr) +endif() + +add_definitions(-DLINGLONG_PREFIX=\"${CMAKE_INSTALL_PREFIX}/\") + # Install files install(TARGETS ${PROJECT_NAME} DESTINATION lib/deepin-daemon/) -install(FILES ${APP_SERVICE} DESTINATION share/dbus-1/services/) -install(FILES ${AUTOSTART_DESKTOP} DESTINATION /etc/xdg/autostart/) -install(FILES ${HUANGLIDB} DESTINATION share/dde-calendar/data/) +install(FILES ${APP_SERVICE} DESTINATION ${CMAKE_INSTALL_DATADIR}/dbus-1/services/) +install(FILES ${AUTOSTART_DESKTOP} DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/xdg/autostart/) +install(FILES ${HUANGLIDB} DESTINATION ${CMAKE_INSTALL_DATADIR}/dde-calendar/data/) install(FILES ${APP_SYSTEMD_SERVICE} DESTINATION lib/systemd/user/) install(FILES ${APP_SYSTEMD_TIMER} DESTINATION lib/systemd/user/) diff -Nru dde-calendar-5.9.1/calendar-service/src/alarmManager/dalarmmanager.cpp dde-calendar-5.10.0/calendar-service/src/alarmManager/dalarmmanager.cpp --- dde-calendar-5.9.1/calendar-service/src/alarmManager/dalarmmanager.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/alarmManager/dalarmmanager.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,289 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "dalarmmanager.h" + +#include "csystemdtimercontrol.h" +#include "dbus/dbusnotify.h" + +#define Millisecond 1 +#define Second 1000 * Millisecond +#define Minute 60 * Second +#define Hour 60 * Minute + +static QString notifyActKeyDefault("default"); +static QString notifyActKeyClose("close"); +static QString notifyActKeyRemindLater("later"); +static QString notifyActKeyRemindAfter15mins("later-15mins"); +static QString notifyActKeyRemindAfter1hour("later-1hour"); +static QString notifyActKeyRemindAfter4hours("later-4hours"); +static QString notifyActKeyRemind1DayBefore("one-day-before"); +static QString notifyActKeyRemindTomorrow("tomorrow"); +static QString layoutHM("15:04"); + +DAlarmManager::DAlarmManager(QObject *parent) + : QObject(parent) +{ + m_dbusnotify = new DBusNotify("org.deepin.dde.Notification1", + "/org/deepin/dde/Notification1", + "org.deepin.dde.Notification1", + QDBusConnection::sessionBus(), + this); + if (!m_dbusnotify->isValid()) { + delete m_dbusnotify; + m_dbusnotify = new DBusNotify("com.deepin.dde.Notification", + "/com/deepin/dde/Notification", + "com.deepin.dde.Notification", + QDBusConnection::sessionBus(), + this); + } + + //若没开启定时任务则开启定时任务 + CSystemdTimerControl systemdTimer; + systemdTimer.startCalendarServiceSystemdTimer(); +} + +void DAlarmManager::updateRemind(const DRemindData::List &remindList) +{ + if (remindList.size() == 0) + return; + QString &&accountID = remindList.at(0)->accountID(); + CSystemdTimerControl systemdTimerControl; + //清空该帐户下日程提醒 + systemdTimerControl.stopAllRemindSystemdTimer(accountID); + systemdTimerControl.removeRemindFile(accountID); + + QVector infoVector {}; + foreach (auto remind, remindList) { + SystemDInfo info; + info.accountID = remind->accountID(); + info.alarmID = remind->alarmID(); + info.laterCount = remind->remindCount(); + info.triggerTimer = remind->dtRemind(); + infoVector.append(info); + } + systemdTimerControl.buildingConfiggure(infoVector); +} + +void DAlarmManager::notifyJobsChanged(const DRemindData::List &remindList) +{ + if (remindList.size() == 0) + return; + CSystemdTimerControl systemdTimerControl; + + QVector infoVector {}; + foreach (auto remind, remindList) { + SystemDInfo info; + info.accountID = remind->accountID(); + info.alarmID = remind->alarmID(); + info.laterCount = remind->remindCount(); + info.triggerTimer = remind->dtRemind(); + infoVector.append(info); + } + systemdTimerControl.stopSystemdTimerByJobInfos(infoVector); +} + +void DAlarmManager::notifyMsgHanding(const DRemindData::Ptr &remindData, const int operationNum) +{ + switch (operationNum) { + case 1: + //打开日历 + emit signalCallOpenCalendarUI(remindData->alarmID()); + break; + case 2: //稍后提醒 + case 21: //15min后提醒 + case 22: //一个小时后提醒 + case 23: //四个小时后提醒 + case 3: //明天提醒 + case 4: //提前一天提醒 + remindLater(remindData, operationNum); + break; + default: + break; + } +} + +void DAlarmManager::remindLater(const DRemindData::Ptr &remindData, const int operationNum) +{ + CSystemdTimerControl systemdTimerControl; + SystemDInfo info; + info.accountID = remindData->accountID(); + info.alarmID = remindData->alarmID(); + //如果是稍后提醒则设置对应的重复次数 + if (operationNum == 2) { + info.laterCount = remindData->remindCount(); + } else { + //如果不是稍后提醒,因为次数没有增加所以停止任务的时候需要加一以保证能够停止上次的任务 + info.laterCount = remindData->remindCount() + 1; + } + info.triggerTimer = remindData->dtRemind(); + //停止相应的任务 + systemdTimerControl.stopSystemdTimerByJobInfo(info); + + if (operationNum != 2) { + //如果不是稍后提醒,还原成原来的提醒次数 + info.laterCount--; + } + QVector infoVector; + infoVector.append(info); + //开启新任务 + systemdTimerControl.buildingConfiggure(infoVector); +} + +int DAlarmManager::remindJob(const DRemindData::Ptr &remindData, const DSchedule::Ptr &schedule) +{ + //如果没有提醒 + if (schedule->alarms().size() == 0) { + qWarning() << "remind job failed id=%1" << schedule->uid(); + return 0; + } + + KCalendarCore::Alarm::Ptr alarm = schedule->alarms().at(0); + + int nDays = -(alarm->startOffset().asDays()); + + qint64 duration = 0; + bool bmax = getRemindLaterDuration(remindData->remindCount(), duration); + QStringList actionlist; + QVariantMap hints; + QString cmd = QString("dbus-send --session --print-reply --dest=com.deepin.dataserver.Calendar " + "/com/deepin/dataserver/Calendar/AccountManager " + "com.deepin.dataserver.Calendar.AccountManager.notifyMsgHanding string:%1 string:%2") + .arg(remindData->accountID()) + .arg(remindData->alarmID()); + auto argMake = [&](int operationNum, const QString & text, const QString & transText) { + actionlist << text << transText; + hints.insert("x-deepin-action-" + text, QString("/bin/bash,-c,%1 int32:%2").arg(cmd).arg(operationNum)); + }; + + QDateTime tm = QDateTime::currentDateTime(); + if (tm < schedule->dtStart()) { + //如果提醒规则大于3天且是第二次提醒 + if (nDays >= 3 && remindData->remindCount() == 1) { + //default对应的是默认操作,也就是在点击空白区域会出发的操作 + argMake(1, notifyActKeyDefault, ""); + argMake(5, notifyActKeyClose, tr("Close", "button")); + //当前时间与开始时间间隔大于1天 + if (tm < schedule->dtStart().addDays(-1)) + argMake(4, notifyActKeyRemind1DayBefore, tr("One day before start")); + + } else if ((nDays == 1 || nDays == 2) && bmax) { + argMake(1, notifyActKeyDefault, ""); + argMake(5, notifyActKeyClose, tr("Close", "button")); + argMake(3, notifyActKeyRemindTomorrow, tr("Remind me tomorrow")); + + } else { + argMake(1, notifyActKeyDefault, ""); + argMake(5, notifyActKeyClose, tr("Close", "button")); + argMake(2, notifyActKeyRemindLater, tr("Remind me later")); + //后面的actions会在拉列表中显示 + argMake(21, notifyActKeyRemindAfter15mins, tr("15 mins later")); + argMake(22, notifyActKeyRemindAfter1hour, tr("1 hour later")); + argMake(23, notifyActKeyRemindAfter4hours, tr("4 hours later")); + argMake(3, notifyActKeyRemindTomorrow, tr("Tomorrow")); + } + } else { + argMake(1, notifyActKeyDefault, ""); + argMake(5, notifyActKeyClose, tr("Close", "button")); + } + + QString title(tr("Schedule Reminder")); + QString body = getRemindBody(schedule); + QString appicon("dde-calendar"); + QString appname("dde-calendar"); + quint32 replaces_id = 0; + qint32 timeout = 0; + QList argumentList; + argumentList << appname << replaces_id << appicon << title << body << actionlist << hints << timeout; + qDebug() << __FUNCTION__ << QString("remind now: %1, title:" + " %2, body: %3") + .arg(QDateTime::currentDateTime().toString()) + .arg(title) + .arg(body); + int notifyid = m_dbusnotify->Notify(argumentList); + return notifyid; +} + +DBusNotify *DAlarmManager::getdbusnotify() +{ + return m_dbusnotify; +} + +QString DAlarmManager::getRemindBody(const DSchedule::Ptr &schedule) +{ + QDateTime tm = QDateTime::currentDateTime(); + QString msgStart; + QString msgEnd; + msgStart = getBodyTimePart(tm, schedule->dtStart(), schedule->allDay(), true); + msgEnd = getBodyTimePart(tm, schedule->dtEnd(), schedule->allDay(), false); + quint32 startdayofyear = static_cast(schedule->dtStart().date().dayOfYear()); + quint32 enddayofyear = static_cast(schedule->dtEnd().date().dayOfYear()); + QString prefix; + if (schedule->allDay()) { + //全天日程 + if (startdayofyear == enddayofyear) { + //非跨天日程,只展示开始时间 + prefix = msgStart; + } else { + //跨天日程,展示整个日程的时间 + prefix = QString(tr("%1 to %2")).arg(msgStart).arg(msgEnd); + } + } else { + //非全天日程 + if (startdayofyear == enddayofyear) { + //非跨天日程,GetBodyTimePart已经返回了日程的日期,即date,所以,这里只需要日程的结束时间,即time + msgEnd = schedule->dtEnd().time().toString("HH:mm"); + } + //展示日程的开始结束时间 + prefix = QString(tr("%1 to %2")).arg(msgStart).arg(msgEnd); + } + //日程时间+title + QString strBody = QString("%1 %2").arg(prefix).arg(schedule->summary()); + + return strBody; +} + +QString DAlarmManager::getBodyTimePart(const QDateTime &nowtime, const QDateTime &jobtime, bool allday, bool isstart) +{ + Q_UNUSED(isstart); + //ToDo 需确认规则,需根据isstart确认是否为开始时间单独处理 + QString strmsg; + qint64 diff = nowtime.daysTo(jobtime); //jobtime只可能大于等于当前remind任务执行的当前时间 + if (allday) { + //全天日程,只展示日期,即date + //日程开始时间距离现在超过两天 + strmsg.append(jobtime.date().toString(Qt::LocalDate)); + if (diff == 0) { + //日程开始时间是今天 + strmsg = tr("Today"); + } else if (diff == 1) { + //日程开始时间是明天 + strmsg = tr("Tomorrow"); + } + } else { + //非全天日程,展示日期和时间,即date time + //日程开始时间距离现在超过两天 + strmsg.append(QString(" %1").arg(jobtime.toString("yyyy/MM/dd HH:mm"))); + if (diff == 0) { + //日程开始时间是今天, + strmsg = tr("Today") + " " + jobtime.time().toString("HH:mm"); + } else if (diff == 1) { + //日程开始时间是明天 + strmsg = tr("Tomorrow") + " " + jobtime.time().toString("HH:mm"); + } + } + + return strmsg; +} + +int DAlarmManager::getRemindLaterDuration(int count, qint64 &duration) +{ + bool bmax = false; + duration = (10 + ((count - 1) * 5)) * Minute; //下一次提醒距离现在的时间间隔,单位毫秒 + if (duration >= Hour) { + bmax = true; + duration = Hour; + } + return bmax; +} diff -Nru dde-calendar-5.9.1/calendar-service/src/alarmManager/dalarmmanager.h dde-calendar-5.10.0/calendar-service/src/alarmManager/dalarmmanager.h --- dde-calendar-5.9.1/calendar-service/src/alarmManager/dalarmmanager.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/alarmManager/dalarmmanager.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,57 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef DALARMMANAGER_H +#define DALARMMANAGER_H + +#include "dreminddata.h" +#include "dschedule.h" + +#include +#include + +class DBusNotify; +//日程提醒管理类 +class DAlarmManager : public QObject +{ + Q_OBJECT +public: + typedef QSharedPointer Ptr; + + explicit DAlarmManager(QObject *parent = nullptr); + //更新提醒任务 + void updateRemind(const DRemindData::List &remindList); + void notifyJobsChanged(const DRemindData::List &remindList); + + /** + * @brief notifyMsgHanding 通知提示框交互处理 + * @param remindData 提醒日程相关信息 + * @param operationNum 操作编号 + * 1:打开日历, + * 2:稍后提醒 21:15min后提醒 22:一个小时后提醒 23:四个小时后提醒 + * 3:明天提醒 4: 提前1天提醒 + */ + void notifyMsgHanding(const DRemindData::Ptr &remindData, const int operationNum); + + void remindLater(const DRemindData::Ptr &remindData, const int operationNum); + + int remindJob(const DRemindData::Ptr &remindData, const DSchedule::Ptr &schedule); + + DBusNotify *getdbusnotify(); +private: + int getRemindLaterDuration(int count, qint64 &duration); + + //获取日程提醒内容 + QString getRemindBody(const DSchedule::Ptr &schedule); + + QString getBodyTimePart(const QDateTime &nowtime, const QDateTime &jobtime, bool allday, bool isstart); +signals: + //发送打开日历信号 + void signalCallOpenCalendarUI(const QString &alarmID); + +private: + DBusNotify *m_dbusnotify; //日程提醒dbus操作相关 +}; + +#endif // DALARMMANAGER_H diff -Nru dde-calendar-5.9.1/calendar-service/src/alarmManager/dreminddata.cpp dde-calendar-5.10.0/calendar-service/src/alarmManager/dreminddata.cpp --- dde-calendar-5.9.1/calendar-service/src/alarmManager/dreminddata.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/alarmManager/dreminddata.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,127 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "dreminddata.h" + +DRemindData::DRemindData() + : m_alarmID("") + , m_accountID("") + , m_scheduleID("") + , m_remindCount(0) + , m_notifyid(-1) +{ +} + +QString DRemindData::accountID() const +{ + return m_accountID; +} + +void DRemindData::setAccountID(const QString &accountID) +{ + m_accountID = accountID; +} + +QString DRemindData::scheduleID() const +{ + return m_scheduleID; +} + +void DRemindData::setScheduleID(const QString &scheduleID) +{ + m_scheduleID = scheduleID; +} + +QDateTime DRemindData::recurrenceId() const +{ + return m_recurrenceId; +} + +void DRemindData::setRecurrenceId(const QDateTime &recurrenceId) +{ + m_recurrenceId = recurrenceId; +} + +int DRemindData::remindCount() const +{ + return m_remindCount; +} + +void DRemindData::setRemindCount(int remindCount) +{ + m_remindCount = remindCount; +} + +int DRemindData::notifyid() const +{ + return m_notifyid; +} + +void DRemindData::setNotifyid(int notifyid) +{ + m_notifyid = notifyid; +} + +QDateTime DRemindData::dtRemind() const +{ + return m_dtRemind; +} + +void DRemindData::setDtRemind(const QDateTime &dtRemind) +{ + m_dtRemind = dtRemind; +} + +QDateTime DRemindData::dtStart() const +{ + return m_dtStart; +} + +void DRemindData::setDtStart(const QDateTime &dtStart) +{ + m_dtStart = dtStart; +} + +QDateTime DRemindData::dtEnd() const +{ + return m_dtEnd; +} + +void DRemindData::setDtEnd(const QDateTime &dtEnd) +{ + m_dtEnd = dtEnd; +} + +QString DRemindData::alarmID() const +{ + return m_alarmID; +} + +void DRemindData::setAlarmID(const QString &alarmID) +{ + m_alarmID = alarmID; +} + +void DRemindData::updateRemindTimeByCount() +{ + qint64 Minute = 60 * 1000; + qint64 Hour = Minute * 60; + qint64 duration = (10 + ((m_remindCount - 1) * 5)) * Minute; //下一次提醒距离现在的时间间隔,单位毫秒 + if (duration >= Hour) { + duration = Hour; + } + setDtRemind(getRemindTimeByMesc(duration)); +} + +void DRemindData::updateRemindTimeByMesc(qint64 duration) +{ + setDtRemind(getRemindTimeByMesc(duration)); +} + +QDateTime DRemindData::getRemindTimeByMesc(qint64 duration) +{ + QDateTime currentTime = QDateTime::currentDateTime(); + currentTime = currentTime.addMSecs(duration); + return currentTime; +} diff -Nru dde-calendar-5.9.1/calendar-service/src/alarmManager/dreminddata.h dde-calendar-5.10.0/calendar-service/src/alarmManager/dreminddata.h --- dde-calendar-5.9.1/calendar-service/src/alarmManager/dreminddata.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/alarmManager/dreminddata.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,66 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef DREMINDDATA_H +#define DREMINDDATA_H + +#include +#include +#include + +class DRemindData +{ +public: + typedef QSharedPointer Ptr; + typedef QVector List; + + DRemindData(); + + QString accountID() const; + void setAccountID(const QString &accountID); + + QString scheduleID() const; + void setScheduleID(const QString &scheduleID); + + QDateTime recurrenceId() const; + void setRecurrenceId(const QDateTime &recurrenceId); + + int remindCount() const; + void setRemindCount(int remindCount); + + int notifyid() const; + void setNotifyid(int notifyid); + + QDateTime dtRemind() const; + void setDtRemind(const QDateTime &dtRemind); + + QDateTime dtStart() const; + void setDtStart(const QDateTime &dtStart); + + QDateTime dtEnd() const; + void setDtEnd(const QDateTime &dtEnd); + + QString alarmID() const; + void setAlarmID(const QString &alarmID); + + void updateRemindTimeByCount(); + + void updateRemindTimeByMesc(qint64 duration); + +private: + QDateTime getRemindTimeByMesc(qint64 duration); + +private: + QString m_alarmID; + QString m_accountID; + QString m_scheduleID; + QDateTime m_recurrenceId; + int m_remindCount; + int m_notifyid; + QDateTime m_dtRemind; + QDateTime m_dtStart; + QDateTime m_dtEnd; +}; + +#endif // DREMINDDATA_H diff -Nru dde-calendar-5.9.1/calendar-service/src/calendarDataManager/daccountmanagemodule.cpp dde-calendar-5.10.0/calendar-service/src/calendarDataManager/daccountmanagemodule.cpp --- dde-calendar-5.9.1/calendar-service/src/calendarDataManager/daccountmanagemodule.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/calendarDataManager/daccountmanagemodule.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,456 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "daccountmanagemodule.h" + +#include "units.h" +#include "calendarprogramexitcontrol.h" + +DAccountManageModule::DAccountManageModule(QObject *parent) + : QObject(parent) + , m_syncFileManage(new SyncFileManage()) + , m_accountManagerDB(new DAccountManagerDataBase) +{ + m_isSupportUid = m_syncFileManage->getSyncoperation()->hasAvailable(); + //新文件路径 + QString newDbPath = getDBPath(); + QString newDB(newDbPath + "/" + "accountmanager.db"); + m_accountManagerDB->setDBPath(newDB); + m_accountManagerDB->dbOpen(); + + QDBusConnection::RegisterOptions options = QDBusConnection::ExportAllSlots | QDBusConnection::ExportAllSignals | QDBusConnection::ExportAllProperties; + QDBusConnection sessionBus = QDBusConnection::sessionBus(); + + //将云端帐户信息基本数据与本地数据合并 + unionIDDataMerging(); + + //根据获取到的帐户信息创建对应的帐户服务 + foreach (auto account, m_accountList) { + //如果不支持云同步且帐户类型为UID则过滤 + if (!m_isSupportUid && account->accountType() == DAccount::Account_UnionID) { + continue; + } + DAccountModule::Ptr accountModule = DAccountModule::Ptr(new DAccountModule(account)); + QObject::connect(accountModule.data(), &DAccountModule::signalSettingChange, this, &DAccountManageModule::slotSettingChange); + m_accountModuleMap[account->accountID()] = accountModule; + DAccountService::Ptr accountService = DAccountService::Ptr(new DAccountService(account->dbusPath(), account->dbusInterface(), accountModule, this)); + if (!sessionBus.registerObject(accountService->getPath(), accountService->getInterface(), accountService.data(), options)) { + qWarning() << "registerObject accountService failed:" << sessionBus.lastError(); + } else { + m_AccountServiceMap[account->accountType()].insert(account->accountID(), accountService); + //如果是网络帐户则开启定时下载任务 + if (account->isNetWorkAccount() && account->accountState().testFlag(DAccount::Account_Open)) { + accountModule->downloadTaskhanding(0); + } + } + } + m_generalSetting = m_accountManagerDB->getCalendarGeneralSettings(); + + connect(&m_timer, &QTimer::timeout, this, &DAccountManageModule::slotClientIsOpen); + m_timer.start(2000); + + if (m_isSupportUid) { + QObject::connect(m_syncFileManage->getSyncoperation(), &Syncoperation::signalLoginStatusChange, this, &DAccountManageModule::slotUidLoginStatueChange); + QObject::connect(m_syncFileManage->getSyncoperation(), &Syncoperation::SwitcherChange, this, &DAccountManageModule::slotSwitcherChange); + } + + //第一次启动加载完成后发送帐户改变信号 + // emit signalLoginStatusChange(); +} + +QString DAccountManageModule::getAccountList() +{ + QString accountStr; + DAccount::toJsonListString(m_accountList, accountStr); + return accountStr; +} + +QString DAccountManageModule::getCalendarGeneralSettings() +{ + QString cgSetStr; + m_generalSetting = m_accountManagerDB->getCalendarGeneralSettings(); + DCalendarGeneralSettings::toJsonString(m_generalSetting, cgSetStr); + return cgSetStr; +} + +void DAccountManageModule::setCalendarGeneralSettings(const QString &cgSet) +{ + DCalendarGeneralSettings::Ptr cgSetPtr = DCalendarGeneralSettings::Ptr(new DCalendarGeneralSettings); + DCalendarGeneralSettings::fromJsonString(cgSetPtr, cgSet); + if (m_generalSetting != cgSetPtr) { + m_accountManagerDB->setCalendarGeneralSettings(cgSetPtr); + DCalendarGeneralSettings::Ptr tmpSetting = DCalendarGeneralSettings::Ptr(m_generalSetting->clone()); + m_generalSetting = cgSetPtr; + if (tmpSetting->firstDayOfWeek() != m_generalSetting->firstDayOfWeek()) { + emit firstDayOfWeekChange(); + } + if (tmpSetting->timeShowType() != m_generalSetting->timeShowType()) { + emit timeFormatTypeChange(); + } + } +} + +int DAccountManageModule::getfirstDayOfWeek() +{ + return static_cast(m_generalSetting->firstDayOfWeek()); +} + +void DAccountManageModule::setFirstDayOfWeek(const int firstday) +{ + if (m_generalSetting->firstDayOfWeek() != firstday) { + m_generalSetting->setFirstDayOfWeek(static_cast(firstday)); + m_accountManagerDB->setCalendarGeneralSettings(m_generalSetting); + foreach (auto account, m_accountList) { + if (account->accountType() == DAccount::Account_UnionID) { + m_accountModuleMap[account->accountID()]->accountDownload(); + } + } + } +} + +int DAccountManageModule::getTimeFormatType() +{ + return static_cast(m_generalSetting->timeShowType()); +} + +void DAccountManageModule::setTimeFormatType(const int timeType) +{ + if (m_generalSetting->timeShowType() != timeType) { + m_generalSetting->setTimeShowType(static_cast(timeType)); + m_accountManagerDB->setCalendarGeneralSettings(m_generalSetting); + foreach (auto account, m_accountList) { + if (account->accountType() == DAccount::Account_UnionID) { + m_accountModuleMap[account->accountID()]->accountDownload(); + } + } + } +} + +void DAccountManageModule::remindJob(const QString &accountID, const QString &alarmID) +{ + if (m_accountModuleMap.contains(accountID)) { + m_accountModuleMap[accountID]->remindJob(alarmID); + } +} + +void DAccountManageModule::updateRemindSchedules(bool isClear) +{ + QMap::const_iterator iter = m_accountModuleMap.constBegin(); + for (; iter != m_accountModuleMap.constEnd(); ++iter) { + iter.value()->updateRemindSchedules(isClear); + } +} + +void DAccountManageModule::notifyMsgHanding(const QString &accountID, const QString &alarmID, const qint32 operationNum) +{ + if (m_accountModuleMap.contains(accountID)) { + m_accountModuleMap[accountID]->notifyMsgHanding(alarmID, operationNum); + } +} + +void DAccountManageModule::downloadByAccountID(const QString &accountID) +{ + if (m_accountModuleMap.contains(accountID)) { + m_accountModuleMap[accountID]->accountDownload(); + } +} + +void DAccountManageModule::uploadNetWorkAccountData() +{ + QMap::const_iterator iter = m_accountModuleMap.constBegin(); + for (; iter != m_accountModuleMap.constEnd(); ++iter) { + iter.value()->uploadNetWorkAccountData(); + } +} + +//账户登录 +void DAccountManageModule::login() +{ + m_syncFileManage->getSyncoperation()->optlogin(); +} +//账户登出 +void DAccountManageModule::logout() +{ + m_syncFileManage->getSyncoperation()->optlogout(); +} + +bool DAccountManageModule::isSupportUid() +{ + return m_isSupportUid; +} + +void DAccountManageModule::calendarOpen(bool isOpen) +{ + //每次开启日历时需要同步数据 + if (isOpen) { + QMap::iterator iter = m_accountModuleMap.begin(); + for (; iter != m_accountModuleMap.end(); ++iter) { + iter.value()->accountDownload(); + } + } +} + +void DAccountManageModule::unionIDDataMerging() +{ + m_accountList = m_accountManagerDB->getAccountList(); + + //如果不支持云同步 + if (!m_isSupportUid) { + DAccount::Ptr unionidDB; + auto hasUnionid = [ =, &unionidDB](const DAccount::Ptr & account) { + if (account->accountType() == DAccount::Account_UnionID) { + unionidDB = account; + return true; + } + return false; + }; + //如果数据库中有unionid帐户 + if (std::any_of(m_accountList.begin(), m_accountList.end(), hasUnionid)) { + //如果包含则移除 + removeUIdAccount(unionidDB); + } + return; + } + + DAccount::Ptr accountUnionid = m_syncFileManage->getuserInfo(); + + DAccount::Ptr unionidDB; + auto hasUnionid = [ =, &unionidDB](const DAccount::Ptr & account) { + if (account->accountType() == DAccount::Account_UnionID) { + unionidDB = account; + return true; + } + return false; + }; + //如果unionid帐户不存在,则判断数据库中是否有登陆前的信息 + //若有则移除 + if (accountUnionid.isNull() || accountUnionid->accountID().isEmpty()) { + //如果数据库中有unionid帐户 + if (std::any_of(m_accountList.begin(), m_accountList.end(), hasUnionid)) { + removeUIdAccount(unionidDB); + } + } else { + //如果unionID登陆了 + + //如果数据库中有unionid帐户 + if (std::any_of(m_accountList.begin(), m_accountList.end(), hasUnionid)) { + //如果是一个帐户则判断信息是否一致,不一致需更新 + if (unionidDB->accountName() == accountUnionid->accountName()) { + updateUIdAccount(unionidDB, accountUnionid); + } else { + removeUIdAccount(unionidDB); + addUIdAccount(accountUnionid); + } + } else { + addUIdAccount(accountUnionid); + } + } +} + +void DAccountManageModule::initAccountDBusInfo(const DAccount::Ptr &account) +{ + QString typeStr = ""; + switch (account->accountType()) { + case DAccount::Type::Account_UnionID: + typeStr = "uid"; + break; + case DAccount::Type::Account_CalDav: + typeStr = "caldav"; + break; + default: + typeStr = "default"; + break; + } + QString sortID = DDataBase::createUuid().mid(0, 5); + account->setAccountState(DAccount::AccountState::Account_Setting | DAccount::Account_Calendar); + setUidSwitchStatus(account); + //设置DBus路径和数据库名 + //account + account->setAccountType(DAccount::Account_UnionID); + account->setDtCreate(QDateTime::currentDateTime()); + account->setDbName(QString("account_%1_%2.db").arg(typeStr).arg(sortID)); + account->setDbusPath(QString("%1/account_%2_%3").arg(serviceBasePath).arg(typeStr).arg(sortID)); + account->setDbusInterface(accountServiceInterface); +} + +void DAccountManageModule::removeUIdAccount(const DAccount::Ptr &uidAccount) +{ + //帐户列表移除uid帐户 + m_accountList.removeOne(uidAccount); + //移除对应的数据库 ,停止对应的定时器 + DAccountModule::Ptr accountModule(new DAccountModule(uidAccount)); + accountModule->removeDB(); + accountModule->downloadTaskhanding(2); + //帐户管理数据库中删除相关数据 + m_accountManagerDB->deleteAccountInfo(uidAccount->accountID()); +} + +void DAccountManageModule::addUIdAccount(const DAccount::Ptr &uidAccount) +{ + //帐户管理数据库中添加uid帐户 + initAccountDBusInfo(uidAccount); + m_accountManagerDB->addAccountInfo(uidAccount); + m_accountList.append(uidAccount); +} + +void DAccountManageModule::updateUIdAccount(const DAccount::Ptr &oldAccount, const DAccount::Ptr &uidAccount) +{ + oldAccount->avatar() = uidAccount->avatar(); + oldAccount->displayName() = uidAccount->displayName(); + setUidSwitchStatus(oldAccount); + m_accountManagerDB->updateAccountInfo(oldAccount); +} + +void DAccountManageModule::setUidSwitchStatus(const DAccount::Ptr &account) +{ + //获取控制中心开关状态 + bool calendarSwitch = m_syncFileManage->getSyncoperation()->optGetCalendarSwitcher().switch_state; + //获取帐户信息状态 + DAccount::AccountStates accountState = account->accountState(); + accountState.setFlag(DAccount::Account_Open, calendarSwitch); + account->setAccountState(accountState); +} + +void DAccountManageModule::slotFirstDayOfWeek(const int firstDay) +{ + if (getfirstDayOfWeek() != firstDay) { + setFirstDayOfWeek(firstDay); + emit firstDayOfWeekChange(); + } +} + +void DAccountManageModule::slotTimeFormatType(const int timeType) +{ + if (getTimeFormatType() != timeType) { + setTimeFormatType(timeType); + emit timeFormatTypeChange(); + } +} + +void DAccountManageModule::slotUidLoginStatueChange(const int status) +{ + //因为有时登录成功会触发2次 + static QList oldStatus{}; + //登录成功后会触发多次,状态也不一致。比如登录后会连续触发 1 -- 4 -- 1 信号 + if (!oldStatus.contains(status)) { + oldStatus.append(status); + } else { + //如果当前状态和上次状态一直,则退出 + return; + } + //1:登陆成功 2:登陆取消 3:登出 4:获取服务端配置的应用数据成功 + QDBusConnection::RegisterOptions options = QDBusConnection::ExportAllSlots | QDBusConnection::ExportAllSignals | QDBusConnection::ExportAllProperties; + QDBusConnection sessionBus = QDBusConnection::sessionBus(); + + switch (status) { + case 1: { + //移除登出状态 + if (oldStatus.contains(3)) { + oldStatus.removeAt(oldStatus.indexOf(3)); + } + + //登陆成功 + DAccount::Ptr accountUnionid = m_syncFileManage->getuserInfo(); + if (accountUnionid.isNull() || accountUnionid->accountName().isEmpty()) { + qWarning() << "Error getting account information"; + oldStatus.removeAt(oldStatus.indexOf(1)); + return; + } + addUIdAccount(accountUnionid); + + DAccountModule::Ptr accountModule = DAccountModule::Ptr(new DAccountModule(accountUnionid)); + QObject::connect(accountModule.data(), &DAccountModule::signalSettingChange, this, &DAccountManageModule::slotSettingChange); + m_accountModuleMap[accountUnionid->accountID()] = accountModule; + DAccountService::Ptr accountService = DAccountService::Ptr(new DAccountService(accountUnionid->dbusPath(), accountUnionid->dbusInterface(), accountModule, this)); + if (!sessionBus.registerObject(accountService->getPath(), accountService->getInterface(), accountService.data(), options)) { + qWarning() << "registerObject accountService failed:" << sessionBus.lastError(); + } else { + m_AccountServiceMap[accountUnionid->accountType()].insert(accountUnionid->accountID(), accountService); + if (accountUnionid->accountState().testFlag(DAccount::Account_Open)) { + accountModule->downloadTaskhanding(0); + } + } + } break; + case 3: { + //移除登录状态 + if (oldStatus.contains(1)) { + oldStatus.removeAt(oldStatus.indexOf(1)); + } + //登出 + if (m_AccountServiceMap[DAccount::Type::Account_UnionID].size() > 0) { + //如果存在UID帐户则移除相关信息 + //移除服务并注销 + QString accountID = m_AccountServiceMap[DAccount::Type::Account_UnionID].firstKey(); + DAccountService::Ptr accountService = m_AccountServiceMap[DAccount::Type::Account_UnionID].first(); + m_AccountServiceMap[DAccount::Type::Account_UnionID].clear(); + sessionBus.unregisterObject(accountService->getPath()); + //移除uid帐户信息 + //删除对应数据库 + m_accountModuleMap[accountID]->removeDB(); + m_accountModuleMap[accountID]->downloadTaskhanding(2); + m_accountList.removeOne(m_accountModuleMap[accountID]->account()); + m_accountModuleMap.remove(accountID); + m_accountManagerDB->deleteAccountInfo(accountID); + } + } break; + default: + //其它状态当前不做处理 + return; + } + emit signalLoginStatusChange(); +} + +void DAccountManageModule::slotSwitcherChange(const bool state) +{ + foreach (auto schedule, m_accountList) { + if (schedule->accountType() == DAccount::Account_UnionID) { + if (state) { + schedule->setAccountState(schedule->accountState() | DAccount::Account_Open); + //开启 + m_accountModuleMap[schedule->accountID()]->downloadTaskhanding(1); + } else { + schedule->setAccountState(schedule->accountState() & ~DAccount::Account_Open); + //关闭 + m_accountModuleMap[schedule->accountID()]->downloadTaskhanding(2); + m_accountModuleMap[schedule->accountID()]->uploadTaskHanding(0); + } + emit m_accountModuleMap[schedule->accountID()]->signalAccountState(); + return; + } + } +} + +void DAccountManageModule::slotSettingChange() +{ + DCalendarGeneralSettings::Ptr newSetting = m_accountManagerDB->getCalendarGeneralSettings(); + if (newSetting->firstDayOfWeek() != m_generalSetting->firstDayOfWeek()) { + m_generalSetting->setFirstDayOfWeek(newSetting->firstDayOfWeek()); + emit firstDayOfWeekChange(); + } + + if (newSetting->timeShowType() != m_generalSetting->timeShowType()) { + m_generalSetting->setTimeShowType(m_generalSetting->timeShowType()); + emit timeFormatTypeChange(); + } +} + +void DAccountManageModule::slotClientIsOpen() +{ + //如果日历界面不存在则退出 + QProcess process; + process.start("/bin/bash", QStringList() << "-c" + << "pidof dde-calendar"); + process.waitForFinished(); + QString strResult = process.readAllStandardOutput(); + + static QString preResult = ""; + + if (preResult == strResult) { + return; + } else { + preResult = strResult; + DServiceExitControl exitControl; + exitControl.setClientIsOpen(!strResult.isEmpty()); + } +} diff -Nru dde-calendar-5.9.1/calendar-service/src/calendarDataManager/daccountmanagemodule.h dde-calendar-5.10.0/calendar-service/src/calendarDataManager/daccountmanagemodule.h --- dde-calendar-5.9.1/calendar-service/src/calendarDataManager/daccountmanagemodule.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/calendarDataManager/daccountmanagemodule.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,112 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef DACCOUNTMANAGEMODULE_H +#define DACCOUNTMANAGEMODULE_H + +#include "syncfilemanage.h" +#include "daccount.h" +#include "daccountmodule.h" +#include "daccountmanagerdatabase.h" +#include "daccountservice.h" + +#include +#include +#include + +//帐户类型总数,若支持的类型增加则需要修改 +const int accountTypeCount = 3; + +//帐户管理模块 +class DAccountManageModule : public QObject +{ + Q_OBJECT +public: + typedef QSharedPointer Ptr; + + explicit DAccountManageModule(QObject *parent = nullptr); + + //获取所有帐户信息 + QString getAccountList(); + + //获取通用设置 + QString getCalendarGeneralSettings(); + //设置通用设置 + void setCalendarGeneralSettings(const QString &cgSet); + + int getfirstDayOfWeek(); + void setFirstDayOfWeek(const int firstday); + int getTimeFormatType(); + void setTimeFormatType(const int timeType); + + void remindJob(const QString &accountID, const QString &alarmID); + + /** + * @brief updateRemindSchedules 更新未来10分钟的提醒任务 + * @param isClear 是否清空提醒任务数据库 + */ + void updateRemindSchedules(bool isClear); + + /** + * @brief notifyMsgHanding 通知提示框交互处理 + * @param accountID 帐户id + * @param alarmID 提醒任务id + * @param operationNum 操作编号 , 1:打开日历,2:稍后提醒 3: 明天提醒 4: 提前1天提醒 5:关闭按钮 + */ + void notifyMsgHanding(const QString &accountID, const QString &alarmID, const qint32 operationNum); + + void downloadByAccountID(const QString &accountID); + void uploadNetWorkAccountData(); + + //账户登录 + void login(); + //账户登出 + void logout(); + //是否支持UID云同步 + bool isSupportUid(); + + void calendarOpen(bool isOpen); + +private: + void unionIDDataMerging(); + void initAccountDBusInfo(const DAccount::Ptr &account); + //移除uid帐户 + void removeUIdAccount(const DAccount::Ptr &uidAccount); + //添加uid帐户 + void addUIdAccount(const DAccount::Ptr &uidAccount); + //更新uid帐户 + void updateUIdAccount(const DAccount::Ptr &oldAccount, const DAccount::Ptr &uidAccount); + //获取设置开关状态 + void setUidSwitchStatus(const DAccount::Ptr &account); + +signals: + void firstDayOfWeekChange(); + void timeFormatTypeChange(); + void signalLoginStatusChange(); + +public slots: + void slotFirstDayOfWeek(const int firstDay); + void slotTimeFormatType(const int timeType); + //TODO:监听网络帐户管理信号和Union ID登陆退出状态 + void slotUidLoginStatueChange(const int status); + //控制中心的同步开关 + void slotSwitcherChange(const bool state); + //通用设置发生改变 + void slotSettingChange(); + + //定时判断日历界面是否打开 + void slotClientIsOpen(); + +private: + SyncFileManage *m_syncFileManage = nullptr; + DAccountManagerDataBase::Ptr m_accountManagerDB; + DAccount::List m_accountList; + QMap m_accountModuleMap; + QMap m_AccountServiceMap[accountTypeCount]; + DCalendarGeneralSettings::Ptr m_generalSetting; + QTimer m_timer; + bool m_isSupportUid = false; +}; + +#endif // DACCOUNTMANAGEMODULE_H diff -Nru dde-calendar-5.9.1/calendar-service/src/calendarDataManager/daccountmodule.cpp dde-calendar-5.10.0/calendar-service/src/calendarDataManager/daccountmodule.cpp --- dde-calendar-5.9.1/calendar-service/src/calendarDataManager/daccountmodule.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/calendarDataManager/daccountmodule.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,976 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "daccountmodule.h" +#include "units.h" +#include "dscheduletype.h" +#include "dschedulequerypar.h" +#include "memorycalendar.h" +#include "lunardateinfo.h" +#include "lunarmanager.h" +#include "dbus/dbusuiopenschedule.h" +#include "dalarmmanager.h" +#include "syncfilemanage.h" +#include "csystemdtimercontrol.h" +#include "dsyncdatafactory.h" +#include "unionIDDav/dunioniddav.h" +#include "ddatasyncbase.h" +#include "dbusnotify.h" + +#include +#include + +#define UPDATEREMINDJOBTIMEINTERVAL 1000 * 60 * 10 //提醒任务更新时间间隔毫秒数(10分钟) + +DAccountModule::DAccountModule(const DAccount::Ptr &account, QObject *parent) + : QObject(parent) + , m_account(account) + , m_accountDB(new DAccountDataBase(account)) + , m_alarm(new DAlarmManager) + , m_dataSync(DSyncDataFactory::createDataSync(m_account)) +{ + QString newDbPath = getDBPath(); + m_accountDB->setDBPath(newDbPath + "/" + account->dbName()); + m_accountDB->initDBData(); + m_accountDB->getAccountInfo(m_account); + + //关联打开日历界面 + connect(m_alarm.data(), &DAlarmManager::signalCallOpenCalendarUI, this, &DAccountModule::slotOpenCalendar); + if (m_dataSync != nullptr) { + connect(m_dataSync, &DDataSyncBase::signalSyncState, this, &DAccountModule::slotSyncState); + connect(m_dataSync, &DDataSyncBase::signalUpdate, this, &DAccountModule::slotDateUpdate); + } + //关联关闭提醒弹窗 + connect(this, &DAccountModule::signalCloseNotification, m_alarm->getdbusnotify(), &DBusNotify::closeNotification); +} + +DAccountModule::~DAccountModule() +{ + if (m_dataSync != nullptr) { + delete m_dataSync; + m_dataSync = nullptr; + } +} + +QString DAccountModule::getAccountInfo() +{ + QString accountInfo; + DAccount::toJsonString(m_account, accountInfo); + return accountInfo; +} + +bool DAccountModule::getExpand() +{ + return m_account->isExpandDisplay(); +} + +void DAccountModule::setExpand(const bool &isExpand) +{ + if (m_account->isExpandDisplay() != isExpand) { + m_account->setIsExpandDisplay(isExpand); + m_accountDB->updateAccountInfo(); + } +} + +int DAccountModule::getAccountState() +{ + return int(m_account->accountState()); +} + +void DAccountModule::setAccountState(const int accountState) +{ + if (int(m_account->accountState()) != accountState) { + m_account->setAccountState(static_cast(accountState)); + m_accountDB->updateAccountInfo(); + } +} + +int DAccountModule::getSyncState() +{ + return m_account->syncState(); +} + +QString DAccountModule::getSyncFreq() +{ + return DAccount::syncFreqToJsonString(m_account); +} + +void DAccountModule::setSyncFreq(const QString &freq) +{ + DAccount::SyncFreqType syncType = m_account->syncFreq(); + DAccount::syncFreqFromJsonString(m_account, freq); + if (syncType == m_account->syncFreq()) { + return; + } + m_accountDB->updateAccountInfo(); + downloadTaskhanding(1); +} + +QString DAccountModule::getScheduleTypeList() +{ + DScheduleType::List typeList = m_accountDB->getScheduleTypeList(); + //排序 + std::sort(typeList.begin(), typeList.end()); + QString typeListStr; + DScheduleType::toJsonListString(typeList, typeListStr); + return typeListStr; +} + +QString DAccountModule::getScheduleTypeByID(const QString &typeID) +{ + DScheduleType::Ptr scheduleType = m_accountDB->getScheduleTypeByID(typeID); + QString typeStr; + DScheduleType::toJsonString(scheduleType, typeStr); + return typeStr; +} + +QString DAccountModule::createScheduleType(const QString &typeInfo) +{ + DScheduleType::Ptr scheduleType; + DScheduleType::fromJsonString(scheduleType, typeInfo); + //如果颜色为用户自定义则需要在数据库中记录 + if (scheduleType->typeColor().colorID() == "") { + scheduleType->setColorID(DDataBase::createUuid()); + DTypeColor::Ptr typeColor(new DTypeColor(scheduleType->typeColor())); + typeColor->setPrivilege(DTypeColor::PriUser); + m_accountDB->addTypeColor(typeColor); + //添加创建颜色任务 + if (m_account->isNetWorkAccount()) { + DUploadTaskData::Ptr uploadTask(new DUploadTaskData); + uploadTask->setTaskType(DUploadTaskData::TaskType::Create); + uploadTask->setTaskObject(DUploadTaskData::Task_Color); + uploadTask->setObjectId(typeColor->colorID()); + m_accountDB->addUploadTask(uploadTask); + } + } + //设置创建时间 + scheduleType->setDtCreate(QDateTime::currentDateTime()); + QString scheduleTypeID = m_accountDB->createScheduleType(scheduleType); + //如果为网络日程则需要上传任务 + if (m_account->isNetWorkAccount()) { + DUploadTaskData::Ptr uploadTask(new DUploadTaskData); + uploadTask->setTaskType(DUploadTaskData::TaskType::Create); + uploadTask->setTaskObject(DUploadTaskData::Task_ScheduleType); + uploadTask->setObjectId(scheduleTypeID); + m_accountDB->addUploadTask(uploadTask); + //开启上传任务 + uploadNetWorkAccountData(); + } + emit signalScheduleTypeUpdate(); + return scheduleTypeID; +} + +bool DAccountModule::deleteScheduleTypeByID(const QString &typeID) +{ + //如果日程类型被使用需要删除对应到日程信息 + if (m_accountDB->scheduleTypeByUsed(typeID)) { + QStringList scheduleIDList = m_accountDB->getScheduleIDListByTypeID(typeID); + foreach (auto scheduleID, scheduleIDList) { + closeNotification(scheduleID); + //添加删除日程任务 + if (m_account->isNetWorkAccount()) { + DUploadTaskData::Ptr uploadTask(new DUploadTaskData); + uploadTask->setTaskType(DUploadTaskData::TaskType::Delete); + uploadTask->setTaskObject(DUploadTaskData::Task_Schedule); + uploadTask->setObjectId(scheduleID); + m_accountDB->addUploadTask(uploadTask); + } + } + //更新提醒任务 + updateRemindSchedules(false); + m_accountDB->deleteSchedulesByScheduleTypeID(typeID, !m_account->isNetWorkAccount()); + emit signalScheduleUpdate(); + } + DScheduleType::Ptr scheduleType = m_accountDB->getScheduleTypeByID(typeID); + //根据帐户是否为网络帐户需要添加任务列表中,并设置弱删除 + if (m_account->isNetWorkAccount()) { + QStringList scheduleIDList = m_accountDB->getScheduleIDListByTypeID(typeID); + //弱删除 + m_accountDB->deleteScheduleTypeByID(typeID); + + //发送操作内容给任务列表 + DUploadTaskData::Ptr uploadTask(new DUploadTaskData); + uploadTask->setTaskType(DUploadTaskData::TaskType::Delete); + uploadTask->setTaskObject(DUploadTaskData::Task_ScheduleType); + uploadTask->setObjectId(typeID); + m_accountDB->addUploadTask(uploadTask); + + //如果颜色不为系统类型则删除 + if(scheduleType->typeColor().privilege() != DTypeColor::PriSystem){ + m_accountDB->deleteTypeColor(scheduleType->typeColor().colorID()); + DUploadTaskData::Ptr uploadTask(new DUploadTaskData); + uploadTask->setTaskType(DUploadTaskData::TaskType::Delete); + uploadTask->setTaskObject(DUploadTaskData::Task_Color); + uploadTask->setObjectId(scheduleType->typeColor().colorID()); + m_accountDB->addUploadTask(uploadTask); + } + + //开启上传任务 + uploadNetWorkAccountData(); + } else { + m_accountDB->deleteScheduleTypeByID(typeID, 1); + if(scheduleType->typeColor().privilege() != DTypeColor::PriSystem){ + m_accountDB->deleteTypeColor(scheduleType->typeColor().colorID()); + } + } + if (scheduleType.isNull()) { + qWarning() << "scheduleType isNull, typeID:" << typeID; + return false; + } + + //如果为用户颜色则删除颜色 + if (scheduleType->typeColor().privilege() > 1) { + m_accountDB->deleteTypeColor(scheduleType->typeColor().colorID()); + } + emit signalScheduleTypeUpdate(); + return true; +} + +bool DAccountModule::scheduleTypeByUsed(const QString &typeID) +{ + return m_accountDB->scheduleTypeByUsed(typeID); +} + +bool DAccountModule::updateScheduleType(const QString &typeInfo) +{ + DScheduleType::Ptr scheduleType; + DScheduleType::fromJsonString(scheduleType, typeInfo); + DScheduleType::Ptr oldScheduleType = m_accountDB->getScheduleTypeByID(scheduleType->typeID()); + //如果颜色有改动 + if (oldScheduleType.isNull()) { + qWarning() << "get oldScheduleType error,typeID:" << scheduleType->typeID(); + } else { + if (oldScheduleType->typeColor() != scheduleType->typeColor()) { + if (!oldScheduleType->typeColor().isSysColorInfo()) { + m_accountDB->deleteTypeColor(oldScheduleType->typeColor().colorID()); + //添加删除颜色任务 + if (m_account->isNetWorkAccount()) { + DUploadTaskData::Ptr uploadTask(new DUploadTaskData); + uploadTask->setTaskType(DUploadTaskData::TaskType::Delete); + uploadTask->setTaskObject(DUploadTaskData::Task_Color); + uploadTask->setObjectId(oldScheduleType->typeColor().colorID()); + m_accountDB->addUploadTask(uploadTask); + } + } + if (!scheduleType->typeColor().isSysColorInfo()) { + DTypeColor::Ptr typeColor(new DTypeColor(scheduleType->typeColor())); + typeColor->setPrivilege(DTypeColor::PriUser); + m_accountDB->addTypeColor(typeColor); + scheduleType->setColorID(typeColor->colorID()); + //添加创建颜色任务 + if (m_account->isNetWorkAccount()) { + DUploadTaskData::Ptr uploadTask(new DUploadTaskData); +// uploadTask->setTaskType(DUploadTaskData::TaskType::Delete); + uploadTask->setTaskType(DUploadTaskData::TaskType::Create); + uploadTask->setTaskObject(DUploadTaskData::Task_Color); + uploadTask->setObjectId(typeColor->colorID()); + m_accountDB->addUploadTask(uploadTask); + } + } + } + } + scheduleType->setDtUpdate(QDateTime::currentDateTime()); + bool isSucc = m_accountDB->updateScheduleType(scheduleType); + + if (isSucc) { + if (m_account->isNetWorkAccount()) { + DUploadTaskData::Ptr uploadTask(new DUploadTaskData); + uploadTask->setTaskType(DUploadTaskData::TaskType::Modify); + uploadTask->setTaskObject(DUploadTaskData::Task_ScheduleType); + uploadTask->setObjectId(scheduleType->typeID()); + m_accountDB->addUploadTask(uploadTask); + //开启上传任务 + uploadNetWorkAccountData(); + } + //如果不是修改显示状态则发送日程类型改变信号 + if (oldScheduleType->showState() == scheduleType->showState()) { + emit signalScheduleTypeUpdate(); + } else { + //日程改变信号 + emit signalScheduleUpdate(); + } + } + return isSucc; +} + +QString DAccountModule::createSchedule(const QString &scheduleInfo) +{ + DSchedule::Ptr schedule; + DSchedule::fromJsonString(schedule, scheduleInfo); + schedule->setCreated(QDateTime::currentDateTime()); + + QString scheduleID = m_accountDB->createSchedule(schedule); + //根据是否为网络帐户判断是否需要更新任务列表 + if (m_account->isNetWorkAccount()) { + DUploadTaskData::Ptr uploadTask(new DUploadTaskData); + uploadTask->setTaskType(DUploadTaskData::TaskType::Create); + uploadTask->setTaskObject(DUploadTaskData::Task_Schedule); + uploadTask->setObjectId(scheduleID); + m_accountDB->addUploadTask(uploadTask); + //开启上传任务 + uploadNetWorkAccountData(); + } + //根据是否为提醒日程更新提醒任务 + if (schedule->alarms().size() > 0) { + updateRemindSchedules(false); + } + //发送日程更新信号 + emit signalScheduleUpdate(); + return scheduleID; +} + +bool DAccountModule::updateSchedule(const QString &scheduleInfo) +{ + //根据是否为提醒日程更新提醒任务 + DSchedule::Ptr schedule; + DSchedule::fromJsonString(schedule, scheduleInfo); + DSchedule::Ptr oldSchedule = m_accountDB->getScheduleByScheduleID(schedule->uid()); + schedule->setLastModified(QDateTime::currentDateTime()); + schedule->setRevision(schedule->revision() + 1); + + //如果旧日程为提醒日程 + if (oldSchedule->alarms().size() > 0) { + //根据日程ID获取提醒日程信息 + DRemindData::List remindList = m_accountDB->getRemindByScheduleID(schedule->schedulingID()); + + DRemindData::List deleteRemind; + + //如果是重复日程且重复规则不一样 + if ((schedule->recurs() || oldSchedule->recurs()) && *schedule->recurrence() != *oldSchedule->recurrence()) { + QDateTime dtEnd = schedule->dtStart(); + for (int i = remindList.size() - 1; i >= 0; --i) { + dtEnd = dtEnd > remindList.at(i)->dtStart() ? dtEnd : remindList.at(i)->dtStart(); + } + + if (remindList.size() > 0) { + //获取新日程的重复时间 + QList dtList = schedule->recurrence()->timesInInterval(schedule->dtStart(), dtEnd); + foreach (auto remind, remindList) { + //如果生成的开始时间列表内不包含提醒日程的开始时间,则表示该重复日程被删除 + if (!dtList.contains(remind->dtStart())) { + //如果改日程已经提醒,且通知弹框未操作 + if (remind->notifyid() > 0) { + emit signalCloseNotification(static_cast(remind->notifyid())); + deleteRemind.append(remind); + } else if (remind->dtRemind() > QDateTime::currentDateTime()) { + //删除没有触发的提醒日程 + deleteRemind.append(remind); + } + } + } + } + } else { + //不是重复日程 + if (remindList.size() > 0 && remindList.at(0)->notifyid() > 0) { + deleteRemind.append(remindList.at(0)); + } + } + for (int i = 0; i < deleteRemind.size(); ++i) { + m_accountDB->deleteRemindInfoByAlarmID(deleteRemind.at(i)->alarmID()); + } + } + + bool ok = m_accountDB->updateSchedule(schedule); + + //如果存在提醒 + if (oldSchedule->alarms().size() > 0 || schedule->alarms().size() > 0) { + updateRemindSchedules(false); + } + + emit signalScheduleUpdate(); + //根据是否为网络帐户判断是否需要更新任务列表 + if (m_account->isNetWorkAccount()) { + DUploadTaskData::Ptr uploadTask(new DUploadTaskData); + uploadTask->setTaskType(DUploadTaskData::TaskType::Modify); + uploadTask->setTaskObject(DUploadTaskData::Task_Schedule); + uploadTask->setObjectId(schedule->uid()); + m_accountDB->addUploadTask(uploadTask); + //开启上传任务 + uploadNetWorkAccountData(); + } + return ok; +} + +QString DAccountModule::getScheduleByScheduleID(const QString &scheduleID) +{ + DSchedule::Ptr schedule = m_accountDB->getScheduleByScheduleID(scheduleID); + QString scheduleStr; + DSchedule::toJsonString(schedule, scheduleStr); + return scheduleStr; +} + +bool DAccountModule::deleteScheduleByScheduleID(const QString &scheduleID) +{ + //根据是否为网络判断是否需要弱删除 + bool isOK; + DSchedule::Ptr schedule = m_accountDB->getScheduleByScheduleID(scheduleID); + if (m_account->isNetWorkAccount()) { + isOK = m_accountDB->deleteScheduleByScheduleID(scheduleID); + //更新上传任务表 + DUploadTaskData::Ptr uploadTask(new DUploadTaskData); + uploadTask->setTaskType(DUploadTaskData::TaskType::Delete); + uploadTask->setTaskObject(DUploadTaskData::Task_Schedule); + uploadTask->setObjectId(scheduleID); + m_accountDB->addUploadTask(uploadTask); + //开启任务 + uploadNetWorkAccountData(); + } else { + isOK = m_accountDB->deleteScheduleByScheduleID(scheduleID, 1); + } + //如果删除的是提醒日程 + if (schedule->alarms().size() > 0) { + //关闭提醒消息和对应的通知弹框 + closeNotification(scheduleID); + updateRemindSchedules(false); + } + emit signalScheduleUpdate(); + return isOK; +} + +QString DAccountModule::querySchedulesWithParameter(const QString ¶ms) +{ + DScheduleQueryPar::Ptr queryPar = DScheduleQueryPar::fromJsonString(params); + if (queryPar.isNull()) { + return QString(); + } + DSchedule::List scheduleList; + if (queryPar->queryType() == DScheduleQueryPar::Query_RRule) { + scheduleList = m_accountDB->querySchedulesByRRule(queryPar->key(), queryPar->rruleType()); + } else if (queryPar->queryType() == DScheduleQueryPar::Query_ScheduleID) { + DSchedule::Ptr schedule = m_accountDB->getScheduleByScheduleID(queryPar->key()); + if (schedule.isNull()) { + return QString(); + } + QMap m_scheduleMap; + //相差多少天 + int days = static_cast(queryPar->dtStart().daysTo(queryPar->dtEnd())); + for (int i = 0; i <= days; ++i) { + DSchedule::List scheduleList; + m_scheduleMap[queryPar->dtStart().addDays(i).date()] = scheduleList; + } + extendRecurrence(m_scheduleMap, schedule, queryPar->dtStart(), queryPar->dtEnd(), false); + return DSchedule::toMapString(m_scheduleMap); + + } else { + scheduleList = m_accountDB->querySchedulesByKey(queryPar->key()); + } + + bool extend = queryPar->queryType() == DScheduleQueryPar::Query_None; + //根据条件判断是否需要添加节假日日程 + if (isChineseEnv() && extend && m_account->accountType() == DAccount::Account_Local) { + scheduleList.append(getFestivalSchedule(queryPar->dtStart(), queryPar->dtEnd(), queryPar->key())); + } + + //获取一定范围内的日程 + QMap scheduleMap = getScheduleTimesOn(queryPar->dtStart(), queryPar->dtEnd(), scheduleList, extend); + + //如果为查询前N个日程,则取前N个日程 + if (queryPar->queryType() == DScheduleQueryPar::Query_Top) { + int scheduleNum = 0; + DSchedule::Map filterSchedule; + DSchedule::Map::const_iterator iter = scheduleMap.constBegin(); + for (; iter != scheduleMap.constEnd(); ++iter) { + if (iter.value().size() == 0) { + continue; + } + if (scheduleNum + iter.value().size() > queryPar->queryTop()) { + DSchedule::List scheduleList; + int residuesNum = queryPar->queryTop() - scheduleNum; + for (int i = 0; i < residuesNum; ++i) { + scheduleList.append(iter.value().at(i)); + } + filterSchedule[iter.key()] = scheduleList; + } else { + filterSchedule[iter.key()] = iter.value(); + } + } + scheduleMap = filterSchedule; + } + return DSchedule::toMapString(scheduleMap); +} + +DSchedule::List DAccountModule::getRemindScheduleList(const QDateTime &dtStart, const QDateTime &dtEnd) +{ + //获取范围内需要提醒的日程信息 + DSchedule::List scheduleList; + //当前最多提前一周提醒。所以结束时间+8天 + QMap scheduleMap = getScheduleTimesOn(dtStart, dtEnd.addDays(8), m_accountDB->getRemindSchedule(), false); + QMap::const_iterator iter = scheduleMap.constBegin(); + for (; iter != scheduleMap.constEnd(); ++iter) { + foreach (auto schedule, iter.value()) { + if (schedule->alarms().size() > 0 + && schedule->alarms()[0]->time() >= dtStart && schedule->alarms()[0]->time() <= dtEnd) { + scheduleList.append(schedule); + } + } + } + return scheduleList; +} + +QString DAccountModule::getSysColors() +{ + DTypeColor::List colorList = m_accountDB->getSysColor(); + std::sort(colorList.begin(), colorList.end()); + return DTypeColor::toJsonString(colorList); +} + +DAccount::Ptr DAccountModule::account() const +{ + return m_account; +} + +void DAccountModule::updateRemindSchedules(bool isClear) +{ + //因为全天的当前提醒日程会在开始时间延后9小时提醒 + QDateTime dtCurrent = QDateTime::currentDateTime(); + QDateTime dtStart = dtCurrent.addSecs(-9*60*60); + QDateTime dtEnd = dtCurrent.addMSecs(UPDATEREMINDJOBTIMEINTERVAL); + + //获取未提醒的日程相关信息 + DRemindData::List noRemindList = m_accountDB->getValidRemindJob(); + + //获取每个账户下需要提醒的日程信息 + DRemindData::List accountRemind; + + DSchedule::List scheduleList = getRemindScheduleList(dtStart, dtEnd); + foreach (auto &remind, scheduleList) { + DRemindData::Ptr remindData = DRemindData::Ptr(new DRemindData); + remindData->setScheduleID(remind->uid()); + remindData->setAccountID(m_account->accountID()); + remindData->setDtStart(remind->dtStart()); + remindData->setDtEnd(remind->dtEnd()); + remindData->setRecurrenceId(remind->recurrenceId()); + //由于获取的都是需要提醒的日程,所以日程的提醒列表size必然是大于0的 + remindData->setDtRemind(remind->alarms()[0]->time()); + remindData->setNotifyid(0); + remindData->setRemindCount(0); + accountRemind.append(remindData); + } + + //获取未提醒的稍后日程信息,由于15分钟后,1xxx后等不会修改提醒次数 + //所以需要根据提醒时间,日程id,日程重复id来判断是否是没有被触发点提醒日程 + for (int i = 0; i < noRemindList.size(); i++) { + for (int j = accountRemind.size() - 1; j >= 0; j--) { + if (accountRemind.at(j)->scheduleID() == noRemindList.at(i)->scheduleID() + && accountRemind.at(j)->recurrenceId() == noRemindList.at(i)->recurrenceId() + && accountRemind.at(j)->dtRemind() == noRemindList.at(i)->dtRemind()) + //如果该日程没有被触发提醒过(创建后没有被提醒,而不是提醒后点了15分钟后等不改变提醒次数的日程) + //则移除 + accountRemind.removeAt(j); + } + } + + if (isClear) { + //清空数据库 + m_accountDB->clearRemindJobDatabase(); + + foreach (auto remind, noRemindList) { + m_accountDB->createRemindInfo(remind); + } + } + //添加从账户中获取到的需要提醒的日程信息 + foreach (auto remind, accountRemind) { + m_accountDB->createRemindInfo(remind); + } + accountRemind.append(noRemindList); + //更新提醒任务 + m_alarm->updateRemind(accountRemind); +} + +void DAccountModule::notifyMsgHanding(const QString &alarmID, const qint32 operationNum) +{ + DRemindData::Ptr remindData = m_accountDB->getRemindData(alarmID); + remindData->setAccountID(m_account->accountID()); + //如果相应的日程被删除,则不做处理 + if (remindData.isNull()) { + return; + } + //如果为稍后提醒操作则需要更新对应的重复次数和提醒时间 + qint64 Minute = 60 * 1000; + qint64 Hour = Minute * 60; + switch (operationNum) { + case 2: { //稍后提醒 + remindData->setRemindCount(remindData->remindCount() + 1); + remindData->updateRemindTimeByCount(); + m_accountDB->updateRemindInfo(remindData); + } break; + case 21: { //15min后提醒 + remindData->updateRemindTimeByMesc(15 * Minute); + m_accountDB->updateRemindInfo(remindData); + } break; + case 22: { //一个小时后提醒 + remindData->updateRemindTimeByMesc(Hour); + m_accountDB->updateRemindInfo(remindData); + } break; + case 23: { //四个小时后提醒 + remindData->updateRemindTimeByMesc(4 * Hour); + m_accountDB->updateRemindInfo(remindData); + } break; + case 3: { //明天提醒 + remindData->updateRemindTimeByMesc(24 * Hour); + m_accountDB->updateRemindInfo(remindData); + } break; + case 1: { //打开日历 + } break; + case 4: { //提前1天提醒 + DSchedule::Ptr schedule = getScheduleByRemind(remindData); + //TODO:如果是重复日程是否需要修改所有日程的提醒?还是只修改此日程? + if (schedule->allDay()) { + schedule->setAlarmType(DSchedule::Alarm_15Min_Front); + } else { + schedule->setAlarmType(DSchedule::Alarm_1Day_Front); + } + m_accountDB->updateSchedule(schedule); + //删除对应提醒任务数据 + m_accountDB->deleteRemindInfoByAlarmID(alarmID); + emit signalScheduleUpdate(); + } break; + default: + //删除对应提醒任务数据 + m_accountDB->deleteRemindInfoByAlarmID(alarmID); + break; + } + + m_alarm->notifyMsgHanding(remindData, operationNum); +} + +void DAccountModule::remindJob(const QString &alarmID) +{ + DRemindData::Ptr remindData = m_accountDB->getRemindData(alarmID); + remindData->setAccountID(m_account->accountID()); + DSchedule::Ptr schedule = getScheduleByRemind(remindData); + + int notifyid = m_alarm->remindJob(remindData, schedule); + remindData->setNotifyid(notifyid); + m_accountDB->updateRemindInfo(remindData); +} + +void DAccountModule::accountDownload() +{ + if (m_dataSync != nullptr) { + qInfo() << "开始下载数据"; + m_dataSync->syncData(this->account()->accountID(), this->account()->accountName(), (int)this->account()->accountState(), DDataSyncBase::Sync_Upload | DDataSyncBase::Sync_Download); + } +} + +void DAccountModule::uploadNetWorkAccountData() +{ + if (m_dataSync != nullptr) { + qInfo() << "开始上传数据"; + m_dataSync->syncData(this->account()->accountID(), this->account()->accountName(), (int)this->account()->accountState(), DDataSyncBase::Sync_Upload); + } +} + +QString DAccountModule::getDtLastUpdate() +{ + return dtToString(m_account->dtLastSync()); +} + +void DAccountModule::removeDB() +{ + m_accountDB->removeDB(); + //如果为uid帐户退出则清空目录下所有关于uid的数据库文件 + //解决在某些条件下数据库没有被移除的问题(自测未发现) + if(account()->accountType() == DAccount::Type::Account_UnionID){ + QString dbPatch = getHomeConfigPath().append(QString("/deepin/dde-calendar-service/")); + QDir dir(dbPatch); + if (dir.exists()) { + QStringList filters; + filters << QString("account_uid_*"); + dir.setFilter(QDir::Files | QDir::NoSymLinks); + dir.setNameFilters(filters); + for (uint i = 0; i < dir.count(); ++i) { + QFile::remove(dbPatch + dir[i]); + } + } + } +} + +QMap DAccountModule::getScheduleTimesOn(const QDateTime &dtStart, const QDateTime &dtEnd, const DSchedule::List &scheduleList, bool extend) +{ + QMap m_scheduleMap; + //相差多少天 + int days = static_cast(dtStart.daysTo(dtEnd)); + for (int i = 0; i <= days; ++i) { + DSchedule::List scheduleList; + m_scheduleMap[dtStart.addDays(i).date()] = scheduleList; + } + + foreach (auto &schedule, scheduleList) { + //获取日程的开始结束时间差 + qint64 interval = schedule->dtStart().secsTo(schedule->dtEnd()); + //如果存在重复日程 + if (schedule->recurs()) { + //如果为农历日程 + if (schedule->lunnar()) { + //农历重复日程计算 + LunarDateInfo lunardate(schedule->recurrence()->defaultRRuleConst(), interval); + + QMap ruleStartDate = lunardate.getRRuleStartDate(dtStart.date(), dtEnd.date(), schedule->dtStart().date()); + + QDateTime recurDateTime; + recurDateTime.setTime(schedule->dtStart().time()); + QDateTime copyEnd; + QMap::ConstIterator iter = ruleStartDate.constBegin(); + for (; iter != ruleStartDate.constEnd(); iter++) { + recurDateTime.setDate(iter.value()); + //如果在忽略时间列表中,则忽略 + if (schedule->recurrence()->exDateTimes().contains(recurDateTime)) + continue; + copyEnd = recurDateTime.addSecs(interval); + DSchedule::Ptr newSchedule = DSchedule::Ptr(new DSchedule(*schedule.data())); + newSchedule->setDtStart(recurDateTime); + newSchedule->setDtEnd(copyEnd); + //只有重复日程设置RecurrenceId + if (schedule->dtStart() != recurDateTime) { + newSchedule->setRecurrenceId(recurDateTime); + } + + if (extend) { + //需要扩展的天数 + int extenddays = static_cast(recurDateTime.daysTo(copyEnd)); + for (int i = 0; i <= extenddays; ++i) { + m_scheduleMap[recurDateTime.date().addDays(i)].append(newSchedule); + } + + } else { + m_scheduleMap[recurDateTime.date()].append(newSchedule); + } + } + } else { + //非农历日程 + extendRecurrence(m_scheduleMap, schedule, dtStart, dtEnd, extend); + } + } else { + //普通日程 + //如果在查询时间范围内 + QDateTime queryDtStart = dtStart; + //如果日程为全天日程,则查询的开始时间设置为0点,因为全天日程的开始和结束时间都是0点 + if(schedule->allDay()){ + queryDtStart.setTime(QTime(0,0,0)); + } + if (!(schedule->dtEnd() < queryDtStart || schedule->dtStart() > dtEnd)) { + if (extend && schedule->isMultiDay()) { + //需要扩展的天数 + int extenddays = static_cast(schedule->dtStart().daysTo(schedule->dtEnd())); + for (int i = 0; i <= extenddays; ++i) { + //如果扩展的日期在查询范围内则添加,否则退出 + if(m_scheduleMap.contains(schedule->dtStart().date().addDays(i))){ + m_scheduleMap[schedule->dtStart().date().addDays(i)].append(schedule); + } else { + break; + } + } + } else { + m_scheduleMap[schedule->dtStart().date()].append(schedule); + } + } + } + } + return m_scheduleMap; +} + +DSchedule::List DAccountModule::getFestivalSchedule(const QDateTime &dtStart, const QDateTime &dtEnd, const QString &key) +{ + QList festivaldays = GetFestivalsInRange(dtStart, dtEnd); + if (!key.isEmpty()) { + festivaldays = FilterDayFestival(festivaldays, key); + } + DSchedule::List scheduleList; + foreach (stDayFestival festivalDay, festivaldays) { + foreach (QString festival, festivalDay.Festivals) { + if (!festival.isEmpty()) { + DSchedule::Ptr schedule = DSchedule::Ptr(new DSchedule); + schedule->setSummary(festival); + schedule->setAllDay(true); + schedule->setDtStart(QDateTime(QDate(festivalDay.date.date()), QTime(0, 0))); + schedule->setDtEnd(QDateTime(QDate(festivalDay.date.date()), QTime(23, 59))); + //设置UID为开始时间+内容 + schedule->setUid(dtToString(schedule->dtStart()) + schedule->summary()); + schedule->setScheduleTypeID(m_accountDB->getFestivalTypeID()); + scheduleList.append(schedule); + } + } + } + return scheduleList; +} + +void DAccountModule::extendRecurrence(DSchedule::Map &scheduleMap, const DSchedule::Ptr &schedule, const QDateTime &dtStart, const QDateTime &dtEnd, bool extend) +{ + QDateTime queryDtStart = dtStart; + //如果日程为全天日程,则查询的开始时间设置为0点,因为全天日程的开始和结束时间都是0点 + if(schedule->allDay()){ + queryDtStart.setTime(QTime(0,0,0)); + } + if (schedule->recurs()) { + //获取日程的开始结束时间差 + qint64 interval = schedule->dtStart().secsTo(schedule->dtEnd()); + QList dtList = schedule->recurrence()->timesInInterval(queryDtStart, dtEnd); + foreach (auto &dt, dtList) { + QDateTime scheduleDtEnd = dt.addSecs(interval); + DSchedule::Ptr newSchedule = DSchedule::Ptr(schedule->clone()); + newSchedule->setDtStart(dt); + newSchedule->setDtEnd(scheduleDtEnd); + + //只有重复日程设置RecurrenceId + if (schedule->dtStart() != dt) { + newSchedule->setRecurrenceId(dt); + } + if (extend) { + //需要扩展的天数 + int extenddays = static_cast(dt.daysTo(scheduleDtEnd)); + for (int i = 0; i <= extenddays; ++i) { + scheduleMap[dt.date().addDays(i)].append(newSchedule); + } + } else { + scheduleMap[dt.date()].append(newSchedule); + } + } + } else { + if (!(schedule->dtStart() > dtEnd || schedule->dtEnd() < queryDtStart)) { + scheduleMap[schedule->dtStart().date()].append(schedule); + } + } +} + +void DAccountModule::closeNotification(const QString &scheduleId) +{ + //根据日程ID获取提醒日程信息 + DRemindData::List remindList = m_accountDB->getRemindByScheduleID(scheduleId); + foreach (auto remind, remindList) { + m_accountDB->deleteRemindInfoByAlarmID(remind->alarmID()); + emit signalCloseNotification(static_cast(remind->notifyid())); + } +} + +DSchedule::Ptr DAccountModule::getScheduleByRemind(const DRemindData::Ptr &remindData) +{ + DSchedule::Ptr schedule = m_accountDB->getScheduleByScheduleID(remindData->scheduleID()); + if (!schedule.isNull() && schedule->dtStart() != remindData->dtStart()) { + schedule->setDtStart(remindData->dtStart()); + schedule->setDtEnd(remindData->dtEnd()); + schedule->setRecurrenceId(remindData->recurrenceId()); + } + return schedule; +} + +void DAccountModule::downloadTaskhanding(int index) +{ + //index: 0:帐户登录 1:修改同步频率 2:帐户登出 + CSystemdTimerControl sysControl; + if (index > 0) { + //修改和停止都需要停止定时任务 + sysControl.stopDownloadTask(m_account->accountID()); + } + if (index != 2) { + //如果帐户刚刚登录开启定时任务 + //设置同步频率 + if (m_account->isNetWorkAccount()) { + int sync = -1; + switch (m_account->syncFreq()) { + case DAccount::SyncFreq_15Mins: + sync = 15; + break; + case DAccount::SyncFreq_30Mins: + sync = 30; + break; + case DAccount::SyncFreq_1hour: + sync = 60; + break; + case DAccount::SyncFreq_24hour: + sync = 24 * 60; + break; + default: + break; + } + if (sync > 0) { + sysControl.startDownloadTask(m_account->accountID(), sync); + } + } + } +} + +void DAccountModule::uploadTaskHanding(int open) +{ + CSystemdTimerControl sysControl; + if (1 == open) { + sysControl.startUploadTask(15); + return; + } + if (0 == open) { + //TODO:需要考虑多个帐户情况 + sysControl.stopUploadTask(); + return; + } +} + +void DAccountModule::slotOpenCalendar(const QString &alarmID) +{ + DbusUIOpenSchedule openCalendar("com.deepin.Calendar", + "/com/deepin/Calendar", + QDBusConnection::sessionBus(), + this); + DRemindData::Ptr remindData = m_accountDB->getRemindData(alarmID); + if (remindData.isNull()) { + qWarning() << "No corresponding reminder ID found"; + return; + } + DSchedule::Ptr schedule = getScheduleByRemind(remindData); + QString scheduleStr; + DSchedule::toJsonString(schedule, scheduleStr); + openCalendar.OpenSchedule(scheduleStr); + //删除对应提醒任务数据 + m_accountDB->deleteRemindInfoByAlarmID(alarmID); +} + +void DAccountModule::slotSyncState(const int syncState) +{ + m_account->setDtLastSync(QDateTime::currentDateTime()); + switch (syncState) { + case 0: + //执行正常 + m_account->setSyncState(DAccount::Sync_Normal); + m_accountDB->updateAccountInfo(); + //同步成功后更新提醒任务 + updateRemindSchedules(false); + break; + case 7506: + //网络异常 + m_account->setSyncState(DAccount::Sync_NetworkAnomaly); + break; + case 7508: + //存储已满 + m_account->setSyncState(DAccount::Sync_StorageFull); + break; + default: + qWarning()<<"syncState:"<setSyncState(DAccount::Sync_ServerException); + break; + } + + emit signalDtLastUpdate(); + //错误处理 + emit signalSyncState(); + //如果上传失败,需要启动定时上传 +// if (m_account->syncState() != DAccount::Sync_Normal) { +// uploadTaskHanding(1); +// } else { +// //如果有定时上传则停止 +// uploadTaskHanding(0); +// } +} + +void DAccountModule::slotDateUpdate(const DDataSyncBase::UpdateTypes updateType) +{ + if (updateType.testFlag(DDataSyncBase::Update_Setting)) { + emit signalSettingChange(); + } + if (updateType.testFlag(DDataSyncBase::Update_Schedule)) { + emit signalScheduleUpdate(); + } + if (updateType.testFlag(DDataSyncBase::Update_ScheduleType)) { + emit signalScheduleTypeUpdate(); + } +} diff -Nru dde-calendar-5.9.1/calendar-service/src/calendarDataManager/daccountmodule.h dde-calendar-5.10.0/calendar-service/src/calendarDataManager/daccountmodule.h --- dde-calendar-5.9.1/calendar-service/src/calendarDataManager/daccountmodule.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/calendarDataManager/daccountmodule.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,141 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef DACCOUNTMODULE_H +#define DACCOUNTMODULE_H + +#include "daccount.h" +#include "daccountdatabase.h" +#include "dschedule.h" +#include "dalarmmanager.h" +#include "ddatasyncbase.h" + +#include +#include + +//帐户模块 +//处理后端数据获取,提醒,上传下载等 +class DAccountModule : public QObject +{ + Q_OBJECT +public: + typedef QSharedPointer Ptr; + typedef QList List; + + explicit DAccountModule(const DAccount::Ptr &account, QObject *parent = nullptr); + ~DAccountModule(); + //获取帐户信息 + QString getAccountInfo(); + //设置获取帐户是否展开 + bool getExpand(); + void setExpand(const bool &isExpand); + //帐户状态。 + int getAccountState(); + void setAccountState(const int accountState); + //获取同步状态 + int getSyncState(); + QString getSyncFreq(); + void setSyncFreq(const QString &freq); + + //获取类型 + QString getScheduleTypeList(); + QString getScheduleTypeByID(const QString &typeID); + QString createScheduleType(const QString &typeInfo); + bool deleteScheduleTypeByID(const QString &typeID); + bool scheduleTypeByUsed(const QString &typeID); + bool updateScheduleType(const QString &typeInfo); + + //日程信息 + QString createSchedule(const QString &scheduleInfo); + bool updateSchedule(const QString &scheduleInfo); + QString getScheduleByScheduleID(const QString &scheduleID); + bool deleteScheduleByScheduleID(const QString &scheduleID); + QString querySchedulesWithParameter(const QString ¶ms); + + //获取需要提醒的日程 + DSchedule::List getRemindScheduleList(const QDateTime &dtStart, const QDateTime &dtEnd); + + //内置颜色 + QString getSysColors(); + + DAccount::Ptr account() const; + + /** + * @brief updateRemindSchedules 更新未来10分钟的提醒任务 + * @param isClear 是否清空提醒任务数据库 + */ + void updateRemindSchedules(bool isClear); + + /** + * @brief notifyMsgHanding 通知提示框交互处理 + * @param alarmID 提醒任务id + * @param operationNum 操作编号 + * 1:打开日历, + * 2:稍后提醒 21:15min后提醒 22:一个小时后提醒 23:四个小时后提醒 + * 3:明天提醒 4: 提前1天提醒 + */ + void notifyMsgHanding(const QString &alarmID, const qint32 operationNum); + + void remindJob(const QString &alarmID); + + void accountDownload(); + void uploadNetWorkAccountData(); + + //删除数据库 + void removeDB(); + //index: 0:帐户登录 1:修改同步频率 2:帐户登出 + void downloadTaskhanding(int index); + + // 0:关闭 1:启动 + void uploadTaskHanding(int open); + + //获取最后一次同步时间 + QString getDtLastUpdate(); + +private: + QMap getScheduleTimesOn(const QDateTime &dtStart, const QDateTime &dtEnd, const DSchedule::List &scheduleList, bool extend = true); + DSchedule::List getFestivalSchedule(const QDateTime &dtStart, const QDateTime &dtEnd, const QString &key); + + //根据重复规则扩展非农历重复日程 + void extendRecurrence(DSchedule::Map &scheduleMap, const DSchedule::Ptr &schedule, const QDateTime &dtStart, const QDateTime &dtEnd, bool extend = true); + + /** + * @brief closeNotification 关闭通知弹框 + * @param scheduleId 日程id + */ + void closeNotification(const QString &scheduleId); + + //根据提醒任务获取对应的日程信息 + DSchedule::Ptr getScheduleByRemind(const DRemindData::Ptr &remindData); + +signals: + void signalScheduleUpdate(); + void signalScheduleTypeUpdate(); + //关闭通知弹框 + void signalCloseNotification(quint64 notifyID); + + void signalAccountState(); + void signalSyncState(); + + void signalDtLastUpdate(); + //通用设置发生改变 + void signalSettingChange(); + + //数据同步完成 + void signalSyncFinished(int); + +public slots: + void slotOpenCalendar(const QString &alarmID); + + void slotSyncState(const int syncState); + void slotDateUpdate(const DDataSyncBase::UpdateTypes updateType); + +private: + DAccount::Ptr m_account; + DAccountDataBase::Ptr m_accountDB; + DAlarmManager::Ptr m_alarm; + DDataSyncBase *m_dataSync; +}; + +#endif // DACCOUNTMODULE_H diff -Nru dde-calendar-5.9.1/calendar-service/src/calendarDataManager/duploadtaskdata.cpp dde-calendar-5.10.0/calendar-service/src/calendarDataManager/duploadtaskdata.cpp --- dde-calendar-5.9.1/calendar-service/src/calendarDataManager/duploadtaskdata.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/calendarDataManager/duploadtaskdata.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,89 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "duploadtaskdata.h" + +QString DUploadTaskData::sql_table_name(int task_obj) +{ + switch(task_obj) { + case DUploadTaskData::Task_ScheduleType: + return "scheduleType"; + case DUploadTaskData::Task_Schedule: + return "schedules"; + case DUploadTaskData::Task_Color: + return "typeColor"; + } + return ""; +} + +QString DUploadTaskData::sql_table_primary_key(int task_obj) +{ + switch(task_obj) { + case DUploadTaskData::Task_ScheduleType: + return "typeID"; + case DUploadTaskData::Task_Schedule: + return "scheduleID"; + case DUploadTaskData::Task_Color: + return "colorID"; + } + return ""; +} + +DUploadTaskData::DUploadTaskData() + : m_taskType(Create) + , m_taskObject(Task_ScheduleType) + , m_objectId("") + , m_taskID("") +{ +} + +DUploadTaskData::TaskType DUploadTaskData::taskType() const +{ + return m_taskType; +} + +void DUploadTaskData::setTaskType(const TaskType &taskType) +{ + m_taskType = taskType; +} + +DUploadTaskData::TaskObject DUploadTaskData::taskObject() const +{ + return m_taskObject; +} + +void DUploadTaskData::setTaskObject(const TaskObject &taskObject) +{ + m_taskObject = taskObject; +} + +QString DUploadTaskData::objectId() const +{ + return m_objectId; +} + +void DUploadTaskData::setObjectId(const QString &objectId) +{ + m_objectId = objectId; +} + +QString DUploadTaskData::taskID() const +{ + return m_taskID; +} + +void DUploadTaskData::setTaskID(const QString &taskID) +{ + m_taskID = taskID; +} + +QDateTime DUploadTaskData::dtCreate() const +{ + return m_dtCreate; +} + +void DUploadTaskData::setDtCreate(const QDateTime &dtCreate) +{ + m_dtCreate = dtCreate; +} diff -Nru dde-calendar-5.9.1/calendar-service/src/calendarDataManager/duploadtaskdata.h dde-calendar-5.10.0/calendar-service/src/calendarDataManager/duploadtaskdata.h --- dde-calendar-5.9.1/calendar-service/src/calendarDataManager/duploadtaskdata.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/calendarDataManager/duploadtaskdata.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,59 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef DUPLOADTASKDATA_H +#define DUPLOADTASKDATA_H + +#include +#include +#include +#include + +//上传任务相关数据 +class DUploadTaskData +{ +public: + //任务类型 + enum TaskType { + Create, //创建 + Modify, //修改 + Delete, //删除 + }; + //任务对象 + enum TaskObject { + Task_ScheduleType, //日程类型 + Task_Schedule, //日程 + Task_Color, //类型颜色 + }; + + static QString sql_table_name(int task_obj); + static QString sql_table_primary_key(int task_obj); + + typedef QSharedPointer Ptr; + typedef QVector List; + DUploadTaskData(); + TaskType taskType() const; + void setTaskType(const TaskType &taskType); + + TaskObject taskObject() const; + void setTaskObject(const TaskObject &taskObject); + + QString objectId() const; + void setObjectId(const QString &objectId); + + QString taskID() const; + void setTaskID(const QString &taskID); + + QDateTime dtCreate() const; + void setDtCreate(const QDateTime &dtCreate); + +private: + TaskType m_taskType; + TaskObject m_taskObject; + QString m_objectId; + QString m_taskID; + QDateTime m_dtCreate; +}; + +#endif // DUPLOADTASKDATA_H diff -Nru dde-calendar-5.9.1/calendar-service/src/calendarhuangli.cpp dde-calendar-5.10.0/calendar-service/src/calendarhuangli.cpp --- dde-calendar-5.9.1/calendar-service/src/calendarhuangli.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/calendarhuangli.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: kongyunzhen -* -* Maintainer: kongyunzhen -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "calendarhuangli.h" #include "lunarandfestival/lunarmanager.h" @@ -27,17 +11,17 @@ CalendarHuangLi::CalendarHuangLi(QObject *parent) : QObject(parent) - , m_database(new HuangLiDataBase(this)) + , m_database(new DHuangLiDataBase(this)) { } //获取指定公历月的假日信息 -QString CalendarHuangLi::GetFestivalMonth(quint32 year, quint32 month) +QString CalendarHuangLi::getFestivalMonth(quint32 year, quint32 month) { - return m_database->QueryFestivalList(year, static_cast(month)); + return m_database->queryFestivalList(year, static_cast(month)); } -QString CalendarHuangLi::GetHuangLiDay(quint32 year, quint32 month, quint32 day) +QString CalendarHuangLi::getHuangLiDay(quint32 year, quint32 month, quint32 day) { stDay viewday{static_cast(year), static_cast(month), static_cast(day)}; QList viewdate{viewday}; @@ -45,7 +29,7 @@ //获取阴历信息 stLunarDayInfo lunardayinfo = SolarToLunar(static_cast(year), static_cast(month), static_cast(day)); //获取宜忌信息 - QList hllist = m_database->QueryHuangLiByDays(viewdate); + QList hllist = m_database->queryHuangLiByDays(viewdate); //将黄历信息保存到CaHuangLiDayInfo hldayinfo.mSuit = hllist.begin()->Suit; hldayinfo.mAvoid = hllist.begin()->Avoid; @@ -64,14 +48,14 @@ return hldayinfo.toJson(); } -QString CalendarHuangLi::GetHuangLiMonth(quint32 year, quint32 month, bool fill) +QString CalendarHuangLi::getHuangLiMonth(quint32 year, quint32 month, bool fill) { CaHuangLiMonthInfo monthinfo; SolarMonthInfo solarmonth = GetSolarMonthCalendar(static_cast(year), static_cast(month), fill); LunarMonthInfo lunarmonth = GetLunarMonthCalendar(static_cast(year), static_cast(month), fill); monthinfo.mFirstDayWeek = lunarmonth.FirstDayWeek; monthinfo.mDays = lunarmonth.Days; - QList hllist = m_database->QueryHuangLiByDays(solarmonth.Datas); + QList hllist = m_database->queryHuangLiByDays(solarmonth.Datas); for (int i = 0; i < lunarmonth.Datas.size(); ++i) { CaHuangLiDayInfo hldayinfo; hldayinfo.mAvoid = hllist.at(i).Avoid; @@ -97,7 +81,7 @@ return monthinfo.toJson(); } -CaLunarDayInfo CalendarHuangLi::GetLunarInfoBySolar(quint32 year, quint32 month, quint32 day) +CaLunarDayInfo CalendarHuangLi::getLunarInfoBySolar(quint32 year, quint32 month, quint32 day) { CaLunarDayInfo lunardayinfo; //获取阴历信息 @@ -118,7 +102,7 @@ return lunardayinfo; } -CaLunarMonthInfo CalendarHuangLi::GetLunarCalendarMonth(quint32 year, quint32 month, bool fill) +CaLunarMonthInfo CalendarHuangLi::getLunarCalendarMonth(quint32 year, quint32 month, bool fill) { CaLunarMonthInfo lunarmonthinfo; //获取阴历月信息 diff -Nru dde-calendar-5.9.1/calendar-service/src/calendarhuangli.h dde-calendar-5.10.0/calendar-service/src/calendarhuangli.h --- dde-calendar-5.9.1/calendar-service/src/calendarhuangli.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/calendarhuangli.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,31 +1,15 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: kongyunzhen -* -* Maintainer: kongyunzhen -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef CALENDARHUANGLI_H #define CALENDARHUANGLI_H -#include "dbmanager/huanglidatabase.h" +#include "dhuanglidatabase.h" #include -class HuangLiDataBase; +class DHuangLiDataBase; class CalendarHuangLi : public QObject { @@ -33,19 +17,14 @@ public: explicit CalendarHuangLi(QObject *parent = nullptr); - QString GetFestivalMonth(quint32 year, quint32 month); - QString GetHuangLiDay(quint32 year, quint32 month, quint32 day); - QString GetHuangLiMonth(quint32 year, quint32 month, bool fill); - CaLunarDayInfo GetLunarInfoBySolar(quint32 year, quint32 month, quint32 day); - CaLunarMonthInfo GetLunarCalendarMonth(quint32 year, quint32 month, bool fill); - -private: -signals: - -public slots: + QString getFestivalMonth(quint32 year, quint32 month); + QString getHuangLiDay(quint32 year, quint32 month, quint32 day); + QString getHuangLiMonth(quint32 year, quint32 month, bool fill); + CaLunarDayInfo getLunarInfoBySolar(quint32 year, quint32 month, quint32 day); + CaLunarMonthInfo getLunarCalendarMonth(quint32 year, quint32 month, bool fill); private: - HuangLiDataBase *m_database; + DHuangLiDataBase *m_database; }; #endif // CALENDARHUANGLI_H diff -Nru dde-calendar-5.9.1/calendar-service/src/calendarprogramexitcontrol.cpp dde-calendar-5.10.0/calendar-service/src/calendarprogramexitcontrol.cpp --- dde-calendar-5.9.1/calendar-service/src/calendarprogramexitcontrol.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/calendarprogramexitcontrol.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,8 +1,13 @@ +// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "calendarprogramexitcontrol.h" #include #include +bool CalendarProgramExitControl::m_clientIsOpen = false; CalendarProgramExitControl *CalendarProgramExitControl::getProgramExitControl() { static CalendarProgramExitControl programExitControl; @@ -26,21 +31,33 @@ void CalendarProgramExitControl::reduce() { #ifdef CALENDAR_SERVICE_AUTO_EXIT - //1秒后退出,防止程序频繁的开启关闭 - QTimer::singleShot(1000,[=]{ - readWriteLock.lockForWrite(); - --m_excNum; - if ( m_excNum < 1 ) { - exit(); - } - readWriteLock.unlock(); + //3秒后退出,防止程序频繁的开启关闭 + QTimer::singleShot(3000, [=] { + readWriteLock.lockForWrite(); + --m_excNum; + if (m_excNum < 1 && !m_clientIsOpen) { + exit(); + } + readWriteLock.unlock(); }); #endif } void CalendarProgramExitControl::exit() { +#ifdef NDEBUG qApp->exit(); +#endif +} + +bool CalendarProgramExitControl::getClientIsOpen() +{ + return m_clientIsOpen; +} + +void CalendarProgramExitControl::setClientIsOpen(bool clientIsOpen) +{ + m_clientIsOpen = clientIsOpen; } CalendarProgramExitControl::CalendarProgramExitControl() diff -Nru dde-calendar-5.9.1/calendar-service/src/calendarprogramexitcontrol.h dde-calendar-5.10.0/calendar-service/src/calendarprogramexitcontrol.h --- dde-calendar-5.9.1/calendar-service/src/calendarprogramexitcontrol.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/calendarprogramexitcontrol.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef CALENDARPROGRAMEXITCONTROL_H #define CALENDARPROGRAMEXITCONTROL_H @@ -24,12 +28,33 @@ * @brief reduce 接口处理结束后使用该函数,用来减少计数,跟addExc配对使用 */ void reduce(); + static bool getClientIsOpen(); + static void setClientIsOpen(bool clientIsOpen); + private: CalendarProgramExitControl(); void exit(); private: + static bool m_clientIsOpen; int m_excNum = 0; QReadWriteLock readWriteLock; }; +class DServiceExitControl +{ +public: + DServiceExitControl() + { + CalendarProgramExitControl::getProgramExitControl()->addExc(); + } + ~DServiceExitControl() + { + CalendarProgramExitControl::getProgramExitControl()->reduce(); + } + void setClientIsOpen(bool isOpen) + { + CalendarProgramExitControl::setClientIsOpen(isOpen); + } +}; + #endif // CALENDARPROGRAMEXITCONTROL_H diff -Nru dde-calendar-5.9.1/calendar-service/src/calendarscheduler.cpp dde-calendar-5.10.0/calendar-service/src/calendarscheduler.cpp --- dde-calendar-5.9.1/calendar-service/src/calendarscheduler.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/calendarscheduler.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,1154 +0,0 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: kongyunzhen -* -* Maintainer: kongyunzhen -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ -#include "calendarscheduler.h" -#include "src/commondatastruct.h" -#include "src/scheduledatainfo.h" -#include "src/utils.h" -#include "lunarmanager.h" -#include "pinyin/pinyinsearch.h" -#include "jobremindmanager.h" -#include "lunardateinfo.h" - -#include -#include -#include -#include -#include -#include - -#define RECURENCELIMIT 3650 //递归次数限制 -#define UPDATEREMINDJOBTIMEINTERVAL 1000 * 60 * 10 //提醒任务更新时间间隔毫秒数(10分钟) - -QMap CalendarScheduler::m_festivalIdMap; -quint32 CalendarScheduler::nextFestivalJobId = INT32_MAX; -QMutex CalendarScheduler::m_getJobIdMutex; -CalendarScheduler::CalendarScheduler(QObject *parent) - : QObject(parent) - , m_database(new SchedulerDatabase(this)) -{ - IsFestivalJobEnabled(); - //将提醒提醒任务管理放入子线程 - m_jobremindmanager = new JobRemindManager; - threadremind = new QThread(this); - m_jobremindmanager->moveToThread(threadremind); - threadremind->start(); - initConnections(); -} - -CalendarScheduler::~CalendarScheduler() -{ - if (!threadremind->isFinished()) { - m_jobremindmanager->disconnect(); - threadremind->quit(); - threadremind->wait(); - } - //清空黄历数据 - logOffEmptyData(); - delete m_jobremindmanager; -} - -void CalendarScheduler::initConnections() -{ - connect(this, &CalendarScheduler::NotifyUpdateRemindJobs, m_jobremindmanager, &JobRemindManager::UpdateRemindJobs); - connect(m_jobremindmanager, &JobRemindManager::ModifyJobRemind, this, &CalendarScheduler::OnModifyJobRemind); - connect(this, &CalendarScheduler::NotifyJobChange, m_jobremindmanager, &JobRemindManager::NotifyJobsChanged); - connect(this, &CalendarScheduler::signalRemindJob, m_jobremindmanager, &JobRemindManager::RemindJob); - connect(this, &CalendarScheduler::signalNotifyMsgHanding, m_jobremindmanager, &JobRemindManager::notifyMsgHanding); - connect(m_jobremindmanager, &JobRemindManager::saveNotifyID, this, &CalendarScheduler::saveNotifyID); - connect(this, &CalendarScheduler::signalCloseNotification, m_jobremindmanager, &JobRemindManager::closeNotification); -} - -void CalendarScheduler::DeleteJob(qint64 id) -{ - m_database->DeleteJob(id); - //获取通知弹框id - closeNotification(id); - QList ids; - ids.append(id); - m_database->deleteRemindJobs(ids); - AfterJobChanged(ids); -} - -QString CalendarScheduler::GetJob(qint64 id) -{ - return m_database->GetJob(id); -} - -// 给定日程Json信息,解析为job类型传入数据库 -qint64 CalendarScheduler::CreateJob(const QString &jobInfo) -{ - Job job = josnStringToJob(jobInfo); - qint64 id = m_database->CreateJob(job); - QList ids; - ids.append(id); - m_database->deleteRemindJobs(ids); - AfterJobChanged(ids); - return id; -} - -// 可将要改动的日程信息直接传入数据库操作层中 -void CalendarScheduler::UpdateJob(const QString &jobInfo) -{ - Job oldJob = josnStringToJob(jobInfo); - oldJob = josnStringToJob(m_database->GetJob(oldJob.ID)); - qint64 id = m_database->UpdateJob(jobInfo); - //获取修改后的日程信息 - QString newJobInfo = m_database->GetJob(id); - Job job = josnStringToJob(newJobInfo); - //是否删除日程提醒相关信息 - bool isDeleteRemindData = true; - //获取该日程的提醒信息 - QList remindJobs = m_database->getRemindJob(job.ID); - - struct JobIn { - qint64 jobID; - qint64 recurID; - }; - - QVector jobInVector; - - //如果重复规则或忽略列表不一样 - if ((oldJob.RRule != job.RRule || oldJob.Ignore != job.Ignore)) { - isDeleteRemindData = false; - - QDateTime endDateTime = job.Start; - for (int i = remindJobs.size() - 1 ; i >= 0; --i) { - //获取结束时间 - endDateTime = endDateTime > remindJobs.at(i).Start ? endDateTime : remindJobs.at(i).Start; - } - if (remindJobs.size() > 0) { - //根据起止时间和重复规则,获取生成的日程开始时间 - QList jobtimelist = GetJobTimesBetween(job.Start, endDateTime, job); - QVector jobStartDateTime; - foreach (auto jobTime, jobtimelist) { - jobStartDateTime.append(jobTime.start); - } - foreach (auto rjob, remindJobs) { - //如果生成的开始时间列表内不包含提醒日程的开始时间,则表示该重复日程被删除 - if (!jobStartDateTime.contains(rjob.Start)) { - int notifyID = m_database->getNotifyID(rjob.ID, rjob.RecurID); - JobIn jobin {rjob.ID, rjob.RecurID}; - //如果改日程已经提醒,且通知弹框未操作 - if (notifyID >= 0) { - emit signalCloseNotification(static_cast(notifyID)); - isDeleteRemindData = true; - jobInVector.append(jobin); - } else if (rjob.Start > QDateTime::currentDateTime()) { //删除没有触发的提醒日程 - isDeleteRemindData = true; - jobInVector.append(jobin); - } - } - } - } - } else if (oldJob.RRule == job.RRule && job.RRule.isEmpty()) { //不是重复日程 - int notifyID = m_database->getNotifyID(job.ID, job.RecurID); - //如果日程被提醒,且通知弹框未操作, - if (notifyID > 0) { - isDeleteRemindData = false; - } - JobIn jobin{ job.ID, job.RecurID}; - jobInVector.append(jobin); - } - //是否删除对应的提醒日程数据 - if (isDeleteRemindData) { - foreach (auto jobin, jobInVector) { - m_database->deleteRemindJobs(jobin.jobID, jobin.recurID); - } - } - - if (-1 != id) { - QList ids; - ids.append(id); - AfterJobChanged(ids); - } -} - -/** - * @brief GetJobs 获取指定范围内的日程 - * @param start 起始时间 - * @param end 结束时间 - * @return 返回指定范围内的日程JSON格式 - */ -QString CalendarScheduler::GetJobs(const QDateTime &start, const QDateTime &end) -{ - QString strJson; - QList joblist = m_database->GetAllOriginJobs(); - QList jobArrList = GetJobsBetween(start, end, joblist, m_festivalJobEnabled); //获取时间范围内所有的Job - strJson = JobArrListToJsonStr(jobArrList); - return strJson; -} - -/** - * @brief QueryJobs 查询指定时间范围日程 - * @param params 查询条件json字符串 - * @return 返回指定范围内的日程JSON格式 - */ -QString CalendarScheduler::QueryJobs(const QString ¶ms) -{ - QJsonDocument doc; - QJsonParseError err; - doc = QJsonDocument::fromJson(params.toUtf8(), &err); - QJsonObject obj = doc.object(); - QString strKey = obj.value("Key").toString(); - QDateTime starttime = Utils::fromconvertData(obj.value("Start").toString()); - QDateTime endtime = Utils::fromconvertData(obj.value("End").toString()); - QList joblist = m_database->GetAllOriginJobs(strKey); - QList jobArrList = GetJobsBetween(starttime, endtime, joblist, m_festivalJobEnabled, strKey); - QString strJson = JobArrListToJsonStr(jobArrList); - return strJson; -} - -QString CalendarScheduler::QueryJobsWithLimit(const QString ¶ms, qint32 maxNum) -{ - QJsonParseError err; - QJsonDocument doc = QJsonDocument::fromJson(params.toUtf8(), &err); - QJsonObject obj = doc.object(); - QDateTime start = Utils::fromconvertData(obj.value("Start").toString()); - QDateTime end = Utils::fromconvertData(obj.value("End").toString()); - QString strKey = obj.value("key").toString(); - - QList joblist = m_database->GetAllOriginJobs(strKey, QString("start asc")); - //获取时间范围内符合条件的Job,不扩展 - QList jobArrList = GetJobsBetween(start, end, joblist, false, strKey, false); - jobArrList = FilterDateJobsWrap(jobArrList, start, end); - //根据manNum获取指定数量的Job多余的直接丢弃 - int jobCount = 0; - QList resArr; - foreach (stJobArr jobarr, jobArrList) { - if (jobarr.jobs.size() > 0) { - int jobsLength = jobarr.jobs.size(); - jobCount += jobsLength; - if (jobCount >= maxNum) { - int edge = jobsLength - (jobCount - maxNum); - QList jobs; - for (int i = 0; i < edge; ++i) { - jobs.append(jobarr.jobs.at(i)); - } - jobarr.jobs = jobs; - resArr.append(jobarr); - break; - } - resArr.append(jobarr); - } - } - QString strJson = JobArrListToJsonStr(resArr); - - return strJson; -} - -QString CalendarScheduler::QueryJobsWithRule(const QString ¶ms, const QString &rules) -{ - QJsonParseError err; - QJsonDocument doc = QJsonDocument::fromJson(params.toUtf8(), &err); - QJsonObject obj = doc.object(); - QDateTime start = Utils::fromconvertData(obj.value("Start").toString()); - QDateTime end = Utils::fromconvertData(obj.value("End").toString()); - QString strKey = obj.value("key").toString(); - QList joblist = m_database->GetAllOriginJobsWithRule(strKey, rules); - //获取时间范围内符合条件的Job,不扩展 - QList jobArrList = GetJobsBetween(start, end, joblist, false, strKey, false); - jobArrList = FilterDateJobsWrap(jobArrList, start, end); - QString strJson = JobArrListToJsonStr(jobArrList); - return strJson; -} - -void CalendarScheduler::remindJob(const qint64 id, const qint64 recurID) -{ - //根据日程id获取日程信息和稍后提醒次数 - Job job = m_database->getRemindJob(id, recurID); - emit signalRemindJob(job); -} - -//检测当前环境是否为中文环境来决定是否开启获取节日日程开关 -void CalendarScheduler::IsFestivalJobEnabled() -{ - QString str_lcall(qgetenv("LC_ALL").data()); - QString str_language = qgetenv("LANGUAGE"); - QString str_lang = qgetenv("LANG"); - qDebug() << str_lcall << str_language << str_lang; - if (("C" != str_lcall) && (str_language.startsWith("zh") || str_lang.startsWith("zh"))) { - m_festivalJobEnabled = true; - } -} - -/** - * @brief CalendarScheduler::GetJobsBetween 对查询到的日程进行解析处理 - * @param start 查询的开始时间 - * @param end 查询的结束时间 - * @param joblist 查询到的日程list - * @param needFestival 是否需要返回节日日程 - * @param querykey 查询的关键字 - * @param bextend 是否需要扩展跨天日程 - * @return 日程list - */ -QList CalendarScheduler::GetJobsBetween(const QDateTime &start, const QDateTime &end, const QList &joblist, bool needFestival, const QString &querykey, bool bextend) -{ - QList jobArrList; - int days = static_cast(start.daysTo(end)); - for (int i = 0; i <= days; ++i) { - stJobArr arr; - QDateTime tem = start.addDays(i); - arr.date = tem.date(); - jobArrList.append(arr); - } - //判断是否需要获取中国节日日程 - if (needFestival) { - FillFestivalJobs(start, end, querykey, jobArrList); - } - - foreach (Job jb, joblist) { - qint64 interval = jb.Start.secsTo(jb.End); //当前job开始结束时间差,单位秒 - QList jobtimelist = GetJobTimesBetween(start, end, jb); - if (jobtimelist.isEmpty()) { - continue; - } - foreach (stJobTime jobtime, jobtimelist) { - Job jobtem = jb; - jobtem.Start = jobtime.start; - jobtem.End = jobtime.start.addSecs(interval); - jobtem.RecurID = jobtime.recurID; - int idx = static_cast(start.daysTo(jobtime.start)); - if (idx >= 0 && idx <= days) { - jobArrList[idx].jobs.append(jobtem); - } - - // extend 指把跨越多天的 job 给扩展开,比如开始日期为 2019-09-01 结束日期为 2019-09-02 的 - // job, 将会扩展出一个job 放入 2019-09-02 那天的 extendJobs 字段中。 - if (!bextend) { - continue; - } - //需要扩展的天数 - int extenddays = static_cast(jobtem.Start.daysTo(jobtem.End)); - for (int i = 0; i < extenddays; ++i) { - int tIdx = idx + i + 1; - if (tIdx == jobArrList.size()) { - break; - } - if (tIdx < 0) { - continue; - } - jobArrList[tIdx].extends.append(jobtem); - } - } - } - return jobArrList; -} - -QList CalendarScheduler::GetJobTimesBetween(const QDateTime &start, const QDateTime &end, const Job &job) -{ - QList jobtimelist; - if (start <= end) { - QList igonrelist = GetIgnoreList(job); - //如果没有规则,则直接判断其开始结束时间就可以了 - if (job.RRule.isEmpty()) { - //开始时间小于job的结束时间并且结束时间要大于job的开始时间,保证有交集,保证 - if (start <= job.End && end >= job.Start) { - stJobTime jobtime; - jobtime.start = job.Start; - jobtime.end = job.End; - jobtime.recurID = 0; - jobtimelist.append(jobtime); - } - return jobtimelist; - } - int count = 0; //当前为日程的第几次重复 - stRRuleOptions options = ParseRRule(job.RRule); - - QDateTime jobstart = job.Start; //当前原始job的起始时间 - QDateTime jobend = job.End; //当前原始job的结束时间 - int dateinterval = static_cast(jobstart.secsTo(jobend)); //job的开始结束间隔日期 - - //是否为农历日程 - if (job.IsLunar) { - QVector recurJobDates; - LunarDateInfo lunardate(job); - - QMap ruleStartDate = lunardate.getRRuleStartDate(start.date(), end.date(), job.Start.date()); - - QDateTime recurDateTime; - recurDateTime.setTime(job.Start.time()); - QDateTime copyEnd; - QMap::ConstIterator iter = ruleStartDate.constBegin(); - for (; iter != ruleStartDate.constEnd(); iter++) { - recurDateTime.setDate(iter.value()); - //如果在忽略时间列表中,则忽略 - if (igonrelist.contains(recurDateTime)) - continue; - copyEnd = recurDateTime.addSecs(dateinterval); - stJobTime jt; - jt.start = recurDateTime; - jt.end = copyEnd; - jt.recurID = iter.key(); - jobtimelist.append(jt); - } - - } else { - //公历日程数据 - - int dayofweek = jobstart.date().dayOfWeek(); //判断是周几 - if (dayofweek > Qt::Friday && options.rpeat == RepeatType::RepeatWorkDay) //周末并且options为工作日重复 - jobstart.setDate(jobstart.date().addDays(7 - dayofweek + 1)); //在周末设置工作日重复日程,需要重新设置日程开始时间 - QDateTime next = jobstart; //next为下一新建日程起始日期 - //只有当下一个新建日程的起始日期小于查询日期的结束日期才会有交集,否则没有意义 - //注意一定要判断是否有交集,因为Job的创建日期可能远远早于查询日期,查询到的是多次重复后与查询时间有交集的 - while (true) { - QDateTime copystart = next; - //这里应该比较date,而不是datetime,如果是非全天的日程,这个设计具体时间的问题,会导致返回的job个数出现问题 - if (copystart.date() > end.date()) { - //起始日期超出查询结束日期直接退出 - break; - } - - QDateTime copyend = next.addSecs(dateinterval); - //如果查询时间范围和Job时间范围有交集则保存 - //另外需要保证该新建任务没有被删除即未被ignore,新建任务重复的规则删除是删除该次重复包含的的所有天, - if (OverLap(start, end, copystart, copyend) && !ContainsInIgnoreList(igonrelist, copystart)) { - stJobTime jt; - jt.start = copystart; - jt.end = copyend; - jt.recurID = count; - jobtimelist.append(jt); - } - count++; - //当结束重复为按多少次结束判断时,检查重复次数是否达到,达到则退出 - //当重复次数达到最大限制直接返回 - //options.tcount表示重复的次数,而count表示总次数,所以这里不能有“=” - if ((options.type == RepeatOverCount && options.tcount < count) - || count > RECURENCELIMIT) { - break; - } - //根据rule获取下一个Job的起始日期 - next = GetNextJobStartTimeByRule(options, copystart); - //判断next是否有效,时间大于RRule的until - //判断next是否大于查询的截止时间,这里应该比较date,而不是datetime,如果是非全天的日程,这个设计具体时间的问题,会导致返回的job个数出现问题 - if ((options.type == RepeatOverUntil && next.date() >= options.overdate.date()) - || next.date() > end.date()) { - break; - } - copystart = next; - } - } - - } else { - qDebug() << __FUNCTION__ << "start time later than end time param error! do nothoing"; - } - - return jobtimelist; -} - -/** - * @brief FillFestivalJobs 获取指定范围内的节日日程信息 - * @param start 起始时间 - * @param end 结束时间 - */ -void CalendarScheduler::FillFestivalJobs(const QDateTime &start, const QDateTime &end, const QString &querykey, QList &listjob) -{ - QList festivaldays = GetFestivalsInRange(start, end); - - if (!querykey.isEmpty()) { - festivaldays = FilterDayFestival(festivaldays, querykey); - } - - foreach (stDayFestival day, festivaldays) { - int index = static_cast(start.daysTo(day.date)); - if (index >= 0 && index < listjob.size()) { - foreach (QString festival, day.Festivals) { - if (!festival.isEmpty()) { - Job jb; - jb.Title = festival; - jb.Type = JobTypeFestival; - jb.AllDay = true; - jb.Start = QDateTime(QDate(day.date.date()), QTime(0, 0)); - jb.End = QDateTime(QDate(day.date.date()), QTime(23, 59)); - jb.RRule = "FREQ=YEARLY"; - jb.ID = GetFestivalId(festival); - listjob[index].jobs.append(jb); - } - } - } - } -} - -/** - * @brief GetIgnoreList 获取指定Job的忽略列表 - * @param job 查询的Job - * @return 当前Job的忽略列表 - */ -QList CalendarScheduler::GetIgnoreList(const Job &job) -{ - QList list; - if (!job.Ignore.isEmpty()) { - QJsonParseError err; - QJsonDocument doc = QJsonDocument::fromJson(job.Ignore.toLocal8Bit(), &err); - if (QJsonParseError::NoError == err.error) { - QJsonArray arr = doc.array(); - for (int i = 0; i < arr.count(); ++i) { - QString str = arr.at(i).toString(); - QDateTime datetime = QDateTime::fromString(str, Qt::ISODate); - list.append(datetime); - } - } - } - return list; -} - -/** - * @brief ContainsInIgnoreList 检查日期是否在忽略列表里 - * @param ignorelist 日期忽略列表 - * @param start 需要检测时间 - * @return bool 如果在忽略列表中则返回true - */ -bool CalendarScheduler::ContainsInIgnoreList(const QList &ignorelist, const QDateTime &time) -{ - return ignorelist.contains(time); -} - -/** - * @brief OverLap 判断两个时间范围是否有交集 - * @param start 第一个时间范围的开始时间 - * @param end 第一个时间范围的结束时间 - * @param jobstart 第二个时间范围的开始时间 - * @param jobend 第二个时间范围的结束时间 - * @return bool 有交集返回true否则返回false - */ -bool CalendarScheduler::OverLap(const QDateTime &start, const QDateTime &end, const QDateTime &jobstart, const QDateTime &jobend) -{ - bool boverlap = false; - if ((start <= jobstart && end >= jobstart) - || (start >= jobstart && start <= jobend)) { - boverlap = true; - } - - return boverlap; -} - -/** - * @brief GetNextJobStartTimeByRule 根据规则获取下一个job开始时间 - * @param options 包含重复规则相关字段结构体 - * @param datetime 上一个Job的时间 - * @return QDateTime 下一个重复Job的起始时间 - */ -QDateTime CalendarScheduler::GetNextJobStartTimeByRule(const stRRuleOptions &options, const QDateTime &datetime) -{ - QDateTime next; - quint8 dayofweek; - //日程所在年 - int year = datetime.date().year(); - //日程所在月 - int month = datetime.date().month(); - //日程所在日 - int day = datetime.date().day(); - //日程时间 - QTime nextTime = datetime.time(); - //判断next日期是否合法,需要先给next赋值,所以使用do-while - do { - switch (options.rpeat) { - case RepeatDaily: - next = datetime.addDays(1); - break; - case RepeatWorkDay: - dayofweek = static_cast(datetime.date().dayOfWeek()); - //计算当前为周几如果是周五或者是周末需要跳过,否则直接下一天 - //需要跳过因为工作日不包括周末 - if (dayofweek >= Qt::Friday) { - next = datetime.addDays(7 - dayofweek + 1); - } else { - next = datetime.addDays(1); - } - break; - case RepeatWeekly: - next = datetime.addDays(7); - break; - case RepeatMonthly: - //月份超过12月,则进入下一年 - if (++month == 13) { - year += 1; - month = 1; - } - next = QDateTime(QDate(year, month, day), nextTime); - break; - case RepeatYearly: - next = QDateTime(QDate(++year, month, day), nextTime); - break; - default: - break; - } - } while (!next.isValid()); - - return next; -} - -/** - * @brief ParseRRule 解析重复规则 - * @param rule 规则字符串 - * @return stRRuleOptions 包含重复规则相关字段的结构体 - */ -stRRuleOptions CalendarScheduler::ParseRRule(const QString &rule) -{ - //无规则的不走这里判断所以此处默认rule不为空 - //局部变量初始化 - stRRuleOptions options {}; - QStringList rruleslist = rule.split(";", QString::SkipEmptyParts); - //rpeat重复规则 0 无 1 每天 2 每个工作日 3 每周 4每月 5每年 - //type结束重复类型 0 永不 1 多少次结束 2 结束日期 - if (rruleslist.contains("FREQ=DAILY") && rruleslist.contains("BYDAY=MO,TU,WE,TH,FR")) { - options.rpeat = RepeatWorkDay; - } else if (rruleslist.contains("FREQ=DAILY")) { - options.rpeat = RepeatDaily; - } else if (rruleslist.contains("FREQ=WEEKLY")) { - options.rpeat = RepeatWeekly; - } else if (rruleslist.contains("FREQ=MONTHLY")) { - options.rpeat = RepeatMonthly; - } else if (rruleslist.contains("FREQ=YEARLY")) { - options.rpeat = RepeatYearly; - } - - for (int i = 0; i < rruleslist.count(); i++) { - if (rruleslist.at(i).contains("COUNT=")) { - QStringList liststr = rruleslist.at(i).split("=", QString::SkipEmptyParts); - options.type = RepeatOverCount; - options.tcount = liststr.at(1).toInt() - 1; - } - - if (rruleslist.at(i).contains("UNTIL=")) { - QStringList liststr = rruleslist.at(i).split("=", QString::SkipEmptyParts); - options.type = RepeatOverUntil; - options.overdate = QDateTime::fromString(liststr.at(1).left(liststr.at(1).count() - 1), "yyyyMMddThhmmss"); - options.overdate = options.overdate.addDays(1); - } - } - return options; -} - -/** - * @brief JobArrListToJsonStr 将jobArrList转化为json字符串 - * @param jobArrList jobArrList - * @return json字符串 - */ -QString CalendarScheduler::JobArrListToJsonStr(const QList &jobArrList) -{ - QString strJson; - QJsonDocument doc; - QJsonArray jsonarr; - foreach (stJobArr jobarr, jobArrList) { - QJsonObject obj; - QJsonArray jobsJsonArr; - QJsonObject objjob; - obj.insert("Date", jobarr.date.toString("yyyy-MM-dd")); - foreach (Job job, jobarr.jobs) { - objjob = Utils::JobToObject(job); - jobsJsonArr.append(objjob); - } - foreach (Job job, jobarr.extends) { - objjob = Utils::JobToObject(job); - jobsJsonArr.append(objjob); - } - obj.insert("Jobs", jobsJsonArr); - jsonarr.append(obj); - } - doc.setArray(jsonarr); - strJson = QString::fromUtf8(doc.toJson(QJsonDocument::Compact)); - return strJson; -} - -QList CalendarScheduler::GetRemindJobs(const QDateTime &start, const QDateTime &end) -{ - QList jobs; - jobs = m_database->GetJobsContainRemind(); - QDateTime endDate = start.addDays(8); - QList jobArrList = GetJobsBetween(start, endDate, jobs, false, "", false); //此处获取的数据不需要展开,因此extend为空 - if (jobArrList.size() > 0) { - jobs.clear(); - foreach (stJobArr jobarr, jobArrList) { - foreach (Job job, jobarr.jobs) { - QDateTime jbtm = GetJobRemindTime(job); - //如果计算出的时间无效则忽略该Job继续 - if (!jbtm.isValid()) { - continue; - } - if (jbtm >= start && jbtm <= end) { - job.RemidTime = jbtm; - jobs.append(job); - } - } - } - } - return jobs; -} - -/** - * @brief GetJobRemindTime 计算job的提醒时间 - * @param job 日程 - * @return 日程提醒时间,调用方需判断日程时间是否有效 - */ -QDateTime CalendarScheduler::GetJobRemindTime(const Job &job) -{ - QDateTime tm = job.Start; - if (job.AllDay) { - tm.setTime(QTime(0, 0, 0)); - } - return ParseRemind(tm, job.Remind); -} - -/** - * @brief ParseRemind 根据规则和给定的任务时间计算提醒时间 - * @param tm 日程开始时间 - * @param strremind 日程提醒规则 - * @return 日程提醒时间,调用方需判断日程时间是否有效 - */ -QDateTime CalendarScheduler::ParseRemind(const QDateTime &tm, const QString &strremind) -{ - // 提醒的提前时间最大为 7 天 - //创建一个无效的时间,如果计算出有效时间则根据计算结果更新否则返回无效结果用于调用方判断 - QDateTime remindtm(QDate(2020, 13, 31), QTime(24, 24, 100)); - if (!strremind.isEmpty()) { - QRegExp reg("\\d;\\d\\d:\\d\\d"); - // QRegExp reg("\\d;\\d+?:\\d+?"); - if (reg.exactMatch(strremind)) { - //提前多少天 - qint64 nDays; - //提醒时间 - int hour, min; - int ret = sscanf(strremind.toStdString().c_str(), "%lld;%d:%d", &nDays, &hour, &min); - //判断解析出来的规则是否合法 - //对ndays,hour,min的判断应该包含边界值 - if (-1 != ret && nDays >= 0 && nDays <= 7 && hour >= 0 && hour <= 23 && min >= 0 && min <= 59) { - remindtm = tm.addDays(-nDays); //多少天前 - remindtm.setTime(QTime(hour, min, 0)); - } - } else { - bool bsuccess = false; - //一天以内的时间单位是分钟 - qint32 nMinutes = strremind.toInt(&bsuccess); - //nMinutes为非全天日程提醒的分钟数,应该包含边界值 - if (bsuccess && (nMinutes >= 0 && nMinutes <= 60 * 24 * 7)) { - remindtm = tm.addSecs(-nMinutes * 60); //将分转换成秒进行回退 - } - } - } - - return remindtm; -} - -void CalendarScheduler::AfterJobChanged(const QList &Ids) -{ - //发送更新jobs信号 - emit JobsUpdated(Ids); - //停止所有提醒任务,获取未来10分钟内有提醒的日程,更新提醒任务 - UpdateRemindTimeout(false); -} - -QList CalendarScheduler::FilterDateJobsWrap(const QList &arrList, const QDateTime &start, const QDateTime &end) -{ - QList wraplist; - foreach (stJobArr jobarr, arrList) { - QList jobs, extendjobs; - foreach (Job jb1, jobarr.jobs) { - if (OverLap(start, end, jb1.Start, jb1.End)) { - jobs.append(jb1); - } - } - foreach (Job jb2, jobarr.extends) { - if (OverLap(start, end, jb2.Start, jb2.End)) { - extendjobs.append(jb2); - } - } - if (jobs.size() + extendjobs.size() > 0) { - jobarr.jobs = jobs; - jobarr.extends = extendjobs; - wraplist.append(jobarr); - } - } - - return wraplist; -} - -Job CalendarScheduler::josnStringToJob(const QString &str) -{ - // 现将给的Json信息转为Job类型 - - Job job; - QJsonParseError json_error; - QJsonDocument jsonDoc(QJsonDocument::fromJson(str.toLocal8Bit(), &json_error)); - - if (json_error.error != QJsonParseError::NoError) { - return job; - } - - QJsonObject rootObj = jsonDoc.object(); - - - if (rootObj.contains("ID")) { - job.ID = rootObj.value("ID").toInt(); - } - if (rootObj.contains("Type")) { - job.Type = rootObj.value("Type").toInt(); - } - if (rootObj.contains("Title")) { - job.Title = rootObj.value("Title").toString(); - } - if (rootObj.contains("Description")) { - job.Description = rootObj.value("Description").toString(); - } - if (rootObj.contains("AllDay")) { - job.AllDay = rootObj.value("AllDay").toBool(); - } - if (rootObj.contains("Start")) { - // 此处时间转换为与client同样式 - job.Start = QDateTime::fromString(rootObj.value("Start").toString(), Qt::ISODate); - } - if (rootObj.contains("End")) { - job.End = QDateTime::fromString(rootObj.value("End").toString(), Qt::ISODate); - } - if (rootObj.contains("RRule")) { - job.RRule = rootObj.value("RRule").toString(); - } - if (rootObj.contains("Remind")) { - job.Remind = rootObj.value("Remind").toString(); - } - if (rootObj.contains("Ignore")) { - QJsonArray subArray = rootObj.value("Ignore").toArray(); - QJsonDocument doc; - doc.setArray(subArray); - job.Ignore = QString::fromUtf8(doc.toJson(QJsonDocument::Compact)); - } - //添加title拼音 - job.Title_pinyin = pinyinsearch::getPinPinSearch()->CreatePinyin(rootObj.value("Title").toString()); - //是否为农历日程 - if (rootObj.contains("IsLunar")) { - job.IsLunar = rootObj.value("IsLunar").toBool(); - } - return job; -} - -QDateTime CalendarScheduler::getRemindTimeByCount(int count) -{ - qint64 Minute = 60 * 1000; - qint64 Hour = Minute * 60; - qint64 duration = (10 + ((count - 1) * 5)) * Minute; //下一次提醒距离现在的时间间隔,单位毫秒 - if (duration >= Hour) { - duration = Hour; - } - return getRemindTimeByMesc(duration); -} - -QDateTime CalendarScheduler::getRemindTimeByMesc(qint64 duration) -{ - QDateTime currentTime = QDateTime::currentDateTime(); - currentTime = currentTime.addMSecs(duration); - return currentTime; -} - -void CalendarScheduler::closeNotification(qint64 jobId) -{ - QVector notifyIDVector = m_database->getNotifyID(jobId); - foreach (auto notifyID, notifyIDVector) { - emit signalCloseNotification(static_cast(notifyID)); - } -} - -void CalendarScheduler::UpdateRemindTimeout(bool isClear) -{ - QDateTime tmstart = QDateTime::currentDateTime(); - QDateTime tmend = tmstart.addMSecs(UPDATEREMINDJOBTIMEINTERVAL); - QList jobList = GetRemindJobs(tmstart, tmend); - //获取未提醒的 - QList remindJobList = m_database->getValidRemindJob(); - //获取未提醒的稍后日程信息,由于15分钟后,1xxx后等不会修改提醒次数 - //所以需要根据提醒时间,日程id,日程重复id来判断是否是没有被触发点提醒日程 - for (int i = 0; i < jobList.size(); i++) { - for (int j = jobList.size() - 1; j < 0; j--) { - if (remindJobList.at(j).ID == jobList.at(i).ID - && remindJobList.at(j).RecurID == jobList.at(i).RecurID - && remindJobList.at(j).RemidTime == jobList.at(i).RemidTime) - //如果该日程没有被触发提醒过(创建后没有被提醒,而不是提醒后点了15分钟后等不改变提醒次数的日程) - //则移除 - remindJobList.removeAt(j); - } - } - - if (isClear) { - //清空数据库 - m_database->clearRemindJobDatabase(); - jobList.append(remindJobList); - foreach (auto job, jobList) { - m_database->saveRemindJob(job); - } - } else { - foreach (auto job, jobList) { - Job rJob = m_database->getRemindJob(job.ID, job.RecurID); - //如果提醒日程数据库中不存在此日程相关信息,插入相关信息 - if (rJob.ID != job.ID || rJob.RecurID != job.RecurID) { - m_database->saveRemindJob(job); - } - } - jobList.append(remindJobList); - } - emit NotifyUpdateRemindJobs(jobList); -} - -void CalendarScheduler::notifyMsgHanding(const qint64 jobID, const qint64 recurID, const int operationNum) -{ - Job job = m_database->getRemindJob(jobID, recurID); - //如果相应的日程被删除,则不做处理 - if (job.ID == 0) { - return; - } - //如果为稍后提醒操作则需要更新对应的重复次数和提醒时间 - qint64 Minute = 60 * 1000; - qint64 Hour = Minute * 60; - switch (operationNum) { - case 2://稍后提醒 - ++job.RemindLaterCount; - job.RemidTime = getRemindTimeByCount(job.RemindLaterCount); - m_database->updateRemindJob(job); - break; - case 21://15min后提醒 - job.RemidTime = getRemindTimeByMesc(15 * Minute); - m_database->updateRemindJob(job); - break; - case 22://一个小时后提醒 - job.RemidTime = getRemindTimeByMesc(Hour); - m_database->updateRemindJob(job); - break; - case 23://四个小时后提醒 - job.RemidTime = getRemindTimeByMesc(4 * Hour); - m_database->updateRemindJob(job); - break; - case 3://明天提醒 - job.RemidTime = getRemindTimeByMesc(24 * Hour); - m_database->updateRemindJob(job); - break; - case 1://打开日历 - case 4://提前1天提醒 - if (job.AllDay) { - //如果为全天则提醒时间为一天前9点提醒 - job.RemidTime.setTime(QTime(9, 0)); - } else { - //如果为非全天,则为开始时间的一天前 - job.RemidTime.setTime(job.Start.time()); - } - job.RemidTime.setDate(job.Start.date().addDays(-1)); - m_database->updateRemindJob(job); - break; - default: - //删除对应的数据 - QList Ids; - Ids.append(jobID); - m_database->deleteRemindJobs(Ids); - break; - } - emit signalNotifyMsgHanding(job, operationNum); -} - -void CalendarScheduler::OnModifyJobRemind(const Job &job, const QString &remind) -{ - Job newjob = job; - QList ids; - //规则不为空则创建一个新的日程 - if (!newjob.RRule.isEmpty()) { - //修改重复日程的提醒规则相当于“仅修改此日程”的规则,忽略当天的日程,新建一个没有重复规则的日程 - //修改新日程的提醒规则 - newjob.Remind = remind; - //清空日程的重复规则 - newjob.RRule.clear(); - //设置初始值 - newjob.RecurID = 0; - QList ignorelist = GetIgnoreList(job); - bool bsuccess = true; - //判断是否在忽略列表,如果不在忽略列表则加入忽略列表,后面重新创建新日程替代该旧日程 - if (!ignorelist.contains(job.Start)) { - ignorelist.append(job.Start); - QJsonDocument doc; - QJsonArray arr; - foreach (QDateTime tm, ignorelist) { - arr.append(tm.toString(Qt::ISODate)); - } - doc.setArray(arr); - QString strignorejson = QString::fromUtf8(doc.toJson(QJsonDocument::Compact)); - bsuccess = m_database->UpdateJobIgnore(strignorejson, job.ID); - } - newjob.ID = m_database->CreateJob(newjob); - if (bsuccess && -1 != newjob.ID) { - ids << job.ID << newjob.ID; - m_database->deleteRemindJobs(ids); - AfterJobChanged(ids); - } - } else { - ids.append(newjob.ID); - m_database->deleteRemindJobs(ids); - AfterJobChanged(ids); - } -} - -void CalendarScheduler::saveNotifyID(const Job &job, int notifyid) -{ - m_database->updateNotifyID(job, notifyid); -} - -/** - * @brief GetFestivalId 根据节日名称获取节日id - * @param name 节日名称 - * @return 节日id - */ -quint32 CalendarScheduler::GetFestivalId(const QString &name) -{ - //自动加锁,函数结束销毁时自动解锁 - QMutexLocker lock(&m_getJobIdMutex); - quint32 id = 0; - auto it = m_festivalIdMap.find(name); - if (it != m_festivalIdMap.end()) { - id = it.value(); - } else { - id = nextFestivalJobId; - m_festivalIdMap.insert(name, id); - nextFestivalJobId--; - } - return id; -} - - -/** - * @brief CreateJobType 创建日程类型 - * param jobTypeInfo json格式的日程类型信息 - * return bool 返回操作结果 - */ -bool CalendarScheduler::CreateJobType(const QString &jobTypeInfo) -{ - JobTypeInfo jobType; - if (!JobTypeInfo::jsonStrToJobTypeInfo(jobTypeInfo, jobType)) { - return false; - } - - bool isSuccess = m_database->addJobType(jobType.getJobTypeNo(), jobType.getJobTypeName(), jobType.getColorInfo().getTypeNo(), jobType.getAuthority()); - //如果为用户自定义类型则创建相关颜色 - if (!jobType.getColorInfo().isSysColorInfo()) { - isSuccess = m_database->addColorType(jobType.getColorTypeNo(), jobType.getColorHex(), jobType.getColorInfo().getAuthority()); - } - if (isSuccess) { - emit JobTypeOrColorUpdated(); - } - return isSuccess; -} -/** - * @brief DeleteJobType 删除日程类型 - * param typeNo 日程类型编号 - * return bool 返回操作结果 - */ -bool CalendarScheduler::DeleteJobType(const int &typeNo) -{ - bool isExists = m_database->isJobTypeUsed(typeNo); - if (isExists) { - //获取需要被删除的日程编号 - QVector jobsID = m_database->getJobIDByJobType(typeNo); - QList ids; - foreach (auto &jobID, jobsID) { - closeNotification(jobID); - ids.append(jobID); - } - //删除对应的提醒任务 - m_database->deleteRemindJobs(ids); - //根据日程类型删除日程信息 - m_database->DeleteJobsByJobType(typeNo); - emit JobsUpdated(QList()); - } - JobTypeInfo oldInfo; - //获取原始的日程类型信息 - m_database->getJobTypeByTypeNo(typeNo, oldInfo); - bool isSuccess = m_database->deleteJobType(typeNo); - //如果为用户自定义类型则删除相关颜色 - if (!oldInfo.getColorInfo().isSysColorInfo()) { - isSuccess = m_database->deleteColorType(oldInfo.getColorTypeNo()); - } - - if (isSuccess) { - emit JobTypeOrColorUpdated(); - } - return isSuccess; -} -/** - * @brief UpdateJobType 更新日程类型 - * param jobTypeInfo json格式的日程类型信息 - * return bool 返回操作结果 - */ -bool CalendarScheduler::UpdateJobType(const QString &jobTypeInfo) -{ - JobTypeInfo jobType; - if (!JobTypeInfo::jsonStrToJobTypeInfo(jobTypeInfo, jobType)) { - return false; - } - JobTypeInfo oldInfo; - //获取原始的日程类型信息 - m_database->getJobTypeByTypeNo(jobType.getJobTypeNo(), oldInfo); - //如果颜色有改动 - if (oldInfo.getColorInfo() != jobType.getColorInfo()) { - //如果原来为自定义颜色则删除 - if (!oldInfo.getColorInfo().isSysColorInfo()) { - m_database->deleteColorType(oldInfo.getColorTypeNo()); - } - //如果修改的类型颜色为自定义颜色则创建 - if (!jobType.getColorInfo().isSysColorInfo()) { - m_database->addColorType(jobType.getColorInfo().getTypeNo(), jobType.getColorInfo().getColorHex(), jobType.getColorInfo().getAuthority()); - } - } - - bool isSuccess = m_database->updateJobType(jobType.getJobTypeNo(), jobType.getJobTypeName(), jobType.getColorTypeNo()); - if (isSuccess) { - emit JobTypeOrColorUpdated(); - } - return isSuccess; -} -/** - * @brief GetJobTypeList 获取日程类型字符串 - * return bool 返回查询结果 - */ -QString CalendarScheduler::GetJobTypeList() -{ - QString strJson; - QList lstJobType; - if (m_database->getJobTypeList(lstJobType)) { - JobTypeInfo::jobTypeInfoListToJosnString(lstJobType, strJson); - } - return strJson; -} - -/** - * @brief isJobTypeUsed 获取日程类型是否被使用 - * return bool 返回是否被使用 - */ -bool CalendarScheduler::isJobTypeUsed(int iTypeNo) -{ - return m_database->isJobTypeUsed(iTypeNo); -} - -/** - * @brief GetColorTypeList 获取日程类型字符串 - * return bool 返回查询结果 - */ -QString CalendarScheduler::GetColorTypeList() -{ - QString strJson = ""; - QList lstColorType; - if (m_database->getColorTypeList(lstColorType)) { - JobTypeInfo::colorTypeInfoListToJosnString(lstColorType, strJson); - } - return strJson; -} diff -Nru dde-calendar-5.9.1/calendar-service/src/calendarscheduler.h dde-calendar-5.10.0/calendar-service/src/calendarscheduler.h --- dde-calendar-5.9.1/calendar-service/src/calendarscheduler.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/calendarscheduler.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,166 +0,0 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: kongyunzhen -* -* Maintainer: kongyunzhen -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ -#ifndef CALENDARSCHEDULER_H -#define CALENDARSCHEDULER_H -#include "dbmanager/schedulerdatabase.h" -#include "src/scheduledatainfo.h" - -#include -#include - -class JobRemindManager; -class QTimer; - -class CalendarScheduler : public QObject -{ - Q_OBJECT -public: - explicit CalendarScheduler(QObject *parent = nullptr); - ~CalendarScheduler(); - void DeleteJob(qint64 id); - QString GetJob(qint64 id); - qint64 CreateJob(const QString &jobInfo); - void UpdateJob(const QString &jobInfo); - QString GetJobs(const QDateTime &start, const QDateTime &end); - QString QueryJobs(const QString ¶ms); - QString QueryJobsWithLimit(const QString ¶ms, qint32 maxNum); - QString QueryJobsWithRule(const QString ¶ms, const QString &rules); - - //CalendarScheduler: jobtype & color - /** - * @brief CreateJobType 创建日程类型 - * param jobTypeInfo json格式的日程类型信息 - * return bool 返回操作结果 - */ - bool CreateJobType(const QString &jobTypeInfo);// - /** - * @brief DeleteJobType 删除日程类型 - * param typeNo 日程类型编号 - * return bool 返回操作结果 - */ - bool DeleteJobType(const int &typeNo); - /** - * @brief UpdateJobType 更新日程类型 - * param jobTypeInfo json格式的日程类型信息 - * return bool 返回操作结果 - */ - bool UpdateJobType(const QString &jobTypeInfo); - /** - * @brief GetJobTypeList 获取日程类型字符串 - * return bool 返回查询结果 - */ - QString GetJobTypeList(); - - /** - * @brief isJobTypeUsed 获取日程类型是否被使用 - * return bool 返回是否被使用 - */ - bool isJobTypeUsed(int iTypeNo); - - /** - * @brief GetColorTypeList 获取日程类型字符串 - * return bool 返回查询结果 - */ - QString GetColorTypeList(); - - void remindJob(const qint64 id, const qint64 recurID); - - /** - * @brief UpdateRemindTimeout 更新未来10分钟有提醒信息的日程 - * @param isClear 是否清空日程定时任务数据库 - */ - void UpdateRemindTimeout(bool isClear); - - /** - * @brief notifyMsgHanding 处理通知弹框信息 - * @param jobID 日程ID - * @param recurID 重复日程编号 - * @param operationNum 操作编号 - */ - void notifyMsgHanding(const qint64 jobID, const qint64 recurID, const int operationNum); - -private: - void initConnections(); - static quint32 GetFestivalId(const QString &name); - void IsFestivalJobEnabled(); - QList GetJobsBetween(const QDateTime &start, const QDateTime &end, const QList &joblist, bool needFestival, const QString &querykey = QString(), bool bextend = true); - QList GetJobTimesBetween(const QDateTime &start, const QDateTime &end, const Job &job); - void FillFestivalJobs(const QDateTime &start, const QDateTime &end, const QString &querykey, QList &listjob); - QList GetIgnoreList(const Job &job); - bool ContainsInIgnoreList(const QList &ignorelist, const QDateTime &time); - bool OverLap(const QDateTime &start, const QDateTime &end, const QDateTime &jobstart, const QDateTime &jobend); - QDateTime GetNextJobStartTimeByRule(const stRRuleOptions &options, const QDateTime &datetime); - stRRuleOptions ParseRRule(const QString &rule); - QString JobArrListToJsonStr(const QList &jobArrList); - QList GetRemindJobs(const QDateTime &start, const QDateTime &end); - QDateTime GetJobRemindTime(const Job &job); - QDateTime ParseRemind(const QDateTime &tm, const QString &strremind); - void AfterJobChanged(const QList &Ids); - QList FilterDateJobsWrap(const QList &arrList, const QDateTime &start, const QDateTime &end); - - Job josnStringToJob(const QString &str); - - /** - * @brief getRemindTimeByCount 获取下次提醒时间 - * @param count 第几次提醒,从1开始 - * @return - */ - QDateTime getRemindTimeByCount(int count); - - /** - * @brief getRemindTimeByMesc 获取下次提醒时间 - * @param duration 毫秒时长 - * @return - */ - QDateTime getRemindTimeByMesc(qint64 duration); - - /** - * @brief closeNotification 关闭通知弹框 - * @param jobId 日程id - */ - void closeNotification(qint64 jobId); - -signals: - void NotifyJobChange(const QList &jobs); - void NotifyUpdateRemindJobs(const QList &jobs); - void JobsUpdated(const QList &Ids); - //日程类型发生改变 - void JobTypeOrColorUpdated(); - void signalRemindJob(const Job &job); - void signalNotifyMsgHanding(const Job &job, const int operationNum); - void signalCloseNotification(quint32 notifyID); - -private slots: - - void OnModifyJobRemind(const Job &job, const QString &remind); - void saveNotifyID(const Job &job, int notifyid); - -private: - SchedulerDatabase *m_database; - JobRemindManager *m_jobremindmanager; - bool m_festivalJobEnabled = false; //是否允许节假日日程 - static QMap m_festivalIdMap; //节日对应节日Id - static quint32 nextFestivalJobId; //下一个节日id - static QMutex m_getJobIdMutex; //节日id获取锁 - QThread *threadremind = nullptr; -}; - -#endif // CALENDARSCHEDULER_H diff -Nru dde-calendar-5.9.1/calendar-service/src/calendarservice.cpp dde-calendar-5.10.0/calendar-service/src/calendarservice.cpp --- dde-calendar-5.9.1/calendar-service/src/calendarservice.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/calendarservice.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,261 +0,0 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: kongyunzhen -* -* Maintainer: kongyunzhen -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ -#include "calendarservice.h" -#include "src/commondatastruct.h" - -#include "calendarprogramexitcontrol.h" - -CalendarService::CalendarService(QObject *parent) - : QObject(parent) -{ - CalendarProgramExitControl::getProgramExitControl()->addExc(); - CaLunarDayInfo::registerMetaType(); - CaLunarMonthInfo::registerMetaType(); - CaHuangLiDayInfo::registerMetaType(); - CaHuangLiMonthInfo::registerMetaType(); - qRegisterMetaType("Job"); - qRegisterMetaType>("QList"); - m_scheduler = new CalendarScheduler(this); - m_huangli = new CalendarHuangLi(this); - initConnections(); - CalendarProgramExitControl::getProgramExitControl()->reduce(); -} - -void CalendarService::initConnections() -{ - connect(m_scheduler, &CalendarScheduler::JobsUpdated, this, &CalendarService::JobsUpdated); - connect(m_scheduler, &CalendarScheduler::JobTypeOrColorUpdated, this, &CalendarService::JobTypeOrColorUpdated); -} - -//获取指定公历月的假日信息 -QString CalendarService::GetFestivalMonth(quint32 year, quint32 month) -{ - CalendarProgramExitControl::getProgramExitControl()->addExc(); - QString festivalInfo = m_huangli->GetFestivalMonth(year, month); - CalendarProgramExitControl::getProgramExitControl()->reduce(); - return festivalInfo; -} - -//获取指定公历日的黄历信息 -QString CalendarService::GetHuangLiDay(quint32 year, quint32 month, quint32 day) -{ - CalendarProgramExitControl::getProgramExitControl()->addExc(); - QString huangliInfo = m_huangli->GetHuangLiDay(year, month, day); - CalendarProgramExitControl::getProgramExitControl()->reduce(); - return huangliInfo; -} - -//获取指定公历月的黄历信息 -QString CalendarService::GetHuangLiMonth(quint32 year, quint32 month, bool fill) -{ - CalendarProgramExitControl::getProgramExitControl()->addExc(); - QString huangliInfo = m_huangli->GetHuangLiMonth(year, month, fill); - CalendarProgramExitControl::getProgramExitControl()->reduce(); - return huangliInfo; -} - -//通过公历获取阴历信息 -CaLunarDayInfo CalendarService::GetLunarInfoBySolar(quint32 year, quint32 month, quint32 day) -{ - CalendarProgramExitControl::getProgramExitControl()->addExc(); - CaLunarDayInfo huangliInfo = m_huangli->GetLunarInfoBySolar(year, month, day); - CalendarProgramExitControl::getProgramExitControl()->reduce(); - return huangliInfo; -} - -//获取阴历月信息 -CaLunarMonthInfo CalendarService::GetLunarMonthCalendar(quint32 year, quint32 month, bool fill) -{ - CalendarProgramExitControl::getProgramExitControl()->addExc(); - CaLunarMonthInfo huangliInfo = m_huangli->GetLunarCalendarMonth(year, month, fill); - CalendarProgramExitControl::getProgramExitControl()->reduce(); - return huangliInfo; -} - -// 根据日程json创建日程信息,并返回jobID -qint64 CalendarService::CreateJob(const QString &jobInfo) -{ - CalendarProgramExitControl::getProgramExitControl()->addExc(); - qint64 jobID = m_scheduler->CreateJob(jobInfo); - CalendarProgramExitControl::getProgramExitControl()->reduce(); - return jobID; -} - -qint64 CalendarService::CreateType(const QString &typeInfo) -{ - Q_UNUSED(typeInfo); - CalendarProgramExitControl::getProgramExitControl()->addExc(); - CalendarProgramExitControl::getProgramExitControl()->reduce(); - return 0; -} - -// 根据日程id来删除日程记录 -void CalendarService::DeleteJob(qint64 id) -{ - CalendarProgramExitControl::getProgramExitControl()->addExc(); - m_scheduler->DeleteJob(id); - CalendarProgramExitControl::getProgramExitControl()->reduce(); -} - -QString CalendarService::GetJob(qint64 id) -{ - CalendarProgramExitControl::getProgramExitControl()->addExc(); - QString scheduleInfo = m_scheduler->GetJob(id); - CalendarProgramExitControl::getProgramExitControl()->reduce(); - return scheduleInfo; -} - -/** - * @brief GetJobs 获取指定范围内的日程 - * @param startYear 起始年信息 - * @param startMonth 起始月信息 - * @param startDay 起始日信息 - * @param endYear 结束年信息 - * @param endMonth 结束月信息 - * @param endDay 结束日信息 - * @return 返回指定范围内的日程JSON格式 - */ -QString CalendarService::GetJobs(quint32 startYear, quint32 startMonth, quint32 startDay, quint32 endYear, quint32 endMonth, quint32 endDay) -{ - CalendarProgramExitControl::getProgramExitControl()->addExc(); - //getjobs查询的时间为一整天,给查询的日期赋上精准的时间,和queryjobs查询保持一致 - QDate startdate(static_cast(startYear), static_cast(startMonth), static_cast(startDay)); - //查询的开始时间为当天的0:0 - QDateTime start(startdate); - QDate enddate(static_cast(endYear), static_cast(endMonth), static_cast(endDay)); - //getjobs查询是以天为单位的,如果没有设置时间,则默认时间为00:00,那么查询的就是一个时间点,不符合期望,所以需要显示的设置一个当天最晚的时间点,来代表一整天的时间。 - QDateTime end(enddate, QTime(23, 59)); - QString scheduleInfo = m_scheduler->GetJobs(start, end); - CalendarProgramExitControl::getProgramExitControl()->reduce(); - return scheduleInfo; -} - -QString CalendarService::QueryJobs(const QString ¶ms) -{ - CalendarProgramExitControl::getProgramExitControl()->addExc(); - QString scheduleInfo = m_scheduler->QueryJobs(params); - CalendarProgramExitControl::getProgramExitControl()->reduce(); - return scheduleInfo; -} - -// 传入要改动的日程信息来更新数据库 -void CalendarService::UpdateJob(const QString &jobInfo) -{ - CalendarProgramExitControl::getProgramExitControl()->addExc(); - m_scheduler->UpdateJob(jobInfo); - CalendarProgramExitControl::getProgramExitControl()->reduce(); -} - -QString CalendarService::QueryJobsWithLimit(const QString ¶ms, qint32 maxNum) -{ - CalendarProgramExitControl::getProgramExitControl()->addExc(); - QString scheduleInfo = m_scheduler->QueryJobsWithLimit(params, maxNum); - CalendarProgramExitControl::getProgramExitControl()->reduce(); - return scheduleInfo; -} - -QString CalendarService::QueryJobsWithRule(const QString ¶ms, const QString &rules) -{ - CalendarProgramExitControl::getProgramExitControl()->addExc(); - QString scheduleInfo = m_scheduler->QueryJobsWithRule(params, rules); - CalendarProgramExitControl::getProgramExitControl()->reduce(); - return scheduleInfo; -} - -void CalendarService::remindJob(const qint64 jobID, const qint64 recurID) -{ - CalendarProgramExitControl::getProgramExitControl()->addExc(); - m_scheduler->remindJob(jobID, recurID); - CalendarProgramExitControl::getProgramExitControl()->reduce(); -} - -void CalendarService::updateRemindJob(bool isClear) -{ - CalendarProgramExitControl::getProgramExitControl()->addExc(); - m_scheduler->UpdateRemindTimeout(isClear); - CalendarProgramExitControl::getProgramExitControl()->reduce(); -} - -void CalendarService::notifyMsgHanding(const qint64 jobID, const qint64 recurID, const qint32 operationNum) -{ - CalendarProgramExitControl::getProgramExitControl()->addExc(); - m_scheduler->notifyMsgHanding(jobID, recurID, operationNum); - CalendarProgramExitControl::getProgramExitControl()->reduce(); -} -// 根据日程json创建日程类型信息,并返回操作结果 -bool CalendarService::CreateJobType(const QString &jobTypeInfo) -{ - bool bRet; - CalendarProgramExitControl::getProgramExitControl()->addExc(); - bRet = m_scheduler->CreateJobType(jobTypeInfo); - CalendarProgramExitControl::getProgramExitControl()->reduce(); - return bRet; -} -// 根据日程typeNo删除日程类型信息,并返回操作结果 -bool CalendarService::DeleteJobType(const int &typeNo) -{ - bool bRet; - CalendarProgramExitControl::getProgramExitControl()->addExc(); - bRet = m_scheduler->DeleteJobType(typeNo); - CalendarProgramExitControl::getProgramExitControl()->reduce(); - return bRet; -} -// 根据日程json修改日程类型信息,并返回操作结果 -bool CalendarService::UpdateJobType(const QString &jobTypeInfo) -{ - bool bRet; - CalendarProgramExitControl::getProgramExitControl()->addExc(); - bRet = m_scheduler->UpdateJobType(jobTypeInfo); - CalendarProgramExitControl::getProgramExitControl()->reduce(); - return bRet; -} -// 返回类型列表 -QString CalendarService::GetJobTypeList() -{ - QString strJobType; - CalendarProgramExitControl::getProgramExitControl()->addExc(); - strJobType = m_scheduler->GetJobTypeList(); - CalendarProgramExitControl::getProgramExitControl()->reduce(); - return strJobType; -} -/** - * @brief isJobTypeUsed 获取日程类型是否被使用 - * return bool 返回是否被使用 - */ -bool CalendarService::isJobTypeUsed(const int &typeNo) -{ - bool bRet; - CalendarProgramExitControl::getProgramExitControl()->addExc(); - bRet = m_scheduler->isJobTypeUsed(typeNo); - CalendarProgramExitControl::getProgramExitControl()->reduce(); - return bRet; -} - -// 返回类型列表 -QString CalendarService::GetColorTypeList() -{ - QString strJobType; - CalendarProgramExitControl::getProgramExitControl()->addExc(); - strJobType = m_scheduler->GetColorTypeList(); - CalendarProgramExitControl::getProgramExitControl()->reduce(); - return strJobType; -} - diff -Nru dde-calendar-5.9.1/calendar-service/src/calendarservice.h dde-calendar-5.10.0/calendar-service/src/calendarservice.h --- dde-calendar-5.9.1/calendar-service/src/calendarservice.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/calendarservice.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,94 +0,0 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: kongyunzhen -* -* Maintainer: kongyunzhen -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ -#ifndef CALENDARSERVICE_H -#define CALENDARSERVICE_H - -#include "src/commondef.h" -#include "src/dbusdatastruct.h" -#include "calendarscheduler.h" -#include "calendarhuangli.h" - -#include -#include - -class CalendarService : public QObject - , protected QDBusContext -{ - Q_OBJECT - Q_CLASSINFO("D-Bus Interface", "com.deepin.dataserver.Calendar") -public: - explicit CalendarService(QObject *parent = nullptr); - -private: - void initConnections(); -Q_SIGNALS: - Q_SCRIPTABLE void JobsUpdated(const QList &Ids); - //日程类型发生改变 - Q_SCRIPTABLE void JobTypeOrColorUpdated(); - -public Q_SLOTS: - //LunarCalendar - Q_SCRIPTABLE QString GetFestivalMonth(quint32 year, quint32 month); - Q_SCRIPTABLE QString GetHuangLiDay(quint32 year, quint32 month, quint32 day); - Q_SCRIPTABLE QString GetHuangLiMonth(quint32 year, quint32 month, bool fill); - Q_SCRIPTABLE CaLunarDayInfo GetLunarInfoBySolar(quint32 year, quint32 month, quint32 day); - Q_SCRIPTABLE CaLunarMonthInfo GetLunarMonthCalendar(quint32 year, quint32 month, bool fill); - - //CalendarScheduler - Q_SCRIPTABLE qint64 CreateJob(const QString &jobInfo); - Q_SCRIPTABLE qint64 CreateType(const QString &typeInfo); - Q_SCRIPTABLE void DeleteJob(qint64 id); - Q_SCRIPTABLE QString GetJob(qint64 id); - Q_SCRIPTABLE QString GetJobs(quint32 startYear, quint32 startMonth, quint32 startDay, quint32 endYear, quint32 endMonth, quint32 endDay); - Q_SCRIPTABLE QString QueryJobs(const QString ¶ms); - Q_SCRIPTABLE void UpdateJob(const QString &jobInfo); - Q_SCRIPTABLE QString QueryJobsWithLimit(const QString ¶ms, qint32 maxNum); - Q_SCRIPTABLE QString QueryJobsWithRule(const QString ¶ms, const QString &rules); - //CalendarScheduler: jobtype & color - Q_SCRIPTABLE bool CreateJobType(const QString &jobTypeInfo);// - Q_SCRIPTABLE bool DeleteJobType(const int &typeNo); - Q_SCRIPTABLE bool UpdateJobType(const QString &jobTypeInfo); - Q_SCRIPTABLE QString GetJobTypeList(); - Q_SCRIPTABLE bool isJobTypeUsed(const int &typeNo); - - Q_SCRIPTABLE QString GetColorTypeList(); - //稍后提醒相关接口 - Q_SCRIPTABLE void remindJob(const qint64 jobID, const qint64 recurID); - - /** - * @brief updateRemindJob 每隔10分钟更新提醒日程 - * @param isClear 是否情况日程定时任务数据库 - */ - Q_SCRIPTABLE void updateRemindJob(bool isClear); - - /** - * @brief notifyMsgHanding 通知提示框交互处理 - * @param jobID 日程id - * @param operationNum 操作编号 , 1:打开日历,2:稍后提醒 3: 明天提醒 4: 提前1天提醒 5:关闭按钮 - */ - Q_SCRIPTABLE void notifyMsgHanding(const qint64 jobID, const qint64 recurID, const qint32 operationNum); - -private: - CalendarScheduler *m_scheduler; - CalendarHuangLi *m_huangli; -}; - -#endif // CALENDARSERVICE_H diff -Nru dde-calendar-5.9.1/calendar-service/src/csystemdtimercontrol.cpp dde-calendar-5.10.0/calendar-service/src/csystemdtimercontrol.cpp --- dde-calendar-5.9.1/calendar-service/src/csystemdtimercontrol.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/csystemdtimercontrol.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,10 +1,19 @@ +// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "csystemdtimercontrol.h" +#include "units.h" + #include #include #include #include +const QString UPLOADTASK_SERVICE = "uploadNetWorkAccountData_calendar.service"; +const QString UPLOADTASK_TIMER = "uploadNetWorkAccountData_calendar.timer"; + CSystemdTimerControl::CSystemdTimerControl(QObject *parent) : QObject(parent) { @@ -17,13 +26,13 @@ void CSystemdTimerControl::buildingConfiggure(const QVector &infoVector) { - if(infoVector.size() ==0) + if (infoVector.size() == 0) return; QStringList fileNameList{}; - foreach(auto info ,infoVector){ - fileNameList.append(QString("job-%1-%2-%3").arg(info.jobID).arg(info.recurID).arg(info.laterCount)); - createService(fileNameList.last(),info); - createTimer(fileNameList.last(),info.triggerTimer); + foreach (auto info, infoVector) { + fileNameList.append(QString("calendar-remind-%1-%2-%3").arg(info.accountID.mid(0,8)).arg(info.alarmID.mid(0, 8)).arg(info.laterCount)); + createService(fileNameList.last(), info); + createTimer(fileNameList.last(), info.triggerTimer); } startSystemdTimer(fileNameList); } @@ -31,8 +40,8 @@ void CSystemdTimerControl::stopSystemdTimerByJobInfos(const QVector &infoVector) { QStringList fileNameList; - foreach(auto info ,infoVector){ - fileNameList.append(QString("job-%1-%2-%3").arg(info.jobID).arg(info.recurID).arg(info.laterCount)); + foreach (auto info, infoVector) { + fileNameList.append(QString("calendar-remind-%1-%2-%3").arg(info.accountID.mid(0,8)).arg(info.alarmID.mid(0, 8)).arg(info.laterCount)); } stopSystemdTimer(fileNameList); } @@ -41,14 +50,20 @@ { QStringList fileName; //停止刚刚提醒的稍后提醒,所以需要对提醒次数减一 - fileName << QString("job-%1-%2-%3").arg(info.jobID).arg(info.recurID).arg(info.laterCount-1); + fileName << QString("calendar-remind-%1-%2-%3").arg(info.accountID.mid(0,8)).arg(info.alarmID).arg(info.laterCount - 1); stopSystemdTimer(fileName); } void CSystemdTimerControl::startSystemdTimer(const QStringList &timerName) { + QString command_stop("systemctl --user stop "); + foreach (auto str, timerName) { + command_stop += QString(" %1.timer").arg(str); + } + execLinuxCommand(command_stop); + QString command("systemctl --user start "); - foreach(auto str,timerName){ + foreach (auto str, timerName) { command += QString(" %1.timer").arg(str); } execLinuxCommand(command); @@ -57,7 +72,7 @@ void CSystemdTimerControl::stopSystemdTimer(const QStringList &timerName) { QString command("systemctl --user stop "); - foreach(auto str,timerName){ + foreach (auto str, timerName) { command += QString(" %1.timer").arg(str); } execLinuxCommand(command); @@ -65,38 +80,153 @@ void CSystemdTimerControl::removeFile(const QStringList &fileName) { - foreach(auto f,fileName){ + foreach (auto f, fileName) { QFile::remove(f); } } -void CSystemdTimerControl::stopAllRemindSystemdTimer() +void CSystemdTimerControl::stopAllRemindSystemdTimer(const QString &accountID) { - execLinuxCommand("systemctl --user stop job-*.timer"); + execLinuxCommand(QString("systemctl --user stop calendar-remind-%1-*.timer").arg(accountID.mid(0,8))); } -void CSystemdTimerControl::removeRemindFile() +void CSystemdTimerControl::removeRemindFile(const QString &accountID) { - // - QString cmd("rm "); - cmd +=m_systemdPath; - cmd +="job-*"; - execLinuxCommand(cmd); + QDir dir(m_systemdPath); + if (dir.exists()) { + QStringList filters; + filters << QString("calendar-remind-%1*").arg(accountID.mid(0,8)); + dir.setFilter(QDir::Files | QDir::NoSymLinks); + dir.setNameFilters(filters); + for (uint i = 0; i < dir.count(); ++i) { + QFile::remove(m_systemdPath + dir[i]); + } + } } void CSystemdTimerControl::startCalendarServiceSystemdTimer() { - QFileInfo fileInfo(m_systemdPath+"timers.target.wants/com.dde.calendarserver.calendar.timer"); + QFileInfo fileInfo(m_systemdPath + "timers.target.wants/com.dde.calendarserver.calendar.timer"); //如果没有设置定时任务则开启定时任务 - if(!fileInfo.exists()){ + if (!fileInfo.exists()) { execLinuxCommand("systemctl --user enable com.dde.calendarserver.calendar.timer"); execLinuxCommand("systemctl --user start com.dde.calendarserver.calendar.timer"); } } +void CSystemdTimerControl::startDownloadTask(const QString &accountID, const int minute) +{ + { + //.service + QString fileName; + QString remindCMD = QString("dbus-send --session --print-reply --dest=com.deepin.dataserver.Calendar " + "/com/deepin/dataserver/Calendar/AccountManager " + "com.deepin.dataserver.Calendar.AccountManager.downloadByAccountID string:%1 ") + .arg(accountID); + fileName = m_systemdPath + accountID + "_calendar.service"; + QString content; + content += "[Unit]\n"; + content += "Description = schedule download task.\n"; + content += "[Service]\n"; + content += QString("ExecStart = /bin/bash -c \"%1\"\n").arg(remindCMD); + content += "[Install]\n"; + content += "WantedBy=user-session.target\n"; + createFile(fileName, content); + } + + { + //timer + QString fileName; + fileName = m_systemdPath + accountID + "_calendar.timer"; + QString content; + content += "[Unit]\n"; + content += "Description = schedule download task.\n"; + content += "[Timer]\n"; + content += "OnActiveSec = 1s\n"; + content += QString("OnUnitInactiveSec = %1m\n").arg(minute); + content += "AccuracySec = 1us\n"; + content += "RandomizedDelaySec = 0\n"; + content += "[Install]\n"; + content += "WantedBy = timers.target\n"; + createFile(fileName, content); + + const QString accountTimer = accountID + "_calendar.timer"; + execLinuxCommand("systemctl --user enable " + accountTimer); + execLinuxCommand("systemctl --user start " + accountTimer); + } +} + +void CSystemdTimerControl::stopDownloadTask(const QString &accountID) +{ + QString fileName; + fileName = m_systemdPath + accountID + "_calendar.timer"; + QString command("systemctl --user stop "); + command += accountID + "_calendar.timer"; + execLinuxCommand(command); + QFile::remove(fileName); + QString fileServiceName = m_systemdPath + accountID + "_calendar.service"; + QFile::remove(fileServiceName); +} + +void CSystemdTimerControl::startUploadTask(const int minute) +{ + { + //如果定时器为激活状态则退出 + QString cmd = "systemctl --user is-active " + UPLOADTASK_SERVICE; + QString isActive = execLinuxCommand(cmd); + if (isActive == "active") { + return; + } + } + { + //.service + QString fileName; + QString remindCMD = QString("dbus-send --session --print-reply --dest=com.deepin.dataserver.Calendar " + "/com/deepin/dataserver/Calendar/AccountManager " + "com.deepin.dataserver.Calendar.AccountManager.uploadNetWorkAccountData "); + fileName = m_systemdPath + UPLOADTASK_SERVICE; + QString content; + content += "[Unit]\n"; + content += "Description = schedule uploadNetWorkAccountData task.\n"; + content += "[Service]\n"; + content += QString("ExecStart = /bin/bash -c \"%1\"\n").arg(remindCMD); + createFile(fileName, content); + } + + { + //timer + QString fileName; + fileName = m_systemdPath + UPLOADTASK_TIMER; + QString content; + content += "[Unit]\n"; + content += "Description = schedule uploadNetWorkAccountData task.\n"; + content += "[Timer]\n"; + content += "OnActiveSec = 1s\n"; + content += QString("OnUnitInactiveSec = %1m\n").arg(minute); + content += "AccuracySec = 1us\n"; + content += "RandomizedDelaySec = 0\n"; + createFile(fileName, content); + + execLinuxCommand("systemctl --user enable " + UPLOADTASK_TIMER); + execLinuxCommand("systemctl --user start " + UPLOADTASK_TIMER); + } +} + +void CSystemdTimerControl::stopUploadTask() +{ + QString fileName; + fileName = m_systemdPath + UPLOADTASK_TIMER; + QString command("systemctl --user stop "); + command += UPLOADTASK_TIMER; + execLinuxCommand(command); + QFile::remove(fileName); + QString fileServiceName = m_systemdPath + UPLOADTASK_SERVICE; + QFile::remove(fileServiceName); +} + void CSystemdTimerControl::createPath() { - m_systemdPath = QStandardPaths::writableLocation(QStandardPaths::HomeLocation).append("/.config/systemd/user/"); + m_systemdPath = getHomeConfigPath().append("/systemd/user/"); QDir dir; //如果该路径不存在,则创建该文件夹 if (!dir.exists(m_systemdPath)) { @@ -107,7 +237,7 @@ QString CSystemdTimerControl::execLinuxCommand(const QString &command) { QProcess process; - process.start("/bin/bash",QStringList()<<"-c"< #include - -struct SystemDInfo{ - qint64 jobID = 0; //日程id +struct SystemDInfo { + QString accountID = ""; //帐户ID + QString alarmID = ""; //提醒编号id qint64 laterCount = 0; //稍后提醒次数 - qint64 recurID = 0 ; //重复日程编号 QDateTime triggerTimer; //触发时间 }; @@ -55,17 +58,25 @@ /** * @brief stopAllRemindSystemdTimer 停止所有的日程定时任务 */ - void stopAllRemindSystemdTimer(); + void stopAllRemindSystemdTimer(const QString &accountID); /** * @brief removeRemindFile 移除日程定时任务相关文件 */ - void removeRemindFile(); + void removeRemindFile(const QString &accountID); /** * @brief startCalendarServiceSystemdTimer 开启日程后端定时器 */ void startCalendarServiceSystemdTimer(); + + //开启定时下载任务 + void startDownloadTask(const QString &accountID, const int minute); + void stopDownloadTask(const QString &accountID); + //开启定时上传任务 + void startUploadTask(const int minute); + void stopUploadTask(); + private: /** * @brief removeFile 移除.service和.timer文件 @@ -89,19 +100,19 @@ * @brief createService * 创建 .service文件 */ - void createService(const QString &name ,const SystemDInfo &info); + void createService(const QString &name, const SystemDInfo &info); /** * @brief createTimer * 创建 .timer文件 */ - void createTimer(const QString &name ,const QDateTime &triggerTimer); + void createTimer(const QString &name, const QDateTime &triggerTimer); /** * @brief createFile 创建文件 * @param fileName 文件名称 * @param content 内容 */ - void createFile(const QString &fileName ,const QString &content); + void createFile(const QString &fileName, const QString &content); signals: public slots: diff -Nru dde-calendar-5.9.1/calendar-service/src/dbmanager/daccountdatabase.cpp dde-calendar-5.10.0/calendar-service/src/dbmanager/daccountdatabase.cpp --- dde-calendar-5.9.1/calendar-service/src/dbmanager/daccountdatabase.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/dbmanager/daccountdatabase.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,1199 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "daccountdatabase.h" + +#include "units.h" +#include "pinyin/pinyinsearch.h" + +#include +#include +#include +#include +#include +#include + +DAccountDataBase::DAccountDataBase(const DAccount::Ptr &account, QObject *parent) + : DDataBase(parent) + , m_account(account) +{ + setConnectionName(m_account->accountName()); +} + +QString DAccountDataBase::createSchedule(const DSchedule::Ptr &schedule) +{ + if (!schedule.isNull()) { + SqliteQuery query(m_database); + schedule->setUid(DDataBase::createUuid()); + + QString strSql("INSERT INTO schedules \ + (scheduleID, scheduleTypeID, summary, description, allDay, dtStart \ + , dtEnd, isAlarm, titlePinyin,isLunar, ics, fileName, dtCreate, isDeleted) \ + VALUES(?, ?, ?, ?, ?, ?, ?, ?,?, ?, ?, ?, ?, ?);"); + if (query.prepare(strSql)) { + query.addBindValue(schedule->schedulingID()); + query.addBindValue(schedule->scheduleTypeID()); + query.addBindValue(schedule->summary()); + query.addBindValue(schedule->description()); + query.addBindValue(schedule->allDay()); + query.addBindValue(dtToString(schedule->dtStart())); + query.addBindValue(dtToString(schedule->dtEnd())); + query.addBindValue(schedule->hasEnabledAlarms()); + query.addBindValue(pinyinsearch::getPinPinSearch()->CreatePinyin(schedule->summary())); + query.addBindValue(schedule->lunnar()); + query.addBindValue(DSchedule::toIcsString(schedule)); + query.addBindValue(schedule->fileName()); + query.addBindValue(dtToString(schedule->created())); + query.addBindValue(0); + if (!query.exec()) { + schedule->setUid(""); + qWarning() << "createSchedule error:" << query.lastError(); + } + if (query.isActive()) { + query.finish(); + } + } else { + schedule->setUid(""); + qWarning() << "createSchedule error:" << query.lastError(); + } + + } else { + schedule->setUid(""); + qWarning() << "schedule is null"; + } + + return schedule->uid(); +} + +bool DAccountDataBase::updateSchedule(const DSchedule::Ptr &schedule) +{ + bool resbool = false; + if (!schedule.isNull()) { + SqliteQuery query(m_database); + QString strSql("UPDATE schedules \ + SET scheduleTypeID=?, summary=?, description=?, allDay=? \ + , dtStart=?, dtEnd=?, isAlarm=?,titlePinyin=?, isLunar=?, ics=?, fileName=? \ + , dtUpdate=? WHERE scheduleID= ?;"); + if (query.prepare(strSql)) { + query.addBindValue(schedule->scheduleTypeID()); + query.addBindValue(schedule->summary()); + query.addBindValue(schedule->description()); + query.addBindValue(schedule->allDay()); + query.addBindValue(dtToString(schedule->dtStart())); + query.addBindValue(dtToString(schedule->dtEnd())); + query.addBindValue(schedule->hasEnabledAlarms()); + query.addBindValue(pinyinsearch::getPinPinSearch()->CreatePinyin(schedule->summary())); + query.addBindValue(schedule->lunnar()); + query.addBindValue(DSchedule::toIcsString(schedule)); + query.addBindValue(schedule->fileName()); + query.addBindValue(dtToString(schedule->lastModified())); + query.addBindValue(schedule->schedulingID()); + if (query.exec()) { + resbool = true; + } else { + qWarning() << Q_FUNC_INFO << query.lastError(); + } + if (query.isActive()) { + query.finish(); + } + } else { + qWarning() << Q_FUNC_INFO << query.lastError(); + } + } + + return resbool; +} + +DSchedule::Ptr DAccountDataBase::getScheduleByScheduleID(const QString &scheduleID) +{ + QString strSql("SELECT scheduleID, scheduleTypeID, summary, description, allDay, dtStart, dtEnd, \ + isAlarm,titlePinyin,isLunar, ics, fileName, dtCreate, dtUpdate, dtDelete, isDeleted \ + FROM schedules WHERE scheduleID = ? ;"); + SqliteQuery query(m_database); + DSchedule::Ptr schedule; + if (query.prepare(strSql)) { + query.addBindValue(scheduleID); + schedule = DSchedule::Ptr(new DSchedule); + if (query.exec()) { + if (query.next()) { + QString &&icsStr = query.value("ics").toString(); + DSchedule::fromIcsString(schedule, icsStr); + schedule->setScheduleTypeID(query.value("scheduleTypeID").toString()); + } + } else { + qWarning() << Q_FUNC_INFO << query.lastError(); + return schedule; + } + if (query.isActive()) { + query.finish(); + } + } else { + qWarning() << Q_FUNC_INFO << query.lastError(); + return schedule; + } + + return schedule; +} + +QStringList DAccountDataBase::getScheduleIDListByTypeID(const QString &typeID) +{ + QStringList scheduleIDList; + QString strSql("SELECT scheduleID FROM schedules WHERE scheduleTypeID = ?;"); + SqliteQuery query(m_database); + if (query.prepare(strSql)) { + query.addBindValue(typeID); + if (query.exec()) { + while (query.next()) { + scheduleIDList.append(query.value("scheduleID").toString()); + } + } else { + qWarning() << Q_FUNC_INFO << query.lastError(); + } + if (query.isActive()) { + query.finish(); + } + } else { + qWarning() << Q_FUNC_INFO << query.lastError(); + } + + return scheduleIDList; +} + +bool DAccountDataBase::deleteScheduleByScheduleID(const QString &scheduleID, const int isDeleted) +{ + QString strSql; + if (isDeleted) { + strSql = "DELETE FROM schedules WHERE scheduleID=?;"; + } else { + strSql = QString("UPDATE schedules SET dtDelete = '%1' , isDeleted = 1 WHERE scheduleID=?").arg(dtToString(QDateTime::currentDateTime())); + } + SqliteQuery query(m_database); + bool resBool = false; + if (query.prepare(strSql)) { + query.addBindValue(scheduleID); + resBool = query.exec(); + } + if (!resBool) { + qWarning() << Q_FUNC_INFO << query.lastError(); + } + + if (query.isActive()) { + query.finish(); + } + + return resBool; +} + +bool DAccountDataBase::deleteSchedulesByScheduleTypeID(const QString &typeID, const int isDeleted) +{ + QString strSql; + if (isDeleted) { + strSql = "DELETE FROM schedules WHERE scheduleTypeID=?;"; + } else { + strSql = QString("UPDATE schedules SET dtDelete = '%1' , isDeleted = 1 WHERE scheduleTypeID=?").arg(dtToString(QDateTime::currentDateTime())); + } + SqliteQuery query(m_database); + bool resBool = false; + if (query.prepare(strSql)) { + query.addBindValue(typeID); + resBool = query.exec(); + } + + if (!resBool) { + qWarning() << Q_FUNC_INFO << query.lastError(); + } + + if (query.isActive()) { + query.finish(); + } + return resBool; +} + +DSchedule::List DAccountDataBase::querySchedulesByKey(const QString &key) +{ + DSchedule::List scheduleList; + QString strSql("SELECT s.scheduleID, s.scheduleTypeID, s.summary, s.description, s.allDay, s.dtStart, s.dtEnd, \ + s.isAlarm,s.titlePinyin,s.isLunar, s.ics, s.fileName, s.dtCreate, s.dtUpdate, s.dtDelete, s.isDeleted \ + FROM schedules s inner join scheduleType st WHERE s.isDeleted = 0 and st.showState =1 and s.scheduleTypeID = st.typeID "); + //如果关键字不为空,添加查询条件 + pinyinsearch *psearch = pinyinsearch::getPinPinSearch(); + QMap sqlBindValue; + QString strKey = key.trimmed(); + if (psearch->CanQueryByPinyin(key)) { + //可以按照拼音查询 + QString pinyin = psearch->CreatePinyinQuery(strKey.toLower()); + strSql += QString("and ( instr(UPPER(s.summary), UPPER(:key)) OR s.titlePinyin LIKE :pinyin )"); + sqlBindValue[":key"] = key; + sqlBindValue[":pinyin"] = pinyin; + } else if (!key.isEmpty()) { + //按照key查询 + strSql += QString(" and instr(UPPER(s.summary), UPPER(:key))"); + sqlBindValue[":key"] = key; + } + + strSql.append(QString(" order by :strsort ")); + sqlBindValue[":strsort"] = "s.dtStart asc"; + + SqliteQuery query(m_database); + if (query.prepare(strSql)) { + for (auto iter = sqlBindValue.constBegin(); iter != sqlBindValue.constEnd(); iter++) { + query.bindValue(iter.key(), iter.value()); + } + + if (query.exec()) { + while (query.next()) { + DSchedule::Ptr schedule; + QString &&icsStr = query.value("ics").toString(); + DSchedule::fromIcsString(schedule, icsStr); + schedule->setScheduleTypeID(query.value("scheduleTypeID").toString()); + scheduleList.append(schedule); + } + } else { + qWarning() << Q_FUNC_INFO << query.lastError(); + } + } else { + qWarning() << Q_FUNC_INFO << query.lastError(); + } + + if (query.isActive()) { + query.finish(); + } + return scheduleList; +} + +DSchedule::List DAccountDataBase::querySchedulesByRRule(const QString &key, const int &rruleType) +{ + DSchedule::List scheduleList; + QString strSql("SELECT scheduleID, scheduleTypeID, summary, description, allDay, dtStart, dtEnd, \ + isAlarm,titlePinyin,isLunar, ics, fileName, dtCreate, dtUpdate, dtDelete, isDeleted \ + FROM schedules "); + SqliteQuery query(m_database); + if (!key.isEmpty()) { + strSql += " WHERE summary = ? "; + } + if (query.prepare(strSql)) { + if (!key.isEmpty()) { + query.addBindValue(key); + } + + if (query.exec()) { + while (query.next()) { + DSchedule::Ptr schedule = DSchedule::Ptr(new DSchedule); + QString &&icsStr = query.value("ics").toString(); + DSchedule::fromIcsString(schedule, icsStr); + schedule->setScheduleTypeID(query.value("scheduleTypeID").toString()); + DSchedule::RRuleType rRuleType = schedule->getRRuleType(); + //如果存在重复规则 + if (schedule->recurs()) { + //如果为需要获取的重复规则 + if (rruleType == rRuleType) { + scheduleList.append(schedule); + } + } + } + } else { + qWarning() << Q_FUNC_INFO << query.lastError(); + } + } else { + qWarning() << Q_FUNC_INFO << query.lastError(); + } + + if (query.isActive()) { + query.finish(); + } + return scheduleList; +} + +DSchedule::List DAccountDataBase::getRemindSchedule() +{ + QString strSql("SELECT scheduleID, scheduleTypeID, summary, description, allDay, dtStart, dtEnd, isAlarm, \ + titlePinyin, isLunar, ics, fileName, dtCreate, dtUpdate, dtDelete, isDeleted \ + FROM schedules WHERE isAlarm =1;"); + SqliteQuery query(m_database); + DSchedule::List scheduleList; + if (query.prepare(strSql)) { + if (query.exec()) { + while (query.next()) { + DSchedule::Ptr schedule = DSchedule::Ptr(new DSchedule); + QString &&icsStr = query.value("ics").toString(); + DSchedule::fromIcsString(schedule, icsStr); + scheduleList.append(schedule); + } + } else { + qWarning() << Q_FUNC_INFO << query.lastError(); + } + } else { + qWarning() << Q_FUNC_INFO << query.lastError(); + } + + if (query.isActive()) { + query.finish(); + } + return scheduleList; +} + +void DAccountDataBase::initDBData() +{ + //如果不存在对应的数据库则创建 + if (!dbFileExists()) { + createDB(); + initTypeColor(); + initScheduleDB(); + initScheduleType(); + initAccountDB(); + } else { + //如果存在则连接数据库 + dbOpen(); + } +} + +QString DAccountDataBase::createScheduleType(const DScheduleType::Ptr &scheduleType) +{ + QString strSql("INSERT INTO scheduleType ( \ + typeID, typeName, typeDisplayName, typePath, \ + typeColorID, description, privilege, showState, \ + syncTag,dtCreate,isDeleted) \ + VALUES(?,?,?,?,?,?,?,?,?,?,?)"); + SqliteQuery query(m_database); + if (query.prepare(strSql)) { + if (scheduleType->typeID().size() < 30) { + scheduleType->setTypeID(DDataBase::createUuid()); + } + + query.addBindValue(scheduleType->typeID()); + query.addBindValue(scheduleType->typeName()); + query.addBindValue(scheduleType->displayName()); + query.addBindValue(scheduleType->typePath()); + query.addBindValue(scheduleType->typeColor().colorID()); + query.addBindValue(scheduleType->description()); + query.addBindValue(int(scheduleType->privilege())); + query.addBindValue(scheduleType->showState()); + query.addBindValue(scheduleType->syncTag()); + query.addBindValue(dtToString(scheduleType->dtCreate())); + query.addBindValue(scheduleType->deleted()); + + if (!query.exec()) { + qWarning() << __FUNCTION__ << query.lastError(); + scheduleType->setTypeID(""); + } + } else { + qWarning() << __FUNCTION__ << query.lastError(); + scheduleType->setTypeID(""); + } + + if (query.isActive()) { + query.finish(); + } + return scheduleType->typeID(); +} + +DScheduleType::Ptr DAccountDataBase::getScheduleTypeByID(const QString &typeID, const int isDeleted) +{ + DScheduleType::Ptr type; + QString strSql("SELECT \ + st.typeID , st.typeName ,st.typeDisplayName , \ + st.typePath ,st.typeColorID ,tc.ColorHex , \ + tc.privilege as colorPri,st.description, \ + st.privilege as typePri,st.showState ,st.syncTag , \ + st.dtCreate ,st.dtUpdate ,st.dtDelete ,st.isDeleted \ + FROM \ + scheduleType st \ + inner join typeColor tc on \ + st.typeColorID = tc.ColorID \ + WHERE \ + st.typeID = ? AND st.isDeleteD = ?"); + SqliteQuery query(m_database); + if (query.prepare(strSql)) { + query.addBindValue(typeID); + query.addBindValue(isDeleted); + if (query.exec() && query.next()) { + type = DScheduleType::Ptr(new DScheduleType(m_account->accountID())); + type->setTypeID(typeID); + type->setTypeName(query.value("typeName").toString()); + type->setDisplayName(query.value("typeDisplayName").toString()); + type->setTypePath(query.value("typePath").toString()); + DTypeColor color; + color.setColorID(query.value("typeColorID").toString()); + color.setColorCode(query.value("ColorHex").toString()); + color.setPrivilege(static_cast(query.value("colorPri").toInt())); + type->setTypeColor(color); + type->setDescription(query.value("description").toString()); + type->setPrivilege(static_cast(query.value("typePri").toInt())); + type->setSyncTag(query.value("syncTag").toInt()); + type->setDtCreate(dtFromString(query.value("dtCreate").toString())); + type->setDtUpdate(dtFromString(query.value("dtUpdate").toString())); + type->setDtDelete(dtFromString(query.value("dtDelete").toString())); + type->setShowState(static_cast(query.value("showState").toInt())); + type->setDeleted(query.value("isDeleted").toInt()); + systemTypeTran(type); + } + } else { + qWarning() << query.lastError(); + } + query.addBindValue(typeID); + query.addBindValue(isDeleted); + + if (query.isActive()) { + query.finish(); + } + return type; +} + +DScheduleType::List DAccountDataBase::getScheduleTypeList(const int isDeleted) +{ + QString strSql("SELECT \ + st.typeID , st.typeName ,st.typeDisplayName , \ + st.typePath ,st.typeColorID ,tc.ColorHex , \ + tc.privilege as colorPri,st.description, \ + st.privilege as typePri,st.showState ,st.syncTag , \ + st.dtCreate ,st.dtUpdate ,st.dtDelete ,st.isDeleted \ + FROM \ + scheduleType st \ + inner join typeColor tc on \ + st.typeColorID = tc.ColorID \ + WHERE \ + st.isDeleted = ?"); + DScheduleType::List typeList; + SqliteQuery query(m_database); + if (query.prepare(strSql)) { + query.addBindValue(isDeleted); + if (query.exec()) { + while (query.next()) { + DScheduleType::Ptr type = DScheduleType::Ptr(new DScheduleType(m_account->accountID())); + type->setTypeID(query.value("typeID").toString()); + type->setTypeName(query.value("typeName").toString()); + type->setDisplayName(query.value("typeDisplayName").toString()); + type->setTypePath(query.value("typePath").toString()); + DTypeColor color; + color.setColorID(query.value("typeColorID").toString()); + color.setColorCode(query.value("ColorHex").toString()); + color.setPrivilege(static_cast(query.value("colorPri").toInt())); + type->setTypeColor(color); + type->setDescription(query.value("description").toString()); + type->setPrivilege(static_cast(query.value("typePri").toInt())); + type->setSyncTag(query.value("syncTag").toInt()); + type->setDtCreate(dtFromString(query.value("dtCreate").toString())); + type->setDtUpdate(dtFromString(query.value("dtUpdate").toString())); + type->setDtDelete(dtFromString(query.value("dtDelete").toString())); + type->setShowState(static_cast(query.value("showState").toInt())); + type->setDeleted(query.value("isDeleted").toInt()); + systemTypeTran(type); + typeList.append(type); + } + } else { + qWarning() << "getScheduleTypeList error:" << query.lastError(); + } + } else { + qWarning() << "getScheduleTypeList error:" << query.lastError(); + } + + if (query.isActive()) { + query.finish(); + } + return typeList; +} + +bool DAccountDataBase::scheduleTypeByUsed(const QString &typeID, const int isDeleted) +{ + QString strSql("SELECT COUNT(scheduleTypeID) FROM schedules WHERE scheduleTypeID = ? AND isDeleted = ?;"); + SqliteQuery query(m_database); + int typeCount = 0; + if (query.prepare(strSql)) { + query.addBindValue(typeID); + query.addBindValue(isDeleted); + + if (query.exec() && query.next()) { + typeCount = query.value(0).toInt(); + } + } else { + qWarning() << query.lastError(); + } + + if (query.isActive()) { + query.finish(); + } + return typeCount; +} + +bool DAccountDataBase::deleteScheduleTypeByID(const QString &typeID, const int isDeleted) +{ + SqliteQuery query(m_database); + QString strSql; + if (isDeleted == 0) { + //弱删除 + QDateTime &&dtCurrent = QDateTime::currentDateTime(); + strSql = QString("UPDATE scheduleType SET dtDelete='%1', isDeleted=1 WHERE typeID=?;") + .arg(dtToString(dtCurrent)); + } else { + //真删除 + strSql = "DELETE FROM scheduleType WHERE typeID = ?"; + } + bool res = false; + if (query.prepare(strSql)) { + query.addBindValue(typeID); + res = query.exec(); + if (!res) { + qWarning() << "DELETE scheduleType error by typeID:" << typeID << " " << query.lastError(); + } + if (query.isActive()) { + query.finish(); + } + } else { + qWarning() << "DELETE scheduleType error by typeID:" << typeID << " " << query.lastError(); + } + + return res; +} + +bool DAccountDataBase::updateScheduleType(const DScheduleType::Ptr &scheduleType) +{ + bool res = false; + SqliteQuery query(m_database); + QString strSql("UPDATE scheduleType \ + SET typeName=?, typeDisplayName=?, typePath=?, typeColorID=?, description=?, \ + privilege=?, showState=?, dtUpdate=?, dtDelete=?, isDeleted=? \ + WHERE typeID = ?"); + if (query.prepare(strSql)) { + query.addBindValue(scheduleType->typeName()); + query.addBindValue(scheduleType->displayName()); + query.addBindValue(scheduleType->typePath()); + query.addBindValue(scheduleType->typeColor().colorID()); + query.addBindValue(scheduleType->description()); + query.addBindValue(int(scheduleType->privilege())); + query.addBindValue(scheduleType->showState()); + query.addBindValue(dtConvert(scheduleType->dtUpdate())); + query.addBindValue(dtConvert(scheduleType->dtDelete())); + query.addBindValue(scheduleType->deleted()); + query.addBindValue(scheduleType->typeID()); + if (query.exec()) { + res = true; + } else { + qWarning() << "updateScheduleType error:" << query.lastError(); + } + } else { + qWarning() << "updateScheduleType error:" << query.lastError(); + } + + if (query.isActive()) { + query.finish(); + } + return res; +} + +QString DAccountDataBase::getFestivalTypeID() +{ + QString strSql("SELECT typeID FROM scheduleType WHERE privilege = 0;"); + SqliteQuery query(m_database); + QString typeID(""); + if (query.prepare(strSql)) { + if (query.exec()) { + if (query.next()) { + typeID = query.value("typeID").toString(); + } + } else { + qWarning() << "updateScheduleType error:" << query.lastError(); + } + + } else { + qWarning() << "updateScheduleType error:" << query.lastError(); + } + if (query.isActive()) { + query.finish(); + } + + return typeID; +} + +void DAccountDataBase::getAccountInfo(const DAccount::Ptr &account) +{ + QString strSql("SELECT syncState,accountState, accountName, displayName, cloudPath, \ + accountType, syncFreq, intervalTime, syncTag, expandStatus, dtLastUpdate \ + FROM account WHERE id = 1;"); + SqliteQuery query(m_database); + if (query.prepare(strSql) && query.exec() && query.next()) { + account->setSyncState(static_cast(query.value("syncState").toInt())); + // accountState字段以accountmanager.db中accountManager字段为准,它会在登陆和切换状态时根据最新云同步状态去更新开关状态 +// account->setAccountState(static_cast(query.value("accountState").toInt())); + account->setAccountName(query.value("accountName").toString()); + account->setDisplayName(query.value("displayName").toString()); + account->setCloudPath(query.value("cloudPath").toString()); + account->setAccountType(static_cast(query.value("accountType").toInt())); + account->setSyncFreq(static_cast(query.value("syncFreq").toInt())); + account->setIntervalTime(query.value("intervalTime").toInt()); + account->setSyncTag(query.value("syncTag").toInt()); + account->setIsExpandDisplay(query.value("expandStatus").toBool()); + account->setDtLastSync(dtFromString(query.value("dtLastUpdate").toString())); + } else { + qWarning() << query.lastError(); + } + if (query.isActive()) { + query.finish(); + } +} + +void DAccountDataBase::updateAccountInfo() +{ + QString strSql("UPDATE account \ + SET syncState=?, accountState = ?,accountName=?, displayName=?, \ + cloudPath=?, accountType=?, syncFreq=?, intervalTime=?, syncTag=? \ + , expandStatus = ?, dtLastUpdate = ? WHERE id=1;"); + SqliteQuery query(m_database); + if (query.prepare(strSql)) { + query.addBindValue(m_account->syncState()); + query.addBindValue(int(m_account->accountState())); + query.addBindValue(m_account->accountName()); + query.addBindValue(m_account->displayName()); + query.addBindValue(m_account->cloudPath()); + query.addBindValue(m_account->accountType()); + query.addBindValue(m_account->syncFreq()); + query.addBindValue(m_account->intervalTime()); + query.addBindValue(m_account->syncTag()); + query.addBindValue(m_account->isExpandDisplay()); + query.addBindValue(dtToString(m_account->dtLastSync())); + if (!query.exec()) { + qWarning() << query.lastError(); + } + } else { + qWarning() << query.lastError(); + } + + if (query.isActive()) { + query.finish(); + } +} + +bool DAccountDataBase::addTypeColor(const DTypeColor::Ptr &typeColor) +{ + if (typeColor.isNull()) + return false; + return addTypeColor(*typeColor.data()); +} + +bool DAccountDataBase::addTypeColor(DTypeColor &typeColor) +{ + QString strSql("INSERT INTO TypeColor \ + (ColorID, ColorHex, privilege,dtCreate) \ + VALUES(:ColorID, :ColorHex, :privilege,:dtCreate)"); + + //如果为空则创建颜色id + if (typeColor.colorID().isEmpty()) { + typeColor.setColorID(createUuid()); + } + if (typeColor.dtCreate().isNull()) { + typeColor.setDtCreate(QDateTime::currentDateTime()); + } + SqliteQuery query(m_database); + bool res = false; + if (query.prepare(strSql)) { + query.bindValue(":ColorID", typeColor.colorID()); + query.bindValue(":ColorHex", typeColor.colorCode()); + query.bindValue(":privilege", typeColor.privilege()); + query.bindValue(":dtCreate", dtToString(typeColor.dtCreate())); + + if (query.exec()) { + res = true; + } else { + qWarning() << __FUNCTION__ << query.lastError(); + } + } else { + qWarning() << __FUNCTION__ << query.lastError(); + } + + if (query.isActive()) { + query.finish(); + } + return res; +} + +void DAccountDataBase::deleteTypeColor(const QString &colorNo) +{ + QString strSql("DELETE FROM typeColor WHERE ColorID = ?;"); + SqliteQuery query(m_database); + if (query.prepare(strSql)) { + query.addBindValue(colorNo); + if (!query.exec()) { + qWarning() << __FUNCTION__ << query.lastError(); + } + } else { + qWarning() << __FUNCTION__ << query.lastError(); + } + + if (query.isActive()) { + query.finish(); + } +} + +DTypeColor::List DAccountDataBase::getSysColor() +{ + QString strSql("SELECT ColorID, ColorHex, privilege,dtCreate FROM typeColor WHERE privilege =1;"); + SqliteQuery query(m_database); + DTypeColor::List typeColorList; + + if (query.prepare(strSql) && query.exec()) { + while (query.next()) { + DTypeColor::Ptr color = DTypeColor::Ptr(new DTypeColor); + color->setColorID(query.value("ColorID").toString()); + color->setColorCode(query.value("ColorHex").toString()); + color->setPrivilege(static_cast(query.value("privilege").toInt())); + color->setDtCreate(dtFromString(query.value("dtCreate").toString())); + typeColorList.append(color); + } + } else { + qWarning() << __FUNCTION__ << query.lastError(); + } + if (query.isActive()) { + query.finish(); + } + return typeColorList; +} + +void DAccountDataBase::createRemindInfo(const DRemindData::Ptr &remind) +{ + QString strSql("INSERT INTO remindTask \ + (alarmID, scheduleID, recurID,remindCount,notifyID \ + , dtRemind, dtStart, dtEnd) \ + VALUES(?,?,?,?,?,?,?,?);"); + SqliteQuery query(m_database); + if (query.prepare(strSql)) { + remind->setAlarmID(createUuid()); + query.addBindValue(remind->alarmID()); + query.addBindValue(remind->scheduleID()); + query.addBindValue(dtToString(remind->recurrenceId())); + query.addBindValue(remind->remindCount()); + query.addBindValue(remind->notifyid()); + query.addBindValue(dtToString(remind->dtRemind())); + query.addBindValue(dtToString(remind->dtStart())); + query.addBindValue(dtToString(remind->dtEnd())); + if (!query.exec()) { + qWarning() << Q_FUNC_INFO << query.lastError(); + } + } else { + qWarning() << Q_FUNC_INFO << query.lastError(); + } +} + +void DAccountDataBase::updateRemindInfo(const DRemindData::Ptr &remind) +{ + QString strSql("UPDATE remindTask \ + SET scheduleID=?, recurID=?, remindCount=?, \ + notifyID=?, dtRemind=?, dtStart=?, dtEnd=? WHERE alarmID = ?"); + + SqliteQuery query(m_database); + if (query.prepare(strSql)) { + query.addBindValue(remind->scheduleID()); + query.addBindValue(dtToString(remind->recurrenceId())); + query.addBindValue(remind->remindCount()); + query.addBindValue(remind->notifyid()); + query.addBindValue(dtToString(remind->dtRemind())); + query.addBindValue(dtToString(remind->dtStart())); + query.addBindValue(dtToString(remind->dtEnd())); + query.addBindValue(remind->alarmID()); + if (!query.exec()) { + qWarning() << Q_FUNC_INFO << query.lastError(); + } + } else { + qWarning() << Q_FUNC_INFO << query.lastError(); + } +} + +void DAccountDataBase::deleteRemindInfoByAlarmID(const QString &alarmID) +{ + QString strSql("DELETE FROM remindTask WHERE alarmID=?;"); + SqliteQuery query(m_database); + if (query.prepare(strSql)) { + query.addBindValue(alarmID); + if (!query.exec()) { + qWarning() << Q_FUNC_INFO << query.lastError(); + } + } else { + qWarning() << Q_FUNC_INFO << query.lastError(); + } + + if (query.isActive()) { + query.finish(); + } +} + +DRemindData::Ptr DAccountDataBase::getRemindData(const QString &alarmID) +{ + QString strSql("SELECT alarmID, scheduleID, recurID, remindCount, notifyID, dtRemind, dtStart, dtEnd \ + FROM remindTask WHERE alarmID = ? ;"); + SqliteQuery query(m_database); + DRemindData::Ptr remindData; + if (query.prepare(strSql)) { + query.addBindValue(alarmID); + + if (query.exec()) { + while (query.next()) { + remindData = DRemindData::Ptr(new DRemindData); + remindData->setAlarmID(query.value("alarmID").toString()); + remindData->setScheduleID(query.value("scheduleID").toString()); + remindData->setRemindCount(query.value("remindCount").toInt()); + remindData->setNotifyid(query.value("notifyID").toInt()); + remindData->setDtStart(dtFromString(query.value("dtStart").toString())); + remindData->setDtEnd(dtFromString(query.value("dtEnd").toString())); + remindData->setDtRemind(dtFromString(query.value("dtRemind").toString())); + remindData->setRecurrenceId(dtFromString(query.value("recurID").toString())); + } + } else { + qWarning() << Q_FUNC_INFO << query.lastError(); + } + } else { + qWarning() << Q_FUNC_INFO << query.lastError(); + } + + if (query.isActive()) { + query.finish(); + } + return remindData; +} + +DRemindData::List DAccountDataBase::getValidRemindJob() +{ + QString strSql("SELECT alarmID,scheduleID, recurID, remindCount, notifyID, dtRemind, dtStart, dtEnd \ + FROM remindTask WHERE dtRemind > ? ;"); + SqliteQuery query(m_database); + DRemindData::List remindList; + if (query.prepare(strSql)) { + query.addBindValue(dtToString(QDateTime::currentDateTime())); + + if (query.exec()) { + while (query.next()) { + DRemindData::Ptr remindData = DRemindData::Ptr(new DRemindData); + remindData->setAccountID(m_account->accountID()); + remindData->setAlarmID(query.value("alarmID").toString()); + remindData->setScheduleID(query.value("scheduleID").toString()); + remindData->setRemindCount(query.value("remindCount").toInt()); + remindData->setNotifyid(query.value("notifyID").toInt()); + remindData->setDtStart(dtFromString(query.value("dtStart").toString())); + remindData->setDtEnd(dtFromString(query.value("dtEnd").toString())); + remindData->setDtRemind(dtFromString(query.value("dtRemind").toString())); + remindData->setRecurrenceId(dtFromString(query.value("recurID").toString())); + remindList.append(remindData); + } + } else { + qWarning() << Q_FUNC_INFO << query.lastError(); + } + } else { + qWarning() << Q_FUNC_INFO << query.lastError(); + } + + if (query.isActive()) { + query.finish(); + } + return remindList; +} + +void DAccountDataBase::clearRemindJobDatabase() +{ + SqliteQuery query(m_database); + QString sql("delete from remindTask"); + if (query.exec(sql)) { + if (query.isActive()) { + query.finish(); + } + } else { + qWarning() << __FUNCTION__ << query.lastError(); + } +} + +DRemindData::List DAccountDataBase::getRemindByScheduleID(const QString &scheduleID) +{ + QString strSql("SELECT alarmID, scheduleID, recurID, remindCount, notifyID, dtRemind, dtStart, dtEnd \ + FROM remindTask WHERE scheduleID = ? ;"); + SqliteQuery query(m_database); + DRemindData::List remindList; + if (query.prepare(strSql)) { + query.addBindValue(scheduleID); + + if (query.exec()) { + while (query.next()) { + DRemindData::Ptr remindData = DRemindData::Ptr(new DRemindData); + remindData->setAlarmID(query.value("alarmID").toString()); + remindData->setScheduleID(query.value("scheduleID").toString()); + remindData->setRemindCount(query.value("remindCount").toInt()); + remindData->setNotifyid(query.value("notifyID").toInt()); + remindData->setDtStart(dtFromString(query.value("dtStart").toString())); + remindData->setDtEnd(dtFromString(query.value("dtEnd").toString())); + remindData->setDtRemind(dtFromString(query.value("dtRemind").toString())); + remindData->setRecurrenceId(dtFromString(query.value("recurID").toString())); + remindList.append(remindData); + } + } else { + qWarning() << Q_FUNC_INFO << query.lastError(); + } + } else { + qWarning() << Q_FUNC_INFO << query.lastError(); + } + + if (query.isActive()) { + query.finish(); + } + return remindList; +} + +void DAccountDataBase::addUploadTask(const DUploadTaskData::Ptr &uploadTask) +{ + QString strSql("INSERT INTO uploadTask \ + (taskID, uploadType, uploadObject, objectID, dtCreate) \ + VALUES(?, ?, ?, ?, ?);"); + SqliteQuery query(m_database); + if (query.prepare(strSql)) { + uploadTask->setTaskID(createUuid()); + query.addBindValue(uploadTask->taskID()); + query.addBindValue(uploadTask->taskType()); + query.addBindValue(uploadTask->taskObject()); + query.addBindValue(uploadTask->objectId()); + query.addBindValue(dtToString(QDateTime::currentDateTime())); + if (!query.exec()) { + qWarning() << Q_FUNC_INFO << query.lastError(); + } + } else { + qWarning() << Q_FUNC_INFO << query.lastError(); + } + + if (query.isActive()) { + query.finish(); + } +} + +DUploadTaskData::List DAccountDataBase::getUploadTask() +{ + DUploadTaskData::List uploadList; + QString strSql("SELECT taskID, uploadType, uploadObject, objectID, dtCreate \ + FROM uploadTask;"); + SqliteQuery query(m_database); + if (query.prepare(strSql) && query.exec()) { + while (query.next()) { + DUploadTaskData::Ptr upload = DUploadTaskData::Ptr(new DUploadTaskData); + upload->setTaskID(query.value("taskID").toString()); + upload->setTaskType(static_cast(query.value("uploadType").toInt())); + upload->setTaskObject(static_cast(query.value("uploadObject").toInt())); + upload->setObjectId(query.value("objectID").toString()); + upload->setDtCreate(dtFromString(query.value("dtCreate").toString())); + uploadList.append(upload); + } + } else { + qWarning() << Q_FUNC_INFO << query.lastError(); + } + if (query.isActive()) { + query.finish(); + } + return uploadList; +} + +void DAccountDataBase::deleteUploadTask(const QString &taskID) +{ + QString strSql("DELETE FROM uploadTask WHERE taskID = ?;"); + SqliteQuery query(m_database); + if (query.prepare(strSql)) { + query.addBindValue(taskID); + if (!query.exec()) { + qWarning() << Q_FUNC_INFO << query.lastError(); + } + } else { + qWarning() << Q_FUNC_INFO << query.lastError(); + } + + if (query.isActive()) { + query.finish(); + } +} + +void DAccountDataBase::createDB() +{ + dbOpen(); + //这里用QFile来修改日历数据库文件的权限 + QFile file; + file.setFileName(getDBPath()); + //如果不存在该文件则创建 + if (!file.exists() && m_database.open()) { + m_database.close(); + } + //将权限修改为600(对文件的所有者可以读写,其他用户不可读不可写) + if (!file.setPermissions(QFile::WriteOwner | QFile::ReadOwner)) { + qWarning() << "permissions cannot be modified,error:" << file.errorString(); + } + if (m_database.open()) { + SqliteQuery query(m_database); + bool res = true; + //帐户信息表 + res = query.exec(sql_create_account); + if (!res) { + qWarning() << "account create failed.error:" << query.lastError(); + } + + //日程表 + res = query.exec(sql_create_schedules); + if (!res) { + qWarning() << "schedules create failed.error:" << query.lastError(); + } + + //类型表 + res = query.exec(sql_create_scheduleType); + if (!res) { + qWarning() << "scheduleType create failed.error:" << query.lastError(); + } + + //颜色表 + res = query.exec(sql_create_typeColor); + if (!res) { + qWarning() << "typeColorSql create failed.error:" << query.lastError(); + } + + //创建上传任务表 + res = query.exec(sql_create_uploadTask); + if (!res) { + qWarning() << "uploadTask create failed.error:" << query.lastError(); + } + + //创建提醒任务表 + res = query.exec(sql_create_remindTask); + if (!res) { + qWarning() << "remindTask create failed.error:" << query.lastError(); + } + + if (query.isActive()) { + query.finish(); + } + } +} + +void DAccountDataBase::initScheduleDB() +{ + //创建数据库时,需要初始化的日程数据 +} + +void DAccountDataBase::initScheduleType() +{ + //创建数据库时,需要初始化的类型数据 + initSysType(); +} + +void DAccountDataBase::initSysType() +{ + //如果为本地帐户则初始化本地日程类型数据 + if (m_account->accountType() == DAccount::Account_Local) { + QDateTime currentTime = QDateTime::currentDateTime(); + //添加节假日日程类型,不会展示在类型列表中 + DScheduleType::Ptr scheduleType(new DScheduleType); + scheduleType->setTypeID(createUuid()); + scheduleType->setDtCreate(currentTime.addDays(-3)); + scheduleType->setPrivilege(DScheduleType::None); + scheduleType->setTypeName("festival"); + scheduleType->setDisplayName("Holiday schedule type"); + scheduleType->setColorID(GFestivalColorID); + scheduleType->setColorCode("#FF9436"); + scheduleType->setShowState(DScheduleType::Show); + createScheduleType(scheduleType); + + //工作类型 + DScheduleType::Ptr workType(new DScheduleType(m_account->accountID())); + workType->setTypeID("107c369e-b13a-4d45-9ff3-de4eb3c0475b"); + workType->setDtCreate(currentTime.addDays(-2)); + workType->setPrivilege(DScheduleType::Read); + workType->setTypeName("Work"); + workType->setDisplayName("Work"); + DTypeColor workColor; + workColor.setColorID(GWorkColorID); + workColor.setColorCode("#ff5e97"); + workColor.setPrivilege(DTypeColor::PriSystem); + workType->setTypeColor(workColor); + workType->setShowState(DScheduleType::Show); + createScheduleType(workType); + + //生活 + DScheduleType::Ptr lifeType(new DScheduleType(m_account->accountID())); + lifeType->setTypeID("24cf3ae3-541d-487f-83df-f068416b56b6"); + lifeType->setDtCreate(currentTime.addDays(-1)); + lifeType->setPrivilege(DScheduleType::Read); + lifeType->setTypeName("Life"); + lifeType->setDisplayName("Life"); + DTypeColor lifeColor; + lifeColor.setColorID(GLifeColorID); + lifeColor.setColorCode("#5d51ff"); + lifeColor.setPrivilege(DTypeColor::PriSystem); + lifeType->setTypeColor(lifeColor); + lifeType->setShowState(DScheduleType::Show); + createScheduleType(lifeType); + + //其他 + DScheduleType::Ptr otherType(new DScheduleType(m_account->accountID())); + otherType->setTypeID("403bf009-2005-4679-9c76-e73d9f83a8b4"); + otherType->setDtCreate(currentTime); + otherType->setPrivilege(DScheduleType::Read); + otherType->setTypeName("Other"); + otherType->setDisplayName("Other"); + DTypeColor otherColor; + otherColor.setColorID(GOtherColorID); + otherColor.setColorCode("#5bdd80"); + otherColor.setPrivilege(DTypeColor::PriSystem); + otherType->setTypeColor(otherColor); + otherType->setShowState(DScheduleType::Show); + createScheduleType(otherType); + } +} + +void DAccountDataBase::systemTypeTran(const DScheduleType::Ptr &type) +{ + //如果为本地帐户且类型为默认类型 + if ((m_account->accountType() == DAccount::Account_Local || m_account->accountType() == DAccount::Account_UnionID) && type->privilege() == DScheduleType::Privilege::Read) { + if (type->typeName() == "Work") { + type->setDisplayName(tr("Work")); + } else if (type->typeName() == "Life") { + type->setDisplayName(tr("Life")); + } else if (type->typeName() == "Other") { + type->setDisplayName(tr("Other")); + } + } +} + +void DAccountDataBase::initTypeColor() +{ + QDateTime currentTime = QDateTime::currentDateTime(); + int index = -10; + + QMap::const_iterator iter = GTypeColor.constBegin(); + for (; iter != GTypeColor.constEnd(); ++iter) { + DTypeColor::Ptr typeColor(new DTypeColor); + typeColor->setDtCreate(currentTime.addDays(++index)); + typeColor->setPrivilege(DTypeColor::PriSystem); + typeColor->setColorCode(iter.value()); + typeColor->setColorID(iter.key()); + addTypeColor(typeColor); + } +} + +void DAccountDataBase::initAccountDB() +{ + QString strSql("INSERT \ + INTO \ + account \ + (syncState,accountState,accountName, \ + displayName,cloudPath,accountType, \ + syncFreq,intervalTime,syncTag, expandStatus) \ + VALUES(?,?,?,?,?,?,?,?,?,?);"); + SqliteQuery query(m_database); + if (query.prepare(strSql)) { + query.addBindValue(m_account->syncState()); + query.addBindValue(int(m_account->accountState())); + query.addBindValue(m_account->accountName()); + query.addBindValue(m_account->displayName()); + query.addBindValue(m_account->cloudPath()); + query.addBindValue(m_account->accountType()); + query.addBindValue(m_account->syncFreq()); + query.addBindValue(m_account->intervalTime()); + query.addBindValue(m_account->syncTag()); + query.addBindValue(m_account->isExpandDisplay()); + if (!query.exec()) { + qWarning() << "initAccountDB error:" << query.lastError(); + } + } else { + qWarning() << "initAccountDB error:" << query.lastError(); + } + + if (query.isActive()) { + query.finish(); + } +} diff -Nru dde-calendar-5.9.1/calendar-service/src/dbmanager/daccountdatabase.h dde-calendar-5.10.0/calendar-service/src/dbmanager/daccountdatabase.h --- dde-calendar-5.9.1/calendar-service/src/dbmanager/daccountdatabase.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/dbmanager/daccountdatabase.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,128 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef DACCOUNTDATABASE_H +#define DACCOUNTDATABASE_H + +#include "ddatabase.h" +#include "daccount.h" +#include "dschedule.h" +#include "dscheduletype.h" +#include "dreminddata.h" +#include "duploadtaskdata.h" +#include "dtypecolor.h" + +#include + +class DAccountDataBase : public DDataBase +{ + Q_OBJECT +public: + typedef QSharedPointer Ptr; + + explicit DAccountDataBase(const DAccount::Ptr &account, QObject *parent = nullptr); + //初始化数据库数据,会创建数据库文件和相关数据表 + void initDBData() override; + ///////////////日程信息 + //创建日程 + QString createSchedule(const DSchedule::Ptr &schedule); + bool updateSchedule(const DSchedule::Ptr &schedule); + //根据日程id获取日程信息 + DSchedule::Ptr getScheduleByScheduleID(const QString &scheduleID); + + //根据日程类型ID获取日程id列表 + QStringList getScheduleIDListByTypeID(const QString &typeID); + bool deleteScheduleByScheduleID(const QString &scheduleID, const int isDeleted = 0); + bool deleteSchedulesByScheduleTypeID(const QString &typeID, const int isDeleted = 0); + //根据关键字查询一定范围内的日程 + DSchedule::List querySchedulesByKey(const QString &key); + //根据重复规则查询一定范围内的日程 + DSchedule::List querySchedulesByRRule(const QString &key, const int &rruleType); + //获取需要提醒的日程信息 + DSchedule::List getRemindSchedule(); + + ///////////////类型信息 + /** + * @brief createScheduleType 创建日程类型 + * @param typeInfo + * @return + */ + QString createScheduleType(const DScheduleType::Ptr &scheduleType); + virtual DScheduleType::Ptr getScheduleTypeByID(const QString &typeID, const int isDeleted = 0); + virtual DScheduleType::List getScheduleTypeList(const int isDeleted = 0); + bool scheduleTypeByUsed(const QString &typeID, const int isDeleted = 0); + bool deleteScheduleTypeByID(const QString &typeID, const int isDeleted = 0); + bool updateScheduleType(const DScheduleType::Ptr &scheduleType); + + //获取节假日类型ID + QString getFestivalTypeID(); + ///////////////帐户信息 + void getAccountInfo(const DAccount::Ptr &account); + void updateAccountInfo(); + + ///////////////////类型颜色 + bool addTypeColor(const DTypeColor::Ptr &typeColor); + bool addTypeColor(DTypeColor &typeColor); + void deleteTypeColor(const QString &colorNo); + //获取内置类型颜色 + DTypeColor::List getSysColor(); + + ////////////////////任务 + /** + * @brief createRemindInfo 存储提醒日程的相关信息 + * @param remind + */ + void createRemindInfo(const DRemindData::Ptr &remind); + + /** + * @brief updateRemindJob 更新对应的稍后提醒日程 + * @param job 日程信息 + */ + void updateRemindInfo(const DRemindData::Ptr &remind); + + void deleteRemindInfoByAlarmID(const QString &alarmID); + + DRemindData::Ptr getRemindData(const QString &alarmID); + + /** + * @brief getValidRemindJob 获取未提醒的稍后提醒日程 + * @return + */ + DRemindData::List getValidRemindJob(); + /** + * @brief clearRemindJobDatabase 清空稍后提醒表 + */ + void clearRemindJobDatabase(); + + DRemindData::List getRemindByScheduleID(const QString &scheduleID); + + /** + * @brief deleteRemindJobs 根据日程id删除提醒日程信息 + * @param Ids 日程id集 + */ + void deleteRemindInfos(const QStringList &jobIDs); + + //添加上传任务 + void addUploadTask(const DUploadTaskData::Ptr &uploadTask); + DUploadTaskData::List getUploadTask(); + void deleteUploadTask(const QString &taskID); + +protected: + virtual void initScheduleType(); + //初始化系统类型 + virtual void initSysType(); + void systemTypeTran(const DScheduleType::Ptr &type); + +protected: + void createDB() override; + //初始化日程数据库 + void initScheduleDB(); + void initTypeColor(); + void initAccountDB(); + +protected: + DAccount::Ptr m_account; +}; + +#endif // DACCOUNTDATABASE_H diff -Nru dde-calendar-5.9.1/calendar-service/src/dbmanager/daccountmanagerdatabase.cpp dde-calendar-5.10.0/calendar-service/src/dbmanager/daccountmanagerdatabase.cpp --- dde-calendar-5.9.1/calendar-service/src/dbmanager/daccountmanagerdatabase.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/dbmanager/daccountmanagerdatabase.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,327 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "daccountmanagerdatabase.h" + +#include "units.h" + +#include +#include +#include +#include + +DAccountManagerDataBase::DAccountManagerDataBase(QObject *parent) + : DDataBase(parent) +{ + setConnectionName(NameAccountManager); +} + +void DAccountManagerDataBase::initDBData() +{ + createDB(); + initAccountManagerDB(); +} + +DAccount::List DAccountManagerDataBase::getAccountList() +{ + DAccount::List accountList; + QString strSql("SELECT accountID,accountName, displayName, accountState, accountAvatar, \ + accountDescription, accountType, dbName,dBusPath,dBusInterface, dtCreate, expandStatus, dtDelete, dtUpdate, isDeleted \ + FROM accountManager"); + SqliteQuery query(m_database); + if (query.prepare(strSql) && query.exec()) { + while (query.next()) { + DAccount::Type type = static_cast(query.value("accountType").toInt()); + DAccount::Ptr account(new DAccount(type)); + account->setAccountID(query.value("accountID").toString()); + account->setAccountName(query.value("accountName").toString()); + account->setDisplayName(query.value("displayName").toString()); + account->setAccountState(static_cast(query.value("accountState").toInt())); + account->setAvatar(query.value("accountAvatar").toString()); + account->setDescription(query.value("accountDescription").toString()); + account->setDbName(query.value("dbName").toString()); + account->setDbusPath(query.value("dBusPath").toString()); + account->setDbusInterface(query.value("dBusInterface").toString()); + account->setIsExpandDisplay(query.value("expandStatus").toBool()); + account->setDtCreate(QDateTime::fromString(query.value("dtCreate").toString(), Qt::ISODate)); + accountList.append(account); + } + } else { + qWarning() << "getAccountList error:" << query.lastError(); + } + return accountList; +} + +DAccount::Ptr DAccountManagerDataBase::getAccountByID(const QString &accountID) +{ + QString strSql("SELECT accountName, displayName, accountState, accountAvatar, \ + accountDescription, accountType, dbName,dBusPath,dBusInterface, dtCreate, dtDelete, dtUpdate, expandStatus, isDeleted \ + FROM accountManager WHERE accountID = ?"); + SqliteQuery query(m_database); + if (query.prepare(strSql)) { + query.addBindValue(accountID); + if (query.exec() && query.next()) { + DAccount::Type type = static_cast(query.value("accountType").toInt()); + DAccount::Ptr account(new DAccount(type)); + account->setAccountID(accountID); + account->setAccountName(query.value("accountName").toString()); + account->setDisplayName(query.value("displayName").toString()); + account->setAccountState(static_cast(query.value("accountState").toInt())); + account->setAvatar(query.value("accountAvatar").toString()); + account->setDescription(query.value("accountDescription").toString()); + account->setDbName(query.value("dbName").toString()); + account->setDbusPath(query.value("dBusPath").toString()); + account->setDbusInterface(query.value("dBusInterface").toString()); + account->setIsExpandDisplay(query.value("expandStatus").toBool()); + account->setDtCreate(QDateTime::fromString(query.value("dtCreate").toString(), Qt::ISODate)); + return account; + } else { + qWarning() << "getAccountByID error:" << query.lastError(); + } + } else { + qWarning() << "getAccountByID error:" << query.lastError(); + } + + return nullptr; +} + +QString DAccountManagerDataBase::addAccountInfo(const DAccount::Ptr &accountInfo) +{ + SqliteQuery query(m_database); + //生成唯一标识 + if (accountInfo->accountID().isEmpty()) { + accountInfo->setAccountID(DDataBase::createUuid()); + } + QString strSql("INSERT INTO accountManager \ + (accountID, accountName, displayName, accountState, accountAvatar, \ + accountDescription, accountType, dbName,dBusPath,dBusInterface, dtCreate, \ + expandStatus, isDeleted) \ + VALUES(?,?, ?, ?,?,?,?,?,?,?,?,?,?)"); + if (query.prepare(strSql)) { + query.addBindValue(accountInfo->accountID()); + query.addBindValue(accountInfo->accountName()); + query.addBindValue(accountInfo->displayName()); + query.addBindValue(int(accountInfo->accountState())); + query.addBindValue(accountInfo->avatar()); + query.addBindValue(accountInfo->description()); + query.addBindValue(accountInfo->accountType()); + query.addBindValue(accountInfo->dbName()); + query.addBindValue(accountInfo->dbusPath()); + query.addBindValue(accountInfo->dbusInterface()); + query.addBindValue(dtToString(accountInfo->dtCreate())); + query.addBindValue(accountInfo->isExpandDisplay()); + query.addBindValue(0); + if (!query.exec()) { + qWarning() << "addAccountInfo error:" << query.lastError(); + accountInfo->setAccountID(""); + } + } else { + qWarning() << "addAccountInfo error:" << query.lastError(); + accountInfo->setAccountID(""); + } + + return accountInfo->accountID(); +} + +bool DAccountManagerDataBase::updateAccountInfo(const DAccount::Ptr &accountInfo) +{ + QString strSql("UPDATE accountManager \ + SET accountName=?, displayName=?, accountState= ?, \ + accountAvatar=?, accountDescription=?, accountType=?, dbName=?, \ + dBusPath = ? ,dBusInterface = ?, expandStatus = ? WHERE accountID=?"); + SqliteQuery query(m_database); + bool res = false; + if (query.prepare(strSql)) { + query.addBindValue(accountInfo->accountName()); + query.addBindValue(accountInfo->displayName()); + query.addBindValue(int(accountInfo->accountState())); + query.addBindValue(accountInfo->avatar()); + query.addBindValue(accountInfo->description()); + query.addBindValue(accountInfo->accountType()); + query.addBindValue(accountInfo->dbName()); + query.addBindValue(accountInfo->dbusPath()); + query.addBindValue(accountInfo->dbusInterface()); + query.addBindValue(accountInfo->isExpandDisplay()); + query.addBindValue(accountInfo->accountID()); + res = query.exec(); + } + if (!res) { + qWarning() << "updateAccountInfo error:" << query.lastError(); + } + + return res; +} + +bool DAccountManagerDataBase::deleteAccountInfo(const QString &accountID) +{ + QString strSql("DELETE FROM accountManager \ + WHERE accountID=?"); + SqliteQuery query(m_database); + bool res = false; + if (query.prepare(strSql)) { + query.addBindValue(accountID); + res = query.exec(); + } + + if (!res) { + qWarning() << "deleteAccountInfo error:" << query.lastError(); + } + return res; +} + +DCalendarGeneralSettings::Ptr DAccountManagerDataBase::getCalendarGeneralSettings() +{ + DCalendarGeneralSettings::Ptr cgSet(new DCalendarGeneralSettings); + SqliteQuery query(m_database); + query.exec("select vch_value from calendargeneralsettings where vch_key = 'firstDayOfWeek' "); + if (query.next()) + cgSet->setFirstDayOfWeek(static_cast(query.value(0).toInt())); + + query.exec("select vch_value from calendargeneralsettings where vch_key = 'timeShowType' "); + if (query.next()) + cgSet->setTimeShowType(static_cast(query.value(0).toInt())); + + return cgSet; +} + +void DAccountManagerDataBase::setCalendarGeneralSettings(const DCalendarGeneralSettings::Ptr &cgSet) +{ + SqliteQuery query(m_database); + query.prepare("update calendargeneralsettings set vch_value = ? where vch_key = 'firstDayOfWeek' "); + query.addBindValue(cgSet->firstDayOfWeek()); + if (!query.exec()) { + qWarning() << "UPDATE calendargeneralsettings error," << query.lastError(); + } + + query.prepare("update calendargeneralsettings set vch_value = ? where vch_key = 'timeShowType' "); + query.addBindValue(cgSet->timeShowType()); + if (!query.exec()) { + qWarning() << "UPDATE calendargeneralsettings error," << query.lastError(); + } +} + +void DAccountManagerDataBase::createDB() +{ + dbOpen(); + //这里用QFile来修改日历数据库文件的权限 + QFile file; + file.setFileName(getDBPath()); + //如果不存在该文件则创建 + if (!file.exists()) { + m_database.open(); + m_database.close(); + } + //将权限修改为600(对文件的所有者可以读写,其他用户不可读不可写) + if (!file.setPermissions(QFile::WriteOwner | QFile::ReadOwner)) { + qWarning() << "permissions cannot be modified,error:" << file.errorString(); + } + + if (m_database.open()) { + SqliteQuery query(m_database); + bool res = true; + //创建帐户管理表 + res = query.exec(sql_create_accountManager); + if (!res) { + qWarning() << "accountManager create failed.error:" << query.lastError(); + } + + + //日历通用设置 + res = query.exec(sql_create_calendargeneralsettings); + if (!res) { + qWarning() << "uploadTask create failed.error:" << query.lastError(); + } + + //创建calendargeneralsettings的触发器,数据有变动时,更新dt_update + query.exec("SELECT name FROM sqlite_master WHERE type = 'trigger' and name = 'trigger_sync_calendargeneralsettings_datetime_when_insert'"); + if (!query.next()) { + query.exec("CREATE TRIGGER trigger_sync_calendargeneralsettings_datetime_when_insert AFTER INSERT " + "ON calendargeneralsettings " + "BEGIN " + " replace into calendargeneralsettings (vch_key, vch_value) values('dt_update', datetime(CURRENT_TIMESTAMP,'localtime')); " + "END;"); + } + query.exec("SELECT name FROM sqlite_master WHERE type = 'trigger' and name = 'trigger_sync_calendargeneralsettings_datetime_when_update'"); + if (!query.next()) { + query.exec("CREATE TRIGGER trigger_sync_calendargeneralsettings_datetime_when_update AFTER UPDATE " + "ON calendargeneralsettings " + "BEGIN " + " replace into calendargeneralsettings (vch_key, vch_value) values('dt_update', datetime(CURRENT_TIMESTAMP,'localtime')); " + "END;"); + } + query.exec("SELECT name FROM sqlite_master WHERE type = 'trigger' and name = 'trigger_sync_calendargeneralsettings_datetime_when_delete'"); + if (!query.next()) { + query.exec("CREATE TRIGGER trigger_sync_calendargeneralsettings_datetime_when_delete AFTER DELETE " + "ON calendargeneralsettings " + "BEGIN " + " replace into calendargeneralsettings (vch_key, vch_value) values('dt_update', datetime(CURRENT_TIMESTAMP,'localtime')); " + "END;"); + } + if (query.isActive()) { + query.finish(); + } + } +} + +void DAccountManagerDataBase::initAccountManagerDB() +{ + QDateTime currentDateTime = QDateTime::currentDateTime(); + currentDateTime.setOffsetFromUtc(currentDateTime.offsetFromUtc()); + m_database = QSqlDatabase::database(NameAccountManager); + m_database.setDatabaseName(getDBPath()); + //帐户管理表 + { + SqliteQuery query(m_database); + QString strsql("INSERT INTO accountManager \ + (accountID, accountName, displayName, \ + accountState, accountAvatar, accountDescription, \ + accountType, dbName,dBusPath,dBusInterface,dtCreate, dtUpdate, \ + expandStatus, isDeleted) \ + VALUES(:accountID,:accountName,:displayName,:accountState,:accountAvatar, \ + :accountDescription,:accountType,:dbName,:dBusPath,:dBusInterface,:dtCreate,:dtUpdate, \ + :expandStatus, :isDeleted);"); + if (query.prepare(strsql)) { + query.bindValue(":accountID", DDataBase::createUuid()); + query.bindValue(":accountName", "localAccount"); + query.bindValue(":displayName", "localAccount"); + query.bindValue(":accountState", 0); + query.bindValue(":accountAvatar", ""); + query.bindValue(":accountDescription", ""); + query.bindValue(":accountType", 0); + query.bindValue(":dbName", m_loaclDB); + query.bindValue(":dBusPath", serviceBasePath + "/account_local"); + query.bindValue(":dBusInterface", accountServiceInterface); + query.bindValue(":dtCreate", dtToString(currentDateTime)); + query.bindValue(":expandStatus", 1); + query.bindValue(":isDeleted", 0); + + if (query.exec()) { + if (query.isActive()) { + query.finish(); + } + } else { + qWarning() << __FUNCTION__ << query.lastError(); + } + } else { + qWarning() << __FUNCTION__ << query.lastError(); + } + } + + //通用设置 + { + SqliteQuery query(m_database); + if (query.exec("insert into calendargeneralsettings values" + "('firstDayOfWeek', '7')," + "('timeShowType', '0')")) { + m_database.commit(); + } else { + qWarning() << __FUNCTION__ << query.lastError(); + } + } +} + +void DAccountManagerDataBase::setLoaclDB(const QString &loaclDB) +{ + m_loaclDB = loaclDB; +} diff -Nru dde-calendar-5.9.1/calendar-service/src/dbmanager/daccountmanagerdatabase.h dde-calendar-5.10.0/calendar-service/src/dbmanager/daccountmanagerdatabase.h --- dde-calendar-5.9.1/calendar-service/src/dbmanager/daccountmanagerdatabase.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/dbmanager/daccountmanagerdatabase.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,57 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef DACCOUNTMANAGERDATABASE_H +#define DACCOUNTMANAGERDATABASE_H + +#include "daccount.h" +#include "dschedule.h" +#include "ddatabase.h" +#include "dcalendargeneralsettings.h" + +#include +#include + +class DAccountManagerDataBase : public DDataBase +{ + Q_OBJECT +public: + typedef QSharedPointer Ptr; + + explicit DAccountManagerDataBase(QObject *parent = nullptr); + + //初始化数据库数据,只有在创建表的时候才需要 + void initDBData() override; + + ///////////////帐户 + //获取所有帐户信息 + DAccount::List getAccountList(); + + //根据帐户id获取帐户信息 + DAccount::Ptr getAccountByID(const QString &accountID); + //添加帐户信息 + QString addAccountInfo(const DAccount::Ptr &accountInfo); + //更新帐户信息 + bool updateAccountInfo(const DAccount::Ptr &accountInfo); + //根据帐户id删除对应帐户 + bool deleteAccountInfo(const QString &accountID); + + ///////////////通用设置 + + DCalendarGeneralSettings::Ptr getCalendarGeneralSettings(); + void setCalendarGeneralSettings(const DCalendarGeneralSettings::Ptr &cgSet); + + + void setLoaclDB(const QString &loaclDB); + +protected: + //创建数据库 + void createDB() override; + void initAccountManagerDB(); + +private: + QString m_loaclDB; +}; + +#endif // DACCOUNTMANAGERDATABASE_H diff -Nru dde-calendar-5.9.1/calendar-service/src/dbmanager/ddatabase.cpp dde-calendar-5.10.0/calendar-service/src/dbmanager/ddatabase.cpp --- dde-calendar-5.9.1/calendar-service/src/dbmanager/ddatabase.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/dbmanager/ddatabase.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,303 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "ddatabase.h" + +#include +#include +#include +#include + +static QMap DbpathMutexMap;//记录所有用到的数据库文件锁 +static QMutex DbpathMutexMapMutex; //DbpathMutexMap的锁 + +/** + * @brief getDbMutexRef 根据dbpath获取数据库文件锁的引用 + */ +SqliteMutex &getDbMutexRef(const QString &dbpath) +{ + QMutexLocker locker(&DbpathMutexMapMutex); + + if (!DbpathMutexMap.contains(dbpath)) { + DbpathMutexMap.insert(dbpath, SqliteMutex()); + } + return DbpathMutexMap[dbpath]; +} + + +const QString DDataBase::NameAccountManager = "AccountManager"; +const QString DDataBase::NameSync = "SyncManager"; + +const QString DDataBase::sql_create_account = + " CREATE TABLE if not exists account( " + " id integer not null primary key, " + " syncState integer not null , " + " accountState integer not null, " + " accountName text not null, " + " displayName text not null, " + " cloudPath text , " + " accountType integer not null, " + " syncFreq integer not null, " + " intervalTime integer, " + " syncTag integer, " + " expandStatus integer, " + " dtLastUpdate DATETIME " + " )"; + +//日程表 +const QString DDataBase::sql_create_schedules = + " CREATE TABLE if not exists schedules (" + " scheduleID TEXT not null primary key, " + " scheduleTypeID TEXT not null, " + " summary TEXT not null, " + " description TEXT, " + " allDay BOOL not null, " + " dtStart DATETIME not null, " + " dtEnd DATETIME not null, " + " isAlarm INTEGER , " + " titlePinyin TEXT, " + " isLunar INTEGER not null, " + " ics TEXT not null, " + " fileName TEXT, " + " dtCreate DATETIME not null, " + " dtUpdate DATETIME , " + " dtDelete DATETIME, " + " isDeleted INTEGER not null)"; + +//类型表 +const QString DDataBase::sql_create_scheduleType = + " CREATE TABLE if not exists scheduleType ( " + " typeID TEXT not null PRIMARY KEY, " + " typeName TEXT not null, " + " typeDisplayName TEXT, " + " typePath TEXT, " + " typeColorID TEXT not null, " + " description TEXT , " + " privilege INTEGER not null, " + " showState INTEGER not null, " + " syncTag INTEGER, " + " dtCreate DATETIME not null, " + " dtUpdate DATETIME, " + " dtDelete DATETIME, " + " isDeleted INTEGER not null)"; +//颜色表 +const QString DDataBase::sql_create_typeColor = + " CREATE TABLE if not exists typeColor ( " + " ColorID TEXT not null PRIMARY KEY, " + " ColorHex TEXT not null, " + " privilege INTEGER not null," + " dtCreate DATETIME not null)"; + +//创建上传任务表 +const QString DDataBase::sql_create_uploadTask = + " CREATE TABLE if not exists uploadTask ( " + " taskID TEXT NOT NULL PRIMARY KEY, " + " uploadType integer NOT NULL, " + " uploadObject integer NOT NULL, " + " objectID TEXT NOT NULL, " + " dtCreate DATETIME NOT NULL)"; + +//创建提醒任务表 +const QString DDataBase::sql_create_remindTask = + " CREATE TABLE if not exists remindTask ( " + " alarmID TEXT NOT NULL PRIMARY KEY, " + " scheduleID TEXT NOT NULL, " + " recurID DATETIME , " + " remindCount INTEGER, " + " notifyID INTEGER , " + " dtRemind DATETIME NOT NULL, " + " dtStart DATETIME NOT NULL, " + " dtEnd DATETIME NOT NULL)"; + +//创建帐户管理表 +const QString DDataBase::sql_create_accountManager = + " CREATE TABLE if not exists accountManager ( " + " accountID TEXT NOT NULL PRIMARY KEY, " + " accountName TEXT NOT NULL, " + " displayName TEXT NOT NULL, " + " accountState INTEGER not null, " + " accountAvatar TEXT, " + " accountDescription TEXT , " + " accountType INTEGER not null, " + " dbName TEXT not null, " + " dBusPath TEXT not null, " + " dBusInterface TEXT not null, " + " dtCreate DATETIME not null, " + " dtDelete DATETIME, " + " dtUpdate DATETIME, " + " expandStatus integer, " + " isDeleted INTEGER not null)"; + +//日历通用设置 +const QString DDataBase::sql_create_calendargeneralsettings = + " CREATE TABLE if not exists calendargeneralsettings( " + " vch_key TEXT NOT NULL PRIMARY KEY, " + " vch_value TEXT NOT NULL " + " )"; + +const QString DDataBase::GWorkColorID = "0cecca8a-291b-46e2-bb92-63a527b77d46"; +const QString DDataBase::GLifeColorID = "6cfd1459-1085-47e9-8ca6-379d47ec319a"; +const QString DDataBase::GOtherColorID = "35e70047-98bb-49b9-8ad8-02d1c942f5d0"; +const QString DDataBase::GFestivalColorID = "10af78a1-3c25-4744-91db-6fbe5e88083b"; + +DDataBase::DDataBase(QObject *parent) + : QObject(parent) + , m_DBPath("") + , m_connectionName("") +{ +} + +DDataBase::~DDataBase() +{ +} + +QString DDataBase::getDBPath() const +{ + return m_DBPath; +} + +void DDataBase::setDBPath(const QString &DBPath) +{ + m_DBPath = DBPath; +} + +QString DDataBase::createUuid() +{ + return QUuid::createUuid().toString(QUuid::WithoutBraces); +} + +QString DDataBase::getConnectionName() const +{ + return m_connectionName; +} + +void DDataBase::setConnectionName(const QString &connectionName) +{ + m_connectionName = connectionName; +} + +void DDataBase::initDBData() +{ + createDB(); +} + +void DDataBase::dbOpen() +{ + QStringList cntNames = QSqlDatabase::connectionNames(); + if (cntNames.contains(getConnectionName())) { + m_database = QSqlDatabase::database(getConnectionName()); + //如果数据库不一致则设置新的数据库 + if (m_database.databaseName() != getDBPath()) { + m_database.setDatabaseName(getDBPath()); + } + } else { + m_database = QSqlDatabase::addDatabase("QSQLITE", getConnectionName()); + m_database.setDatabaseName(getDBPath()); + m_database.open(); + } +} + +bool DDataBase::dbFileExists() +{ + QFile file; + file.setFileName(getDBPath()); + return file.exists(); +} + +void DDataBase::removeDB() +{ + QFile::remove(getDBPath()); +} + +void SqliteMutex::lock() +{ + if (transactionLocked && transactionThreadId == qint64(QThread::currentThreadId())) { + return; + } + m.lock(); +} + +void SqliteMutex::unlock() +{ + if (transactionLocked && transactionThreadId == qint64(QThread::currentThreadId())) { + return; + } + m.unlock(); +} + +void SqliteMutex::transactionLock() +{ + m.lock(); + transactionLocked = true; + transactionThreadId = qint64(QThread::currentThreadId()); +} + +void SqliteMutex::transactionUnlock() +{ + transactionLocked = false; + transactionThreadId = 0; + m.unlock(); +} + +SqliteQuery::SqliteQuery(QSqlDatabase db) + : QSqlQuery(db) + , _db(db) +{ +} + +SqliteQuery::SqliteQuery(const QString &connectionName) + : SqliteQuery(QSqlDatabase::database(connectionName)) +{ +} + +SqliteQuery::SqliteQuery(const QString &query, QSqlDatabase db) + : QSqlQuery(query, db) + , _db(db) +{ +} + +bool SqliteQuery::exec(QString sql) +{ + getDbMutexRef(_db.databaseName()).lock(); + bool f = QSqlQuery::exec(sql); + getDbMutexRef(_db.databaseName()).unlock(); + return f; +} + +bool SqliteQuery::exec() +{ + getDbMutexRef(_db.databaseName()).lock(); + bool f = QSqlQuery::exec(); + getDbMutexRef(_db.databaseName()).unlock(); + return f; +} + +void SqliteQuery::transaction() +{ + getDbMutexRef(_db.databaseName()).transactionLock(); + _db.transaction(); +} + +void SqliteQuery::commit() +{ + _db.commit(); + getDbMutexRef(_db.databaseName()).transactionUnlock(); +} + +void SqliteQuery::rollback() +{ + _db.rollback(); + getDbMutexRef(_db.databaseName()).transactionUnlock(); +} + + +void SqliteMutex::UnCopyMutex::lock() +{ + m.lock(); +} + +void SqliteMutex::UnCopyMutex::unlock() +{ + m.unlock(); +} diff -Nru dde-calendar-5.9.1/calendar-service/src/dbmanager/ddatabase.h dde-calendar-5.10.0/calendar-service/src/dbmanager/ddatabase.h --- dde-calendar-5.9.1/calendar-service/src/dbmanager/ddatabase.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/dbmanager/ddatabase.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,149 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef DDATABASE_H +#define DDATABASE_H + +#include +#include +#include +#include +#include +#include +#include + +//账户数据库的实例 +#define DBAccountManager QSqlDatabase::database(DDataBase::NameAccountManager) +//云同步的临时数据库的实例 +#define DBSync QSqlDatabase::database(DDataBase::NameSync) + +class DDataBase : public QObject +{ + Q_OBJECT +public: + //账户数据库的别名 + static const QString NameAccountManager; + //云同步的临时数据库的别名 + static const QString NameSync; + //账户 + static const QString sql_create_account; + //日程表 + static const QString sql_create_schedules; + //类型表 + static const QString sql_create_scheduleType; + //颜色表 + static const QString sql_create_typeColor; + //创建上传任务表 + static const QString sql_create_uploadTask; + //创建提醒任务表 + static const QString sql_create_remindTask; + //创建帐户管理表 + static const QString sql_create_accountManager; + //日历通用设置 + static const QString sql_create_calendargeneralsettings; + + //工作颜色id + static const QString GWorkColorID; + //生活颜色id + static const QString GLifeColorID; + //其他颜色id + static const QString GOtherColorID; + //节假日颜色id + static const QString GFestivalColorID; + +public: + explicit DDataBase(QObject *parent = nullptr); + virtual ~DDataBase(); + + QString getDBPath() const; + void setDBPath(const QString &DBPath); + static QString createUuid(); + + QString getConnectionName() const; + void setConnectionName(const QString &connectionName); + + //初始化数据库数据,会创建数据库文件和相关数据表 + virtual void initDBData(); + void dbOpen(); + + //判断数据库是否存在 + bool dbFileExists(); + + //删除db数据库文件 + void removeDB(); + +protected: + //创建数据库 + virtual void createDB() = 0; + +protected: + QSqlDatabase m_database; + QString m_DBPath; + QString m_connectionName; +}; + +/** + * @brief The DbPathMutex struct 整理了sqlite数据库文件锁的相关操作 + */ +struct SqliteMutex { +private: + /** + * @brief The SqliteMutex struct 用于跳过QMutex的拷贝构造函数和operator=函数的调用 + */ + struct UnCopyMutex { + UnCopyMutex(){} + UnCopyMutex(const UnCopyMutex &) {} + UnCopyMutex &operator=(const UnCopyMutex &) {return *this;} + void lock(); + void unlock(); + + private: + QMutex m; + } m; //数据库文件锁 + bool transactionLocked = false; //是否开启事务 及 数据库文件是否被锁定 + qint64 transactionThreadId = 0; //开启事务的线程id + +public: + /** + * @brief lock 数据库文件被锁定,用于非事务场景 + */ + void lock(); + + /** + * @brief unlock 数据库文件被解锁,用于非事务场景 + */ + void unlock(); + + /** + * @brief transactionLock 数据库文件被锁定,用非事务场景 + */ + void transactionLock(); + + /** + * @brief transactionUnlock 数据库文件被解锁,用非事务场景 + */ + void transactionUnlock(); +}; + +/** + * @brief The SqliteQuery class 根据数据库文件锁来执行sql语句的类 + */ +class SqliteQuery : public QSqlQuery { +public: + explicit SqliteQuery(QSqlDatabase db); + explicit SqliteQuery(const QString &connectionName); + SqliteQuery(const QString &query, QSqlDatabase db); + + bool exec(QString sql); + bool exec(); + + void transaction(); + void commit(); + void rollback(); + +private: + QSqlDatabase _db; +}; + +#endif // DDATABASE_H diff -Nru dde-calendar-5.9.1/calendar-service/src/dbmanager/ddatabasemanagement.cpp dde-calendar-5.10.0/calendar-service/src/dbmanager/ddatabasemanagement.cpp --- dde-calendar-5.9.1/calendar-service/src/dbmanager/ddatabasemanagement.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/dbmanager/ddatabasemanagement.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,399 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "ddatabasemanagement.h" + +#include "ddatabase.h" +#include "vcalformat.h" +#include "daccountdatabase.h" +#include "daccountmanagerdatabase.h" +#include "units.h" +#include "recurrence.h" +#include "alarm.h" +#include "icalformat.h" +#include "memorycalendar.h" + +#include +#include +#include +#include +#include +#include +#include + +const QString localDBName = "localAccount.db"; + +DDataBaseManagement::DDataBaseManagement() + : m_newDatabaseName("accountmanager.db") + , m_oldDatabaseName("scheduler.db") +{ + //旧文件路径 + QString oldDbPath = getHomeConfigPath().append("/deepin/dde-daemon/calendar"); + setOldDatabasePath(oldDbPath); + //新文件路径 + QString newDbPath = getDBPath(); + setNewDatabasePath(newDbPath); + QString newDB(newDatabasePath() + "/" + m_newDatabaseName); + //如果新数据库不存在 + if (!databaseExists(newDatabasePath())) { + QString localAccountDB(newDatabasePath() + "/" + localDBName); + DAccountManagerDataBase accountManager; + accountManager.setDBPath(newDB); + accountManager.setLoaclDB(localDBName); + accountManager.initDBData(); + + DAccount::List accountList = accountManager.getAccountList(); + DAccount::Ptr localAccount; + for (auto account : accountList) { + if (account->accountType() == DAccount::Account_Local) { + localAccount = account; + break; + } + } + DAccountDataBase localDB(localAccount); + localDB.setDBPath(localAccountDB); + localDB.initDBData(); + + DTypeColor::List sysColorList = localDB.getSysColor(); + + QMap oldSysColor={ + {"#FF5E97",1} + ,{"#FF9436",2} + ,{"#FFDC00",3} + ,{"#5BDD80",4} + ,{"#00B99B",5} + ,{"#4293FF",6} + ,{"#5D51FF",7} + ,{"#A950FF",8} + ,{"#717171",9} + }; + + foreach (const auto &sysColor, sysColorList) { + if(oldSysColor.contains(sysColor->colorCode())){ + m_sysColorID.insert(oldSysColor[sysColor->colorCode()],sysColor->colorID()); + } + } + + //判断是否存在旧的数据库 + QString oldDBFile(oldDatabasePath() + "/" + m_oldDatabaseName); + if (databaseExists(oldDBFile)) { + //对数据进行迁移 + QSqlDatabase oldDB = QSqlDatabase::addDatabase("QSQLITE", "oldDB"); + oldDB.setDatabaseName(oldDBFile); + oldDB.open(); + + m_typeMap.insert(1, "107c369e-b13a-4d45-9ff3-de4eb3c0475b"); + m_typeMap.insert(2, "24cf3ae3-541d-487f-83df-f068416b56b6"); + m_typeMap.insert(3, "403bf009-2005-4679-9c76-e73d9f83a8b4"); + + //获取类型 + if (hasTypeDB(oldDB)) { + DScheduleType::List typeList = queryOldJobTypeData(oldDB); + foreach (auto &type, typeList) { + int &&typeid_int = type->typeID().toInt(); + QString &&type_ID = localDB.createScheduleType(type); + m_typeMap.insert(typeid_int, type_ID); + } + + //获取颜色 + QVector colorList = queryOldTypeColorData(oldDB); + foreach (auto color, colorList) { + localDB.addTypeColor(color); + } + } + + DSchedule::List scheduleList = queryOldJobData(oldDB, hasLunnarField(oldDB)); + //将原数据库中日程编号与当前日程编号匹配上 + foreach (auto schedule, scheduleList) { + int scheduleID = schedule->uid().toInt(); + m_schedule.insert(scheduleID, localDB.createSchedule(schedule)); + } + + //提醒任务 + if (hasRemindDB(oldDB)) { + DRemindData::List remindList = querOldRemindData(oldDB); + foreach (auto remind, remindList) { + remind->setAccountID(localAccount->accountID()); + localDB.createRemindInfo(remind); + } + } + + m_hasTransfer = true; + } + } +} + +QString DDataBaseManagement::newDatabasePath() const +{ + return m_newDatabasePath; +} + +void DDataBaseManagement::setNewDatabasePath(const QString &newDatabasePath) +{ + m_newDatabasePath = newDatabasePath; +} + +QString DDataBaseManagement::oldDatabasePath() const +{ + return m_oldDatabasePath; +} + +void DDataBaseManagement::setOldDatabasePath(const QString &oldDatabasePath) +{ + m_oldDatabasePath = oldDatabasePath; +} + +bool DDataBaseManagement::databaseExists(const QString &databasePath, bool create) +{ + QDir dir; + bool exist = false; + if (dir.exists(databasePath)) { + exist = true; + } else { + if (create) { + dir.mkpath(databasePath); + } + } + return exist; +} + +bool DDataBaseManagement::hasLunnarField(QSqlDatabase &db) +{ + SqliteQuery query(db); + bool haslunnar = false; + QString hasIsLunarField = "select count(1) from sqlite_master where type='table' and " + "tbl_name = 'jobs' and sql like '%is_Lunar%'"; + if (query.exec(hasIsLunarField) && query.next()) { + //获取是否存在为农历标识字段,若存在则返回1,不存在则返回0 + haslunnar = query.value(0).toInt(); + } + if (query.isActive()) { + query.finish(); + } + return haslunnar; +} + +bool DDataBaseManagement::hasTypeDB(QSqlDatabase &db) +{ + SqliteQuery query(db); + bool hasType = false; + QString strSql = "select count(1) from sqlite_master where type='table' and " + "tbl_name = 'JobType'"; + if (query.exec(strSql) && query.next()) { + //获取是否存在为农历标识字段,若存在则返回1,不存在则返回0 + hasType = query.value(0).toInt(); + } + if (query.isActive()) { + query.finish(); + } + return hasType; +} + +bool DDataBaseManagement::hasRemindDB(QSqlDatabase &db) +{ + SqliteQuery query(db); + bool hasRemind = false; + QString strSql = "select count(1) from sqlite_master where type='table' and " + "tbl_name = 'jobsReminder'"; + if (query.exec(strSql) && query.next()) { + //获取是否存在为农历标识字段,若存在则返回1,不存在则返回0 + hasRemind = query.value(0).toInt(); + } + if (query.isActive()) { + query.finish(); + } + return hasRemind; +} + +DScheduleType::List DDataBaseManagement::queryOldJobTypeData(QSqlDatabase &db) +{ + SqliteQuery query(db); + //旧数据日程默认包含一个节假日日程类型,其他的都为用户创建的类型 + QString strSql("SELECT TypeNo, TypeName, ColorTypeNo, CreateTime, Authority \ + FROM JobType where Authority >0;"); + DScheduleType::List typeList; + query.prepare(strSql); + if (query.exec()) { + while (query.next()) { + DScheduleType::Ptr type = DScheduleType::Ptr(new DScheduleType); + type->setTypeID(QString::number(query.value("TypeNo").toInt())); + type->setTypeName(query.value("TypeName").toString()); + type->setDisplayName(query.value("TypeName").toString()); + type->setDtCreate(query.value("CreateTime").toDateTime()); + type->setPrivilege(static_cast(query.value("Authority").toInt())); + int oldColorTypeID = query.value("ColorTypeNo").toInt(); + //如果为系统色 + if(oldColorTypeID <10){ + type->setColorID(m_sysColorID[oldColorTypeID]); + }else { + //如果为用户自定义颜色 + if (!m_typeColorID.contains(oldColorTypeID)) { + m_typeColorID[oldColorTypeID] = DDataBase::createUuid(); + } + type->setColorID(m_typeColorID[oldColorTypeID]); + } + typeList.append(type); + } + } + return typeList; +} + +DSchedule::List DDataBaseManagement::queryOldJobData(QSqlDatabase &db, const bool haslunar) +{ + SqliteQuery query(db); + QString strSql; + if (haslunar) { + strSql = "SELECT id, created_at, \"type\", title, description, all_day, \ + \"start\", \"end\", r_rule, remind, \"ignore\", title_pinyin, is_Lunar \ + FROM jobs;"; + } else { + strSql = "SELECT id, created_at, \"type\", title, description, all_day, \ + \"start\", \"end\", r_rule, remind, \"ignore\", title_pinyin \ + FROM jobs;"; + } + DSchedule::List scheduleList; + query.prepare(strSql); + if (query.exec()) { + while (query.next()) { + DSchedule::Ptr schedule = DSchedule::Ptr(new DSchedule); + schedule->setUid(QString::number(query.value("id").toInt())); + schedule->setDtStart(dtFromString(query.value("start").toString())); + schedule->setCreated(dtFromString(query.value("created_at").toString())); + schedule->setSummary(query.value("title").toString()); + schedule->setAllDay(query.value("all_day").toBool()); + schedule->setDtEnd(dtFromString(query.value("end").toString())); + //如果有农历信息则设置相关信息 + if(haslunar){ + schedule->setLunnar(query.value("is_Lunar").toBool()); + } + QString rrule = query.value("r_rule").toString(); + if (!rrule.isEmpty()) { + //重复规则 + KCalendarCore::Recurrence *recurrence = schedule->recurrence(); + KCalendarCore::ICalFormat ical; + KCalendarCore::RecurrenceRule *rule = new KCalendarCore::RecurrenceRule; + + if (ical.fromString(rule, query.value("r_rule").toString())) { + recurrence->addRRule(rule); + } + + //添加忽略列表 + QJsonArray ignore = query.value("Ignore").toJsonArray(); + foreach (auto ignoreTime, ignore) { + if (schedule->allDay()) { + recurrence->addExDate(dtFromString(ignoreTime.toString()).date()); + } else { + recurrence->addExDateTime(dtFromString(ignoreTime.toString())); + } + } + } + QString remind = query.value("remind").toString(); + if (!remind.isEmpty()) { + //提醒规则 + QStringList strList = remind.split(";", QString::SkipEmptyParts); + + int remindNum = strList.at(0).toInt(); + //小于0表示不提醒 + if (remindNum >= 0) { + KCalendarCore::Alarm::Ptr alarm = KCalendarCore::Alarm::Ptr(new KCalendarCore::Alarm(schedule.data())); + alarm->setEnabled(true); + alarm->setType(KCalendarCore::Alarm::Display); + alarm->setDisplayAlarm(schedule->summary()); + + if (schedule->allDay()) { + //提前多少秒 + int offset = 0; + if (strList.size() > 1) { + QTime time = QTime::fromString(strList.at(1), "hh:mm"); + offset = time.hour() * 60 * 60 + time.second() * 60; + } + KCalendarCore::Duration duration(-(24 * 60 * 60 * remindNum - offset)); + alarm->setStartOffset(duration); + } else { + KCalendarCore::Duration duration(-(60 * remindNum)); + alarm->setStartOffset(duration); + } + schedule->addAlarm(alarm); + } + } + int type = query.value("type").toInt(); + if (m_typeMap.contains(type)) { + schedule->setScheduleTypeID(m_typeMap[type]); + } else { + qWarning() << " can not find type:" << type; + } + scheduleList.append(schedule); + } + } + + if (query.isActive()) { + query.finish(); + } + return scheduleList; +} + +QVector DDataBaseManagement::queryOldTypeColorData(QSqlDatabase &db) +{ + SqliteQuery query(db); + QVector colorVector; + //获取用户创建颜色 + QString strSql("SELECT TypeNo, ColorHex, Authority \ + FROM ColorType WHERE ID >9;"); + query.prepare(strSql); + if (query.exec()) { + while (query.next()) { + DTypeColor color; + int oldTpyeID = query.value("TypeNo").toInt(); + //如果包含则添加,没有则丢弃 + if (m_typeColorID.contains(oldTpyeID)) { + color.setColorID(m_typeColorID[oldTpyeID]); + color.setColorCode(query.value("ColorHex").toString()); + color.setPrivilege(DTypeColor::PriUser); + colorVector.append(color); + } + } + } + if (query.isActive()) { + query.finish(); + } + return colorVector; +} + +DRemindData::List DDataBaseManagement::querOldRemindData(QSqlDatabase &db) +{ + SqliteQuery query(db); + DRemindData::List remindList; + QString strSql("SELECT jobid, recurid, remindCount, notifyid, remindTime, jobStartTime, jobEndTime FROM jobsReminder;"); + query.prepare(strSql); + if (query.exec()) { + while (query.next()) { + int jobid = query.value("jobid").toInt(); + if (m_schedule.contains(jobid)) { + DRemindData::Ptr remind = DRemindData::Ptr(new DRemindData); + remind->setScheduleID(m_schedule[jobid]); + remind->setRemindCount(query.value("remindCount").toInt()); + remind->setNotifyid(query.value("notifyid").toInt()); + remind->setDtRemind(dtFromString(query.value("remindTime").toString())); + remind->setDtStart(dtFromString(query.value("jobStartTime").toString())); + remind->setDtEnd(dtFromString(query.value("jobEndTime").toString())); + + int recurid = query.value("recurid").toInt(); + //如果重复id大于0,则表示为重复日程的提醒,设置提醒id为日程开始时间 + if (recurid > 0) { + remind->setRecurrenceId(remind->dtStart()); + } + remindList.append(remind); + } + } + } + if (query.isActive()) { + query.finish(); + } + return remindList; +} + +bool DDataBaseManagement::hasTransfer() const +{ + return m_hasTransfer; +} diff -Nru dde-calendar-5.9.1/calendar-service/src/dbmanager/ddatabasemanagement.h dde-calendar-5.10.0/calendar-service/src/dbmanager/ddatabasemanagement.h --- dde-calendar-5.9.1/calendar-service/src/dbmanager/ddatabasemanagement.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/dbmanager/ddatabasemanagement.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,66 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef DDATABASEMANAGEMENT_H +#define DDATABASEMANAGEMENT_H + +#include "dschedule.h" +#include "dscheduletype.h" +#include "dreminddata.h" + +#include +#include + +/** + * @brief The DDataBaseManagement class + * 数据库初始化 ,管理数据的创建和对旧版本的数据迁移 + */ + +class DDataBaseManagement +{ +public: + DDataBaseManagement(); + + bool hasTransfer() const; + +private: + QString newDatabasePath() const; + void setNewDatabasePath(const QString &newDatabasePath); + + QString oldDatabasePath() const; + void setOldDatabasePath(const QString &oldDatabasePath); + + //数据库所在文件夹是否存在,若不存在则创建该文件夹 + bool databaseExists(const QString &databasePath, bool create = true); + + //旧数据库jab表是否存在是否为农历日程字段 + bool hasLunnarField(QSqlDatabase &db); + //存在日程类型相关数据 + bool hasTypeDB(QSqlDatabase &db); + //存在提醒任务表 + bool hasRemindDB(QSqlDatabase &db); + + DScheduleType::List queryOldJobTypeData(QSqlDatabase &db); + DSchedule::List queryOldJobData(QSqlDatabase &db, const bool haslunar); + + QVector queryOldTypeColorData(QSqlDatabase &db); + DRemindData::List querOldRemindData(QSqlDatabase &db); + +private: + //新数据库路径地址 + QString m_newDatabasePath; + //旧数据库路径地址 + QString m_oldDatabasePath; + QString m_newDatabaseName; + QString m_oldDatabaseName; + + bool m_hasTransfer = false; + + QMap m_typeMap; + QMap m_sysColorID; //日程类型内置颜色新旧id对应map + QMap m_schedule; + QMap m_typeColorID; //日程类型颜色新旧id对应map +}; + +#endif // DDATABASEMANAGEMENT_H diff -Nru dde-calendar-5.9.1/calendar-service/src/dbmanager/dhuanglidatabase.cpp dde-calendar-5.10.0/calendar-service/src/dbmanager/dhuanglidatabase.cpp --- dde-calendar-5.9.1/calendar-service/src/dbmanager/dhuanglidatabase.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/dbmanager/dhuanglidatabase.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,97 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "dhuanglidatabase.h" +#include "units.h" + +#include +#include +#include + +#ifndef LINGLONG_PREFIX +#define LINGLONG_PREFIX "/usr/" +#endif + +DHuangLiDataBase::DHuangLiDataBase(QObject *parent) + : DDataBase(parent) +{ + setDBPath(QString("%1share/dde-calendar/data/huangli.db").arg(LINGLONG_PREFIX)); + setConnectionName("HuangLi"); + dbOpen(); +} + +QString DHuangLiDataBase::queryFestivalList(quint32 year, quint8 month) +{ + QString strtable = QString("festival_%1").arg(year); + QString strsql = QString("SELECT id,month,name,description,rest,list FROM %1 WHERE month = %2").arg(strtable).arg(month); + SqliteQuery query(strsql, m_database); + QString strjson; + if (query.exec()) { + QJsonDocument doc; + QJsonArray arr; + while (query.next()) { + QJsonObject obj; + obj.insert("id", query.value("id").toString()); + obj.insert("month", query.value("month").toInt()); + obj.insert("name", query.value("name").toString()); + obj.insert("rest", query.value("rest").toString()); + obj.insert("description", query.value("description").toString()); + QString strlist = query.value("list").toString(); + QJsonParseError error; + QJsonArray listarr; + QJsonDocument doctmp = QJsonDocument::fromJson(strlist.toLocal8Bit(), &error); + if (!doctmp.isNull()) { + listarr = doctmp.array(); + } else { + qDebug() << __FUNCTION__ << error.errorString(); + } + obj.insert("list", listarr); + arr.append(obj); + } + doc.setArray(arr); + strjson = QString::fromUtf8(doc.toJson(QJsonDocument::Compact)); + } else { + qWarning() << Q_FUNC_INFO << query.lastError(); + } + if (query.isActive()) { + query.finish(); + } + return strjson; +} + +QList DHuangLiDataBase::queryHuangLiByDays(const QList &days) +{ + QList infos; + SqliteQuery query(m_database); + foreach (stDay d, days) { + //查询的id + qint64 id = QString().sprintf("%d%02d%02d", d.Year, d.Month, d.Day).toInt(); + QString strsql("SELECT id, avoid, suit FROM huangli WHERE id = %1"); + strsql = strsql.arg(id); + //数据库中的宜忌信息是从2008年开始的 + stHuangLi sthuangli; + //因此这里先将sthuangli内容初始化 + sthuangli.ID = id; + //如果数据库中有查询到数据,则进行赋值,如果没有,则使用初始值 + if (query.exec(strsql) && query.next()) { + sthuangli.ID = query.value("id").toInt(); + sthuangli.Avoid = query.value("avoid").toString(); + sthuangli.Suit = query.value("suit").toString(); + } + //将黄历数据放到list中 + infos.append(sthuangli); + } + if (query.isActive()) { + query.finish(); + } + return infos; +} + +void DHuangLiDataBase::initDBData() +{ +} + +void DHuangLiDataBase::createDB() +{ +} diff -Nru dde-calendar-5.9.1/calendar-service/src/dbmanager/dhuanglidatabase.h dde-calendar-5.10.0/calendar-service/src/dbmanager/dhuanglidatabase.h --- dde-calendar-5.9.1/calendar-service/src/dbmanager/dhuanglidatabase.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/dbmanager/dhuanglidatabase.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,28 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef DHUANGLIDATABASE_H +#define DHUANGLIDATABASE_H + +#include "ddatabase.h" +#include "huangliData/lunardatastruct.h" +#include "huangliData/dbusdatastruct.h" +#include "lunarandfestival.h" + +class DHuangLiDataBase : public DDataBase +{ + Q_OBJECT +public: + explicit DHuangLiDataBase(QObject *parent = nullptr); + QString queryFestivalList(quint32 year, quint8 month); + QList queryHuangLiByDays(const QList &days); + + void initDBData() override; + +protected: + //创建数据库 + void createDB() override; +}; + +#endif // DHUANGLIDATABASE_H diff -Nru dde-calendar-5.9.1/calendar-service/src/dbmanager/huanglidatabase.cpp dde-calendar-5.10.0/calendar-service/src/dbmanager/huanglidatabase.cpp --- dde-calendar-5.9.1/calendar-service/src/dbmanager/huanglidatabase.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/dbmanager/huanglidatabase.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,110 +0,0 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: kongyunzhen -* -* Maintainer: kongyunzhen -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ -#include "huanglidatabase.h" - -#include -#include -#include -#include -#include -#include - -HuangLiDataBase::HuangLiDataBase(QObject *parent) - : QObject(parent), dbpath("/usr/share/dde-calendar/data/huangli.db") -{ - //黄历数据库路径 "/usr/share/dde-calendar/data/huangli.db" - OpenHuangliDatabase(dbpath); - Q_ASSERT(m_database.isOpen()); -} - -bool HuangLiDataBase::OpenHuangliDatabase(const QString &dbpath) -{ - m_database = QSqlDatabase::addDatabase("QSQLITE"); - m_database.setDatabaseName(dbpath); - return m_database.open(); -} - -QString HuangLiDataBase::QueryFestivalList(quint32 year, quint8 month) -{ - QString strtable = QString("festival_%1").arg(year); - QString strsql = QString("SELECT id,month,name,description,rest,list FROM %1 WHERE month = %2").arg(strtable).arg(month); - QSqlQuery query(strsql, m_database); - QString strjson; - if (query.exec()) { - QJsonDocument doc; - QJsonArray arr; - while (query.next()) { - QJsonObject obj; - obj.insert("id", query.value("id").toString()); - obj.insert("month", query.value("month").toInt()); - obj.insert("name", query.value("name").toString()); - obj.insert("rest", query.value("rest").toString()); - obj.insert("description", query.value("description").toString()); - QString strlist = query.value("list").toString(); - QJsonParseError error; - QJsonArray listarr; - QJsonDocument doctmp = QJsonDocument::fromJson(strlist.toLocal8Bit(), &error); - if (!doctmp.isNull()) { - listarr = doctmp.array(); - } else { - qDebug() << __FUNCTION__ << error.errorString(); - } - obj.insert("list", listarr); - arr.append(obj); - } - doc.setArray(arr); - strjson = QString::fromUtf8(doc.toJson(QJsonDocument::Compact)); - } else { - qDebug() < HuangLiDataBase::QueryHuangLiByDays(const QList &days) -{ - QList infos; - QSqlQuery query(m_database); - foreach (stDay d, days) { - //查询的id - qint64 id = QString().sprintf("%d%02d%02d", d.Year, d.Month, d.Day).toInt(); - QString strsql("SELECT id, avoid, suit FROM huangli WHERE id = %1"); - strsql = strsql.arg(id); - //数据库中的宜忌信息是从2008年开始的 - stHuangLi sthuangli; - //因此这里先将sthuangli内容初始化 - sthuangli.ID = id; - //如果数据库中有查询到数据,则进行赋值,如果没有,则使用初始值 - if (query.exec(strsql) && query.next()) { - sthuangli.ID = query.value("id").toInt(); - sthuangli.Avoid = query.value("avoid").toString(); - sthuangli.Suit = query.value("suit").toString(); - } - //将黄历数据放到list中 - infos.append(sthuangli); - } - if (query.isActive()) { - query.finish(); - } - return infos; -} diff -Nru dde-calendar-5.9.1/calendar-service/src/dbmanager/huanglidatabase.h dde-calendar-5.10.0/calendar-service/src/dbmanager/huanglidatabase.h --- dde-calendar-5.9.1/calendar-service/src/dbmanager/huanglidatabase.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/dbmanager/huanglidatabase.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,49 +0,0 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: kongyunzhen -* -* Maintainer: kongyunzhen -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ -#ifndef HUANGLIDATABASE_H -#define HUANGLIDATABASE_H -#include "src/lunardatastruct.h" -#include "src/dbusdatastruct.h" -#include "lunarandfestival.h" - -#include -#include - -class HuangLiDataBase : public QObject -{ - Q_OBJECT -public: - explicit HuangLiDataBase(QObject *parent = nullptr); - QString QueryFestivalList(quint32 year, quint8 month); - QList QueryHuangLiByDays(const QList &days); - -signals: - -public slots: - -private: - QSqlDatabase m_database; - QString dbpath; - - bool OpenHuangliDatabase(const QString &dbpath); -}; - -#endif // HUANGLIDATABASE_H diff -Nru dde-calendar-5.9.1/calendar-service/src/dbmanager/schedulerdatabase.cpp dde-calendar-5.10.0/calendar-service/src/dbmanager/schedulerdatabase.cpp --- dde-calendar-5.9.1/calendar-service/src/dbmanager/schedulerdatabase.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/dbmanager/schedulerdatabase.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,1162 +0,0 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: kongyunzhen -* -* Maintainer: kongyunzhen -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ -#include "schedulerdatabase.h" -#include "src/commondef.h" -#include "pinyin/pinyinsearch.h" -#include "src/utils.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -SchedulerDatabase::SchedulerDatabase(QObject *parent) - : QObject(parent) - , m_dbPath("") -{ - //旧文件路径 - QString oldDbPatch = QStandardPaths::writableLocation(QStandardPaths::HomeLocation).append("/.config/deepin/dde-daemon/calendar"); - QDir dir; - //如果该路径不存在,则创建该文件夹 - if (!dir.exists(oldDbPatch)) { - dir.mkpath(oldDbPatch); - } - m_dbPath = oldDbPatch.append("/scheduler.db"); - OpenSchedulerDatabase(); -} - -//通过id获取日程信息 -QString SchedulerDatabase::GetJob(qint64 id) -{ - QString strjson; - QSqlQuery query(m_database); - QString strsql = QString("SELECT id, type, title, description, " - "all_day, start, end, r_rule, remind, ignore , is_Lunar" - " FROM jobs WHERE id = '%1' ") - .arg(id); - //id唯一因此此处最多只有一条数据 - if (query.exec(strsql) && query.next()) { - QJsonDocument doc; - QJsonObject obj; - obj.insert("ID", query.value("id").toInt()); - obj.insert("Type", query.value("type").toInt()); - obj.insert("Title", query.value("title").toString()); - obj.insert("Description", query.value("description").toString()); - obj.insert("AllDay", query.value("all_day").toBool()); - //调整时间格式,方便前端解析 - obj.insert("Start", Utils::toconvertData(query.value("start").toDateTime())); - obj.insert("End", Utils::toconvertData(query.value("end").toDateTime())); - obj.insert("RRule", query.value("r_rule").toString()); - obj.insert("Remind", query.value("remind").toString()); - //将QString类型转换为QJsonArray类型,方便前端解析 - obj.insert("Ignore", QJsonDocument::fromJson(query.value("ignore").toString().toUtf8()).array()); - //数据库包含的都是原始数据所以RecurID默认为0 - obj.insert("RecurID", 0); - obj.insert("IsLunar", query.value("is_Lunar").toBool()); - - doc.setObject(obj); - strjson = QString::fromUtf8(doc.toJson(QJsonDocument::Compact)); - } else { - qDebug() << __FUNCTION__ << query.lastError(); - } - if (query.isActive()) { - query.finish(); - } - return strjson; -} - -/** - * @brief GetAllOriginJobs 获取所有原始日程 - * @return 返回所有原始日程集合 - */ -QList SchedulerDatabase::GetAllOriginJobs() -{ - QList jobs; - QSqlQuery query(m_database); - - QString strsql = QString("select id,type,title,description,all_day,start,end,r_rule,remind,ignore,title_pinyin,is_Lunar" - " from jobs "); - if (query.exec(strsql)) { - while (query.next()) { - Job jb; - jb.ID = query.value("id").toInt(); - jb.Type = query.value("type").toInt(); - jb.Title = query.value("title").toString(); - jb.Description = query.value("description").toString(); - jb.AllDay = query.value("all_day").toBool(); - jb.Start = query.value("start").toDateTime(); - jb.End = query.value("end").toDateTime(); - jb.RRule = query.value("r_rule").toString(); - jb.Remind = query.value("remind").toString(); - jb.Ignore = query.value("ignore").toString(); - jb.Title_pinyin = query.value("title_pinyin").toString(); - jb.IsLunar = query.value("is_Lunar").toBool(); - jobs.append(jb); - } - } - if (query.isActive()) { - query.finish(); - } - - return jobs; -} - -/** - * @brief GetAllOriginJobs 获取所有与key相关的job原始数据 - * @param key 搜索词 - * @param strsort 查询排序条件 - * @return 返回所有原始日程集合 - */ -QList SchedulerDatabase::GetAllOriginJobs(const QString &key, const QString &strsort) -{ - QList jobs; - QSqlQuery query(m_database); - QString strKey = key.trimmed(); - pinyinsearch *psearch = pinyinsearch::getPinPinSearch(); - QString strsql("select id,type,title,description,all_day,start,end,r_rule,remind,ignore,title_pinyin,is_Lunar from jobs"); - QMap sqlBindValue; - if (psearch->CanQueryByPinyin(strKey)) { - //可以按照拼音查询 - QString pinyin = psearch->CreatePinyinQuery(strKey.toLower()); - strsql += QString(" where instr(UPPER(title), UPPER(:key)) OR title_pinyin LIKE :pinyin"); - sqlBindValue[":key"] = key; - sqlBindValue[":pinyin"] = pinyin; - } else if (!key.isEmpty()) { - //按照key查询 - strsql += QString(" where instr(UPPER(title), UPPER(:key))"); - sqlBindValue[":key"] = key; - } - - //排序条件不为空 - if (!strsort.isEmpty()) { - strsql.append(QString("order by :strsort ")); - sqlBindValue[":strsort"] = strsort; - } - query.prepare(strsql); - for (auto iter = sqlBindValue.constBegin(); iter != sqlBindValue.constEnd(); iter++) { - query.bindValue(iter.key(), iter.value()); - } - if (query.exec()) { - while (query.next()) { - Job jb; - jb.ID = query.value("id").toInt(); - jb.Type = query.value("type").toInt(); - jb.Title = query.value("title").toString(); - jb.Description = query.value("description").toString(); - jb.AllDay = query.value("all_day").toBool(); - jb.Start = query.value("start").toDateTime(); - jb.End = query.value("end").toDateTime(); - jb.RRule = query.value("r_rule").toString(); - jb.Remind = query.value("remind").toString(); - jb.Ignore = query.value("ignore").toString(); - jb.Title_pinyin = query.value("title_pinyin").toString(); - jb.IsLunar = query.value("is_Lunar").toBool(); - jobs.append(jb); - } - } - if (query.isActive()) { - query.finish(); - } - - return jobs; -} - -QList SchedulerDatabase::GetAllOriginJobsWithRule(const QString &key, const QString &rules) -{ - QList jobs; - QSqlQuery query(m_database); - QString strKey = key.trimmed(); - QString strrule; - if (!rules.contains("BYDAY") && rules.contains("DAILY")) { - // 每日 - strrule = QString("r_rule LIKE '%%1%' AND r_rule NOT LIKE '%BYDAY%' ").arg(rules); - } else { - // 工作日 每周 每月 每年 - strrule = QString("r_rule LIKE '%%1%'").arg(rules); - } - - pinyinsearch *psearch = pinyinsearch::getPinPinSearch(); - QString strsql; - if (psearch->CanQueryByPinyin(strKey)) { - //可以按照拼音查询 - QString pinyin = psearch->CreatePinyinQuery(strKey.toLower()); - strsql = QString("select id from jobs where title like '%%1%' or title_pinyin like '%%2%' ").arg(key).arg(pinyin); - } else if (!key.isEmpty()) { - //按照key查询 - strsql = QString("select id from jobs where title like '%%1%' ").arg(key); - } else { - //如果没有key,则搜索所有 - strsql = QString("select id from jobs "); - } - - strsql = QString("select id,type,title,description,all_day,start,end,r_rule,remind,ignore,title_pinyin,is_Lunar " - " from jobs where id in(%1) and %2") - .arg(strsql) - .arg(strrule); - - if (query.exec(strsql)) { - while (query.next()) { - Job jb; - jb.ID = query.value("id").toInt(); - jb.Type = query.value("type").toInt(); - jb.Title = query.value("title").toString(); - jb.Description = query.value("description").toString(); - jb.AllDay = query.value("all_day").toBool(); - jb.Start = query.value("start").toDateTime(); - jb.End = query.value("end").toDateTime(); - jb.RRule = query.value("r_rule").toString(); - jb.Remind = query.value("remind").toString(); - jb.Ignore = query.value("ignore").toString(); - jb.Title_pinyin = query.value("title_pinyin").toString(); - jb.IsLunar = query.value("is_Lunar").toBool(); - jobs.append(jb); - } - } - if (query.isActive()) { - query.finish(); - } - - return jobs; -} - -/** - * @brief GetJobsContainRemind 获取包含提醒规则的jos集合 - */ -QList SchedulerDatabase::GetJobsContainRemind() -{ - QList jobs; - QSqlQuery query(m_database); - QString strSql("select id,type,title,description,all_day,start,end,r_rule,remind,ignore,title_pinyin,is_Lunar " - "from jobs where remind is not null and remind !=' ' "); - if (query.exec(strSql)) { - while (query.next()) { - Job jb; - jb.ID = query.value("id").toInt(); - jb.Type = query.value("type").toInt(); - jb.Title = query.value("title").toString(); - jb.Description = query.value("description").toString(); - jb.AllDay = query.value("all_day").toBool(); - jb.Start = query.value("start").toDateTime(); - jb.End = query.value("end").toDateTime(); - jb.RRule = query.value("r_rule").toString(); - jb.Remind = query.value("remind").toString(); - jb.Ignore = query.value("ignore").toString(); - jb.Title_pinyin = query.value("title_pinyin").toString(); - jb.IsLunar = query.value("is_Lunar").toBool(); - jobs.append(jb); - } - } - if (query.isActive()) { - query.finish(); - } - return jobs; -} - -//存储提醒日程的相关信息 -void SchedulerDatabase::saveRemindJob(const Job &job) -{ - QSqlQuery query(m_database); - QString strsql = "INSERT INTO jobsReminder (jobid,recurid,remindCount,notifyid, remindTime,jobStartTime,jobEndTime)" - "values (:jobid,:recurid,:remindCount,:notifyid,:remindTime,:jobStartTime,:jobEndTime)"; - query.prepare(strsql); - int i = 0; - query.bindValue(i, job.ID); - query.bindValue(++i, job.RecurID); - query.bindValue(++i, job.RemindLaterCount); - //通知提醒id默认为-1,表示未提醒 - query.bindValue(++i, -1); - query.bindValue(++i, job.RemidTime); - query.bindValue(++i, job.Start); - query.bindValue(++i, job.End); - if (query.exec()) { - if (query.isActive()) { - query.finish(); - } - } else { - qDebug() << __FUNCTION__ << query.lastError(); - } -} - -void SchedulerDatabase::updateRemindJob(const Job &job) -{ - //点击稍后提醒后,更新信息并设置通知提醒为-1 - QString strsql = QString("UPDATE jobsReminder SET remindCount = '%1' , remindTime = '%2', notifyid = -1 WHERE jobid = %3 and recurid = %4 ") - .arg(job.RemindLaterCount) - .arg(dateTimeToString(job.RemidTime)) - .arg(job.ID) - .arg(job.RecurID); - QSqlQuery query(m_database); - if (query.exec(strsql)) { - if (query.isActive()) { - query.finish(); - } - m_database.commit(); - } else { - qWarning() << __FUNCTION__ << query.lastError(); - } -} - -void SchedulerDatabase::deleteRemindJobs(const QList &Ids) -{ - if (Ids.size() == 0) - return; - QStringList idList; - for (int i = 0; i < Ids.size(); ++i) { - idList.append(QString::number(Ids.at(i))); - } - QSqlQuery query(m_database); - QString sql = QString("delete from jobsReminder where jobsReminder.jobid in ( %1)").arg(idList.join(",")); - if (query.exec(sql)) { - if (query.isActive()) { - query.finish(); - } - } else { - qWarning() << __FUNCTION__ << query.lastError(); - } -} - -void SchedulerDatabase::deleteRemindJobs(const qlonglong &jobID, const qint64 recurid) -{ - QSqlQuery query(m_database); - QString sql = QString("delete from jobsReminder where jobsReminder.jobid = %1 and jobsReminder.recurid = %2") - .arg(jobID) - .arg(recurid); - if (query.exec(sql)) { - if (query.isActive()) { - query.finish(); - } - } else { - qWarning() << __FUNCTION__ << query.lastError(); - } -} - -QList SchedulerDatabase::getValidRemindJob() -{ - QList jobs{}; - QSqlQuery query(m_database); - QString sql("select jobs.id, jobs.all_day,jobs.type,jobs.title,jobs.description,jobs.is_Lunar,jobsReminder.jobStartTime as start," - "jobsReminder.jobEndTime as end,jobs.r_rule,jobs.remind,jobs.ignore,jobs.title_pinyin,jobsReminder.remindCount," - "jobsReminder.remindTime , jobsReminder.recurid from jobs left join jobsReminder on jobs.id = jobsReminder.jobid " - "where jobsReminder.remindTime > "); - sql += QString(" '%1'").arg(dateTimeToString(QDateTime::currentDateTime())); - if (query.exec(sql)) { - while (query.next()) { - Job jb; - jb.ID = query.value("id").toInt(); - jb.Type = query.value("type").toInt(); - jb.Title = query.value("title").toString(); - jb.Description = query.value("description").toString(); - jb.AllDay = query.value("all_day").toBool(); - jb.Start = query.value("start").toDateTime(); - jb.End = query.value("end").toDateTime(); - jb.RRule = query.value("r_rule").toString(); - jb.Remind = query.value("remind").toString(); - jb.Ignore = query.value("ignore").toString(); - jb.Title_pinyin = query.value("title_pinyin").toString(); - jb.RemindLaterCount = query.value("remindCount").toInt(); - jb.RemidTime = query.value("remindTime").toDateTime(); - jb.RecurID = query.value("recurid").toInt(); - jb.IsLunar = query.value("is_Lunar").toBool(); - jobs.append(jb); - } - } - if (query.isActive()) { - query.finish(); - } - return jobs; -} - -void SchedulerDatabase::clearRemindJobDatabase() -{ - QSqlQuery query(m_database); - QString sql("delete from jobsReminder"); - if (query.exec(sql)) { - if (query.isActive()) { - query.finish(); - } - } else { - qWarning() << __FUNCTION__ << query.lastError(); - } - -} - -Job SchedulerDatabase::getRemindJob(const qint64 id, const qint64 recurid) -{ - QSqlQuery query(m_database); - QString sql = QString("select jobs.id, jobs.all_day,jobs.type,jobs.title,jobs.description,jobs.is_Lunar," - "jobsReminder.jobStartTime as start,jobsReminder.jobEndTime as end,jobs.r_rule,jobs.remind,jobs.ignore,jobs.title_pinyin," - "jobsReminder.remindCount,jobsReminder.remindTime , jobsReminder.recurid from jobs inner join jobsReminder " - "on jobs.id = jobsReminder.jobid where jobsReminder.jobid = %1 and jobsReminder.recurid = %2") - .arg(id) - .arg(recurid); - - //id唯一因此此处最多只有一条数据 - Job jb; - if (query.exec(sql) && query.next()) { - jb.ID = query.value("id").toInt(); - jb.Type = query.value("type").toInt(); - jb.Title = query.value("title").toString(); - jb.Description = query.value("description").toString(); - jb.AllDay = query.value("all_day").toBool(); - jb.Start = query.value("start").toDateTime(); - jb.End = query.value("end").toDateTime(); - jb.RRule = query.value("r_rule").toString(); - jb.Remind = query.value("remind").toString(); - jb.Ignore = query.value("ignore").toString(); - jb.Title_pinyin = query.value("title_pinyin").toString(); - jb.RemindLaterCount = query.value("remindCount").toInt(); - jb.RemidTime = query.value("remindTime").toDateTime(); - jb.RecurID = query.value("recurid").toInt(); - jb.IsLunar = query.value("is_Lunar").toBool(); - } else { - qWarning() << query.lastError(); - } - if (query.isActive()) { - query.finish(); - } - return jb; -} - -QList SchedulerDatabase::getRemindJob(const qint64 id) -{ - QSqlQuery query(m_database); - QString sql = QString("select jobs.id, jobs.all_day,jobs.type,jobs.title,jobs.description,jobs.is_Lunar," - "jobsReminder.jobStartTime as start,jobsReminder.jobEndTime as end,jobs.r_rule,jobs.remind,jobs.ignore,jobs.title_pinyin," - "jobsReminder.remindCount,jobsReminder.remindTime , jobsReminder.recurid from jobs inner join jobsReminder " - "on jobs.id = jobsReminder.jobid where jobsReminder.jobid = %1") - .arg(id); - - //id唯一因此此处最多只有一条数据 - QList jbList; - if (query.exec(sql) && query.next()) { - Job jb; - jb.ID = query.value("id").toInt(); - jb.Type = query.value("type").toInt(); - jb.Title = query.value("title").toString(); - jb.Description = query.value("description").toString(); - jb.AllDay = query.value("all_day").toBool(); - jb.Start = query.value("start").toDateTime(); - jb.End = query.value("end").toDateTime(); - jb.RRule = query.value("r_rule").toString(); - jb.Remind = query.value("remind").toString(); - jb.Ignore = query.value("ignore").toString(); - jb.Title_pinyin = query.value("title_pinyin").toString(); - jb.RemindLaterCount = query.value("remindCount").toInt(); - jb.RemidTime = query.value("remindTime").toDateTime(); - jb.RecurID = query.value("recurid").toInt(); - jb.IsLunar = query.value("is_Lunar").toBool(); - jbList.append(jb); - } else { - qWarning() << query.lastError(); - } - if (query.isActive()) { - query.finish(); - } - return jbList; -} - -//获取桌面顶部通知ID -QVector SchedulerDatabase::getNotifyID(const qint64 id) -{ - QVector notifyid; - QSqlQuery query(m_database); - QString sql("select distinct jobsReminder.notifyid from jobsReminder where jobsReminder.jobid = "); - sql += QString::number(id); - if (query.exec(sql) && query.next()) { - notifyid.append(query.value("notifyid").toInt()); - } - if (query.isActive()) { - query.finish(); - } - return notifyid; -} - -int SchedulerDatabase::getNotifyID(const qint64 jobID, const qint64 recurid) -{ - int notifyid = -1; - QSqlQuery query(m_database); - QString sql = QString("select distinct jobsReminder.notifyid from jobsReminder where jobsReminder.jobid = %1 and jobsReminder.recurid = %2") - .arg(jobID) - .arg(recurid); - if (query.exec(sql) && query.next()) { - notifyid = query.value("notifyid").toInt(); - } - if (query.isActive()) { - query.finish(); - } - return notifyid; -} - -//更新桌面顶部通知ID -void SchedulerDatabase::updateNotifyID(const Job &job, int notifyid) -{ - QString strsql = - QString("UPDATE jobsReminder SET notifyid = '%1' WHERE jobid = %2 and recurid = %3") - .arg(notifyid) - .arg(job.ID) - .arg(job.RecurID); - QSqlQuery query(m_database); - if (query.exec(strsql)) { - if (query.isActive()) { - query.finish(); - } - m_database.commit(); - } else { - qWarning() << __FUNCTION__ << query.lastError(); - } -} - -/** - * @brief CreateTables 创建日程相关数据表(新用户创建) - */ -void SchedulerDatabase::CreateTables() -{ - QSqlQuery query(m_database); - bool ret; - //table job_types - ret = query.exec("CREATE TABLE IF NOT EXISTS \"job_types\" (\"id\" integer primary key autoincrement,\"created_at\"" - " datetime,\"updated_at\" datetime,\"deleted_at\" datetime,\"name\" varchar(255),\"color\" varchar(255) )"); - if (!ret) { - qDebug() << query.lastError(); - } - - ret = query.exec("CREATE INDEX IF NOT EXISTS idx_job_types_deleted_at ON \"job_types\"(deleted_at)"); - if (!ret) { - qDebug() << query.lastError(); - } - //table jobs - ret = query.exec("CREATE TABLE IF NOT EXISTS \"jobs\" (\"id\" integer primary key autoincrement," - "\"created_at\" datetime,\"updated_at\" datetime,\"deleted_at\" datetime," - "\"type\" integer,\"title\" varchar(255),\"description\" varchar(255)," - "\"all_day\" bool,\"start\" datetime,\"end\" datetime,\"r_rule\" varchar(255)," - "\"remind\" varchar(255),\"ignore\" varchar(255) , \"title_pinyin\" varchar(255))"); - if (!ret) { - qDebug() << query.lastError(); - } - ret = query.exec("CREATE INDEX IF NOT EXISTS idx_jobs_deleted_at ON \"jobs\"(deleted_at)"); - if (!ret) { - qDebug() << query.lastError(); - } - - ret = query.exec("CREATE TABLE IF NOT EXISTS \"jobsReminder\" (\"id\" integer primary key autoincrement," - "\"jobid\" integer,\"recurid\" integer,\"remindCount\" integer ,\"notifyid\" integer ," - "\"remindTime\" datetime ,\"jobStartTime\" datetime ,\"jobEndTime\" datetime) "); - if (!ret) { - qDebug() << query.lastError(); - } - - ret = query.exec("CREATE TABLE IF NOT EXISTS JobType ( \ - ID INTEGER PRIMARY KEY AUTOINCREMENT \ - ,TypeNo INTEGER NOT NULL UNIQUE \ - ,TypeName VARCHAR(20) NOT NULL \ - ,ColorTypeNo INTEGER NOT NULL \ - ,CreateTime DATETIME NOT NULL \ - ,Authority INTEGER NOT NULL \ - )");//Authority:用来标识权限,0:读 1:展示 2:改 4:删 - - if (!ret) { - qDebug() << query.lastError(); - } - ret = query.exec("CREATE TABLE IF NOT EXISTS ColorType ( \ - ID INTEGER PRIMARY KEY AUTOINCREMENT \ - ,TypeNo INTEGER NOT NULL UNIQUE \ - ,ColorHex CHAR(10) NOT NULL \ - ,Authority INTEGER NOT NULL \ - )");//Authority:用来标识权限,0:读 1:展示 2:改 4:删 - if (!ret) { - qDebug() << query.lastError(); - } - - if (query.isActive()) { - query.finish(); - } - - m_database.commit(); -} -/** - * @brief initJobTypeTables 初始化日程类型,添加默认日程类型、颜色类型 - * @return 无 - */ -void SchedulerDatabase::initJobTypeTables() -{ - //getJobTypeByTypeNo(int iTypeNo, JobTypeInfo jobType); - JobTypeInfo jobType; - if (!getJobTypeByTypeNo(1, jobType) || jobType.getJobTypeNo() > 0) { - return; - } -// addJobType(1, "Work", 1, 1); -// addJobType(2, "Life", 7, 1); -// addJobType(3, "Other", 4, 1); - addJobType(4, "Festival", 2, 0); - - addColorType(1, "#ff5e97", 1); - addColorType(2, "#ff9436", 1); - addColorType(3, "#ffdc00", 1); - addColorType(4, "#5bdd80", 1); - addColorType(5, "#00b99b", 1); - addColorType(6, "#4293ff", 1); - addColorType(7, "#5d51ff", 1); - addColorType(8, "#a950ff", 1); - addColorType(9, "#717171", 1); - - return; -} - -void SchedulerDatabase::OpenSchedulerDatabase() -{ - // 重复调用QSQLITE会导致数据库连接覆盖导致失败,需指定每部分的连接名称 - m_database = QSqlDatabase::addDatabase("QSQLITE", "SchedulerDatabase"); - const QString &dbpath = getDbPath(); - m_database.setDatabaseName(dbpath); - //这里用QFile来修改日历数据库文件的权限 - QFile file; - file.setFileName(dbpath); - //如果不存在该文件则创建 - if (!file.exists()) { - m_database.open(); - m_database.close(); - } - //将权限修改为600(对文件的所有者可以读写,其他用户不可读不可写) - if (!file.setPermissions(QFile::WriteOwner | QFile::ReadOwner)) { - qWarning() << "权限设置失败,错误:" << file.errorString(); - } - if (m_database.open()) { - const QStringList tables = m_database.tables(); - QSqlQuery query(m_database); - CreateTables(); - initJobTypeTables(); - - //jobs需要添加一个是否为农历日程的字段 - //判断jobs表中是否有该字段,如果有则不处理 - QString getHasIsLunarField = "select count(1) from sqlite_master where type='table' and " - "tbl_name = 'jobs' and sql like '%is_Lunar%'"; - if (query.exec(getHasIsLunarField) && query.next()) { - //获取是否存在为农历标识字段,若存在则返回1,不存在则返回0 - int fieldNum = query.value(0).toInt(); - if (fieldNum == 0) { - //添加字段 - QString alterField = "alter table jobs add is_Lunar bool default false "; - if (!query.exec(alterField)) { - qWarning() << "Failed to add field," << query.lastError(); - }; - } - } else { - qWarning() << "select field failed," << query.lastError(); - } - if (query.isActive()) { - query.finish(); - } - m_database.commit(); - - } else { - qDebug() << __FUNCTION__ << m_database.lastError(); - } -} - -QString SchedulerDatabase::dateTimeToString(const QDateTime &dateTime) -{ - QTime _offsetTime = QTime(0, 0).addSecs(dateTime.timeZone().offsetFromUtc(dateTime)); - return QString("%1.000+%2").arg(dateTime.toString("yyyy-MM-ddThh:mm:ss")).arg(_offsetTime.toString("hh:mm")); -} - -QString SchedulerDatabase::getDbPath() const -{ - return m_dbPath; -} - -void SchedulerDatabase::setDbPath(const QString &dbPath) -{ - m_dbPath = dbPath; -} - -// 执行删除日程的数据库SQL命令,以ID为依据 -void SchedulerDatabase::DeleteJob(qint64 id) -{ - QString strsql = QString("DELETE FROM jobs WHERE id = %1").arg(id); - QSqlQuery query(m_database); - if (query.exec(strsql)) { - if (query.isActive()) { - query.finish(); - } - m_database.commit(); - } else { - qDebug() << __FUNCTION__ << query.lastError(); - } -} - -// 执行添加日程的数据库SQL命令,并返回其ID值 -qint64 SchedulerDatabase::CreateJob(const Job &job) -{ - QDateTime currentDateTime = QDateTime::currentDateTime(); - currentDateTime.setOffsetFromUtc(currentDateTime.offsetFromUtc()); - QSqlQuery query(m_database); - QString strsql = "INSERT INTO jobs (created_at, updated_at, type, title," - "description, all_day, start, end, r_rule, remind, ignore, title_pinyin,is_Lunar)" - "values (:created_at, :updated_at, :type, :title, :description," - ":all_day, :start, :end, :r_rule, :remind, :ignore, :title_pinyin,:is_Lunar)"; - query.prepare(strsql); - int i = 0; - query.bindValue(i, currentDateTime); - query.bindValue(++i, currentDateTime); - query.bindValue(++i, job.Type); - query.bindValue(++i, job.Title); - query.bindValue(++i, job.Description); - query.bindValue(++i, job.AllDay); - //修改开始结束时间格式,与前端保持一致 - query.bindValue(++i, Utils::toconvertData(job.Start)); - query.bindValue(++i, Utils::toconvertData(job.End)); - query.bindValue(++i, job.RRule); - query.bindValue(++i, job.Remind); - query.bindValue(++i, job.Ignore); - query.bindValue(++i, job.Title_pinyin); - query.bindValue(++i, job.IsLunar); - if (query.exec()) { - if (query.isActive()) { - query.finish(); - } - } else { - qDebug() << __FUNCTION__ << query.lastError(); - } - - // 获取最新刚插入日程的ID。由于id为数据库自增,因此插入的日程id一直为最大值。 - qint64 jobID; - QString returnIdsql = "SELECT MAX(id) FROM jobs"; - if (query.exec(returnIdsql) && query.next()) { - jobID = query.value(0).toInt(); - if (query.isActive()) { - query.finish(); - } - // 共有两次sql语句执行,commit操作需要置于最后 - m_database.commit(); - } else { - qDebug() << __FUNCTION__ << query.lastError(); - return -1; - } - return jobID; -} - -// 根据传入的jobInfo中的Id来更新数据库中相应的数据 -qint64 SchedulerDatabase::UpdateJob(const QString &jobInfo) -{ - // TODO: 对job数据进行合法性检测 - QJsonParseError json_error; - QJsonDocument jsonDoc(QJsonDocument::fromJson(jobInfo.toLocal8Bit(), &json_error)); - if (json_error.error != QJsonParseError::NoError) { - return -1; - } - QJsonObject rootObj = jsonDoc.object(); - // 此处Ignore参数需要单独解析,后续pinyin参数也可能会单独解析 - QJsonArray subArray = rootObj.value("Ignore").toArray(); - QJsonDocument doc; - doc.setArray(subArray); - - QDateTime currentDateTime = QDateTime::currentDateTime(); - currentDateTime.setOffsetFromUtc(currentDateTime.offsetFromUtc()); - QSqlQuery query(m_database); - QString strsql = "UPDATE jobs SET updated_at = ?, type = ?, title = ?, " - "description = ?, all_day = ?, start = ?, end = ?, r_rule = ?, " - "remind = ?, ignore = ?, title_pinyin = ? ,is_Lunar = ? WHERE id = ?"; - query.prepare(strsql); - qint64 id = rootObj.value("ID").toInt(); - int i = 0; - //修改updatetime时间格式 - query.bindValue(i, currentDateTime); - query.bindValue(++i, rootObj.value("Type").toInt()); - query.bindValue(++i, rootObj.value("Title").toString()); - query.bindValue(++i, rootObj.value("Description").toString()); - query.bindValue(++i, rootObj.value("AllDay").toBool()); - query.bindValue(++i, rootObj.value("Start").toString()); - query.bindValue(++i, rootObj.value("End").toString()); - query.bindValue(++i, rootObj.value("RRule").toString()); - query.bindValue(++i, rootObj.value("Remind").toString()); - query.bindValue(++i, QString::fromUtf8(doc.toJson(QJsonDocument::Compact))); - query.bindValue(++i, pinyinsearch::getPinPinSearch()->CreatePinyin(rootObj.value("Title").toString())); - query.bindValue(++i, rootObj.value("IsLunar").toBool()); - query.bindValue(++i, id); - if (query.exec()) { - if (query.isActive()) { - query.finish(); - } - m_database.commit(); - } else { - qDebug() << __FUNCTION__ << query.lastError(); - } - - return id; -} - -bool SchedulerDatabase::UpdateJobIgnore(const QString &strignore, qint64 id) -{ - QSqlQuery query(m_database); - QString strsql = QString("UPDATE jobs SET ignore='%1' where id=%2;").arg(strignore).arg(id); - bool bsuccess = false; - if (query.exec(strsql)) { - if (query.isActive()) { - query.finish(); - } - bsuccess = m_database.commit(); - } - - return bsuccess; -} - -/** - * @brief getJobTypeByTypeNo 根据类型编号获取日程类型信息 - * @return - */ -bool SchedulerDatabase::getJobTypeByTypeNo(int iTypeNo, JobTypeInfo &jobType) -{ - bool bRet = false; - QSqlQuery query(m_database); - - QString strsql = QString(" SELECT JobType.TypeNo, JobType.TypeName, JobType.ColorTypeNo, ColorType.ColorHex, JobType.Authority " - " FROM JobType LEFT JOIN ColorType " - " ON JobType.ColorTypeNo = ColorType.TypeNo " - " WHERE JobType.TypeNo = %1 ").arg(iTypeNo);//单个查询时,不过滤Authority为0的结果 - bRet = query.exec(strsql); - if (bRet) { - while (query.next()) { - jobType.setJobTypeNo(query.value("TypeNo").toInt()); - jobType.setJobTypeName(query.value("TypeName").toString()); - jobType.getColorInfo().setTypeNo(query.value("ColorTypeNo").toInt()); - jobType.getColorInfo().setColorHex(query.value("ColorHex").toString()); - jobType.setAuthority(query.value("Authority").toInt()); - } - } - if (query.isActive()) { - query.finish(); - } - return bRet; -} -/** - * @brief getJobTypeList 获取日程类型json串 - * @param 无 - */ -bool SchedulerDatabase::getJobTypeList(QList &lstJobType) -{ - bool bRet = false; - QSqlQuery query(m_database); - - QString strsql = QString(" SELECT JobType.TypeNo, JobType.TypeName, JobType.ColorTypeNo, ColorType.ColorHex, JobType.Authority " - " FROM JobType LEFT JOIN ColorType " - " ON JobType.ColorTypeNo = ColorType.TypeNo " - " WHERE JobType.Authority > 0 " - " ORDER BY JobType.CreateTime "); - bRet = query.exec(strsql); - if (bRet) { - QList > lstDefault; - lstDefault.append({1, tr("Work"), 1, "#ff5e97", 1}); - lstDefault.append({2, tr("Life"), 7, "#5d51ff", 1}); - lstDefault.append({3, tr("Other"), 4, "#5bdd80", 1}); - - for (QList lst : lstDefault) { - JobTypeInfo jobType; - jobType.setJobTypeNo(lst[0].toInt()); - jobType.setJobTypeName(lst[1].toString()); - jobType.setColorTypeNo(lst[2].toInt()); - jobType.setColorHex(lst[3].toString()); - jobType.setAuthority(lst[4].toInt()); - lstJobType.append(jobType); - } - - while (query.next()) { - JobTypeInfo jobType; - jobType.setJobTypeNo(query.value("TypeNo").toInt()); - jobType.setJobTypeName(query.value("TypeName").toString()); - jobType.setColorTypeNo(query.value("ColorTypeNo").toInt()); - jobType.setColorHex(query.value("ColorHex").toString()); - jobType.setAuthority(query.value("Authority").toInt()); - lstJobType.append(jobType); - } - } - if (query.isActive()) { - query.finish(); - } - - return bRet; -} - -/** - * @brief isJobTypeUsed 查询日程类型是否被使用 - * @return - */ -bool SchedulerDatabase::isJobTypeUsed(int iTypeNo) -{ - bool bRet = false; - QSqlQuery query(m_database); - - QString strsql = QString(" SELECT count(1) FROM jobs WHERE type = %1").arg(iTypeNo); - if (query.exec(strsql) && query.next()) { - //获取是否存在为农历标识字段,若存在则返回1,不存在则返回0 - int fieldNum = query.value(0).toInt(); - if (fieldNum > 0) { - //被使用 - bRet = true; - } - } - if (query.isActive()) { - query.finish(); - } - - return bRet; -} - -bool SchedulerDatabase::DeleteJobsByJobType(int iTypeNo) -{ - bool bRet = false; - QSqlQuery query(m_database); - - QString strsql = QString("DELETE FROM jobs WHERE type = %1").arg(iTypeNo); - query.prepare(strsql); - bRet = query.exec(); - if (bRet) { - if (query.isActive()) { - query.finish(); - } - m_database.commit(); - } else { - qWarning() << __FUNCTION__ << query.lastError(); - qWarning() << strsql; - } - return bRet; -} - -QVector SchedulerDatabase::getJobIDByJobType(int iTypeNo) -{ - QVector jobsID; - QSqlQuery query(m_database); - - QString strsql = QString(" SELECT \ - id \ - FROM \ - jobs \ - WHERE \ - jobs.\"type\" = %1;") - .arg(iTypeNo); - if (query.exec(strsql)) { - //获取所有的有效数据 - while (query.next()) { - jobsID.append(query.value("id").toInt()); - } - if (query.isActive()) { - query.finish(); - } - } else { - qWarning() << query.lastError(); - } - return jobsID; -} -/** - * @brief addJobType 新增日程类型 - * @param iTypeNo 日程类型编码 - * @param strTypeName 日程类型名称 - * @param iColorTypeNo 日程类型对应颜色编码 - * @param iAuthority 日程类型读写权限 - */ -bool SchedulerDatabase::addJobType(const int &iTypeNo, const QString &strTypeName, const int &iColorTypeNo, int iAuthority) -{ - bool bRet = false; - QDateTime currentDateTime = QDateTime::currentDateTime(); - - QSqlQuery query(m_database); - QString strsql = "INSERT INTO JobType (TypeNo, TypeName, ColorTypeNo, CreateTime, Authority)" - " VALUES (:TypeNo, :TypeName, :ColorTypeNo, :CreateTime, :Authority)"; - query.prepare(strsql); - int i = 0; - query.bindValue(i, iTypeNo); - query.bindValue(++i, strTypeName); - query.bindValue(++i, iColorTypeNo); - currentDateTime.setOffsetFromUtc(currentDateTime.offsetFromUtc()); - query.bindValue(++i, currentDateTime); - query.bindValue(++i, iAuthority); - bRet = query.exec(); - if (bRet) { - if (query.isActive()) { - query.finish(); - } - m_database.commit(); - } else { - qDebug() << __FUNCTION__ << query.lastError(); - } - return bRet; -} -/** - * @brief updateJobType 更新日程类型 - * @param iTypeNo 日程类型编码 - * @param strTypeName 日程类型名称 - * @param iColorTypeNo 日程类型对应颜色编码 - */ -bool SchedulerDatabase::updateJobType(const int &iTypeNo, const QString &strTypeName, const int &iColorTypeNo) -{ - bool bRet = false; - - QSqlQuery query(m_database); - //使用占位符的方式更新数据库 - QString strsql = "UPDATE JobType SET TypeName = ?,ColorTypeNo = ? WHERE TypeNo = ?"; - query.prepare(strsql); - int i = 0; - query.bindValue(i, strTypeName); - query.bindValue(++i, iColorTypeNo); - query.bindValue(++i, iTypeNo); - bRet = query.exec(); - if (bRet) { - if (query.isActive()) { - query.finish(); - } - m_database.commit(); - } else { - qWarning() << Q_FUNC_INFO << query.lastError(); - qWarning() << strsql; - } - return bRet; -} -/** - * @brief deleteJobType 删除日程类型 - * @param strTypeNo 日程类型编码 - */ -bool SchedulerDatabase::deleteJobType(const int &iTypeNo) -{ - bool bRet = false; - QSqlQuery query(m_database); - QString strsql = QString("DELETE FROM JobType WHERE TypeNo = %1").arg(iTypeNo); - - query.prepare(strsql); - bRet = query.exec(); - if (bRet) { - if (query.isActive()) { - query.finish(); - } - m_database.commit(); - } else { - qDebug() << __FUNCTION__ << query.lastError(); - } - return bRet; -} - -/** - * @brief getColorTypeList 获取颜色类型json串 - * @param 无 - */ -bool SchedulerDatabase::getColorTypeList(QList &lstColorType) -{ - bool bRet = false; - QSqlQuery query(m_database); - - QString strsql = QString(" SELECT TypeNo, ColorHex, Authority " - " FROM ColorType " - " ORDER BY TypeNo"); - bRet = query.exec(strsql); - if (bRet) { - while (query.next()) { - JobTypeColorInfo colorType; - colorType.setTypeNo(query.value("TypeNo").toInt()); - colorType.setColorHex(query.value("ColorHex").toString()); - colorType.setAuthority(query.value("Authority").toInt()); - lstColorType.append(colorType); - } - } - if (query.isActive()) { - query.finish(); - } - - return bRet; -} -/** - * @brief addColorType 新增颜色类型 - * @param iTypeNo 颜色类型编码 - * @param strColorHex 颜色16进制编码 - * @param iAuthority 颜色类型读写权限 - */ -bool SchedulerDatabase::addColorType(const int &iTypeNo, const QString &strColorHex, const int iAuthority) -{ - bool bRet = false; - QSqlQuery query(m_database); - QString strsql = "INSERT INTO ColorType (TypeNo, ColorHex, Authority) VALUES(:TypeNo, :ColorHex, :Authority)"; - query.prepare(strsql); - int i = 0; - query.bindValue(i, iTypeNo); - query.bindValue(++i, strColorHex); - query.bindValue(++i, iAuthority); - bRet = query.exec(); - if (bRet) { - if (query.isActive()) { - query.finish(); - } - m_database.commit(); - } else { - qDebug() << __FUNCTION__ << query.lastError(); - } - return bRet; -} - -/** - * @brief updateColorType 更新颜色类型 - * @param iTypeNo 颜色类型编码 - * @param strColorHex 颜色16进制编码 - */ -bool SchedulerDatabase::updateColorType(const int &iTypeNo, const QString &strColorHex) -{ - bool bRet = false; - QSqlQuery query(m_database); - QString strsql = "UPDATE ColorType SET strColorHex = ? WHERE TypeNo = ?"; - - query.prepare(strsql); - int i = 0; - query.bindValue(i, strColorHex); - query.bindValue(++i, iTypeNo); - bRet = query.exec(); - if (bRet) { - if (query.isActive()) { - query.finish(); - } - m_database.commit(); - } else { - qDebug() << __FUNCTION__ << query.lastError(); - } - return bRet; -} -/** - * @brief deleteColorType 删除颜色类型 - * @param iTypeNo 颜色类型编码 - */ -bool SchedulerDatabase::deleteColorType(const int &iTypeNo) -{ - bool bRet = false; - QSqlQuery query(m_database); - QString strsql = QString("DELETE FROM ColorType WHERE TypeNo = %1").arg(iTypeNo); - - query.prepare(strsql); - bRet = query.exec(); - if (bRet) { - if (query.isActive()) { - query.finish(); - } - m_database.commit(); - } else { - qDebug() << __FUNCTION__ << query.lastError(); - } - return bRet; -} diff -Nru dde-calendar-5.9.1/calendar-service/src/dbmanager/schedulerdatabase.h dde-calendar-5.10.0/calendar-service/src/dbmanager/schedulerdatabase.h --- dde-calendar-5.9.1/calendar-service/src/dbmanager/schedulerdatabase.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/dbmanager/schedulerdatabase.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,220 +0,0 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: kongyunzhen -* -* Maintainer: kongyunzhen -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ -#ifndef SCHEDULERDATABASE_H -#define SCHEDULERDATABASE_H -#include "src/commondatastruct.h" -#include "src/scheduledatainfo.h" -#include "gtest/gtest_prod.h" - -#include -#include -#include - -class SchedulerDatabase : public QObject -{ - Q_OBJECT -public: - explicit SchedulerDatabase(QObject *parent = nullptr); - void DeleteJob(qint64 id); - QString GetJob(qint64 id); - qint64 CreateJob(const Job &job); - qint64 UpdateJob(const QString &jobInfo); - bool UpdateJobIgnore(const QString &strignore, qint64 id); - QList GetAllOriginJobs(); - QList GetAllOriginJobs(const QString &key, const QString &strsort = QString()); - QList GetAllOriginJobsWithRule(const QString &key, const QString &rules); - QList GetJobsContainRemind(); - /** - * @brief saveRemindJob 存储提醒日程的相关信息 - * @param job 提醒日程 - */ - void saveRemindJob(const Job &job); - - /** - * @brief updateRemindJob 更新对应的稍后提醒日程 - * @param job 日程信息 - */ - void updateRemindJob(const Job &job); - - /** - * @brief deleteRemindJobs 根据日程id删除提醒日程信息 - * @param Ids 日程id集 - */ - void deleteRemindJobs(const QList &Ids); - - /** - * @brief deleteRemindJobs 根据日程id和重复id删除提醒日程信息 - * @param jobID 日程id - * @param recurid 重复id - */ - void deleteRemindJobs(const qlonglong &jobID, const qint64 recurid); - - /** - * @brief getValidRemindJob 获取未提醒的稍后提醒日程 - * @return - */ - QList getValidRemindJob(); - - /** - * @brief clearRemindJobDatabase 清空稍后提醒表 - */ - void clearRemindJobDatabase(); - - /** - * @brief getRemindJob 根据日程id和重复id获取对应的提醒日程 - * @param id 日程id - * @param recurid 重复id - * @return - */ - Job getRemindJob(const qint64 id, const qint64 recurid); - - /** - * @brief getRemindJob 根据日程id获取对应的提醒日程 - * @param id 日程id - * @return - */ - QList getRemindJob(const qint64 id); - - /** - * @brief getNotifyID 获取桌面顶部通知ID - * @param id 日程ID - * @return 通知ID - */ - QVector getNotifyID(const qint64 id); - - /** - * @brief getNotifyID 获取桌面顶部通知ID - * @param jobID 日程ID - * @param recurid 重复id - * @return - */ - int getNotifyID(const qint64 jobID, const qint64 recurid); - - /** - * @brief updateNotifyID 更新桌面顶部通知ID - * @param jobID 日程ID - * @param notifyid 通知ID - */ - void updateNotifyID(const Job &job, int notifyid); - - /** - * @brief getJobTypeByTypeNo 根据类型编号获取日程类型信息 - * @param iTypeNo 日程类型编号 - * @param jobType 日程类型信息 - * @return bool 操作结果 - */ - bool getJobTypeByTypeNo(int iTypeNo, JobTypeInfo &jobType); - /** - * @brief getJobTypeList 获取日程类型列表 - * @return - */ - bool getJobTypeList(QList &lstJobType); - - /** - * @brief isJobTypeUsed 查询日程类型是否被使用 - * @return - */ - bool isJobTypeUsed(int iTypeNo); - /** - * @brief DeleteJobsByJobType 删除使用指定日程类型的全部日程 - * @return - */ - bool DeleteJobsByJobType(int iTypeNo); - - /** - * @brief getJobIDByJobType 根据日程类型获取对应的日程编号 - * @param iTypeNo 日程类型 - * @return - */ - QVector getJobIDByJobType(int iTypeNo); - /** - * @brief addJobType 新增日程类型 - * @param iTypeNo 日程类型编码 - * @param strTypeName 日程类型名称 - * @param iColorTypeNo 日程类型对应颜色编码 - * @param iAuthority 日程类型读写权限 - */ - bool addJobType(const int &iTypeNo, const QString &strTypeName, const int &iColorTypeNo, int iAuthority); - /** - * @brief updateJobType 更新日程类型 - * @param iTypeNo 日程类型编码 - * @param strTypeName 日程类型名称 - * @param iColorTypeNo 日程类型对应颜色编码 - */ - bool updateJobType(const int &iTypeNo, const QString &strTypeName, const int &iColorTypeNo); - /** - * @brief deleteJobType 删除日程类型 - * @param strTypeNo 日程类型编码 - */ - bool deleteJobType(const int &iTypeNo); - - /** - * @brief getColorTypeList 获取颜色类型列表 - * @param lstColorType 颜色类型列表 - * @return 操作结果 - */ - bool getColorTypeList(QList &lstColorType); - /** - * @brief addColorType 新增颜色类型 - * @param iTypeNo 颜色类型编码 - * @param strColorHex 颜色16进制编码 - * @param iAuthority 颜色类型读写权限 - */ - bool addColorType(const int &iTypeNo, const QString &strColorHex, const int iAuthority); - /** - * @brief updateColorType 更新颜色类型 - * @param iTypeNo 颜色类型编码 - * @param strColorHex 颜色16进制编码 - */ - bool updateColorType(const int &iTypeNo, const QString &strColorHex); - /** - * @brief deleteColorType 删除颜色类型 - * @param iTypeNo 颜色类型编码 - */ - bool deleteColorType(const int &iTypeNo); - QString getDbPath() const; - void setDbPath(const QString &dbPath); - -private: - void CreateTables(); - /** - * @brief initJobTypeTables 初始化日程类型,添加默认日程类型、颜色类型 - * @return 无 - */ - void initJobTypeTables(); - void OpenSchedulerDatabase(); - /** - * @brief dateTimeToString 将时间转换为string格式 - * @param dateTime - * @return - */ - QString dateTimeToString(const QDateTime &dateTime); - -signals: - -public slots: - -private: - QSqlDatabase m_database; - QString m_dbPath; -}; - -#endif // SCHEDULERDATABASE_H diff -Nru dde-calendar-5.9.1/calendar-service/src/dbus/dbusnotify.cpp dde-calendar-5.10.0/calendar-service/src/dbus/dbusnotify.cpp --- dde-calendar-5.9.1/calendar-service/src/dbus/dbusnotify.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/dbus/dbusnotify.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,27 +1,11 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: kongyunzhen -* -* Maintainer: kongyunzhen -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "dbusnotify.h" -DBusNotify::DBusNotify(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent) - : QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent) +DBusNotify::DBusNotify(const QString &service, const QString &path, const QString &interface, const QDBusConnection &connection, QObject *parent) + : QDBusAbstractInterface(service, path, interface.toLatin1().data(), connection, parent) { } diff -Nru dde-calendar-5.9.1/calendar-service/src/dbus/dbusnotify.h dde-calendar-5.10.0/calendar-service/src/dbus/dbusnotify.h --- dde-calendar-5.9.1/calendar-service/src/dbus/dbusnotify.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/dbus/dbusnotify.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: kongyunzhen -* -* Maintainer: kongyunzhen -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef DBUSNOTIFY_H #define DBUSNOTIFY_H #include @@ -26,11 +10,7 @@ { Q_OBJECT public: - static inline const char *staticInterfaceName() - { - return "com.deepin.dde.Notification"; - } - explicit DBusNotify(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = nullptr); + explicit DBusNotify(const QString &service, const QString &path, const QString &interface, const QDBusConnection &connection, QObject *parent = nullptr); inline int Notify(const QList &argumentList) { QDBusMessage reply = callWithArgumentList(QDBus::Block, QStringLiteral("Notify"), argumentList); @@ -47,6 +27,7 @@ } return notifyid; } + /** * @brief closeNotification 根据通知ID关闭桌面顶部通知 * @param notifyID 通知ID diff -Nru dde-calendar-5.9.1/calendar-service/src/dbus/dbusuiopenschedule.cpp dde-calendar-5.10.0/calendar-service/src/dbus/dbusuiopenschedule.cpp --- dde-calendar-5.9.1/calendar-service/src/dbus/dbusuiopenschedule.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/dbus/dbusuiopenschedule.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: kongyunzhen -* -* Maintainer: kongyunzhen -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "dbusuiopenschedule.h" DbusUIOpenSchedule::DbusUIOpenSchedule(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent) diff -Nru dde-calendar-5.9.1/calendar-service/src/dbus/dbusuiopenschedule.h dde-calendar-5.10.0/calendar-service/src/dbus/dbusuiopenschedule.h --- dde-calendar-5.9.1/calendar-service/src/dbus/dbusuiopenschedule.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/dbus/dbusuiopenschedule.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: kongyunzhen -* -* Maintainer: kongyunzhen -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef DBUSUIOPENSCHEDULE_H #define DBUSUIOPENSCHEDULE_H #include diff -Nru dde-calendar-5.9.1/calendar-service/src/dbus/dunioniddbus.cpp dde-calendar-5.10.0/calendar-service/src/dbus/dunioniddbus.cpp --- dde-calendar-5.9.1/calendar-service/src/dbus/dunioniddbus.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/dbus/dunioniddbus.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,20 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "dunioniddbus.h" + +DUnionIDDbus::DUnionIDDbus(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent) + : QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent) +{ + if (!this->isValid()) { + qWarning() << "Error connecting remote object, service:" << this->service() << ",path:" << this->path() << ",interface" << this->interface(); + qWarning() << this->lastError(); + + } +} + +DUnionIDDbus::~DUnionIDDbus() +{ + +} diff -Nru dde-calendar-5.9.1/calendar-service/src/dbus/dunioniddbus.h dde-calendar-5.10.0/calendar-service/src/dbus/dunioniddbus.h --- dde-calendar-5.9.1/calendar-service/src/dbus/dunioniddbus.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/dbus/dunioniddbus.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,138 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef DUNIONIDDBUS_H +#define DUNIONIDDBUS_H + +#include "daccount.h" + +#include +#include + +class DUnionIDDbus : public QDBusAbstractInterface +{ + Q_OBJECT +public: + static inline const char *staticInterfaceName() + { + return "com.deepin.utcloud.Daemon"; + } + +public: + explicit DUnionIDDbus(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = nullptr); + + ~DUnionIDDbus(); + +public slots: + /** + * @brief login 调用系统用户登入接口 + * @param + * @return + */ + inline QDBusPendingReply<> login() + { + QList argumentList; + return asyncCallWithArgumentList(QStringLiteral("Login"), argumentList); + } + /** + * @brief logout 调用系统用户登出接口 + * @param + * @return + */ + inline QDBusPendingReply<> logout() + { + QList argumentList; + return asyncCallWithArgumentList(QStringLiteral("Logout"), argumentList); + } + /** + * @brief Upload 云同步上传接口 + * @param key 数据标识或文件绝对路径等 + * @return data 上传成功数据的元信息ID值 + * err 错误信息 + */ + inline QDBusPendingReply Upload(const QString &key) + { + QList argumentList; + argumentList << QVariant::fromValue(key); + return asyncCallWithArgumentList(QStringLiteral("Upload"), argumentList); + } + + /** + * @brief Download 云同步下载接口 + * @param key 数据标识或文件绝对路径等 + * path1 指定缓存数据的路径 + * @return path2 下载数据的路径 + * err 错误信息 + */ + inline QDBusPendingReply Download(const QString &key, const QString &path1) + { + QList argumentList; + argumentList << QVariant::fromValue(key) << QVariant::fromValue(path1); + return asyncCallWithArgumentList(QStringLiteral("Download"), argumentList); + } + + /** + * @brief Delete 云同步删除接口 + * @param key 数据标识或文件绝对路径等 + * @return id 删除id + * err 错误信息 + */ + inline QDBusPendingReply Delete(const QString &key) + { + QList argumentList; + argumentList << QVariant::fromValue(key); + return asyncCallWithArgumentList(QStringLiteral("Delete"), argumentList); + } + + /** + * @brief Metadata 元数据获取接口 + * @param key 数据标识或文件绝对路径等 + * @return meta 元数据信息 + * err 错误信息 + */ + inline QDBusPendingReply Metadata(const QString &key) + { + QList argumentList; + argumentList << QVariant::fromValue(key); + return asyncCallWithArgumentList(QStringLiteral("Metadata"), argumentList); + } + + /** + * @brief SwitcherGet 获取总开关状态 + * @param + * @return + * + */ + inline QDBusPendingReply SwitcherDump() + { + QList argumentList; + return asyncCallWithArgumentList(QStringLiteral("SwitcherDump"), argumentList); + } + + /** + * @brief SwitcherGet 获取指定应用的开关状态 + * @param arg 指定应用云同步的绝对路径 + * @return + * + */ + inline QDBusPendingReply SwitcherGet(const QString &arg) + { + QList argumentList; + argumentList << QVariant::fromValue(arg); + return asyncCallWithArgumentList(QStringLiteral("SwitcherGet"), argumentList); + } + + +}; + + +namespace com { +namespace deepin { +namespace sync { +typedef ::DUnionIDDbus cloudopt; +} +} +} + +#endif // DUNIONIDDBUS_H diff -Nru dde-calendar-5.9.1/calendar-service/src/dbusservice/daccountmanagerservice.cpp dde-calendar-5.10.0/calendar-service/src/dbusservice/daccountmanagerservice.cpp --- dde-calendar-5.9.1/calendar-service/src/dbusservice/daccountmanagerservice.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/dbusservice/daccountmanagerservice.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,147 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "daccountmanagerservice.h" +#include "units.h" +#include "calendarprogramexitcontrol.h" + +#include +#include +#include + +DAccountManagerService::DAccountManagerService(QObject *parent) + : DServiceBase(serviceBasePath + "/AccountManager", serviceBaseName + ".AccountManager", parent) + , m_accountManager(new DAccountManageModule(this)) +{ + //自动退出 + DServiceExitControl exitControl; + connect(m_accountManager.data(), &DAccountManageModule::signalLoginStatusChange, this, &DAccountManagerService::accountUpdate); + + connect(m_accountManager.data(), &DAccountManageModule::firstDayOfWeekChange, this, [&]() { + notifyPropertyChanged(getInterface(), "firstDayOfWeek"); + }); + connect(m_accountManager.data(), &DAccountManageModule::timeFormatTypeChange, this, [&]() { + notifyPropertyChanged(getInterface(), "timeFormatType"); + }); +} + +QString DAccountManagerService::getAccountList() +{ + DServiceExitControl exitControl; + if (!clientWhite(0)) { + return QString(); + } + return m_accountManager->getAccountList(); +} + +void DAccountManagerService::remindJob(const QString &accountID, const QString &alarmID) +{ + DServiceExitControl exitControl; + m_accountManager->remindJob(accountID, alarmID); +} + +void DAccountManagerService::updateRemindJob(bool isClear) +{ + DServiceExitControl exitControl; + m_accountManager->updateRemindSchedules(isClear); +} + +void DAccountManagerService::notifyMsgHanding(const QString &accountID, const QString &alarmID, const qint32 operationNum) +{ + DServiceExitControl exitControl; + m_accountManager->notifyMsgHanding(accountID, alarmID, operationNum); +} + +void DAccountManagerService::downloadByAccountID(const QString &accountID) +{ + //TODO:云同步获取数据 + DServiceExitControl exitControl; + m_accountManager->downloadByAccountID(accountID); +} + +void DAccountManagerService::uploadNetWorkAccountData() +{ + //TODO:云同步上传数据 + DServiceExitControl exitControl; + m_accountManager->uploadNetWorkAccountData(); +} + +QString DAccountManagerService::getCalendarGeneralSettings() +{ + DServiceExitControl exitControl; + if (!clientWhite(0)) { + return QString(); + } + return m_accountManager->getCalendarGeneralSettings(); +} + +void DAccountManagerService::setCalendarGeneralSettings(const QString &cgSet) +{ + DServiceExitControl exitControl; + if (!clientWhite(0)) { + return; + } + m_accountManager->setCalendarGeneralSettings(cgSet); +} + +void DAccountManagerService::calendarIsShow(const bool &isShow) +{ + DServiceExitControl exitControl; + if (!clientWhite(0)) { + return; + } + exitControl.setClientIsOpen(isShow); + m_accountManager->calendarOpen(isShow); +} + +void DAccountManagerService::login() +{ + DServiceExitControl exitControl; + if (!clientWhite(0)) { + return; + } + m_accountManager->login(); +} + +void DAccountManagerService::logout() +{ + DServiceExitControl exitControl; + if (!clientWhite(0)) { + return; + } + m_accountManager->logout(); +} + +bool DAccountManagerService::isSupportUid() +{ + DServiceExitControl exitControl; + if (!clientWhite(0)) { + return false; + } + return m_accountManager->isSupportUid(); +} + +int DAccountManagerService::getfirstDayOfWeek() const +{ + DServiceExitControl exitControl; + return m_accountManager->getfirstDayOfWeek(); +} + +void DAccountManagerService::setFirstDayOfWeek(const int firstday) +{ + DServiceExitControl exitControl; + m_accountManager->setFirstDayOfWeek(firstday); +} + +int DAccountManagerService::getTimeFormatType() const +{ + DServiceExitControl exitControl; + return m_accountManager->getTimeFormatType(); +} + +void DAccountManagerService::setTimeFormatType(const int timeType) +{ + DServiceExitControl exitControl; + m_accountManager->setTimeFormatType(timeType); +} diff -Nru dde-calendar-5.9.1/calendar-service/src/dbusservice/daccountmanagerservice.h dde-calendar-5.10.0/calendar-service/src/dbusservice/daccountmanagerservice.h --- dde-calendar-5.9.1/calendar-service/src/dbusservice/daccountmanagerservice.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/dbusservice/daccountmanagerservice.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,74 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef ACCOUNTMANAGERSERVICE_H +#define ACCOUNTMANAGERSERVICE_H + +#include "dservicebase.h" +#include "daccountmanagemodule.h" + +#include + +/** + * @brief The DAccountManagerService class 帐户管理服务 + */ + +class DAccountManagerService : public DServiceBase +{ + Q_OBJECT + Q_CLASSINFO("D-Bus Interface", "com.deepin.dataserver.Calendar.AccountManager") + Q_PROPERTY(int firstDayOfWeek READ getfirstDayOfWeek WRITE setFirstDayOfWeek) + Q_PROPERTY(int timeFormatType READ getTimeFormatType WRITE setTimeFormatType) +public: + explicit DAccountManagerService(QObject *parent = nullptr); +public slots: + /** + * @brief getAccountList 获取帐户列表 + * @return + */ + Q_SCRIPTABLE QString getAccountList(); + //稍后提醒相关接口 + Q_SCRIPTABLE void remindJob(const QString &accountID, const QString &alarmID); + + /** + * @brief updateRemindJob 每隔10分钟更新提醒日程 + * @param isClear 是否情况日程定时任务数据库 + */ + Q_SCRIPTABLE void updateRemindJob(bool isClear); + + /** + * @brief notifyMsgHanding 通知提示框交互处理 + * @param alarmID 提醒任务id + * @param operationNum 操作编号 , 1:打开日历,2:稍后提醒 3: 明天提醒 4: 提前1天提醒 5:关闭按钮 + */ + Q_SCRIPTABLE void notifyMsgHanding(const QString &accountID, const QString &alarmID, const qint32 operationNum); + + Q_SCRIPTABLE void downloadByAccountID(const QString &accountID); + Q_SCRIPTABLE void uploadNetWorkAccountData(); + //获取通用设置 + Q_SCRIPTABLE QString getCalendarGeneralSettings(); + //设置通用设置 + Q_SCRIPTABLE void setCalendarGeneralSettings(const QString &cgSet); + //日历打开关闭 + Q_SCRIPTABLE void calendarIsShow(const bool &isShow); + //账户登录 + Q_SCRIPTABLE void login(); + //账户登出 + Q_SCRIPTABLE void logout(); + //是否支持云同步 + Q_SCRIPTABLE bool isSupportUid(); + +signals: + Q_SCRIPTABLE void accountUpdate(); +private: + int getfirstDayOfWeek() const; + void setFirstDayOfWeek(const int firstday); + int getTimeFormatType() const; + void setTimeFormatType(const int timeType); + +private: + DAccountManageModule::Ptr m_accountManager; +}; + +#endif // ACCOUNTMANAGERSERVICE_H diff -Nru dde-calendar-5.9.1/calendar-service/src/dbusservice/daccountservice.cpp dde-calendar-5.10.0/calendar-service/src/dbusservice/daccountservice.cpp --- dde-calendar-5.9.1/calendar-service/src/dbusservice/daccountservice.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/dbusservice/daccountservice.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,182 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "daccountservice.h" +#include "calendarprogramexitcontrol.h" + +DAccountService::DAccountService(const QString &path, const QString &interface, const DAccountModule::Ptr &accountModule, QObject *parent) + : DServiceBase(path, interface, parent) + , m_accountModel(accountModule) +{ + connect(m_accountModel.data(), &DAccountModule::signalScheduleUpdate, this, &DAccountService::scheduleUpdate); + connect(m_accountModel.data(), &DAccountModule::signalScheduleTypeUpdate, this, &DAccountService::scheduleTypeUpdate); + + connect(m_accountModel.data(), &DAccountModule::signalAccountState, this, [&]() { + notifyPropertyChanged(getInterface(), "accountState"); + }); + connect(m_accountModel.data(), &DAccountModule::signalSyncState, this, [&]() { + notifyPropertyChanged(getInterface(), "syncState"); + }); + connect(m_accountModel.data(), &DAccountModule::signalDtLastUpdate, this, [&]() { + notifyPropertyChanged(getInterface(), "dtLastUpdate"); + }); +} + +QString DAccountService::getAccountInfo() +{ + //如果不在白名单内直接放回无效值 + DServiceExitControl exitControl; + if (!clientWhite(m_accountModel->account()->accountType())) { + return QString(); + } + return m_accountModel->getAccountInfo(); +} + +QString DAccountService::getScheduleTypeList() +{ + DServiceExitControl exitControl; + if (!clientWhite(m_accountModel->account()->accountType())) { + return QString(); + } + return m_accountModel->getScheduleTypeList(); +} + +QString DAccountService::getScheduleTypeByID(const QString &typeID) +{ + DServiceExitControl exitControl; + if (!clientWhite(m_accountModel->account()->accountType())) { + return QString(); + } + return m_accountModel->getScheduleTypeByID(typeID); +} + +QString DAccountService::createScheduleType(const QString &typeInfo) +{ + DServiceExitControl exitControl; + if (!clientWhite(m_accountModel->account()->accountType())) { + return QString(); + } + return m_accountModel->createScheduleType(typeInfo); +} + +bool DAccountService::updateScheduleType(const QString &typeInfo) +{ + DServiceExitControl exitControl; + if (!clientWhite(m_accountModel->account()->accountType())) { + return false; + } + return m_accountModel->updateScheduleType(typeInfo); +} + +bool DAccountService::deleteScheduleTypeByID(const QString &typeID) +{ + DServiceExitControl exitControl; + if (!clientWhite(m_accountModel->account()->accountType())) { + return false; + } + return m_accountModel->deleteScheduleTypeByID(typeID); +} + +bool DAccountService::scheduleTypeByUsed(const QString &typeID) +{ + DServiceExitControl exitControl; + if (!clientWhite(m_accountModel->account()->accountType())) { + return false; + } + return m_accountModel->scheduleTypeByUsed(typeID); +} + +QString DAccountService::createSchedule(const QString &scheduleInfo) +{ + DServiceExitControl exitControl; + if (!clientWhite(m_accountModel->account()->accountType())) { + return QString(); + } + return m_accountModel->createSchedule(scheduleInfo); +} + +bool DAccountService::updateSchedule(const QString &scheduleInfo) +{ + DServiceExitControl exitControl; + if (!clientWhite(m_accountModel->account()->accountType())) { + return false; + } + return m_accountModel->updateSchedule(scheduleInfo); +} + +QString DAccountService::getScheduleByScheduleID(const QString &scheduleID) +{ + DServiceExitControl exitControl; + if (!clientWhite(m_accountModel->account()->accountType())) { + return QString(); + } + return m_accountModel->getScheduleByScheduleID(scheduleID); +} + +bool DAccountService::deleteScheduleByScheduleID(const QString &scheduleID) +{ + DServiceExitControl exitControl; + if (!clientWhite(m_accountModel->account()->accountType())) { + return false; + } + return m_accountModel->deleteScheduleByScheduleID(scheduleID); +} + +QString DAccountService::querySchedulesWithParameter(const QString ¶ms) +{ + DServiceExitControl exitControl; + if (!clientWhite(m_accountModel->account()->accountType())) { + return QString(); + } + return m_accountModel->querySchedulesWithParameter(params); +} + +QString DAccountService::getSysColors() +{ + DServiceExitControl exitControl; + if (!clientWhite(m_accountModel->account()->accountType())) { + return QString(); + } + return m_accountModel->getSysColors(); +} + +bool DAccountService::getExpand() +{ + return m_accountModel->getExpand(); +} + +void DAccountService::setExpand(const bool &isExpand) +{ + m_accountModel->setExpand(isExpand); +} + +int DAccountService::getAccountState() +{ + return m_accountModel->getAccountState(); +} + +void DAccountService::setAccountState(const int accountState) +{ + m_accountModel->setAccountState(accountState); +} + +int DAccountService::getSyncState() +{ + return m_accountModel->getSyncState(); +} + +QString DAccountService::getSyncFreq() +{ + return m_accountModel->getSyncFreq(); +} + +void DAccountService::setSyncFreq(const QString &freq) +{ + m_accountModel->setSyncFreq(freq); +} + +QString DAccountService::getDtLastUpdate() +{ + return m_accountModel->getDtLastUpdate(); +} diff -Nru dde-calendar-5.9.1/calendar-service/src/dbusservice/daccountservice.h dde-calendar-5.10.0/calendar-service/src/dbusservice/daccountservice.h --- dde-calendar-5.9.1/calendar-service/src/dbusservice/daccountservice.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/dbusservice/daccountservice.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,138 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef ACCOUNTSERVICE_H +#define ACCOUNTSERVICE_H + +#include "dservicebase.h" +#include "daccountmodule.h" +#include "units.h" + +#include + +class DAccountService : public DServiceBase +{ + Q_OBJECT + Q_CLASSINFO("D-Bus Interface", accountServiceInterface) + Q_PROPERTY(bool isExpand READ getExpand WRITE setExpand) + Q_PROPERTY(int accountState READ getAccountState WRITE setAccountState) + Q_PROPERTY(int syncState READ getSyncState) + Q_PROPERTY(QString syncFreq READ getSyncFreq WRITE setSyncFreq) + Q_PROPERTY(QString dtLastUpdate READ getDtLastUpdate) +public: + typedef QSharedPointer Ptr; + + DAccountService(const QString &path, const QString &interface, const DAccountModule::Ptr &accountModule, QObject *parent = nullptr); +public slots: + /** + * @brief getAccountInfo 获取帐户信息 + * @return + */ + Q_SCRIPTABLE QString getAccountInfo(); + /** + * @brief getScheduleTypeList 获取日程类型信息集 + * @return + */ + Q_SCRIPTABLE QString getScheduleTypeList(); + + /** + * @brief getScheduleTypeByID 根据日程类型ID获取日程类型信息 + * @param typeID 日程类型ID + * @return + */ + Q_SCRIPTABLE QString getScheduleTypeByID(const QString &typeID); + + /** + * @brief createScheduleType 创建日程类型 + * @param typeInfo 类型信息 + * @return 日程类型ID + */ + Q_SCRIPTABLE QString createScheduleType(const QString &typeInfo); + + /** + * @brief updateScheduleType 更新日程类型 + * @param typeInfo 类型信息 + * @return 是否成功,true:更新成功 + */ + Q_SCRIPTABLE bool updateScheduleType(const QString &typeInfo); + + /** + * @brief deleteScheduleTypeByID 根据日程类型ID删除日程类型 + * @param typeID 日程类型ID + * @return 是否成功,true:更新成功 + */ + Q_SCRIPTABLE bool deleteScheduleTypeByID(const QString &typeID); + + /** + * @brief scheduleTypeByUsed 日程类型是否被使用 + * @param typeID 日程类型ID + * @return + */ + Q_SCRIPTABLE bool scheduleTypeByUsed(const QString &typeID); + + /** + * @brief createSchedule 创建日程 + * @param ScheduleInfo 日程信息 + * @return 返回日程ID + */ + Q_SCRIPTABLE QString createSchedule(const QString &scheduleInfo); + + /** + * @brief updateSchedule 更新日程 + * @param ScheduleInfo 日程信息 + * @return 是否成功,true:更新成功 + */ + Q_SCRIPTABLE bool updateSchedule(const QString &scheduleInfo); + + /** + * @brief getScheduleByScheduleID 根据日程id获取日程信息 + * @param scheduleID 日程id + * @return 日程信息 + */ + Q_SCRIPTABLE QString getScheduleByScheduleID(const QString &scheduleID); + + /** + * @brief deleteScheduleByScheduleID 根据日程ID删除日程 + * @param ScheduleID 日程ID + * @return 是否成功,true:删除成功 + */ + Q_SCRIPTABLE bool deleteScheduleByScheduleID(const QString &scheduleID); + + /** + * @brief querySchedulesWithParameter 根据查询参数查询日程 + * @param params 具体的查询参数 + * @return 查询到的日程集 + */ + Q_SCRIPTABLE QString querySchedulesWithParameter(const QString ¶ms); + + ///////获取内置类型颜色 + + Q_SCRIPTABLE QString getSysColors(); + +signals: + //日程更新信号,日程颜色更新信号 + void scheduleUpdate(); + void scheduleTypeUpdate(); + +private: + //帐户列表是否展开 + bool getExpand(); + void setExpand(const bool &isExpand); + //帐户状态。 + int getAccountState(); + void setAccountState(const int accountState); + //获取同步状态 + int getSyncState(); + //设置同步频率相关信息 + QString getSyncFreq(); + void setSyncFreq(const QString &freq); + //获取最后一次同步时间 + QString getDtLastUpdate(); + +public slots: +private: + DAccountModule::Ptr m_accountModel; +}; + +#endif // ACCOUNTSERVICE_H diff -Nru dde-calendar-5.9.1/calendar-service/src/dbusservice/dhuangliservice.cpp dde-calendar-5.10.0/calendar-service/src/dbusservice/dhuangliservice.cpp --- dde-calendar-5.9.1/calendar-service/src/dbusservice/dhuangliservice.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/dbusservice/dhuangliservice.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,76 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "dhuangliservice.h" +#include "units.h" + +#include "calendarprogramexitcontrol.h" + +DHuangliService::DHuangliService(QObject *parent) + : DServiceBase(serviceBasePath + "/HuangLi", serviceBaseName + ".HuangLi", parent) + , m_huangli(new CalendarHuangLi(this)) +{ + CaLunarDayInfo::registerMetaType(); + CaLunarMonthInfo::registerMetaType(); + CaHuangLiDayInfo::registerMetaType(); + CaHuangLiMonthInfo::registerMetaType(); +} + +//获取指定公历月的假日信息 +QString DHuangliService::getFestivalMonth(quint32 year, quint32 month) +{ + DServiceExitControl exitControl; + if (!clientWhite(0)) { + return QString(); + } + QString festivalInfo = m_huangli->getFestivalMonth(year, month); + return festivalInfo; +} + +//获取指定公历日的黄历信息 +QString DHuangliService::getHuangLiDay(quint32 year, quint32 month, quint32 day) +{ + + if( 0 >= year || 0 >= month || 0 >= day) + return ""; + DServiceExitControl exitControl; + if (!clientWhite(0)) { + return QString(); + } + QString huangliInfo = m_huangli->getHuangLiDay(year, month, day); + return huangliInfo; +} + +//获取指定公历月的黄历信息 +QString DHuangliService::getHuangLiMonth(quint32 year, quint32 month, bool fill) +{ + DServiceExitControl exitControl; + if (!clientWhite(0)) { + return QString(); + } + QString huangliInfo = m_huangli->getHuangLiMonth(year, month, fill); + return huangliInfo; +} + +//通过公历获取阴历信息 +CaLunarDayInfo DHuangliService::getLunarInfoBySolar(quint32 year, quint32 month, quint32 day) +{ + DServiceExitControl exitControl; + if (!clientWhite(0)) { + return CaLunarDayInfo(); + } + CaLunarDayInfo huangliInfo = m_huangli->getLunarInfoBySolar(year, month, day); + return huangliInfo; +} + +//获取阴历月信息 +CaLunarMonthInfo DHuangliService::getLunarMonthCalendar(quint32 year, quint32 month, bool fill) +{ + DServiceExitControl exitControl; + if (!clientWhite(0)) { + return CaLunarMonthInfo(); + } + CaLunarMonthInfo huangliInfo = m_huangli->getLunarCalendarMonth(year, month, fill); + return huangliInfo; +} diff -Nru dde-calendar-5.9.1/calendar-service/src/dbusservice/dhuangliservice.h dde-calendar-5.10.0/calendar-service/src/dbusservice/dhuangliservice.h --- dde-calendar-5.9.1/calendar-service/src/dbusservice/dhuangliservice.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/dbusservice/dhuangliservice.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,31 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef HUANGLISERVICE_H +#define HUANGLISERVICE_H + +#include "dservicebase.h" +#include "huangliData/dbusdatastruct.h" +#include "calendarhuangli.h" + +/** + * @brief The DHuangliService class 黄历服务 + */ +class DHuangliService : public DServiceBase +{ + Q_OBJECT + Q_CLASSINFO("D-Bus Interface", "com.deepin.dataserver.HuangLi") +public: + explicit DHuangliService(QObject *parent = nullptr); +public slots: + Q_SCRIPTABLE QString getFestivalMonth(quint32 year, quint32 month); + Q_SCRIPTABLE QString getHuangLiDay(quint32 year, quint32 month, quint32 day); + Q_SCRIPTABLE QString getHuangLiMonth(quint32 year, quint32 month, bool fill); + Q_SCRIPTABLE CaLunarDayInfo getLunarInfoBySolar(quint32 year, quint32 month, quint32 day); + Q_SCRIPTABLE CaLunarMonthInfo getLunarMonthCalendar(quint32 year, quint32 month, bool fill); +private: + CalendarHuangLi *m_huangli; +}; + +#endif // HUANGLISERVICE_H diff -Nru dde-calendar-5.9.1/calendar-service/src/dbusservice/dservicebase.cpp dde-calendar-5.10.0/calendar-service/src/dbusservice/dservicebase.cpp --- dde-calendar-5.9.1/calendar-service/src/dbusservice/dservicebase.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/dbusservice/dservicebase.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,74 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "dservicebase.h" + +#include +#include +#include +#include + +DServiceBase::DServiceBase(const QString &path, const QString &interface, QObject *parent) + : QObject(parent) + , m_path(path) + , m_interface(interface) +{ +} + +QString DServiceBase::getPath() const +{ + return m_path; +} + +QString DServiceBase::getInterface() const +{ + return m_interface; +} + +QString DServiceBase::getClientName() +{ + uint pid = QDBusConnection::sessionBus().interface()->servicePid(message().service()); + QString name; + QFile file(QString("/proc/%1/status").arg(pid)); + if (file.open(QFile::ReadOnly)) { + name = QString(file.readLine()).section(QRegExp("([\\t ]*:[\\t ]*|\\n)"), 1, 1); + file.close(); + } + return name; +} + +bool DServiceBase::clientWhite(const int index) +{ +// DeepinAIAssista +#ifdef CALENDAR_SERVICE_AUTO_EXIT + //根据编号,获取不同到白名单 + static QVector whiteList {{"dde-calendar", "DeepinAIAssistant"}, {"dde-calendar"}, {"dde-calendar"}}; + if (whiteList.size() < index) { + return false; + } + for (int i = 0; i < whiteList.at(index).size(); ++i) { + if (whiteList.at(index).at(i).contains(getClientName())) { + return true; + } + } + return false; +#else + Q_UNUSED(index) + return true; +#endif +} + +void DServiceBase::notifyPropertyChanged(const QString &interface, const QString &propertyName) +{ + QDBusMessage signal = QDBusMessage::createSignal( + getPath(), + "org.freedesktop.DBus.Properties", + "PropertiesChanged"); + signal << interface; + QVariantMap changedProps; + changedProps.insert(propertyName, property(propertyName.toUtf8())); + signal << changedProps; + signal << QStringList(); + QDBusConnection::sessionBus().send(signal); +} diff -Nru dde-calendar-5.9.1/calendar-service/src/dbusservice/dservicebase.h dde-calendar-5.10.0/calendar-service/src/dbusservice/dservicebase.h --- dde-calendar-5.9.1/calendar-service/src/dbusservice/dservicebase.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/dbusservice/dservicebase.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,33 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef DSERVICEBASE_H +#define DSERVICEBASE_H + +#include +#include + +/** + * @brief The serviceBase class 服务基类 + */ +class DServiceBase : public QObject + , protected QDBusContext +{ + Q_OBJECT +public: + explicit DServiceBase(const QString &path, const QString &interface, QObject *parent = nullptr); + QString getPath() const; + QString getInterface() const; + +protected: + QString getClientName(); + bool clientWhite(const int index); + void notifyPropertyChanged(const QString &interface, const QString &propertyName); + +private: + QString m_path; + QString m_interface; +}; + +#endif // DSERVICEBASE_H diff -Nru dde-calendar-5.9.1/calendar-service/src/dbusservice/dservicemanager.cpp dde-calendar-5.10.0/calendar-service/src/dbusservice/dservicemanager.cpp --- dde-calendar-5.9.1/calendar-service/src/dbusservice/dservicemanager.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/dbusservice/dservicemanager.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,54 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "dservicemanager.h" + +#include "dhuangliservice.h" +#include "daccountmanagerservice.h" +#include "units.h" + +#include "dbuscloudsync.h" +#include +#include + + +DServiceManager::DServiceManager(QObject *parent) + : QObject(parent) +{ + //注册服务 + QDBusConnection sessionBus = QDBusConnection::sessionBus(); + if (!sessionBus.registerService(serviceBaseName)) { + qCritical() << "registerService failed:" << sessionBus.lastError(); + exit(0x0001); + } + + QDBusConnection::RegisterOptions options = QDBusConnection::ExportAllSlots | QDBusConnection::ExportAllSignals | QDBusConnection::ExportAllProperties; + //创建黄历服务 + DServiceBase *huangliService = new class DHuangliService(this); + if (!sessionBus.registerObject(huangliService->getPath(), huangliService->getInterface(), huangliService, options)) { + qCritical() << "registerObject huangliService failed:" << sessionBus.lastError(); + exit(0x0002); + } + + //创建帐户管理服务 + m_accountManagerService = new class DAccountManagerService(this); + if (!sessionBus.registerObject(m_accountManagerService->getPath(), m_accountManagerService->getInterface(), m_accountManagerService, options)) { + qCritical() << "registerObject accountManagerService failed:" << sessionBus.lastError(); + exit(0x0003); + } + + //创建云同步回调服务 + DServiceBase *cloudsyncService = new class Dbuscloudsync(this); + if (!sessionBus.registerObject(cloudsyncService->getPath(), cloudsyncService->getInterface(), cloudsyncService, options)) { + qCritical() << "registerObject cloudsyncService failed:" << sessionBus.lastError(); + exit(0x0004); + } +} + +void DServiceManager::updateRemindJob() +{ + if(nullptr != m_accountManagerService){ + m_accountManagerService->updateRemindJob(false); + } +} diff -Nru dde-calendar-5.9.1/calendar-service/src/dbusservice/dservicemanager.h dde-calendar-5.10.0/calendar-service/src/dbusservice/dservicemanager.h --- dde-calendar-5.9.1/calendar-service/src/dbusservice/dservicemanager.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/dbusservice/dservicemanager.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,28 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef SERVICEMANAGER_H +#define SERVICEMANAGER_H + +#include "daccountmanagerservice.h" + +/** + * @brief The DServiceManager class 服务管理类 + */ +class DServiceManager : public QObject +{ + Q_OBJECT +public: + explicit DServiceManager(QObject *parent = nullptr); + + void updateRemindJob(); + +signals: + +public slots: +private: + DAccountManagerService *m_accountManagerService = nullptr; +}; + +#endif // SERVICEMANAGER_H diff -Nru dde-calendar-5.9.1/calendar-service/src/jobremindmanager.cpp dde-calendar-5.10.0/calendar-service/src/jobremindmanager.cpp --- dde-calendar-5.9.1/calendar-service/src/jobremindmanager.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/jobremindmanager.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,365 +0,0 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: kongyunzhen -* -* Maintainer: kongyunzhen -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ -#include "jobremindmanager.h" -#include "src/utils.h" -#include "dbus/dbusuiopenschedule.h" -#include "dbus/dbusnotify.h" -#include "csystemdtimercontrol.h" - -#include -#include - -#define Millisecond 1 -#define Second 1000 * Millisecond -#define Minute 60 * Second -#define Hour 60 * Minute - -static QString notifyActKeyDefault("default"); -static QString notifyActKeyClose("close"); -static QString notifyActKeyRemindLater("later"); -static QString notifyActKeyRemindAfter15mins("later-15mins"); -static QString notifyActKeyRemindAfter1hour("later-1hour"); -static QString notifyActKeyRemindAfter4hours("later-4hours"); -static QString notifyActKeyRemind1DayBefore("one-day-before"); -static QString notifyActKeyRemindTomorrow("tomorrow"); -static QString layoutHM("15:04"); - -JobRemindManager::JobRemindManager(QObject *parent) - : QObject(parent) -{ - m_dbusuiopen = new DbusUIOpenSchedule("com.deepin.Calendar", - "/com/deepin/Calendar", - QDBusConnection::sessionBus(), - this); - m_dbusnotify = new DBusNotify("com.deepin.dde.Notification", - "/com/deepin/dde/Notification", - QDBusConnection::sessionBus(), - this); - //若没开启定时任务则开启定时任务 - CSystemdTimerControl systemdTimer; - systemdTimer.startCalendarServiceSystemdTimer(); -} - -/** - * @brief CallUiOpenSchedule 激活日历前端使之跳转到日视图并弹出编辑框 - * @param job 日程信息 - */ -void JobRemindManager::CallUiOpenSchedule(const Job &job) -{ - QJsonObject obj = Utils::JobToObject(job); - QJsonDocument doc; - doc.setObject(obj); - QString strjson(doc.toJson(QJsonDocument::Compact)); - m_dbusuiopen->OpenSchedule(strjson); -} - -/** - * @brief RemindJob 日程提醒 - * 日程相关信息获取调用dbus服务弹出提醒窗口,并将返回id作为key,job作为value - * 插入m_notifymap,等待后续提醒弹窗被点击后操作 - * @param job 日程信息 - */ -void JobRemindManager::RemindJob(const Job &job) -{ - if (!job.Remind.isEmpty()) { - int nDays = GetRemindAdvanceDays(job.Remind); - if (-1 != nDays) { - qint64 duration = 0; - bool bmax = GetRemindLaterDuration(job.RemindLaterCount, duration); - QStringList actionlist; - QVariantMap hints; - QString cmd = QString("dbus-send --session --print-reply --dest=com.deepin.dataserver.Calendar " - "/com/deepin/dataserver/Calendar com.deepin.dataserver.Calendar.notifyMsgHanding int64:%1 int64:%2 ") - .arg(job.ID) - .arg(job.RecurID); - auto argMake = [&](int operationNum, const QString &text, const QString &transText) { - actionlist << text << transText; - hints.insert("x-deepin-action-" + text, QString("/bin/bash,-c,%1 int32:%2").arg(cmd).arg(operationNum)); - }; - - QDateTime tm = QDateTime::currentDateTime(); - if (tm < job.Start) { - //如果提醒规则大于3天且是第二次提醒 - if (nDays >= 3 && job.RemindLaterCount == 1) { - //default对应的是默认操作,也就是在点击空白区域会出发的操作 - argMake(1, notifyActKeyDefault, ""); - argMake(5, notifyActKeyClose, tr("Close", "button")); - //当前时间与开始时间间隔大于1天 - if (tm < job.Start.addDays(-1)) - argMake(4, notifyActKeyRemind1DayBefore, tr("One day before start")); - - } else if ((nDays == 1 || nDays == 2) && bmax) { - argMake(1, notifyActKeyDefault, ""); - argMake(5, notifyActKeyClose, tr("Close", "button")); - argMake(3, notifyActKeyRemindTomorrow, tr("Remind me tomorrow")); - - } else { - argMake(1, notifyActKeyDefault, ""); - argMake(5, notifyActKeyClose, tr("Close", "button")); - argMake(2, notifyActKeyRemindLater, tr("Remind me later")); - //后面的actions会在拉列表中显示 - argMake(21, notifyActKeyRemindAfter15mins, tr("15 mins later")); - argMake(22, notifyActKeyRemindAfter1hour, tr("1 hour later")); - argMake(23, notifyActKeyRemindAfter4hours, tr("4 hours later")); - argMake(3, notifyActKeyRemindTomorrow, tr("Tomorrow")); - } - } else { - argMake(1, notifyActKeyDefault, ""); - argMake(5, notifyActKeyClose, tr("Close", "button")); - } - - QString title(tr("Schedule Reminder")); - QString body = GetRemindBody(job, QDateTime::currentDateTime()); - QString appicon("dde-calendar"); - QString appname("dde-calendar"); - quint32 replaces_id = 0; - qint32 timeout = 0; - QList argumentList; - argumentList << appname << replaces_id << appicon << title << body << actionlist << hints << timeout; - qDebug() << __FUNCTION__ << QString("remind now: %1, title:" - " %2, body: %3") - .arg(QDateTime::currentDateTime().toString()) - .arg(title) - .arg(body); - int notifyid = m_dbusnotify->Notify(argumentList); - //将获取到的通知弹框id保存 - emit saveNotifyID(job, notifyid); - } else { - qDebug() << __FUNCTION__ << QString("remind job failed id=%1").arg(job.ID); - } - } -} - -//通知提示框交互处理 -void JobRemindManager::notifyMsgHanding(const Job &job, const int operationNum) -{ - switch (operationNum) { - case 1: - //打开日历 - CallUiOpenSchedule(job); - break; - case 2://稍后提醒 - case 21://15min后提醒 - case 22://一个小时后提醒 - case 23://四个小时后提醒 - case 3://明天提醒 - case 4://提前一天提醒 - RemindJobLater(job, operationNum); - break; - default: - break; - } -} - -void JobRemindManager::closeNotification(quint32 notifyID) -{ - m_dbusnotify->closeNotification(notifyID); -} - -/** - * @brief GetRemindAdvanceDays 根据提醒规则获取提前提醒天数 - * @param remind 提醒规则 - * @return 返回天数值 - */ -int JobRemindManager::GetRemindAdvanceDays(const QString &remind) -{ - int nDays = 0, min = 0; - QRegExp reg("\\d;\\d\\d:\\d\\d"); - // QRegExp reg("\\d;\\d+?:\\d+?"); - if (reg.exactMatch(remind)) { - int hour; - int ret = sscanf(remind.toStdString().c_str(), "%d;%d:%d", &nDays, &hour, &min); - if (-1 == ret) { - nDays = -1; - } - } else { - bool bok = false; - min = remind.toInt(&bok); - if (bok) { - nDays = int(float(min) / float(24 * 60)); - } else { - nDays = -1; - } - } - - return nDays; -} - -/** - * @brief GetRemindLaterDuration 根据提醒次数获取下一次提醒距现在的时间间隔 - * @param count 该日程已经提醒的次数 - * @param duration 下一次提醒距离现在的时间间隔单位毫秒 - * @return bool 是否超过一小时 - */ -bool JobRemindManager::GetRemindLaterDuration(int count, qint64 &duration) -{ - bool bmax = false; - duration = (10 + ((count - 1) * 5)) * Minute; //下一次提醒距离现在的时间间隔,单位毫秒 - if (duration >= Hour) { - bmax = true; - duration = Hour; - } - return bmax; -} - -/** - * @brief GetRemindBody 获取日程提醒内容 - * @param job 日程信息结构体 - * @param tm 查询时间 - * @return QString 提醒内容 - */ -QString JobRemindManager::GetRemindBody(const Job &job, const QDateTime &tm) -{ - QString msgStart; - QString msgEnd; - msgStart = GetBodyTimePart(tm, job.Start, job.AllDay, true); - msgEnd = GetBodyTimePart(tm, job.End, job.AllDay, false); - quint32 startdayofyear = static_cast(job.Start.date().dayOfYear()); - quint32 enddayofyear = static_cast(job.End.date().dayOfYear()); - QString prefix; - if (job.AllDay) { - //全天日程 - if (startdayofyear == enddayofyear) { - //非跨天日程,只展示开始时间 - prefix = msgStart; - } else { - //跨天日程,展示整个日程的时间 - prefix = QString(tr("%1 to %2")).arg(msgStart).arg(msgEnd); - } - } else { - //非全天日程 - if (startdayofyear == enddayofyear) { - //非跨天日程,GetBodyTimePart已经返回了日程的日期,即date,所以,这里只需要日程的结束时间,即time - msgEnd = job.End.time().toString("HH:mm"); - } - //展示日程的开始结束时间 - prefix = QString(tr("%1 to %2")).arg(msgStart).arg(msgEnd); - } - //日程时间+title - QString strBody = QString("%1 %2").arg(prefix).arg(job.Title); - - return strBody; -} - -/** - * @brief RemindJobLater 稍后提醒 - * @param job 日程信息结构体 - */ -void JobRemindManager::RemindJobLater(const Job &job, const int operationNum) -{ - CSystemdTimerControl systemdTimerControl; - SystemDInfo info; - info.jobID = job.ID; - //如果是稍后提醒则设置对应的重复次数 - if (operationNum == 2) { - info.laterCount = job.RemindLaterCount; - } else { - //如果不是稍后提醒,因为次数没有增加所以停止任务的时候需要加一以保证能够停止上次的任务 - info.laterCount = job.RemindLaterCount + 1; - } - info.triggerTimer = job.RemidTime; - info.recurID = job.RecurID; - //停止相应的任务 - systemdTimerControl.stopSystemdTimerByJobInfo(info); - - if (operationNum != 2) { - //如果不是稍后提醒,还原成原来的提醒次数 - info.laterCount--; - } - QVector infoVector; - infoVector.append(info); - //开启新任务 - systemdTimerControl.buildingConfiggure(infoVector); -} - -QString JobRemindManager::GetBodyTimePart(const QDateTime &nowtime, const QDateTime &jobtime, bool allday, bool isstart) -{ - Q_UNUSED(isstart); - //ToDo 需确认规则,需根据isstart确认是否为开始时间单独处理 - QString strmsg; - qint64 diff = nowtime.daysTo(jobtime); //jobtime只可能大于等于当前remind任务执行的当前时间 - if (allday) { - //全天日程,只展示日期,即date - //日程开始时间距离现在超过两天 - strmsg.append(jobtime.date().toString(Qt::LocalDate)); - if (diff == 0) { - //日程开始时间是今天 - strmsg = tr("Today"); - } else if (diff == 1) { - //日程开始时间是明天 - strmsg = tr("Tomorrow"); - } - } else { - //非全天日程,展示日期和时间,即date time - //日程开始时间距离现在超过两天 - strmsg.append(QString(" %1").arg(jobtime.toString("yyyy/MM/dd HH:mm"))); - if (diff == 0) { - //日程开始时间是今天, - strmsg = tr("Today") + " " + jobtime.time().toString("HH:mm"); - } else if (diff == 1) { - //日程开始时间是明天 - strmsg = tr("Tomorrow") + " " + jobtime.time().toString("HH:mm"); - } - } - - return strmsg; -} - -/** - * @brief UpdateRemindJobs 提醒日程更新槽 - * @param jobs 待提醒日程集合 - */ -void JobRemindManager::UpdateRemindJobs(const QList &jobs) -{ - CSystemdTimerControl systemdTimerControl; - //清空日程提醒 - systemdTimerControl.stopAllRemindSystemdTimer(); - systemdTimerControl.removeRemindFile(); - - QVector infoVector{}; - foreach (auto job, jobs) { - SystemDInfo info; - info.jobID = job.ID; - info.laterCount = job.RemindLaterCount; - info.triggerTimer = job.RemidTime; - info.recurID = job.RecurID; - infoVector.append(info); - } - systemdTimerControl.buildingConfiggure(infoVector); -} - -//Job被改变删除稍后提醒队列里对应id的Job -void JobRemindManager::NotifyJobsChanged(const QList &jobs) -{ - if (jobs.size() == 0) - return; - CSystemdTimerControl systemdTimerControl; - - QVector infoVector{}; - foreach (auto job, jobs) { - SystemDInfo info; - info.jobID = job.ID; - info.laterCount = job.RemindLaterCount; - info.triggerTimer = job.RemidTime; - infoVector.append(info); - } - systemdTimerControl.stopSystemdTimerByJobInfos(infoVector); -} diff -Nru dde-calendar-5.9.1/calendar-service/src/jobremindmanager.h dde-calendar-5.10.0/calendar-service/src/jobremindmanager.h --- dde-calendar-5.9.1/calendar-service/src/jobremindmanager.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/jobremindmanager.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,74 +0,0 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: kongyunzhen -* -* Maintainer: kongyunzhen -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ -#ifndef JOBREMINDMANAGER_H -#define JOBREMINDMANAGER_H -#include "src/commondatastruct.h" - -#include -#include - -class QTimer; -class DbusUIOpenSchedule; -class DBusNotify; - -class JobRemindManager : public QObject -{ - Q_OBJECT -public: - explicit JobRemindManager(QObject *parent = nullptr); - -private: - void CallUiOpenSchedule(const Job &job); - - int GetRemindAdvanceDays(const QString &remind); - bool GetRemindLaterDuration(int count, qint64 &duration); - QString GetRemindBody(const Job &job, const QDateTime &tm); - void RemindJobLater(const Job &job, const int operationNum); - QString GetBodyTimePart(const QDateTime &nowtime, const QDateTime &jobtime, bool allday, bool isstart); - -signals: - void ModifyJobRemind(const Job &job, const QString &remind); - void saveNotifyID(const Job &job, int notifyid); -public slots: - void UpdateRemindJobs(const QList &jobs); - void NotifyJobsChanged(const QList &jobs); - void RemindJob(const Job &job); - /** - * @brief notifyMsgHanding 通知提示框交互处理 - * @param job 日程信息 - * @param operationNum 操作编号 - * 1:打开日历, - * 2:稍后提醒 21:15min后提醒 22:一个小时后提醒 23:四个小时后提醒 - * 3:明天提醒 4: 提前1天提醒 - */ - void notifyMsgHanding(const Job &job, const int operationNum); - - /** - * @brief closeNotification 关闭桌面顶部通知 - * @param notifyID 通知ID - */ - void closeNotification(quint32 notifyID); -private: - DbusUIOpenSchedule *m_dbusuiopen; //打开日历前端dbus操作相关 - DBusNotify *m_dbusnotify; //日程提醒dbus操作相关 -}; - -#endif // JOBREMINDMANAGER_H diff -Nru dde-calendar-5.9.1/calendar-service/src/lunarandfestival/celestialbodies.cpp dde-calendar-5.10.0/calendar-service/src/lunarandfestival/celestialbodies.cpp --- dde-calendar-5.9.1/calendar-service/src/lunarandfestival/celestialbodies.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/lunarandfestival/celestialbodies.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: kongyunzhen -* -* Maintainer: kongyunzhen -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "celestialbodies.h" double GetEarthL0(double t) diff -Nru dde-calendar-5.9.1/calendar-service/src/lunarandfestival/celestialbodies.h dde-calendar-5.10.0/calendar-service/src/lunarandfestival/celestialbodies.h --- dde-calendar-5.9.1/calendar-service/src/lunarandfestival/celestialbodies.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/lunarandfestival/celestialbodies.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: zhengxiaokang -* -* Maintainer: zhengxiaokang -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef CELESTIALBODIES_H #define CELESTIALBODIES_H diff -Nru dde-calendar-5.9.1/calendar-service/src/lunarandfestival/lunarandfestival.h dde-calendar-5.10.0/calendar-service/src/lunarandfestival/lunarandfestival.h --- dde-calendar-5.9.1/calendar-service/src/lunarandfestival/lunarandfestival.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/lunarandfestival/lunarandfestival.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: zhengxiaokang -* -* Maintainer: zhengxiaokang -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef LUNARANDFESTIVAL_H #define LUNARANDFESTIVAL_H @@ -29,7 +13,7 @@ typedef struct _lunarInfo { int LunarMonthName = 0; // 农历月名 int LunarMonthDays = 0; // 本月天数 - double ShuoJD; // 本月朔日时间 北京时间 儒略日 + double ShuoJD = 0; // 本月朔日时间 北京时间 儒略日 QDateTime ShuoTime; // 本月朔日时间 北京时间 bool IsLeap = false; // 是否为闰月 int LunarYear = 0; // 农历年 @@ -42,7 +26,7 @@ && this->LunarYear == info.LunarYear && this->LunarDay == info.LunarDay && this->IsLeap == info.IsLeap; - }; + } } lunarInfo; typedef struct _day { @@ -61,7 +45,7 @@ QString GanZhiDay {}; // 农历日的干支 QString LunarMonthName {}; // 农历月名 QString LunarDayName {}; // 农历日名 - int32_t LunarLeapMonth; // 未使用 + int32_t LunarLeapMonth = 0; // 未使用 QString Zodiac {}; // 农历年的生肖 QString Term {}; // 农历节气 QString SolarFestival {}; // 公历节日 diff -Nru dde-calendar-5.9.1/calendar-service/src/lunarandfestival/lunarcalendar.cpp dde-calendar-5.10.0/calendar-service/src/lunarandfestival/lunarcalendar.cpp --- dde-calendar-5.9.1/calendar-service/src/lunarandfestival/lunarcalendar.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/lunarandfestival/lunarcalendar.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: kongyunzhen -* -* Maintainer: kongyunzhen -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "lunarcalendar.h" #include diff -Nru dde-calendar-5.9.1/calendar-service/src/lunarandfestival/lunarcalendar.h dde-calendar-5.10.0/calendar-service/src/lunarandfestival/lunarcalendar.h --- dde-calendar-5.9.1/calendar-service/src/lunarandfestival/lunarcalendar.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/lunarandfestival/lunarcalendar.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: kongyunzhen -* -* Maintainer: kongyunzhen -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef LUNARCALENDAR_H #define LUNARCALENDAR_H #include "lunarandfestival.h" diff -Nru dde-calendar-5.9.1/calendar-service/src/lunarandfestival/lunardateinfo.cpp dde-calendar-5.10.0/calendar-service/src/lunarandfestival/lunardateinfo.cpp --- dde-calendar-5.9.1/calendar-service/src/lunarandfestival/lunardateinfo.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/lunarandfestival/lunardateinfo.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "lunardateinfo.h" #include "lunarcalendar.h" @@ -28,11 +12,11 @@ //农历一年最少有363天 const int LunarYearMiniDays = 353; -LunarDateInfo::LunarDateInfo(const Job &job) - : m_job(job) +LunarDateInfo::LunarDateInfo(KCalendarCore::RecurrenceRule *rruleStr, const qint64 interval) + : m_recurenceRule(rruleStr) + , m_dateInterval(interval) { - m_options = ParseRRule(m_job.RRule); - m_dateInterval = m_job.Start.daysTo(m_job.End); + m_rruleType = ParseRRule(m_recurenceRule->rrule()); } QMap LunarDateInfo::getRRuleStartDate(const QDate &beginDate, const QDate &endDate, const QDate &solarDate) @@ -50,12 +34,13 @@ m_queryStartDate = solarDate; } //如果是农历日程 - switch (m_options.rpeat) { - case RepeatType::RepeatMonthly: + //TODO: 重复类型 + switch (m_rruleType) { + case RRule_Month: //每月 solar = getAllNextMonthLunarDayBySolar(solarDate); break; - case RepeatType::RepeatYearly: + case RRule_Year: //每年 solar = getAllNextYearLunarDayBySolar(solarDate); break; @@ -99,10 +84,13 @@ lunarInfo info = solarDateLunar->SolarDayToLunarDay(solarDate.month(), solarDate.day()); //计算时间为日程开始时间 QDate bDate = solarDate; + QDate beforeDate; int count = 0; - while (bDate <= m_queryEndDate) { + //beforeDate == bDate时,两次执行结果相同,会进入死循环 + while (bDate <= m_queryEndDate && beforeDate != bDate) { + beforeDate = bDate; //开始时间农历日期 LunarCalendar *lunc = LunarCalendar::GetLunarCalendar(bDate.year()); lunarInfo startLunarInfo = lunc->SolarDayToLunarDay(bDate.month(), bDate.day()); @@ -193,39 +181,18 @@ * @param rule 规则字符串 * @return stRRuleOptions 包含重复规则相关字段的结构体 */ -stRRuleOptions LunarDateInfo::ParseRRule(const QString &rule) +LunarDateInfo::LunnarRRule LunarDateInfo::ParseRRule(const QString &rule) { //无规则的不走这里判断所以此处默认rule不为空 //局部变量初始化 - stRRuleOptions options {}; + LunnarRRule options = RRule_None; QStringList rruleslist = rule.split(";", QString::SkipEmptyParts); //rpeat重复规则 0 无 1 每天 2 每个工作日 3 每周 4每月 5每年 //type结束重复类型 0 永不 1 多少次结束 2 结束日期 - if (rruleslist.contains("FREQ=DAILY") && rruleslist.contains("BYDAY=MO,TU,WE,TH,FR")) { - options.rpeat = RepeatWorkDay; - } else if (rruleslist.contains("FREQ=DAILY")) { - options.rpeat = RepeatDaily; - } else if (rruleslist.contains("FREQ=WEEKLY")) { - options.rpeat = RepeatWeekly; - } else if (rruleslist.contains("FREQ=MONTHLY")) { - options.rpeat = RepeatMonthly; + if (rruleslist.contains("FREQ=MONTHLY")) { + options = RRule_Month; } else if (rruleslist.contains("FREQ=YEARLY")) { - options.rpeat = RepeatYearly; - } - - for (int i = 0; i < rruleslist.count(); i++) { - if (rruleslist.at(i).contains("COUNT=")) { - QStringList liststr = rruleslist.at(i).split("=", QString::SkipEmptyParts); - options.type = RepeatOverCount; - options.tcount = liststr.at(1).toInt() - 1; - } - - if (rruleslist.at(i).contains("UNTIL=")) { - QStringList liststr = rruleslist.at(i).split("=", QString::SkipEmptyParts); - options.type = RepeatOverUntil; - options.overdate = QDateTime::fromString(liststr.at(1).left(liststr.at(1).count() - 1), "yyyyMMddThhmmss"); - options.overdate = options.overdate.addDays(1); - } + options = RRule_Year; } return options; } @@ -244,11 +211,10 @@ solarMap[count] = nextDate; } count++; - //当结束重复为按多少次结束判断时,检查重复次数是否达到,达到则退出 - //当重复次数达到最大限制直接返回 - //options.tcount表示重复的次数,而count表示总次数,所以这里不能有“=” - if ((m_options.type == RepeatOverCount && m_options.tcount < count) - || count > RECURENCELIMIT) { + // 当结束重复为按多少次结束判断时,检查重复次数是否达到,达到则退出 + // 当重复次数达到最大限制直接返回 + // duration > 0 表示结束与次数 + if ((m_recurenceRule->duration() > 0 && (m_recurenceRule->duration() - 1) < count) || count > RECURENCELIMIT) { return true; } @@ -257,8 +223,8 @@ //判断next是否有效,时间大于RRule的until //判断next是否大于查询的截止时间,这里应该比较date,而不是datetime,如果是非全天的日程,这个设计具体时间的问题,会导致返回的job个数出现问题 - if ((m_options.type == RepeatOverUntil && nextDate >= m_options.overdate.date()) - || nextDate > m_queryEndDate) { + if ((m_recurenceRule->duration() == 0 && nextDate > m_recurenceRule->endDt().date()) + || nextDate > m_queryEndDate) { return true; } return false; diff -Nru dde-calendar-5.9.1/calendar-service/src/lunarandfestival/lunardateinfo.h dde-calendar-5.10.0/calendar-service/src/lunarandfestival/lunardateinfo.h --- dde-calendar-5.9.1/calendar-service/src/lunarandfestival/lunardateinfo.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/lunarandfestival/lunardateinfo.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,29 +1,13 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef LUNARDATEINFO_H #define LUNARDATEINFO_H #include "lunarandfestival.h" #include "method_interface.h" -#include "src/commondatastruct.h" +#include "recurrencerule.h" #include #include @@ -35,7 +19,14 @@ class LunarDateInfo { public: - explicit LunarDateInfo(const Job &job); + //农历日程只支持每年和每月 + enum LunnarRRule { + RRule_None, //不重复 + RRule_Month, //每月 + RRule_Year, //每年 + }; + + explicit LunarDateInfo(KCalendarCore::RecurrenceRule *rruleStr, const qint64 interval); /** * @brief getRRuleStartDate 获取重复农历日程开始时间(公历)集 * @param beginDate 查询的起始时间 @@ -73,7 +64,7 @@ * @param rule 重复规则 * @return */ - stRRuleOptions ParseRRule(const QString &rule); + LunnarRRule ParseRRule(const QString &rule); /** * @brief isWithinTimeFrame 是否在查询时间范围内 @@ -92,8 +83,10 @@ bool addSolarMap(QMap &solarMap, QDate &nextDate, int &count, const int addDays); private: - Job m_job; - stRRuleOptions m_options; + KCalendarCore::RecurrenceRule *m_recurenceRule; + LunnarRRule m_rruleType; + + // stRRuleOptions m_options; QDate m_queryStartDate; QDate m_queryEndDate; qint64 m_dateInterval; //日程开始结束间隔天数 diff -Nru dde-calendar-5.9.1/calendar-service/src/lunarandfestival/lunarmanager.cpp dde-calendar-5.10.0/calendar-service/src/lunarandfestival/lunarmanager.cpp --- dde-calendar-5.9.1/calendar-service/src/lunarandfestival/lunarmanager.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/lunarandfestival/lunarmanager.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: kongyunzhen -* -* Maintainer: kongyunzhen -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "lunarmanager.h" #include "lunarcalendar.h" #include "pinyin/pinyinsearch.h" @@ -215,4 +199,4 @@ void logOffEmptyData() { LunarCalendar::LogOffEmptyData(); -} \ No newline at end of file +} diff -Nru dde-calendar-5.9.1/calendar-service/src/lunarandfestival/lunarmanager.h dde-calendar-5.10.0/calendar-service/src/lunarandfestival/lunarmanager.h --- dde-calendar-5.9.1/calendar-service/src/lunarandfestival/lunarmanager.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/lunarandfestival/lunarmanager.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: kongyunzhen -* -* Maintainer: kongyunzhen -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef LUNARMANAGER_H #define LUNARMANAGER_H #include "lunarandfestival.h" diff -Nru dde-calendar-5.9.1/calendar-service/src/lunarandfestival/method_interface.cpp dde-calendar-5.10.0/calendar-service/src/lunarandfestival/method_interface.cpp --- dde-calendar-5.9.1/calendar-service/src/lunarandfestival/method_interface.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/lunarandfestival/method_interface.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: zhengxiaokang -* -* Maintainer: zhengxiaokang -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "method_interface.h" #include diff -Nru dde-calendar-5.9.1/calendar-service/src/lunarandfestival/method_interface.h dde-calendar-5.10.0/calendar-service/src/lunarandfestival/method_interface.h --- dde-calendar-5.9.1/calendar-service/src/lunarandfestival/method_interface.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/lunarandfestival/method_interface.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: zhengxiaokang -* -* Maintainer: zhengxiaokang -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef METHOD_INTERFACE_H #define METHOD_INTERFACE_H #include "celestialbodies.h" diff -Nru dde-calendar-5.9.1/calendar-service/src/main.cpp dde-calendar-5.10.0/calendar-service/src/main.cpp --- dde-calendar-5.9.1/calendar-service/src/main.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/main.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,31 +1,22 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ -#include +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "dservicemanager.h" +#include "ddatabasemanagement.h" + #include + #include #include #include -#include "calendarservice.h" +#include + +#ifndef LINGLONG_PREFIX +#define LINGLONG_PREFIX "/usr/" +#endif -const static QString CalendarServiceTranslationsDir = "/usr/share/dde-calendar/translations"; +const static QString CalendarServiceTranslationsDir = QString("%1share/dde-calendar/translations").arg(LINGLONG_PREFIX); bool loadTranslator(QCoreApplication *app, QList localeFallback = QList() << QLocale::system()) { @@ -51,7 +42,6 @@ } } } - return bsuccess; } @@ -64,23 +54,22 @@ Dtk::Core::DLogManager::registerConsoleAppender(); Dtk::Core::DLogManager::registerFileAppender(); + //加载翻译 if (!loadTranslator(&a)) { qDebug() << "loadtranslator failed"; } - qDebug() << "write log to" << Dtk::Core::DLogManager::getlogFilePath(); - QDBusConnection sessionBus = QDBusConnection::sessionBus(); - if (!sessionBus.registerService(CalendarServiceName)) { - qCritical() << "registerService failed:" << sessionBus.lastError(); - exit(0x0001); - } - CalendarService service; - qDebug() << "sessionBus.registerService success" << Dtk::Core::DLogManager::getlogFilePath(); - if (!sessionBus.registerObject(CalendarPath, - &service, - QDBusConnection::ExportAllSlots | QDBusConnection::ExportAllSignals | QDBusConnection::ExportAllProperties)) { - qCritical() << "registerObject failed:" << sessionBus.lastError(); - exit(0x0002); + DDataBaseManagement dbManagement; + + DServiceManager serviceManager; + + //如果存在迁移,则更新提醒 + if(dbManagement.hasTransfer()){ + //延迟处理 + QTimer::singleShot(0,[&](){ + serviceManager.updateRemindJob(); + }); } + return a.exec(); } diff -Nru dde-calendar-5.9.1/calendar-service/src/pinyin/pinyindict.cpp dde-calendar-5.10.0/calendar-service/src/pinyin/pinyindict.cpp --- dde-calendar-5.9.1/calendar-service/src/pinyin/pinyindict.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/pinyin/pinyindict.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: zhengxiaokang -* -* Maintainer: zhengxiaokang -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "pinyindict.h" /* 合法拼音列表 */ diff -Nru dde-calendar-5.9.1/calendar-service/src/pinyin/pinyindict.h dde-calendar-5.10.0/calendar-service/src/pinyin/pinyindict.h --- dde-calendar-5.9.1/calendar-service/src/pinyin/pinyindict.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/pinyin/pinyindict.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: zhengxiaokang -* -* Maintainer: zhengxiaokang -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef PINYINDICT_H #define PINYINDICT_H diff -Nru dde-calendar-5.9.1/calendar-service/src/pinyin/pinyinsearch.cpp dde-calendar-5.10.0/calendar-service/src/pinyin/pinyinsearch.cpp --- dde-calendar-5.9.1/calendar-service/src/pinyin/pinyinsearch.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/pinyin/pinyinsearch.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,6 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: zhengxiaokang -* -* Maintainer: zhengxiaokang -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later #include "pinyinsearch.h" #include "pinyindict.h" diff -Nru dde-calendar-5.9.1/calendar-service/src/pinyin/pinyinsearch.h dde-calendar-5.10.0/calendar-service/src/pinyin/pinyinsearch.h --- dde-calendar-5.9.1/calendar-service/src/pinyin/pinyinsearch.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/pinyin/pinyinsearch.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: zhengxiaokang -* -* Maintainer: zhengxiaokang -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef PINYINSEARCH_H #define PINYINSEARCH_H diff -Nru dde-calendar-5.9.1/calendar-service/src/synchronization/dataencrypt.cpp dde-calendar-5.10.0/calendar-service/src/synchronization/dataencrypt.cpp --- dde-calendar-5.9.1/calendar-service/src/synchronization/dataencrypt.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/synchronization/dataencrypt.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,135 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "dataencrypt.h" +#include + +//暂时加解密不适用,待后续补充 +//QByteArray DataEncrypt::aesCbcEncrypt(const QByteArray &data, const QByteArray &key, +// const QByteArray &initialVector) +//{ +// QByteArray result; +// AES_KEY aesKey; +// if (AES_set_encrypt_key(reinterpret_cast(key.data()), key.size() * 8, +// &aesKey) +// != 0) { +// qWarning() << "Init failed"; +// return result; +// } + +// result = aesCbcEncrypt(data, aesKey, initialVector, AES_ENCRYPT); +// if (result.isEmpty()) +// qWarning() << "Encrypt failed"; + +// return result; +//} + +//QByteArray DataEncrypt::aesCbcDecrypt(const QByteArray &data, const QByteArray &key, +// const QByteArray &initialVector) +//{ +// QByteArray result; +// AES_KEY aesKey; +// if (AES_set_decrypt_key(reinterpret_cast(key.data()), key.size() * 8, +// &aesKey) +// != 0) { +// qWarning() << "Init failed"; +// return result; +// } + +// result = aesCbcEncrypt(data, aesKey, initialVector, AES_DECRYPT); +// if (result.isEmpty()) +// qWarning() << "Decrypt failed"; + +// return result; +//} + +//QByteArray DataEncrypt::aesCbcEncrypt(const QByteArray &data, const AES_KEY &key, +// const QByteArray &initialVector, bool isEncrypt) +//{ +// QByteArray result; +// if (initialVector.size() != AES_BLOCK_SIZE) { +// qWarning() << "The length of init vector must be" << AES_BLOCK_SIZE; +// return result; +// } + +// int remainder = data.size() % AES_BLOCK_SIZE; +// int paddingSize = (remainder == 0) ? 0 : (AES_BLOCK_SIZE - remainder); +// result.resize(data.size() + paddingSize); +// result.fill(0); +// QByteArray tmpIinitialVector = initialVector; // 初始向量会被修改,故需要临时变量来暂存 +// AES_cbc_encrypt(reinterpret_cast(data.data()), +// reinterpret_cast(result.data()), +// static_cast(data.size()), &key, +// reinterpret_cast(tmpIinitialVector.data()), +// (isEncrypt ? AES_ENCRYPT : AES_DECRYPT)); +// return result; +//} + +//QByteArray DataEncrypt::aesCfb128Encrypt(const QByteArray &data, const QByteArray &key, +// const QByteArray &initialVector) +//{ +// QByteArray result; + +// AES_KEY aesKey; +// if (AES_set_encrypt_key(reinterpret_cast(key.data()), key.size() * 8, +// &aesKey) +// != 0) { +// qWarning() << "Init failed"; +// return result; +// } + +// result = aesCfb128Encrypt(data, aesKey, initialVector, AES_ENCRYPT); +// if (result.isEmpty()) +// qWarning() << "Encrypt failed"; + +// return result; +//} + +//QByteArray DataEncrypt::aesCfb128Decrypt(const QByteArray &data, const QByteArray &key, +// const QByteArray &initialVector) +//{ +// QByteArray result; + +// if (data.isEmpty()) { +// return result; +// } + +// AES_KEY aesKey; +// if (AES_set_encrypt_key(reinterpret_cast(key.data()), key.size() * 8, +// &aesKey) +// != 0) { +// qWarning() << "Init failed"; +// return result; +// } + +// result = aesCfb128Encrypt(data, aesKey, initialVector, AES_DECRYPT); +// if (result.isEmpty()) +// qWarning() << "Decrypt failed"; + +// return result; +//} + + +//QByteArray DataEncrypt::aesCfb128Encrypt(const QByteArray &data, const AES_KEY &key, +// const QByteArray &initialVector, bool isEncrypt) +//{ +// QByteArray result; +// if (initialVector.size() != AES_BLOCK_SIZE) { +// qWarning() << "The length of init vector must be" << AES_BLOCK_SIZE; +// return result; +// } + +//// int remainder = data.size() % AES_BLOCK_SIZE; +//// int paddingSize = (remainder == 0) ? 0 : (AES_BLOCK_SIZE - remainder); +// result.resize(data.size() + 0); +// result.fill(0); +// int num = 0; +// QByteArray tmpIinitialVector = initialVector; // 初始向量会被修改,故需要临时变量来暂存 +// AES_cfb128_encrypt(reinterpret_cast(data.data()), +// reinterpret_cast(result.data()), +// static_cast(data.size()), &key, +// reinterpret_cast(tmpIinitialVector.data()), &num, +// (isEncrypt ? AES_ENCRYPT : AES_DECRYPT)); +// return result; +//} diff -Nru dde-calendar-5.9.1/calendar-service/src/synchronization/dataencrypt.h dde-calendar-5.10.0/calendar-service/src/synchronization/dataencrypt.h --- dde-calendar-5.9.1/calendar-service/src/synchronization/dataencrypt.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/synchronization/dataencrypt.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,35 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef DATAENCRYPT_H +#define DATAENCRYPT_H + +#include +#include +//#include + +//const QString aesCbcKey = "kjX3yBgJCaFHszod"; + +//class DataEncrypt +//{ +//public: +// static QByteArray aesCbcEncrypt(const QByteArray &data, const QByteArray &key, +// const QByteArray &initialVector); +// static QByteArray aesCbcDecrypt(const QByteArray &data, const QByteArray &key, +// const QByteArray &initialVector); + +// static QByteArray aesCfb128Encrypt(const QByteArray &data, const QByteArray &key, +// const QByteArray &initialVector); +// static QByteArray aesCfb128Decrypt(const QByteArray &data, const QByteArray &key, +// const QByteArray &initialVector); + +//private: +// static QByteArray aesCbcEncrypt(const QByteArray &data, const AES_KEY &key, +// const QByteArray &initialVector, bool isEncrypt); + +// static QByteArray aesCfb128Encrypt(const QByteArray &data, const AES_KEY &key, +// const QByteArray &initialVector, bool isEncrypt); +//}; + +#endif // DATAENCRYPT_H diff -Nru dde-calendar-5.9.1/calendar-service/src/synchronization/dbuscloudsync.cpp dde-calendar-5.10.0/calendar-service/src/synchronization/dbuscloudsync.cpp --- dde-calendar-5.9.1/calendar-service/src/synchronization/dbuscloudsync.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/synchronization/dbuscloudsync.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,26 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "dbuscloudsync.h" +#include +#include +#include "units.h" + +Dbuscloudsync::Dbuscloudsync(QObject *parent) + : DServiceBase(serviceBasePath + "/CloudSync", serviceBaseName + ".CloudSync", parent) +{ + +} + +void Dbuscloudsync::MsgCallBack(const QByteArray &msg) +{ + //msg信息处理 + QJsonObject json; + json = QJsonDocument::fromJson(msg).object(); + + //TODO:解析获取到的数据,依据需要做后续操作 + + qWarning() << "Get " << " error."; +} + diff -Nru dde-calendar-5.9.1/calendar-service/src/synchronization/dbuscloudsync.h dde-calendar-5.10.0/calendar-service/src/synchronization/dbuscloudsync.h --- dde-calendar-5.9.1/calendar-service/src/synchronization/dbuscloudsync.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/synchronization/dbuscloudsync.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,26 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef DBUSCLOUDSYNC_H +#define DBUSCLOUDSYNC_H + +#include "dservicebase.h" +#include "daccountmodule.h" + +class Dbuscloudsync : public DServiceBase +{ + Q_OBJECT + Q_CLASSINFO("D-Bus Interface","com.deepin.dataserver.cloudsync") +public: + Dbuscloudsync(QObject* parent = nullptr); + +public slots: + /** + * @brief MsgCallBack 云同步信息回调 + * @return + */ + void MsgCallBack(const QByteArray &msg); +}; + +#endif // DBUSCLOUDSYNC_H diff -Nru dde-calendar-5.9.1/calendar-service/src/synchronization/syncfilemanage.cpp dde-calendar-5.10.0/calendar-service/src/synchronization/syncfilemanage.cpp --- dde-calendar-5.9.1/calendar-service/src/synchronization/syncfilemanage.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/synchronization/syncfilemanage.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,159 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "syncfilemanage.h" + +#include + +SyncFileManage::SyncFileManage(QObject *parent) + : QObject(parent) + , m_syncoperation(new Syncoperation) + , m_account(new DAccount(DAccount::Account_UnionID)) +{ + +} + +SyncFileManage::~SyncFileManage() +{ + +} + +bool SyncFileManage::SyncDataDownload(const QString &uid, QString &filepath, int &errorcode) +{ + //文件下载目录检查 + QString usersyncdir(QString("/tmp/%1_calendar").arg(uid)); + UserSyncDirectory(usersyncdir); + QString syncDB = usersyncdir + "/" + syncDBname; + QFile syncDBfile(syncDB); + if (syncDBfile.exists()) { + //存在文件即删除 + syncDBfile.remove(); + } + + SyncoptResult result; + result = m_syncoperation->optDownload(syncDB, syncDB); + if (result.error_code == SYNC_No_Error) { + //下载成功 + if (result.data != syncDB) { + //文件下载路径不正确 + //将文件移动到正确路径 + if (!QFile::rename(result.data, syncDB)) { + qWarning() << "down path error!"; + errorcode = -1; + return false; + } + } + filepath = syncDB; + return true; + } else if (result.error_code == SYNC_Data_Not_Exist) { + //云同步数据库文件不存在 + if (SyncDbCreate(syncDB)) { + filepath = syncDB; + return true; + } else { + errorcode = -1; + return false; + } + } + errorcode = result.error_code; + return false; +} + +bool SyncFileManage::SyncDbCreate(const QString &DBpath) +{ + QFile file(DBpath); + if (!file.exists()) { + bool bRet = file.open(QIODevice::ReadWrite | QIODevice::Text | QIODevice::Append); + if (!bRet) { + qWarning() << "file creat failed"; + return false; + } + file.close(); + } + + QSqlDatabase m_db; + m_db = QSqlDatabase::addDatabase("QSQLITE"); + m_db.setPassword(syncDBpassword); + m_db.setDatabaseName(DBpath); + if (!m_db.open()) { + qWarning() << "db open failed"; + return false; + } + qInfo() << "db open successed"; + m_db.close(); + return true; +} + +bool SyncFileManage::SyncDbDelete(const QString &DBpath) +{ + if (DBpath.isEmpty()) { + qWarning() << "DBpath isEmpty"; + return false; + } + QFileInfo fileinfo(DBpath); + QDir dir = fileinfo.dir(); + + if (dir.exists()) { + if (!dir.removeRecursively()) { + return false; + } + } + + return true; +} + +bool SyncFileManage::SyncDataUpload(const QString &filepath, int &errorcode) +{ + SyncoptResult result; + result = m_syncoperation->optUpload(filepath); + errorcode = result.error_code; + if (result.error_code != SYNC_No_Error) { + qWarning() << "upload failed"; + return false; + } + return true; +} + +bool SyncFileManage::syncDataDelete(const QString &filepath) +{ + if (!SyncDbDelete(filepath)) { + qWarning() << "delete file error:" << filepath; + return false; + } + return true; +} + +DAccount::Ptr SyncFileManage::getuserInfo() +{ + QVariantMap userInfoMap; + //如果为社区版本则返回空 + if (Dtk::Core::DSysInfo::uosEditionType() == Dtk::Core::DSysInfo::UosCommunity) { + return nullptr; + } + + if (!m_syncoperation->optUserData(userInfoMap)) { + qInfo() << "can't get userinfo"; + return nullptr; + } + + m_account->setDisplayName(userInfoMap.value("username").toString()); + m_account->setAccountID(userInfoMap.value("uid").toString()); + m_account->setAvatar(userInfoMap.value("profile_image").toString()); + m_account->setAccountName(userInfoMap.value("nickname").toString()); + return m_account; +} + + +Syncoperation *SyncFileManage::getSyncoperation() +{ + return m_syncoperation; +} + +void SyncFileManage::UserSyncDirectory(const QString &dir) +{ + QDir udir(dir); + if (!udir.exists()) { + udir.mkdir(dir); + } +} diff -Nru dde-calendar-5.9.1/calendar-service/src/synchronization/syncfilemanage.h dde-calendar-5.10.0/calendar-service/src/synchronization/syncfilemanage.h --- dde-calendar-5.9.1/calendar-service/src/synchronization/syncfilemanage.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/synchronization/syncfilemanage.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,76 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef SYNCFILEMANAGE_H +#define SYNCFILEMANAGE_H + +#include "syncoperation.h" +#include "dschedule.h" +#include +#include "dataencrypt.h" +#include + +const QString syncDBname = "synccalendarDB.db"; +const QString syncDBpassword = "calendar123"; + + +class SyncFileManage : public QObject +{ + Q_OBJECT +public: + explicit SyncFileManage(QObject *parent = nullptr); + ~SyncFileManage(); + + /** + * @brief SyncDataUpload 云端文件下载接口 + * @param UID:用户UID信息 + * @return filename: 下载数据库文件路径 + * 返回值: -1 数据库文件创建失败 + * 云同步错误码 + */ + bool SyncDataDownload(const QString &uid, QString &filepath, int &errorcode); + + /** + * @brief SyncDataUpload 同步数据上传 + * @param + * @return + */ + bool SyncDataUpload(const QString &filepath, int &errorcode); + + /** + * @brief syncDataDelete 删除临时数据 + * @param filepath + * @return + */ + bool syncDataDelete(const QString &filepath); + /** + * @brief getuserInfo 获取用户信息 + * @param + * @return + */ + DAccount::Ptr getuserInfo(); + + Syncoperation *getSyncoperation(); + +private: + /** + * @brief SyncDbCreate 同步数据库文件创建 + * @param + * @return + */ + bool SyncDbCreate(const QString &DBpath); + /** + * @brief SyncDbCreate 同步数据库文件创建 + * @param + * @return + */ + bool SyncDbDelete(const QString &DBpath); + + void UserSyncDirectory(const QString &dir); +private: + Syncoperation *m_syncoperation = nullptr; + DAccount::Ptr m_account; +}; + +#endif // SYNCFILEMANAGE_H diff -Nru dde-calendar-5.9.1/calendar-service/src/synchronization/syncoperation.cpp dde-calendar-5.10.0/calendar-service/src/synchronization/syncoperation.cpp --- dde-calendar-5.9.1/calendar-service/src/synchronization/syncoperation.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/synchronization/syncoperation.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,273 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "syncoperation.h" + + +Syncoperation::Syncoperation(QObject *parent) + : QObject(parent) + , m_syncInter(new SyncInter(SYNC_DBUS_PATH, SYNC_DBUS_INTERFACE, QDBusConnection::sessionBus(), this)) +{ + + if (!QDBusConnection::sessionBus().connect(SYNC_DBUS_PATH, + SYNC_DBUS_INTERFACE, + "org.freedesktop.DBus.Properties", + QLatin1String("PropertiesChanged"), this, + SLOT(onPropertiesChanged(QString, QVariantMap, QStringList)))) { + qWarning() << "the PropertiesChanged was fail!"; + } + + if (!QDBusConnection::sessionBus().connect(m_syncInter->service(), m_syncInter->path(), m_syncInter->interface(), + "", this, SLOT(slotDbusCall(QDBusMessage)))) { + qWarning() << "the connection was fail!" << "path: " << m_syncInter->path() << "interface: " << m_syncInter->interface(); + }; +} + +Syncoperation::~Syncoperation() +{ + +} + +void Syncoperation::optlogin() +{ + //异步调用无需等待结果,由后续LoginStatus触发处理 + m_syncInter->login(); +} + +void Syncoperation::optlogout() +{ + //异步调用无需等待结果,由后续LoginStatus触发处理 + m_syncInter->logout(); +} + +SyncoptResult Syncoperation::optUpload(const QString &key) +{ + SyncoptResult result; + QDBusPendingReply reply = m_syncInter->Upload(key); + reply.waitForFinished(); + if (reply.error().message().isEmpty()) { + qInfo() << "Upload success!"; + //解析上传成功数据的元信息ID值 ,这个ID值暂时没用,不解析出来 +// QJsonObject json; +// json = QJsonDocument::fromJson(reply).object(); +// if (json.contains(QString("data"))) { +// QJsonObject subJsonObject = json.value(QString("data")).toObject(); +// if (subJsonObject.contains(QString("id"))) { +// result.data = subJsonObject.value(QString("id")).toString(); +// qInfo() << result.data; +// } +// } + result.data = reply.value(); + result.ret = true; + result.error_code = SYNC_No_Error; + } else { + qWarning() << "Upload failed:" << reply.error().message(); + result.ret = false; + QJsonDocument jsonDocument = QJsonDocument::fromJson(reply.error().message().toLocal8Bit().data()); + QJsonObject obj = jsonDocument.object(); + if (obj.contains(QString("code"))) { + result.error_code = obj.value(QString("code")).toInt(); + } + } + + return result; +} + +SyncoptResult Syncoperation::optDownload(const QString &key, const QString &path) +{ + SyncoptResult result; + QDBusPendingReply reply = m_syncInter->Download(key, path); + reply.waitForFinished(); + if (reply.error().message().isEmpty()) { + qInfo() << "Download success!"; + result.data = reply.value(); + result.ret = true; + result.error_code = SYNC_No_Error; + } else { + qWarning() << "Download failed:" << reply.error().message(); + result.ret = false; + QJsonDocument jsonDocument = QJsonDocument::fromJson(reply.error().message().toLocal8Bit().data()); + QJsonObject obj = jsonDocument.object(); + if (obj.contains(QString("code"))) { + result.error_code = obj.value(QString("code")).toInt(); + qWarning() << result.error_code; + } + } + + return result; +} + +SyncoptResult Syncoperation::optDelete(const QString &key) +{ + SyncoptResult result; + QDBusPendingReply reply = m_syncInter->Delete(key); + reply.waitForFinished(); + if (reply.error().message().isEmpty()) { + qInfo() << "Delete success!"; + result.data = reply.value(); + result.ret = true; + result.error_code = SYNC_No_Error; + } else { + qWarning() << "Delete failed:" << reply.error().message(); + result.ret = false; + QJsonDocument jsonDocument = QJsonDocument::fromJson(reply.error().message().toLocal8Bit().data()); + QJsonObject obj = jsonDocument.object(); + if (obj.contains(QString("code"))) { + result.error_code = obj.value(QString("code")).toInt(); + qWarning() << result.error_code; + } + } + + return result; +} + +SyncoptResult Syncoperation::optMetadata(const QString &key) +{ + SyncoptResult result; + QDBusPendingReply reply = m_syncInter->Metadata(key); + reply.waitForFinished(); + if (reply.error().message().isEmpty()) { + qInfo() << "Metadata success!"; + //元数据获取接口,暂时好像用不到 + result.data = reply.value(); + result.ret = true; + result.error_code = SYNC_No_Error; + } else { + qWarning() << "Metadata failed:" << reply.error().message(); + result.ret = false; + QJsonDocument jsonDocument = QJsonDocument::fromJson(reply.error().message().toLocal8Bit().data()); + QJsonObject obj = jsonDocument.object(); + if (obj.contains(QString("code"))) { + result.error_code = obj.value(QString("code")).toInt(); + qWarning() << result.error_code; + } + } + + return result; +} + +bool Syncoperation::optUserData(QVariantMap &userInfoMap) +{ + QDBusMessage msg = QDBusMessage::createMethodCall(SYNC_DBUS_PATH, + SYNC_DBUS_INTERFACE, + "org.freedesktop.DBus.Properties", + QStringLiteral("Get")); + msg << QString("com.deepin.utcloud.Daemon") << QString("UserData"); + QDBusMessage reply = QDBusConnection::sessionBus().call(msg); + + if (reply.type() == QDBusMessage::ReplyMessage) { + QVariant variant = reply.arguments().first(); + QDBusArgument argument = variant.value().variant().value(); + argument >> userInfoMap; + return true; + } else { + qWarning() << "Download failed:"; + return false; + } +} + +bool Syncoperation::hasAvailable() +{ + QDBusMessage msg = QDBusMessage::createMethodCall(SYNC_DBUS_PATH, + SYNC_DBUS_INTERFACE, + "org.freedesktop.DBus.Introspectable", + QStringLiteral("Introspect")); + + QDBusMessage reply = QDBusConnection::sessionBus().call(msg); + + if (reply.type() == QDBusMessage::ReplyMessage) { + QVariant variant = reply.arguments().first(); + return variant.toString().contains("\"Available\""); + } else { + return false; + } +} + +SyncoptResult Syncoperation::optGetMainSwitcher() +{ + SyncoptResult result; + QDBusPendingReply reply = m_syncInter->SwitcherDump(); + reply.waitForFinished(); + if (reply.error().message().isEmpty()) { + QJsonObject json; + json = QJsonDocument::fromJson(reply.value().toUtf8()).object(); + if (json.contains(QString("enabled"))) { + bool state = json.value(QString("enabled")).toBool(); + result.switch_state = state; + } + result.ret = true; + } else { + result.ret = false; + } + return result; +} + +SyncoptResult Syncoperation::optGetCalendarSwitcher() +{ + //登录后立即获取开关状态有问题,需要延迟获取 + QThread::msleep(500); + SyncoptResult mainswitcher = optGetMainSwitcher(); + SyncoptResult result; + result.switch_state = false; //默认关闭 + if (mainswitcher.ret) { + if (mainswitcher.switch_state) { + //总开关开启,获取日历按钮状态 + QDBusPendingReply reply = m_syncInter->SwitcherGet(utcloudcalendatpath); + reply.waitForFinished(); + if (reply.error().message().isEmpty()) { + result.switch_state = reply.value(); + result.ret = true; + } else { + qDebug() << "get calendar switcher failed"; + result.ret = false; + } + } else { + result.ret = false; + } + } else { + qDebug() << "get main switcher failed"; + result.ret = false; + } + + return result; +} + +void Syncoperation::slotDbusCall(const QDBusMessage &msg) +{ + if (msg.member() == "SwitcherChange") { + SyncoptResult result; + //获取总开关状态 + result = optGetCalendarSwitcher(); + if (result.ret) { + Q_EMIT SwitcherChange(result.switch_state); + } else { + Q_EMIT SwitcherChange(false); + } + } else if (msg.member() == "LoginStatus") { + //帐户登陆登出信号监测 + QVariant variant = msg.arguments().first(); + const QDBusArgument &tmp = variant.value(); + + QVector loginStatus; + tmp.beginArray(); + while (!tmp.atEnd()) { + tmp >> loginStatus; + } + tmp.endArray(); + if (loginStatus.size() > 0) { + emit signalLoginStatusChange(loginStatus.first()); + } else { + qWarning() << "get loginStatus error"; + } + } +} + + +void Syncoperation::onPropertiesChanged(const QString &interfaceName, const QVariantMap &changedProperties, const QStringList &invalidatedProperties) +{ + Q_UNUSED(interfaceName); + Q_UNUSED(invalidatedProperties); + if (!changedProperties.contains("UserData")) + return; +} diff -Nru dde-calendar-5.9.1/calendar-service/src/synchronization/syncoperation.h dde-calendar-5.10.0/calendar-service/src/synchronization/syncoperation.h --- dde-calendar-5.9.1/calendar-service/src/synchronization/syncoperation.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/synchronization/syncoperation.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,91 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef SYNCOPERATION_H +#define SYNCOPERATION_H + +#include +#include +#include +#include +#include "dunioniddbus.h" + +//云同步DBUS接口信息 +#define SYNC_DBUS_PATH "com.deepin.sync.Daemon" +#define SYNC_DBUS_INTERFACE "/com/deepin/utcloud/Daemon" + + +//云同步错误码 +#define SYNC_No_Error 0 /*执行正常*/ +#define SYNC_Internal_Error 7500 /*内部错误*/ +#define SYNC_Parameter_Error 7501 /*参数错误*/ +#define SYNC_Login_Expired 7502 /*未登录或登录过期*/ +#define SYNC_No_Access 7503 /*禁止访问,不在白名单内*/ +#define SYNC_Data_Not_Exist 7504 /*数据不存在*/ +#define SYNC_File_Operation_Failed 7505 /*文件操作失败*/ +#define SYNC_Network_Request_Error 7506 /*网络请求出错错误*/ +#define SYNC_Oss_Operation_Error 7507 /*oss操作出错*/ +#define SYNC_Space_Not_Available 7508 /*空间不可用*/ +#define SYNC_File_Or_Path_Error 7509 /*文件或者路径出错*/ +#define SYNC_Invalid_File_Size 7510 /*文件大小不合法*/ +#define SYNC_Metadata_Check_Error 7511 /*元数据校验出错*/ + +const QString utcloudcalendatpath = "/usr/lib/deepin-daemon/dde-calendar-service"; + +using SyncInter = com::deepin::sync::cloudopt; + +struct SyncoptResult { + QString data = ""; //执行结果数据 + bool ret = false; //执行云同步操作的结果 + int error_code = 0; //错误码 + bool switch_state = false; //开关状态 +}; + +class Syncoperation : public QObject +{ + Q_OBJECT +public: + explicit Syncoperation(QObject *parent = nullptr); + ~Syncoperation(); + + void optlogin(); + + void optlogout(); + + SyncoptResult optUpload(const QString &key); + + SyncoptResult optDownload(const QString &key, const QString &path); + + SyncoptResult optDelete(const QString &key); + + SyncoptResult optMetadata(const QString &key); + + bool optUserData(QVariantMap &userInfoMap); + + /** + * @brief hasAvailable 判断云同步是否提供Available方法 + * @return + */ + bool hasAvailable(); + + //获取总开关状态 + SyncoptResult optGetMainSwitcher(); + //获取日历开关状态 + SyncoptResult optGetCalendarSwitcher(); + +Q_SIGNALS: + void signalLoginStatusChange(const int staus); + void LoginStatus(const int data); + void SwitcherChange(const bool state); + +private Q_SLOTS: + void slotDbusCall(const QDBusMessage &msg); + void onPropertiesChanged(const QString &interfaceName, + const QVariantMap &changedProperties, + const QStringList &invalidatedProperties); +private: + SyncInter *m_syncInter; +}; + +#endif // SYNCUPLOAD_H diff -Nru dde-calendar-5.9.1/calendar-service/src/unionIDDav/ddatasyncbase.cpp dde-calendar-5.10.0/calendar-service/src/unionIDDav/ddatasyncbase.cpp --- dde-calendar-5.9.1/calendar-service/src/unionIDDav/ddatasyncbase.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/unionIDDav/ddatasyncbase.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,18 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "ddatasyncbase.h" +#include "dunioniddav.h" + +DDataSyncBase::DDataSyncBase() +{ + qRegisterMetaType("DDataSyncBase::UpdateTypes"); + qRegisterMetaType("SyncTypes"); +} + +DDataSyncBase::~DDataSyncBase() +{ +} + + diff -Nru dde-calendar-5.9.1/calendar-service/src/unionIDDav/ddatasyncbase.h dde-calendar-5.10.0/calendar-service/src/unionIDDav/ddatasyncbase.h --- dde-calendar-5.9.1/calendar-service/src/unionIDDav/ddatasyncbase.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/unionIDDav/ddatasyncbase.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,56 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef DDATASYNCBASE_H +#define DDATASYNCBASE_H + +#include "daccount.h" +#include "daccountdatabase.h" +#include "syncfilemanage.h" + +#include +#include +#include +#include +#include + +#ifndef Q_MOC_RUN +#define Q_DECLARE_FLAGS(Flags, Enum)\ +typedef QFlags Flags; +#endif + +/** + * @brief The DDataSyncBase class 云同步的基类 + */ +class DDataSyncBase : public QObject +{ + Q_OBJECT +public: + enum UpdateType { + Update_None = 0, /*无*/ + Update_Schedule = 1, /*更新日程*/ + Update_ScheduleType = 2, /*更新日程类型*/ + Update_Setting = 4, /*更新设置*/ + }; + Q_DECLARE_FLAGS(UpdateTypes, UpdateType) + + enum SyncType { + Sync_None = 0, /*无*/ + Sync_Upload = 1, /*上传*/ + Sync_Download = 2, /*下载*/ + }; + Q_DECLARE_FLAGS(SyncTypes, SyncType) + DDataSyncBase(); + virtual ~DDataSyncBase(); + virtual void syncData(QString accountId, QString accountName, int accountState, DDataSyncBase::SyncTypes syncType) = 0; +signals: + // + void signalUpdate(const UpdateTypes updateType); + void signalSyncState(const int syncState); +}; +Q_DECLARE_OPERATORS_FOR_FLAGS(DDataSyncBase::UpdateTypes) +Q_DECLARE_OPERATORS_FOR_FLAGS(DDataSyncBase::SyncTypes) + + +#endif // DDATASYNCBASE_H diff -Nru dde-calendar-5.9.1/calendar-service/src/unionIDDav/dsyncdatafactory.cpp dde-calendar-5.10.0/calendar-service/src/unionIDDav/dsyncdatafactory.cpp --- dde-calendar-5.9.1/calendar-service/src/unionIDDav/dsyncdatafactory.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/unionIDDav/dsyncdatafactory.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,28 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "dsyncdatafactory.h" + +#include "dunioniddav.h" + +#include + +DSyncDataFactory::DSyncDataFactory() +{ +} + +DDataSyncBase *DSyncDataFactory::createDataSync(const DAccount::Ptr &account) +{ + DDataSyncBase *syncBase = nullptr; + switch (account->accountType()) { + case DAccount::Account_UnionID: + syncBase = new DUnionIDDav(); + qInfo() << "创建同步任务"; + break; + default: + syncBase = nullptr; + break; + } + return syncBase; +} diff -Nru dde-calendar-5.9.1/calendar-service/src/unionIDDav/dsyncdatafactory.h dde-calendar-5.10.0/calendar-service/src/unionIDDav/dsyncdatafactory.h --- dde-calendar-5.9.1/calendar-service/src/unionIDDav/dsyncdatafactory.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/unionIDDav/dsyncdatafactory.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,20 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef DSYNCDATAFACTORY_H +#define DSYNCDATAFACTORY_H + +#include "ddatasyncbase.h" + +/** + * @brief The DSyncDataFactory class 根据不同类型的账号,生产不同的上传实例 + */ +class DSyncDataFactory +{ +public: + DSyncDataFactory(); + static DDataSyncBase *createDataSync(const DAccount::Ptr &account); +}; + +#endif // DSYNCDATAFACTORY_H diff -Nru dde-calendar-5.9.1/calendar-service/src/unionIDDav/dunioniddav.cpp dde-calendar-5.10.0/calendar-service/src/unionIDDav/dunioniddav.cpp --- dde-calendar-5.9.1/calendar-service/src/unionIDDav/dunioniddav.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/unionIDDav/dunioniddav.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,623 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "dunioniddav.h" + +#include "dcalendargeneralsettings.h" +#include "syncfilemanage.h" +#include "units.h" +#include "ddatabase.h" +#include "dunioniddav_p.h" + +#include +#include +#include +#include +#include +#include +#include + +#include + +/** + * @brief The SqlTransactionLocker class 用于数据库事务相关 + */ + +bool SyncAccount::defaultScheduleType() +{ + //工作类型 + QDateTime currentTime = QDateTime::currentDateTime(); + DScheduleType::Ptr workType(new DScheduleType(_accountID)); + workType->setTypeID(DDataBase::createUuid()); + workType->setDtCreate(currentTime.addDays(-3)); + workType->setPrivilege(DScheduleType::Read); + workType->setTypeName("Work"); + workType->setDisplayName("Work"); + DTypeColor workColor; + workColor.setColorID(DDataBase::GWorkColorID); + workColor.setColorCode("#ff5e97"); + workColor.setPrivilege(DTypeColor::PriSystem); + workType->setTypeColor(workColor); + workType->setShowState(DScheduleType::Show); + if (!insertToScheduleType(workType)) + return false; + + //生活 + DScheduleType::Ptr lifeType(new DScheduleType(_accountID)); + lifeType->setTypeID(DDataBase::createUuid()); + lifeType->setDtCreate(currentTime.addDays(-2)); + lifeType->setPrivilege(DScheduleType::Read); + lifeType->setTypeName("Life"); + lifeType->setDisplayName("Life"); + DTypeColor lifeColor; + lifeColor.setColorID(DDataBase::GLifeColorID); + lifeColor.setColorCode("#5d51ff"); + lifeColor.setPrivilege(DTypeColor::PriSystem); + lifeType->setTypeColor(lifeColor); + lifeType->setShowState(DScheduleType::Show); + if (!insertToScheduleType(lifeType)) + return false; + + //其他 + DScheduleType::Ptr otherType(new DScheduleType(_accountID)); + otherType->setTypeID(DDataBase::createUuid()); + otherType->setDtCreate(currentTime); + otherType->setPrivilege(DScheduleType::Read); + otherType->setTypeName("Other"); + otherType->setDisplayName("Other"); + DTypeColor otherColor; + otherColor.setColorID(DDataBase::GOtherColorID); + otherColor.setColorCode("#5bdd80"); + otherColor.setPrivilege(DTypeColor::PriSystem); + otherType->setTypeColor(otherColor); + otherType->setShowState(DScheduleType::Show); + if (!insertToScheduleType(otherType)) + return false; + + return true; +} + +bool SyncAccount::defaultTypeColor() +{ + QDateTime currentTime = QDateTime::currentDateTime(); + int index = -10; + //使用与本地一致的颜色id + QMap::const_iterator iter = GTypeColor.constBegin(); + for (; iter != GTypeColor.constEnd(); ++iter) { + DTypeColor typeColor; + typeColor.setDtCreate(currentTime.addDays(++index)); + typeColor.setPrivilege(DTypeColor::PriSystem); + typeColor.setColorCode(iter.value()); + typeColor.setColorID(iter.key()); + if (!insertToTypeColor(typeColor)) { + return false; + }; + } + return true; +} + +bool SyncAccount::insertToScheduleType(const DScheduleType::Ptr &scheduleType) +{ + QString strSql("INSERT INTO scheduleType ( \ + typeID, typeName, typeDisplayName, typePath, \ + typeColorID, description, privilege, showState, \ + syncTag,dtCreate,isDeleted) \ + VALUES(?,?,?,?,?,?,?,?,?,?,?)"); + SqliteQuery query(_connectionName); + query.prepare(strSql); + if (scheduleType->typeID().size() < 30) { + scheduleType->setTypeID(DDataBase::createUuid()); + } + + query.addBindValue(scheduleType->typeID()); + query.addBindValue(scheduleType->typeName()); + query.addBindValue(scheduleType->displayName()); + query.addBindValue(scheduleType->typePath()); + query.addBindValue(scheduleType->typeColor().colorID()); + query.addBindValue(scheduleType->description()); + query.addBindValue(int(scheduleType->privilege())); + query.addBindValue(scheduleType->showState()); + query.addBindValue(scheduleType->syncTag()); + query.addBindValue(dtToString(scheduleType->dtCreate())); + query.addBindValue(scheduleType->deleted()); + + return query.exec(); +} + +bool SyncAccount::insertToTypeColor(const DTypeColor &typeColor) +{ + SqliteQuery query(_connectionName); + QString strSql("INSERT INTO TypeColor \ + (ColorID, ColorHex, privilege,dtCreate) \ + VALUES(:ColorID, :ColorHex, :privilege,:dtCreate)"); + + query.prepare("replace into TypeColor (ColorID, ColorHex, privilege,dtCreate) \ + VALUES(:ColorID, :ColorHex, :privilege,:dtCreate)"); + query.bindValue(":ColorID", typeColor.colorID()); + query.bindValue(":ColorHex", typeColor.colorCode()); + query.bindValue(":privilege", typeColor.privilege()); + query.bindValue(":dtCreate", dtToString(typeColor.dtCreate())); + return query.exec(); +} + +void DUIDSynDataWorker::syncData(SyncStack syncType) +{ + if (nullptr == mSyncTimer) { + mSyncTimer = new QTimer(this); + mSyncTimer->setSingleShot(true); + connect(mSyncTimer, &QTimer::timeout, this, &DUIDSynDataWorker::slotSync); + } + mSyncTimer->start(200); + + mSyncList.append(syncType); +} + +void DUIDSynDataWorker::slotSync() +{ + bool next = false; + for (int k = mSyncList.count() - 1; k >= 0; k--) { + if (k == mSyncList.count() - 1) { + mSync = mSyncList[k]; + next = true; + } else { + mSync.syncType |= mSyncList[k].syncType; + } + if (mSync.syncType.testFlag(DDataSyncBase::Sync_Upload) + && mSync.syncType.testFlag(DDataSyncBase::Sync_Download)) + break; + } + + mSyncList.clear(); + + if (next) + startUpdate(); + +} + +void DUIDSynDataWorker::startUpdate() +{ + /* + * A为本地数据库 + * B为云端下载的临时数据库 + * 1.下载B + * 2.将A的uploadTask同步到B + * 3.将B的数据库完全复制到A + * 4.上传B + */ + SyncFileManage fileManger; + int errCode = 0; + DUnionIDDav::UpdateTypes updateType = DUnionIDDav::Update_None; + + QSqlDatabase::cloneDatabase(mSync.db_account, mSync.dbname_account_thread); + QSqlDatabase::cloneDatabase(mSync.db_manager, mSync.dbname_manager_thread); + //获取云端数据 + bool isInitSyncData = false; + errCode = mSync.downloadUidData(isInitSyncData, fileManger); + + //如果下载失败 + if(errCode != 0){ + //发送同步状态 + emit signalSyncState(errCode); + return; + } + + SqlTransactionLocker transactionLocker({mSync.dbname_account_thread, mSync.dbname_manager_thread, mSync.dbname_sync_thread}); + //本地数据迁移到临时文件中 + if (errCode == 0) { + errCode = mSync.loadToTmp(); + } + + //将临时文件数据迁移到本地中 + if (errCode == 0 && mSync.syncType.testFlag(DDataSyncBase::SyncType::Sync_Download)) { + errCode = mSync.tmpToLoad(updateType); + } + + if (errCode == 0) { + transactionLocker.commit(); + } else { + transactionLocker.rollback(); + } + QSqlDatabase::removeDatabase(mSync.dbname_account_thread); + QSqlDatabase::removeDatabase(mSync.dbname_manager_thread); + QSqlDatabase::removeDatabase(mSync.dbname_sync_thread); + + //如果为上传需要上传数据 + if (errCode == 0 && (isInitSyncData || mSync.syncType.testFlag(DDataSyncBase::SyncType::Sync_Upload))) { + errCode = mSync.uploadTmpData(fileManger); + } + //删除临时文件 + mSync.deleteTmpData(fileManger); + + qInfo() << "同步完成"; + if (errCode == 0) { + //发送数据更新消息 + emit signalUpdate(updateType); + } + //发送同步状态 + emit signalSyncState(errCode); +} + +DUnionIDDav::DUnionIDDav() + : DDataSyncBase() + , d(new DUIDSynDataPrivate()) +{ + connect(d, &DUIDSynDataPrivate::signalUpdate, this, &DUnionIDDav::signalUpdate); + connect(d, &DUIDSynDataPrivate::signalSyncState, this, &DUnionIDDav::signalSyncState); +} + +DUnionIDDav::~DUnionIDDav() +{ + delete d; +} + +void DUnionIDDav::syncData(QString accountId, QString accountName, int accountState, DDataSyncBase::SyncTypes syncType) +{ + qInfo() << "DUnionIDDav 同步数据"; + + d->syncData(accountId, accountName, accountState, syncType); +} + + +int SyncStack::downloadUidData(bool &isInitSyncData, SyncFileManage &fileManger) +{ + int errCode = 0; + isInitSyncData = false; + //下载数据库sync + if (!fileManger.SyncDataDownload(accountId, dbpath_sync, errCode)) { + return errCode; + } + + QSqlDatabase db_sync = QSqlDatabase::addDatabase("QSQLITE", dbname_sync_thread); + db_sync.setDatabaseName(dbpath_sync); + if (!db_sync.open()) { + return -1; + } + qInfo() << "初始化表结构"; + + SqliteQuery query(dbname_sync_thread); + + if (!query.exec(DAccountDataBase::sql_create_schedules)) + return -1; + if (!query.exec(DAccountDataBase::sql_create_scheduleType)) + return -1; + if (!query.exec(DAccountDataBase::sql_create_typeColor)) + return -1; + if (!query.exec(DAccountDataBase::sql_create_calendargeneralsettings)) + return -1; + +// if(!repairTable("schedules", dbname_account_thread, dbname_sync_thread)) { +// return -1; +// } +// if(!repairTable("scheduleType", dbname_account_thread, dbname_sync_thread)) { +// return -1; +// } +// if(!repairTable("typeColor", dbname_account_thread, dbname_sync_thread)) { +// return -1; +// } + + query.exec("select count(0) from scheduleType"); + if (query.next() && query.value(0).toInt() == 0) { + qInfo() << "没有数据则设置:默认日程类型、颜色、默认通用设置"; + SyncAccount accountDb(dbname_sync_thread, accountId); + + qInfo() << "默认日程类型"; + if (!accountDb.defaultScheduleType()) + return -1; + + qInfo() << "默认颜色"; + if (!accountDb.defaultTypeColor()) + return -1; + + if (accountState & DAccount::Account_Setting) { + qInfo() << "默认通用设置"; + if(needUpdateSettingValue()) { + if (!syncIntoTable("calendargeneralsettings", dbname_manager_thread, dbname_sync_thread)) + return -1; + } + } + //云端没有对应数据需要初始化,返回初始化状态 + isInitSyncData = true; + } + + return 0; +} + +int SyncStack::loadToTmp() +{ + qInfo() << "将本地A的uploadTask同步到刚刚下载的B里"; + if(accountState & DAccount::Account_Calendar) { + SqliteQuery query(dbname_account_thread); + query.exec("select taskID,uploadType,uploadObject,objectID from uploadTask"); + while (query.next()) { + int type = query.value("uploadType").toInt(); + int obj = query.value("uploadObject").toInt(); + QString key_value = query.value("objectID").toString(); + QString key_name = DUploadTaskData::sql_table_primary_key(obj); + QString table_name = DUploadTaskData::sql_table_name(obj); + + switch (type) { + case DUploadTaskData::Create: + case DUploadTaskData::Modify: + if (!replaceIntoRecord(table_name, selectRecord(table_name, key_name, key_value, dbname_account_thread), dbname_sync_thread)){ + qWarning()<<"faild:" <<__FUNCTION__ <<" : "<<__LINE__; + return -1; + } + break; + case DUploadTaskData::Delete: + if (!deleteTableLine(table_name, key_name, key_value, dbname_sync_thread)){ + qWarning()<<"faild:" <<__FUNCTION__ <<" : "<<__LINE__; + return -1; + } + break; + } + } + + qInfo() << "清空uploadTask"; + if (!deleteTable("uploadTask", dbname_account_thread)){ + qWarning()<<"faild:" <<__FUNCTION__ <<" : "<<__LINE__; + return -1; + } + } + + if (accountState & DAccount::Account_Setting) { + + qInfo() << "同步通用设置"; + if(needUpdateSettingValue()) { + QDateTime managerDate = selectValue("vch_value", "calendargeneralsettings", "vch_key", "dt_update", dbname_manager_thread).toDateTime(); + QDateTime syncDate = selectValue("vch_value", "calendargeneralsettings", "vch_key", "dt_update", dbname_sync_thread).toDateTime(); + if (managerDate > syncDate) + if (!syncIntoTable("calendargeneralsettings", dbname_manager_thread, dbname_sync_thread)){ + qWarning()<<"faild:" <<__FUNCTION__ <<" : "<<__LINE__; + return -1; + } + if (syncDate > managerDate) + if (!syncIntoTable("calendargeneralsettings", dbname_sync_thread, dbname_manager_thread)){ + qWarning()<<"faild:" <<__FUNCTION__ <<" : "<<__LINE__; + return -1; + } + } + } + + + return 0; +} + +bool SyncStack::needUpdateSettingValue() { + int mangerdayweek = selectValue("vch_value", "calendargeneralsettings", "vch_key", "firstDayOfWeek", dbname_manager_thread).toInt(); + int syncdayweek = selectValue("vch_value", "calendargeneralsettings", "vch_key", "firstDayOfWeek", dbname_sync_thread).toInt(); + if(mangerdayweek != syncdayweek) { + return true; + } + + int mangerTimeShow = selectValue("vch_value", "calendargeneralsettings", "vch_key", "timeShowType", dbname_manager_thread).toInt(); + int syncTimeShow = selectValue("vch_value", "calendargeneralsettings", "vch_key", "timeShowType", dbname_sync_thread).toInt(); + if(mangerTimeShow != syncTimeShow) { + return true; + } + + return false; +} + +int SyncStack::tmpToLoad(DDataSyncBase::UpdateTypes &updateType) +{ + if (accountState & DAccount::Account_Calendar) { + qInfo() << "更新schedules、schedules、typeColor"; + if (!syncIntoTable("schedules", dbname_sync_thread, dbname_account_thread)){ + qWarning()<<"faild:" <<__FUNCTION__ <<" : "<<__LINE__; + return -1; + } + if (!syncIntoTable("scheduleType", dbname_sync_thread, dbname_account_thread)){ + qWarning()<<"faild:" <<__FUNCTION__ <<" : "<<__LINE__; + return -1; + } + if (!syncIntoTable("typeColor", dbname_sync_thread, dbname_account_thread)){ + qWarning()<<"faild:" <<__FUNCTION__ <<" : "<<__LINE__; + return -1; + } + updateType = DUnionIDDav::Update_Schedule | DUnionIDDav::Update_ScheduleType; + } + + if (accountState & DAccount::Account_Setting) { + qInfo() << "更新通用设置"; + if(needUpdateSettingValue()) { + if (!syncIntoTable("calendargeneralsettings", dbname_sync_thread, dbname_manager_thread)){ + qWarning()<<"faild:" <<__FUNCTION__ <<" : "<<__LINE__; + return -1; + } + } + + updateType = updateType | DUnionIDDav::Update_Setting; + } + + return 0; +} + +int SyncStack::uploadTmpData(SyncFileManage &fileManger) +{ + int errCode = 0; + fileManger.SyncDataUpload(dbpath_sync, errCode); + return errCode; +} + +void SyncStack::deleteTmpData(SyncFileManage &fileManger) +{ + fileManger.syncDataDelete(dbpath_sync); +} + +QString SyncStack::prepareQuest(int count) +{ + QString r; + while (count--) { + r += "?,"; + } + r.chop(1); + return r; +} + +void SyncStack::prepareBinds(QSqlQuery &query, QSqlRecord source) +{ + for (int k = 0; k < source.count(); k++) + query.addBindValue(source.value(k)); +} + +bool SyncStack::syncIntoTable(const QString &table_name, const QString &connection_name_source, const QString &connection_name_target) +{ + SqliteQuery source(QSqlDatabase::database(connection_name_source)); + SqliteQuery target(QSqlDatabase::database(connection_name_target)); + if (!target.exec(" delete from " + table_name)){ + qWarning() << target.lastError() <<"table_name:"< local_header_info; + QMap server_header_info; + SqliteQuery query_local(connection_name_local); + SqliteQuery query_server(connection_name_server); + QString select_sql = QString("SELECT name, type FROM pragma_table_info('%1')").arg(table_name); + QMap default_map = { + {"TEXT", ""}, + {"INTEGER", "0"}, + {"BOOL", "false"}, + {"DATETIME", QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss")} + }; + + query_local.exec(select_sql); + while (query_local.next()) { + local_header_info.insert(query_local.value("name").toString(), query_local.value("type").toString()); + } + + query_server.exec(select_sql); + while (query_server.next()) { + server_header_info.insert(query_server.value("name").toString(), query_server.value("type").toString()); + } + + auto exceptFunc = [](QSet local, QSet server) -> QSet { + QSet ret = local; + local.intersect(server); + ret.subtract(local); + return ret; + }; + + //本地数据的字段 都需要 在服务端数据库里 + QSet header_ready = exceptFunc(local_header_info.keys().toSet(), server_header_info.keys().toSet()); + if (header_ready.isEmpty()) + return true; + + //将本地数据库不在服务器数据库的字段 插入 服务器数据库 + for (auto header : header_ready) { + QString sql_type = local_header_info.value(header); + QString default_value = default_map.value(sql_type); + QString alter_sql = QString("ALTER TABLE %1 ADD COLUMN %2 %3 DEFAULT '%4';") + .arg(table_name) + .arg(header) + .arg(sql_type) + .arg(default_value); + if (!query_server.exec(alter_sql)) { + qInfo() << query_server.lastError(); + return false; + } + } + + return true; +} + + +DUnionIDDav::DUIDSynDataPrivate::DUIDSynDataPrivate() +{ + mThread = new QThread(this); + DUIDSynDataWorker *mWorker = new DUIDSynDataWorker; + qRegisterMetaType("SyncStack"); + mWorker->moveToThread(mThread); + connect(mThread, &QThread::finished, mWorker, &DUIDSynDataWorker::deleteLater); + connect(mThread, &QThread::finished, mThread, &QThread::deleteLater); + + connect(mWorker, &DUIDSynDataWorker::signalUpdate, this, &DUIDSynDataPrivate::signalUpdate); + connect(mWorker, &DUIDSynDataWorker::signalSyncState, this, &DUIDSynDataPrivate::signalSyncState); + connect(this, &DUIDSynDataPrivate::signalSyncData, mWorker, &DUIDSynDataWorker::syncData); + + mThread->start(); +} + +DUnionIDDav::DUIDSynDataPrivate::~DUIDSynDataPrivate() +{ + if (mThread->isRunning()) { + mThread->quit(); + mThread->wait(); + } +} + +void DUnionIDDav::DUIDSynDataPrivate::syncData(QString accountId, QString accountName, int accountState, DDataSyncBase::SyncTypes syncType) +{ + emit signalSyncData(SyncStack{accountId, accountName, accountState, syncType}); +} diff -Nru dde-calendar-5.9.1/calendar-service/src/unionIDDav/dunioniddav.h dde-calendar-5.10.0/calendar-service/src/unionIDDav/dunioniddav.h --- dde-calendar-5.9.1/calendar-service/src/unionIDDav/dunioniddav.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/unionIDDav/dunioniddav.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,27 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef DUNIONIDDAV_H +#define DUNIONIDDAV_H + +#include "ddatasyncbase.h" + +/** + * @brief The DUnionIDDav class + * Union ID 云同步 + */ +class DUnionIDDav : public DDataSyncBase +{ + Q_OBJECT +public: + DUnionIDDav(); + ~DUnionIDDav() override; + void syncData(QString accountId, QString accountName, int accountState, DDataSyncBase::SyncTypes syncType) override; + +private: + class DUIDSynDataPrivate; + DUIDSynDataPrivate *const d; +}; + +#endif // DUNIONIDDAV_H diff -Nru dde-calendar-5.9.1/calendar-service/src/unionIDDav/dunioniddav_p.h dde-calendar-5.10.0/calendar-service/src/unionIDDav/dunioniddav_p.h --- dde-calendar-5.9.1/calendar-service/src/unionIDDav/dunioniddav_p.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/calendar-service/src/unionIDDav/dunioniddav_p.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,203 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef DUNIONIDDAV_P_H +#define DUNIONIDDAV_P_H + +#include "ddatabase.h" +#include "ddatasyncbase.h" +#include "units.h" + +#include +#include +#include +#include + +/** + * @brief The SyncStack struct 记录单次上传的信息和相关操作 + */ +struct SyncStack { + SyncStack() {} + SyncStack(QString _accountId, QString _accountName, int _accountState, DDataSyncBase::SyncTypes _syncType) + : accountId(_accountId) + , dbname_account(_accountName) + , dbname_manager(DDataBase::NameAccountManager) + , dbname_account_thread(DDataBase::createUuid()) + , dbname_manager_thread(DDataBase::createUuid()) + , dbname_sync_thread(DDataBase::createUuid()) + , accountState(_accountState) + , db_account(QSqlDatabase::database(dbname_account)) + , db_manager(QSqlDatabase::database(dbname_manager)) + , syncType(_syncType) {} + + //data + QString accountId; //账户ID + QString dbname_account; //主线程的账户数据库别名 + QString dbname_manager; //主线程的管理数据库别名 + QString dbname_account_thread; //子线程的账户数据库别名 + QString dbname_manager_thread; //子线程的管理数据库别名 + QString dbname_sync_thread; //子线程的同步数据库别名 + int accountState = 0; //账户状态 + QSqlDatabase db_account; //主线程的账户数据库实例 + QSqlDatabase db_manager; //主线程的管理数据库实例 + DDataSyncBase::SyncTypes syncType;//记录类型:上传或下载 + + //sync + QString dbpath_sync; + + //func + //下载云端数据 + int downloadUidData(bool &isInitSyncData, SyncFileManage &fileManger); + //将本地修改数据移动到下载的临时文件中 + int loadToTmp(); + //将临时文件中的数据移动到本地数据库中 + int tmpToLoad(DDataSyncBase::UpdateTypes &updateType); + //上传修改过的临时数据 + int uploadTmpData(SyncFileManage &fileManger); + void deleteTmpData(SyncFileManage &fileManger); + + //sql prepare + QString prepareQuest(int count); + //sql bindvalue + void prepareBinds(QSqlQuery &query, QSqlRecord source); + //sql sync db1.table to db2.table + bool syncIntoTable(const QString &table_name, const QString &connection_name_source, const QString &connection_name_target); + //sql select first record + QSqlRecord selectRecord(const QString &table_name, const QString &key_name, const QVariant &key_value, const QString &connection_name); + //sql replace db1.record to db2.table + bool replaceIntoRecord(const QString &table_name, QSqlRecord record, const QString &connection_name); + //sql select first value + QVariant selectValue(const QString &value_name, const QString &table_name, const QString &key_name, const QVariant &key_value, const QString &connection_name); + //sql select first value + QVariant selectValue(const QString &sql, const QString &connection_name); + //sql delete table + bool deleteTableLine(const QString &table_name, const QString &key_name, const QVariant &key_value, const QString &connection_name); + //sql delete table + bool deleteTable(const QString &table_name, const QString &connection_name); + //sql add column to server + bool repairTable(const QString &table_name, const QString &connection_name_local, const QString &connection_name_server); + + bool needUpdateSettingValue(); +}; + + +/** + * @brief The ThrowAccount struct 用于初始化日程类型和类型颜色 + */ +struct SyncAccount { + explicit SyncAccount(const QString &connectionName, QString accountID) + : _accountID(accountID) + , _connectionName(connectionName) + { + } + + bool defaultScheduleType(); + bool defaultTypeColor(); + + bool insertToScheduleType(const DScheduleType::Ptr &scheduleType); + bool insertToTypeColor(const DTypeColor &typeColor); + + QString _accountID; + QString _connectionName; +}; + +/** + * @brief The SqlTransactionLocker class 用于数据库事务 + */ +class SqlTransactionLocker +{ +public: + explicit SqlTransactionLocker(const QStringList &connectionNames) + : _connectionNames(connectionNames) + { + for (auto name : _connectionNames) { + SqliteQuery(name).transaction(); + } + } + ~SqlTransactionLocker() + { + if (hasCommited) + return; + + for (auto name : _connectionNames) + SqliteQuery(name).rollback(); + } + void commit() + { + hasCommited = true; + for (auto name : _connectionNames) + SqliteQuery(name).commit(); + } + void rollback() + { + hasCommited = true; + for (auto name : _connectionNames) + SqliteQuery(name).rollback(); + } + +private: + QStringList _connectionNames; + bool hasCommited = false; +}; + +/** + * @brief The DUIDSynDataWorker class 用于多线程上传下载 + */ +class DUIDSynDataWorker : public QObject +{ + Q_OBJECT +public: + DUIDSynDataWorker() : QObject(nullptr) + { + } + ~DUIDSynDataWorker() + { + } + +public slots: + void syncData(SyncStack syncType); + +public slots: + void slotSync(); + +signals: + void signalUpdate(const DDataSyncBase::UpdateTypes updateType); + void signalSyncState(const int syncState); + +private: + void startUpdate(); + +private: + //sync + QString dbpath_sync; + QTimer *mSyncTimer = nullptr; + //thread + SyncStack mSync; + QVector mSyncList; +}; + + +/** + * @brief The DUnionIDDav::DUIDSynDataPrivate class DUIDSynData的私有类 + */ +class DUnionIDDav::DUIDSynDataPrivate : public QObject +{ + Q_OBJECT +public: + DUIDSynDataPrivate(); + ~DUIDSynDataPrivate(); + + void syncData(QString accountId, QString accountName, int accountState, DDataSyncBase::SyncTypes syncType); + +signals: + void signalUpdate(const DDataSyncBase::UpdateTypes updateType); + void signalSyncState(const int syncState); + + void signalSyncData(const SyncStack syncType); + +private: + QThread *mThread; +}; + +#endif // DUNIONIDDAV_P_H diff -Nru dde-calendar-5.9.1/CMakeLists.txt dde-calendar-5.10.0/CMakeLists.txt --- dde-calendar-5.9.1/CMakeLists.txt 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/CMakeLists.txt 2023-04-07 06:02:09.000000000 +0000 @@ -1,6 +1,11 @@ cmake_minimum_required(VERSION 3.7) project(dde-calendar) +include(GNUInstallDirs) +if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set(CMAKE_INSTALL_PREFIX /usr) +endif () + #compile flags if (CMAKE_BUILD_TYPE MATCHES Debug) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -Wall -Wextra") @@ -32,11 +37,12 @@ set(${result} ${dirlist}) endmacro() -ADD_SUBDIRECTORY(calendar-basicstruct) +ADD_SUBDIRECTORY(3rdparty/kcalendarcore) +ADD_SUBDIRECTORY(calendar-common) ADD_SUBDIRECTORY(calendar-client) ADD_SUBDIRECTORY(calendar-service) ADD_SUBDIRECTORY(schedule-plugin) -ADD_SUBDIRECTORY(tests) +#ADD_SUBDIRECTORY(tests) #前后端都有翻译所以将翻译放到更高层级 find_package(Qt5LinguistTools REQUIRED) @@ -75,6 +81,11 @@ ${DTNG_QM_FILES} ) - set(CMAKE_INSTALL_PREFIX /usr) +if(DEFINED ENV{PREFIX}) + set(CMAKE_INSTALL_PREFIX $ENV{PREFIX}) +else() + set(CMAKE_INSTALL_PREFIX /usr) +endif() + file(GLOB APP_QM_FILES "translations/*.qm") - install(FILES ${APP_QM_FILES} DESTINATION share/dde-calendar/translations) + install(FILES ${APP_QM_FILES} DESTINATION ${CMAKE_INSTALL_DATADIR}/dde-calendar/translations) diff -Nru dde-calendar-5.9.1/DDav/CMakeLists.txt dde-calendar-5.10.0/DDav/CMakeLists.txt --- dde-calendar-5.9.1/DDav/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/DDav/CMakeLists.txt 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,23 @@ +cmake_minimum_required(VERSION 3.7) +project(kdav) + +# Find the library +find_package(PkgConfig REQUIRED) +find_package(Qt5 COMPONENTS + Core + DBus +REQUIRED) + +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_INCLUDE_CURRENT_DIR ON) +set(CMAKE_AUTOMOC ON) + +#安全编译参数 +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-protector-strong -D_FORTITY_SOURCE=1 -z noexecstack -pie -fPIC -z lazy") + +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src) +aux_source_directory(src KDAV_SRCS) +link_libraries(${Qt5CORE_LIBRARIES} ${Qt5DBus_LIBRARIES}) +add_library(${PROJECT_NAME} STATIC ${KDAV_SRCS}) + + diff -Nru dde-calendar-5.9.1/DDav/src/ddavbase.cpp dde-calendar-5.10.0/DDav/src/ddavbase.cpp --- dde-calendar-5.9.1/DDav/src/ddavbase.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/DDav/src/ddavbase.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,9 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "ddavbase.h" + +DDavBase::DDavBase() +{ +} diff -Nru dde-calendar-5.9.1/DDav/src/ddavbase.h dde-calendar-5.10.0/DDav/src/ddavbase.h --- dde-calendar-5.9.1/DDav/src/ddavbase.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/DDav/src/ddavbase.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,14 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef DDAVBASE_H +#define DDAVBASE_H + +class DDavBase +{ +public: + DDavBase(); +}; + +#endif // DDAVBASE_H \ No newline at end of file diff -Nru dde-calendar-5.9.1/debian/changelog dde-calendar-5.10.0/debian/changelog --- dde-calendar-5.9.1/debian/changelog 2022-07-14 07:59:09.000000000 +0000 +++ dde-calendar-5.10.0/debian/changelog 2023-06-02 09:24:47.000000000 +0000 @@ -1,167 +1,19 @@ -dde-calendar (5.9.1-3) unstable; urgency=medium +dde-calendar (5.10.0-1) lunar; urgency=medium - * debian/rules: - + remove override_dh_auto_test. - * debian/patches: - + Add disable testing patch. + * Upload to lunar. - -- Clay Stan Thu, 14 Jul 2022 15:59:09 +0800 + -- Arun Kumar Pariyar Fri, 02 Jun 2023 15:09:47 +0545 -dde-calendar (5.9.1-2) unstable; urgency=medium +dde-calendar (5.10.0) unstable; urgency=medium - * debian/rules: - + Skip all test. - * debian/patches: - + Remove skip CreateJobType_01 test patch. + * chore: deepin system does not support calendar sync + * chore: correct a typo in CMakeLists.txt - -- Clay Stan Thu, 14 Jul 2022 14:13:00 +0800 - -dde-calendar (5.9.1-1) unstable; urgency=medium - - * New upstream release 5.9.1. - * debian/control: - + Add new build-dep: libgtest-dev,qttools5-dev. - + Add new depends: libdframeworkdbus2. - + Bump Standards-Version to 4.6.1.0. - * debian/copyright: - + Update upstream contact. - * debian/dde-calendar.1: - + Use upstream manpage. - * debian/patches: - + Remove useless patches. - + Add skip CreateJobType_01 test patch. - * debian/rules: - + Add -DCMAKE_SAFETYTEST_ARG. - * debian/upstream/metadata: - + Update Bug-Database and Bug-Submit address. - - -- Clay Stan Thu, 14 Jul 2022 10:28:17 +0800 - -dde-calendar (5.7.0.23-1) unstable; urgency=medium - - * Team upload. - * Upload to unstable. - - -- Boyuan Yang Sat, 13 Nov 2021 15:57:52 -0500 - -dde-calendar (5.7.0.23-1~exp1) experimental; urgency=medium - - * Team upload. - - [ Clay Stan ] - * New upstream release 5.7.0.23. - - [ Hu Feng ] - * debian/control: - + Add Hu Feng to Uploaders list. - + Add dde-qt5integration to Depends in dde-calendar package. - * debian/rules: Update compilation rules - * debian/patches: - + Add 0003-fix-lintian-problem-and-enable-icon.patch - - [ Boyuan Yang ] - * Tighten version for dtk libraries to 5.5.17+. - - -- Boyuan Yang Tue, 09 Nov 2021 08:38:27 -0500 - -dde-calendar (5.7.0.4-1) unstable; urgency=medium - - [ Clay Stan ] - * New upstream release 5.7.0.4. - + Add Clay Stan to uploaders list. - - [ Arun Kumar Pariyar ] - * debian/control: - + Add Arun Kumar Pariyar to Uploaders. - + Bump Standards-Version to 4.5.1. - + Bump debhelper compat to v13. - + Update Build-Depends and tighten version for libdtkwidget-dev - to (>=5.2~) and libdframeworkdbus-dev to (>=5.2.0~). - * debian/rules: Ensure proper build and drop LDFLAGS. - * debian/patches: - + Add 0001-fix-qt5-14-incompatibility-issue patch file. - + Add 0002-fix-desktop-entry-lacks-keywords-entry patch file. - * debian/upstream: Set upstream metadata fields. - * debian/copyright: Update copyright information. - - -- Arun Kumar Pariyar Sat, 05 Dec 2020 22:03:58 +0545 - -dde-calendar (5.0.1-1) unstable; urgency=medium - - * Team upload. - * New upstream release 5.0.1. - * debian/control: - + Switch buildsystem from qmake to cmake (>= 3.7). - - -- Boyuan Yang Sat, 07 Dec 2019 14:49:00 -0500 - -dde-calendar (1.2.6-1) unstable; urgency=high + -- myml Thu, 6 Apr 2023 11:43:00 +0800 - * Team upload. - * New upstream version 1.2.6. - * Rebuild for Debian Buster. - + Fix crashing when starting up the program. - * debian/control: - + Bump debhelper compat to v12. - + Bump Standards-Version to 4.3.0. - + R³: Use Rules-Requires-Root: no. - -- Boyuan Yang Mon, 07 Jan 2019 09:26:38 -0500 +dde-calendar (5.9.1) unstable; urgency=medium -dde-calendar (1.2.5-1) unstable; urgency=medium + * Init. - * New upstream version 1.2.5 - * Bump Standards-Version to 4.2.0 (no changes needed). - - -- Yanhao Mo Thu, 09 Aug 2018 10:06:58 +0800 - -dde-calendar (1.2.4-1) unstable; urgency=medium - - * New upstream version 1.2.4 - * Bump Standards-Version to 4.1.5 (no changes needed). - - -- Yanhao Mo Wed, 01 Aug 2018 09:52:35 +0800 - -dde-calendar (1.2.3-1) unstable; urgency=medium - - * New upstream release. - * d/control: Use pkg-deepin-devel@lists.alioth.debian.org in maintainer - field. - * d/patches: Drop patches, applied by upstream. - - -- Yanhao Mo Sat, 26 May 2018 10:56:44 +0800 - -dde-calendar (1.2.2-2) unstable; urgency=medium - - * Team upload. - * Backport upstream patch to fix date refreshing issue. - * Use team+pkg-deepin@tracker.debian.org in maintainer field. - * Bump Standards-Version to 4.1.4 (no changes needed). - * d/rules: Use "dh-missing --fail-missing". - * d/copyright: Fix typos. - - -- Boyuan Yang <073plan@gmail.com> Fri, 20 Apr 2018 17:04:32 +0800 - -dde-calendar (1.2.2-1) unstable; urgency=medium - - * New release. - * Some Bug Fixes - * d/rules: use /usr/share/dpkg/pkg-info.mk instead of dpkg-parsechangelog. - * d/control: Use Salsa platform for Vcs field. - * debian/control: Update Standers-Version to 4.1.3. - * debian/compat: Switch compat to level 11. - - -- Yanhao Mo Fri, 30 Mar 2018 10:57:34 +0800 - -dde-calendar (1.1.1-2) unstable; urgency=medium - - * Team upload. - * Set build architecture as linux-any. - - -- Boyuan Yang <073plan@gmail.com> Tue, 12 Dec 2017 09:56:27 +0800 - -dde-calendar (1.1.1-1) unstable; urgency=medium - - * Initial release (Closes: #871981) - - -- Yangfl Thu, 07 Dec 2017 15:19:48 +0800 + -- Clay Stan Thu, 14 Jul 2022 14:13:00 +0800 diff -Nru dde-calendar-5.9.1/debian/control dde-calendar-5.10.0/debian/control --- dde-calendar-5.9.1/debian/control 2022-07-14 02:16:32.000000000 +0000 +++ dde-calendar-5.10.0/debian/control 2023-06-02 09:24:21.000000000 +0000 @@ -1,16 +1,10 @@ Source: dde-calendar Section: utils Priority: optional -Maintainer: Debian Deepin Packaging Team -Uploaders: - Yangfl , - Yanhao Mo , - Arun Kumar Pariyar , - Clay Stan , - Hu Feng , +Maintainer: Deepin Packages Builder Build-Depends: - cmake (>= 3.7), - debhelper-compat (= 13), + debhelper-compat (=11), + cmake, deepin-gettext-tools, libdframeworkdbus-dev (>= 5.4.20~), libdtkgui-dev (>= 5.5.17~), @@ -21,25 +15,25 @@ qtbase5-dev, qttools5-dev, qttools5-dev-tools, + deepin-gettext-tools, + libdframeworkdbus-dev, + libgtest-dev, + qttools5-dev, + libical-dev, + libgcrypt20-dev +Standards-Version: 4.3.0 +Homepage: http://www.deepin.org +Vcs-Git: https://github.com/linuxdeepin/dde-calendar Rules-Requires-Root: no -Standards-Version: 4.6.1.0 -Homepage: https://github.com/linuxdeepin/dde-calendar -Vcs-Git: https://salsa.debian.org/pkg-deepin-team/dde-calendar.git -Vcs-Browser: https://salsa.debian.org/pkg-deepin-team/dde-calendar Package: dde-calendar Architecture: linux-any Depends: dde-qt5integration, libdframeworkdbus2, + dde-api, ${misc:Depends}, ${shlibs:Depends}, -Recommends: - dde-api, -Provides: - deepin-calendar, -Description: Deepin Calendar - Deepin Calendar is an easy calendar tool developed by Deepin Technology, main - features current date, solar terms, lunar calendar and world holidays. - . - This package is part of DDE (Deepin Desktop Environment). +Description: Calendar is a smart daily planner to schedule all things in life. + Calendar is a small management tool for personal life that combines time + and events and integrates the function of memorizing and scheduling. diff -Nru dde-calendar-5.9.1/debian/dde-calendar.1 dde-calendar-5.10.0/debian/dde-calendar.1 --- dde-calendar-5.9.1/debian/dde-calendar.1 2022-07-14 02:18:20.000000000 +0000 +++ dde-calendar-5.10.0/debian/dde-calendar.1 2023-06-02 09:24:21.000000000 +0000 @@ -1,6 +1,5 @@ -.\" Hey, EMACS: -*- nroff -*- -.\" (C) Copyright 2021 chenhaifeng , -.\" +.\" This file is processed to generate manpages in the +.\" build diretory. .TH "dde-calendar" "1" "2021-3-11" "Deepin" .\" Please adjust this date whenever revising the manpage. .\" diff -Nru dde-calendar-5.9.1/debian/dde-calendar.postinst dde-calendar-5.10.0/debian/dde-calendar.postinst --- dde-calendar-5.9.1/debian/dde-calendar.postinst 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/debian/dde-calendar.postinst 2023-06-02 09:24:21.000000000 +0000 @@ -0,0 +1,33 @@ +#!/bin/bash +#日历后端服务进程名称 +calendarServiceName="dde-calendar-service" +#获取日历后端进程id +serviceIDsARR=($(pidof ${calendarServiceName})) + +#判断后端是否在运行。如果在运行则kill掉 +if [ ${#serviceIDsARR[@]} -gt 0 ] +then + killall ${calendarServiceName} +fi +#获取已登陆的用户 +userNameArr=($(who -q | head -n 1)) + +#定时器名称 +sysTimer="com.dde.calendarserver.calendar.timer" + +#根据已登陆的用户开启后端定时任务 +for userName in ${userNameArr[@]} ; do + #获取服务状态 + serviceStatus=$(runuser -l ${userName} -c "XDG_RUNTIME_DIR=\"/run/user/$(id -u ${userName})\" systemctl --user is-active ${sysTimer}") + #活跃的关键字 + activeStr="active" + #如果为活跃的则表示服务已开启 + if [ "$serviceStatus" = "$activeStr" ];then + #如果服务已经启动则重新加载 + runuser -l ${userName} -c "XDG_RUNTIME_DIR=\"/run/user/$(id -u ${userName})\" systemctl --user daemon-reload" + else + #如果服务没有启动则设置开启 + runuser -l ${userName} -c "XDG_RUNTIME_DIR=\"/run/user/$(id -u ${userName})\" systemctl --user enable ${sysTimer}" + runuser -l ${userName} -c "XDG_RUNTIME_DIR=\"/run/user/$(id -u ${userName})\" systemctl --user start ${sysTimer}" + fi +done \ No newline at end of file diff -Nru dde-calendar-5.9.1/debian/patches/0001-disable-testing.patch dde-calendar-5.10.0/debian/patches/0001-disable-testing.patch --- dde-calendar-5.9.1/debian/patches/0001-disable-testing.patch 2022-07-14 07:57:25.000000000 +0000 +++ dde-calendar-5.10.0/debian/patches/0001-disable-testing.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,13 +0,0 @@ -Index: dde-calendar/CMakeLists.txt -=================================================================== ---- dde-calendar.orig/CMakeLists.txt -+++ dde-calendar/CMakeLists.txt -@@ -36,7 +36,7 @@ ADD_SUBDIRECTORY(calendar-basicstruct) - ADD_SUBDIRECTORY(calendar-client) - ADD_SUBDIRECTORY(calendar-service) - ADD_SUBDIRECTORY(schedule-plugin) --ADD_SUBDIRECTORY(tests) -+# ADD_SUBDIRECTORY(tests) - - #前后端都有翻译所以将翻译放到更高层级 - find_package(Qt5LinguistTools REQUIRED) diff -Nru dde-calendar-5.9.1/debian/patches/series dde-calendar-5.10.0/debian/patches/series --- dde-calendar-5.9.1/debian/patches/series 2022-07-14 07:57:09.000000000 +0000 +++ dde-calendar-5.10.0/debian/patches/series 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -0001-disable-testing.patch diff -Nru dde-calendar-5.9.1/debian/README.Debian dde-calendar-5.10.0/debian/README.Debian --- dde-calendar-5.9.1/debian/README.Debian 2022-07-14 01:59:58.000000000 +0000 +++ dde-calendar-5.10.0/debian/README.Debian 1970-01-01 00:00:00.000000000 +0000 @@ -1,7 +0,0 @@ -README.Debian for dde-calendar ------------------------------- - -Note that dde-calendar needs a running dde-api daemon to provide with -lunar calendar information via D-Bus. - - -- Boyuan Yang <073plan@gmail.com> Tue, 12 Dec 2017 09:56:27 +0800 diff -Nru dde-calendar-5.9.1/.github/workflows/backup-to-gitlab.yml dde-calendar-5.10.0/.github/workflows/backup-to-gitlab.yml --- dde-calendar-5.9.1/.github/workflows/backup-to-gitlab.yml 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/.github/workflows/backup-to-gitlab.yml 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,17 @@ +name: backup to gitlab +on: [push] + +concurrency: + group: ${{ github.workflow }} + cancel-in-progress: true + +jobs: + backup-to-gitlabwh: + uses: linuxdeepin/.github/.github/workflows/backup-to-gitlabwh.yml@master + secrets: + BRIDGETOKEN: ${{ secrets.BRIDGETOKEN }} + + backup-to-gitee: + uses: linuxdeepin/.github/.github/workflows/backup-to-gitee.yml@master + secrets: + GITEE_SYNC_TOKEN: ${{ secrets.GITEE_SYNC_TOKEN }} diff -Nru dde-calendar-5.9.1/.github/workflows/call-auto-tag.yml dde-calendar-5.10.0/.github/workflows/call-auto-tag.yml --- dde-calendar-5.9.1/.github/workflows/call-auto-tag.yml 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/.github/workflows/call-auto-tag.yml 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,16 @@ +name: auto tag + +on: + pull_request_target: + types: [opened, synchronize, closed] + paths: + - "debian/changelog" + +concurrency: + group: ${{ github.workflow }}-pull/${{ github.event.number }} + cancel-in-progress: true + +jobs: + auto_tag: + uses: linuxdeepin/.github/.github/workflows/auto-tag.yml@master + secrets: inherit diff -Nru dde-calendar-5.9.1/.github/workflows/call-build-deb.yml dde-calendar-5.10.0/.github/workflows/call-build-deb.yml --- dde-calendar-5.9.1/.github/workflows/call-build-deb.yml 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/.github/workflows/call-build-deb.yml 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,17 @@ +name: Call build-deb +on: + pull_request_target: + paths-ignore: + - ".github/workflows/**" + types: [ opened, closed, synchronize ] + +concurrency: + group: ${{ github.workflow }}-pull/${{ github.event.number }} + cancel-in-progress: true + +jobs: + check_job: + if: github.event.action != 'closed' || github.event.pull_request.merged + uses: linuxdeepin/.github/.github/workflows/build-deb.yml@master + secrets: + BridgeToken: ${{ secrets.BridgeToken }} diff -Nru dde-calendar-5.9.1/.github/workflows/call-build-distribution.yml dde-calendar-5.10.0/.github/workflows/call-build-distribution.yml --- dde-calendar-5.9.1/.github/workflows/call-build-distribution.yml 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/.github/workflows/call-build-distribution.yml 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,17 @@ +name: Call build-distribution +on: + push: + paths-ignore: + - ".github/workflows/**" + pull_request_target: + paths-ignore: + - ".github/workflows/**" + +jobs: + check_job: + uses: linuxdeepin/.github/.github/workflows/build-distribution.yml@master + secrets: + BUILD_GPG_PRIVATE_KEY: ${{ secrets.BUILD_GPG_PRIVATE_KEY }} + BUILD_SSH_PRIVATE_KEY: ${{ secrets.BUILD_SSH_PRIVATE_KEY }} + WEBDAV_PASSWD: ${{ secrets.WEBDAV_PASSWD }} + WEBDAV_USER: ${{ secrets.WEBDAV_USER }} diff -Nru dde-calendar-5.9.1/.github/workflows/call-chatOps.yml dde-calendar-5.10.0/.github/workflows/call-chatOps.yml --- dde-calendar-5.9.1/.github/workflows/call-chatOps.yml 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/.github/workflows/call-chatOps.yml 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,10 @@ +name: chatOps +on: + issue_comment: + types: [created] + +jobs: + chatopt: + uses: linuxdeepin/.github/.github/workflows/chatOps.yml@master + secrets: + APP_PRIVATE_KEY: ${{ secrets.APP_PRIVATE_KEY }} diff -Nru dde-calendar-5.9.1/.github/workflows/call-clacheck.yml dde-calendar-5.10.0/.github/workflows/call-clacheck.yml --- dde-calendar-5.9.1/.github/workflows/call-clacheck.yml 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/.github/workflows/call-clacheck.yml 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,16 @@ +name: Call CLA check +on: + issue_comment: + types: [created] + pull_request_target: + types: [opened, closed, synchronize] + +concurrency: + group: ${{ github.workflow }}-pull/${{ github.event.number }} + cancel-in-progress: true + +jobs: + clacheck: + uses: linuxdeepin/.github/.github/workflows/cla-check.yml@master + secrets: + APP_PRIVATE_KEY: ${{ secrets.APP_PRIVATE_KEY }} diff -Nru dde-calendar-5.9.1/.github/workflows/call-commitlint.yml dde-calendar-5.10.0/.github/workflows/call-commitlint.yml --- dde-calendar-5.9.1/.github/workflows/call-commitlint.yml 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/.github/workflows/call-commitlint.yml 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,11 @@ +name: Call commitlint +on: + pull_request_target: + +concurrency: + group: ${{ github.workflow }}-pull/${{ github.event.number }} + cancel-in-progress: true + +jobs: + check_job: + uses: linuxdeepin/.github/.github/workflows/commitlint.yml@master diff -Nru dde-calendar-5.9.1/.github/workflows/call-license-check.yml dde-calendar-5.10.0/.github/workflows/call-license-check.yml --- dde-calendar-5.9.1/.github/workflows/call-license-check.yml 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/.github/workflows/call-license-check.yml 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,16 @@ +name: Call License and README Check +on: + pull_request_target: + types: [opened, synchronize, reopened] + +permissions: + pull-requests: write + contents: read + +concurrency: + group: ${{ github.workflow }}-pull/${{ github.event.number }} + cancel-in-progress: true + +jobs: + license-check: + uses: linuxdeepin/.github/.github/workflows/license-check.yml@master diff -Nru dde-calendar-5.9.1/.github/workflows/call-tag-build.yml dde-calendar-5.10.0/.github/workflows/call-tag-build.yml --- dde-calendar-5.9.1/.github/workflows/call-tag-build.yml 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/.github/workflows/call-tag-build.yml 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,13 @@ +name: tag build +on: + push: + tags: "*" + +concurrency: + group: ${{ github.workflow }} + cancel-in-progress: true + +jobs: + build: + uses: linuxdeepin/.github/.github/workflows/tag-build.yml@master + secrets: inherit diff -Nru dde-calendar-5.9.1/.github/workflows/cppcheck.yml dde-calendar-5.10.0/.github/workflows/cppcheck.yml --- dde-calendar-5.9.1/.github/workflows/cppcheck.yml 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/.github/workflows/cppcheck.yml 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,26 @@ +name: cppcheck +on: + pull_request_target: + paths-ignore: + - ".github/workflows/**" + +concurrency: + group: ${{ github.workflow }}-pull/${{ github.event.number }} + cancel-in-progress: true + +jobs: + cppchceck: + name: cppcheck + runs-on: ubuntu-latest + steps: + - run: export + - uses: actions/checkout@v2 + with: + ref: ${{ github.event.pull_request.head.sha }} + persist-credentials: false + - uses: linuxdeepin/action-cppcheck@main + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + repository: ${{ github.repository }} + pull_request_id: ${{ github.event.pull_request.number }} + allow_approve: false diff -Nru dde-calendar-5.9.1/LICENSES/CC0-1.0.txt dde-calendar-5.10.0/LICENSES/CC0-1.0.txt --- dde-calendar-5.9.1/LICENSES/CC0-1.0.txt 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/LICENSES/CC0-1.0.txt 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,121 @@ +Creative Commons Legal Code + +CC0 1.0 Universal + + CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE + LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN + ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS + INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES + REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS + PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM + THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED + HEREUNDER. + +Statement of Purpose + +The laws of most jurisdictions throughout the world automatically confer +exclusive Copyright and Related Rights (defined below) upon the creator +and subsequent owner(s) (each and all, an "owner") of an original work of +authorship and/or a database (each, a "Work"). + +Certain owners wish to permanently relinquish those rights to a Work for +the purpose of contributing to a commons of creative, cultural and +scientific works ("Commons") that the public can reliably and without fear +of later claims of infringement build upon, modify, incorporate in other +works, reuse and redistribute as freely as possible in any form whatsoever +and for any purposes, including without limitation commercial purposes. +These owners may contribute to the Commons to promote the ideal of a free +culture and the further production of creative, cultural and scientific +works, or to gain reputation or greater distribution for their Work in +part through the use and efforts of others. + +For these and/or other purposes and motivations, and without any +expectation of additional consideration or compensation, the person +associating CC0 with a Work (the "Affirmer"), to the extent that he or she +is an owner of Copyright and Related Rights in the Work, voluntarily +elects to apply CC0 to the Work and publicly distribute the Work under its +terms, with knowledge of his or her Copyright and Related Rights in the +Work and the meaning and intended legal effect of CC0 on those rights. + +1. Copyright and Related Rights. A Work made available under CC0 may be +protected by copyright and related or neighboring rights ("Copyright and +Related Rights"). Copyright and Related Rights include, but are not +limited to, the following: + + i. the right to reproduce, adapt, distribute, perform, display, + communicate, and translate a Work; + ii. moral rights retained by the original author(s) and/or performer(s); +iii. publicity and privacy rights pertaining to a person's image or + likeness depicted in a Work; + iv. rights protecting against unfair competition in regards to a Work, + subject to the limitations in paragraph 4(a), below; + v. rights protecting the extraction, dissemination, use and reuse of data + in a Work; + vi. database rights (such as those arising under Directive 96/9/EC of the + European Parliament and of the Council of 11 March 1996 on the legal + protection of databases, and under any national implementation + thereof, including any amended or successor version of such + directive); and +vii. other similar, equivalent or corresponding rights throughout the + world based on applicable law or treaty, and any national + implementations thereof. + +2. Waiver. To the greatest extent permitted by, but not in contravention +of, applicable law, Affirmer hereby overtly, fully, permanently, +irrevocably and unconditionally waives, abandons, and surrenders all of +Affirmer's Copyright and Related Rights and associated claims and causes +of action, whether now known or unknown (including existing as well as +future claims and causes of action), in the Work (i) in all territories +worldwide, (ii) for the maximum duration provided by applicable law or +treaty (including future time extensions), (iii) in any current or future +medium and for any number of copies, and (iv) for any purpose whatsoever, +including without limitation commercial, advertising or promotional +purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each +member of the public at large and to the detriment of Affirmer's heirs and +successors, fully intending that such Waiver shall not be subject to +revocation, rescission, cancellation, termination, or any other legal or +equitable action to disrupt the quiet enjoyment of the Work by the public +as contemplated by Affirmer's express Statement of Purpose. + +3. Public License Fallback. Should any part of the Waiver for any reason +be judged legally invalid or ineffective under applicable law, then the +Waiver shall be preserved to the maximum extent permitted taking into +account Affirmer's express Statement of Purpose. In addition, to the +extent the Waiver is so judged Affirmer hereby grants to each affected +person a royalty-free, non transferable, non sublicensable, non exclusive, +irrevocable and unconditional license to exercise Affirmer's Copyright and +Related Rights in the Work (i) in all territories worldwide, (ii) for the +maximum duration provided by applicable law or treaty (including future +time extensions), (iii) in any current or future medium and for any number +of copies, and (iv) for any purpose whatsoever, including without +limitation commercial, advertising or promotional purposes (the +"License"). The License shall be deemed effective as of the date CC0 was +applied by Affirmer to the Work. Should any part of the License for any +reason be judged legally invalid or ineffective under applicable law, such +partial invalidity or ineffectiveness shall not invalidate the remainder +of the License, and in such case Affirmer hereby affirms that he or she +will not (i) exercise any of his or her remaining Copyright and Related +Rights in the Work or (ii) assert any associated claims and causes of +action with respect to the Work, in either case contrary to Affirmer's +express Statement of Purpose. + +4. Limitations and Disclaimers. + + a. No trademark or patent rights held by Affirmer are waived, abandoned, + surrendered, licensed or otherwise affected by this document. + b. Affirmer offers the Work as-is and makes no representations or + warranties of any kind concerning the Work, express, implied, + statutory or otherwise, including without limitation warranties of + title, merchantability, fitness for a particular purpose, non + infringement, or the absence of latent or other defects, accuracy, or + the present or absence of errors, whether or not discoverable, all to + the greatest extent permissible under applicable law. + c. Affirmer disclaims responsibility for clearing rights of other persons + that may apply to the Work or any use thereof, including without + limitation any person's Copyright and Related Rights in the Work. + Further, Affirmer disclaims responsibility for obtaining any necessary + consents, permissions or other rights required for any use of the + Work. + d. Affirmer understands and acknowledges that Creative Commons is not a + party to this document and has no duty or obligation with respect to + this CC0 or use of the Work. diff -Nru dde-calendar-5.9.1/LICENSES/CC-BY-4.0.txt dde-calendar-5.10.0/LICENSES/CC-BY-4.0.txt --- dde-calendar-5.9.1/LICENSES/CC-BY-4.0.txt 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/LICENSES/CC-BY-4.0.txt 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,156 @@ +Creative Commons Attribution 4.0 International + + Creative Commons Corporation (“Creative Commons”) is not a law firm and does not provide legal services or legal advice. Distribution of Creative Commons public licenses does not create a lawyer-client or other relationship. Creative Commons makes its licenses and related information available on an “as-is” basis. Creative Commons gives no warranties regarding its licenses, any material licensed under their terms and conditions, or any related information. Creative Commons disclaims all liability for damages resulting from their use to the fullest extent possible. + +Using Creative Commons Public Licenses + +Creative Commons public licenses provide a standard set of terms and conditions that creators and other rights holders may use to share original works of authorship and other material subject to copyright and certain other rights specified in the public license below. The following considerations are for informational purposes only, are not exhaustive, and do not form part of our licenses. + +Considerations for licensors: Our public licenses are intended for use by those authorized to give the public permission to use material in ways otherwise restricted by copyright and certain other rights. Our licenses are irrevocable. Licensors should read and understand the terms and conditions of the license they choose before applying it. Licensors should also secure all rights necessary before applying our licenses so that the public can reuse the material as expected. Licensors should clearly mark any material not subject to the license. This includes other CC-licensed material, or material used under an exception or limitation to copyright. More considerations for licensors. + +Considerations for the public: By using one of our public licenses, a licensor grants the public permission to use the licensed material under specified terms and conditions. If the licensor’s permission is not necessary for any reason–for example, because of any applicable exception or limitation to copyright–then that use is not regulated by the license. Our licenses grant only permissions under copyright and certain other rights that a licensor has authority to grant. Use of the licensed material may still be restricted for other reasons, including because others have copyright or other rights in the material. A licensor may make special requests, such as asking that all changes be marked or described. Although not required by our licenses, you are encouraged to respect those requests where reasonable. More considerations for the public. + +Creative Commons Attribution 4.0 International Public License + +By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions. + +Section 1 – Definitions. + + a. Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image. + + b. Adapter's License means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License. + + c. Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights. + + d. Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements. + + e. Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material. + + f. Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License. + + g. Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license. + + h. Licensor means the individual(s) or entity(ies) granting rights under this Public License. + + i. Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them. + + j. Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world. + + k. You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning. + +Section 2 – Scope. + + a. License grant. + + 1. Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to: + + A. reproduce and Share the Licensed Material, in whole or in part; and + + B. produce, reproduce, and Share Adapted Material. + + 2. Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions. + + 3. Term. The term of this Public License is specified in Section 6(a). + + 4. Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material. + + 5. Downstream recipients. + + A. Offer from the Licensor – Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License. + + B. No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material. + + 6. No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i). + +b. Other rights. + + 1. Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise. + + 2. Patent and trademark rights are not licensed under this Public License. + + 3. To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties. + +Section 3 – License Conditions. + +Your exercise of the Licensed Rights is expressly made subject to the following conditions. + + a. Attribution. + + 1. If You Share the Licensed Material (including in modified form), You must: + + A. retain the following if it is supplied by the Licensor with the Licensed Material: + + i. identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated); + + ii. a copyright notice; + + iii. a notice that refers to this Public License; + + iv. a notice that refers to the disclaimer of warranties; + + v. a URI or hyperlink to the Licensed Material to the extent reasonably practicable; + + B. indicate if You modified the Licensed Material and retain an indication of any previous modifications; and + + C. indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License. + + 2. You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information. + + 3. If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable. + + 4. If You Share Adapted Material You produce, the Adapter's License You apply must not prevent recipients of the Adapted Material from complying with this Public License. + +Section 4 – Sui Generis Database Rights. + +Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material: + + a. for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database; + + b. if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material; and + + c. You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database. +For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights. + +Section 5 – Disclaimer of Warranties and Limitation of Liability. + + a. Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You. + + b. To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You. + + c. The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability. + +Section 6 – Term and Termination. + + a. This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically. + + b. Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates: + + 1. automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or + + 2. upon express reinstatement by the Licensor. + + c. For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License. + + d. For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License. + + e. Sections 1, 5, 6, 7, and 8 survive termination of this Public License. + +Section 7 – Other Terms and Conditions. + + a. The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed. + + b. Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License. + +Section 8 – Interpretation. + + a. For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License. + + b. To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions. + + c. No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor. + + d. Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority. + +Creative Commons is not a party to its public licenses. Notwithstanding, Creative Commons may elect to apply one of its public licenses to material it publishes and in those instances will be considered the “Licensor.” Except for the limited purpose of indicating that material is shared under a Creative Commons public license or as otherwise permitted by the Creative Commons policies published at creativecommons.org/policies, Creative Commons does not authorize the use of the trademark “Creative Commons” or any other trademark or logo of Creative Commons without its prior written consent including, without limitation, in connection with any unauthorized modifications to any of its public licenses or any other arrangements, understandings, or agreements concerning use of licensed material. For the avoidance of doubt, this paragraph does not form part of the public licenses. + +Creative Commons may be contacted at creativecommons.org. diff -Nru dde-calendar-5.9.1/LICENSES/GPL-3.0-or-later.txt dde-calendar-5.10.0/LICENSES/GPL-3.0-or-later.txt --- dde-calendar-5.9.1/LICENSES/GPL-3.0-or-later.txt 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/LICENSES/GPL-3.0-or-later.txt 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,232 @@ +GNU GENERAL PUBLIC LICENSE +Version 3, 29 June 2007 + +Copyright © 2007 Free Software Foundation, Inc. + +Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. + +Preamble + +The GNU General Public License is a free, copyleft license for software and other kinds of works. + +The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. + +When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. + +To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. + +For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. + +Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. + +For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. + +Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. + +Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. + +The precise terms and conditions for copying, distribution and modification follow. + +TERMS AND CONDITIONS + +0. Definitions. + +“This License” refers to version 3 of the GNU General Public License. + +“Copyright” also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. + +“The Program” refers to any copyrightable work licensed under this License. Each licensee is addressed as “you”. “Licensees” and “recipients” may be individuals or organizations. + +To “modify” a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a “modified version” of the earlier work or a work “based on” the earlier work. + +A “covered work” means either the unmodified Program or a work based on the Program. + +To “propagate” a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. + +To “convey” a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. + +An interactive user interface displays “Appropriate Legal Notices” to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. + +1. Source Code. +The “source code” for a work means the preferred form of the work for making modifications to it. “Object code” means any non-source form of a work. + +A “Standard Interface” means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. + +The “System Libraries” of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A “Major Component”, in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. + +The “Corresponding Source” for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. + +The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. + +The Corresponding Source for a work in source code form is that same work. + +2. Basic Permissions. +All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. + +You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. + +Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. + +3. Protecting Users' Legal Rights From Anti-Circumvention Law. +No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. + +When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. + +4. Conveying Verbatim Copies. +You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. + +You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. + +5. Conveying Modified Source Versions. +You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to “keep intact all notices”. + + c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. + +A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an “aggregate” if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. + +6. Conveying Non-Source Forms. +You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: + + a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. + + d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. + +A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. + +A “User Product” is either (1) a “consumer product”, which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, “normally used” refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. + +“Installation Information” for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. + +If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). + +The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. + +Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. + +7. Additional Terms. +“Additional permissions” are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. + +When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. + +Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or authors of the material; or + + e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. + +All other non-permissive additional terms are considered “further restrictions” within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. + +If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. + +Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. + +8. Termination. +You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). + +However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. + +Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. + +Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. + +9. Acceptance Not Required for Having Copies. +You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. + +10. Automatic Licensing of Downstream Recipients. +Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. + +An “entity transaction” is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. + +You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. + +11. Patents. +A “contributor” is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's “contributor version”. + +A contributor's “essential patent claims” are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, “control” includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. + +Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. + +In the following three paragraphs, a “patent license” is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To “grant” such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. + +If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. “Knowingly relying” means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. + +If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. + +A patent license is “discriminatory” if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. + +Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. + +12. No Surrender of Others' Freedom. +If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. + +13. Use with the GNU Affero General Public License. +Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. + +14. Revised Versions of this License. +The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. + +If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. + +Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. + +15. Disclaimer of Warranty. +THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +16. Limitation of Liability. +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +17. Interpretation of Sections 15 and 16. +If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. + +END OF TERMS AND CONDITIONS + +How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + +If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an “about box”. + +You should also get your employer (if you work as a programmer) or school, if any, to sign a “copyright disclaimer” for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . + +The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . diff -Nru dde-calendar-5.9.1/LICENSES/LGPL-2.0-or-later.txt dde-calendar-5.10.0/LICENSES/LGPL-2.0-or-later.txt --- dde-calendar-5.9.1/LICENSES/LGPL-2.0-or-later.txt 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/LICENSES/LGPL-2.0-or-later.txt 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,304 @@ +GNU LESSER GENERAL PUBLIC LICENSE +Version 3, 29 June 2007 + +Copyright (C) 2007 Free Software Foundation, Inc. + +Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. + +This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. + +0. Additional Definitions. + +As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. + +"The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. + +An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. + +A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". + +The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. + +The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. + +1. Exception to Section 3 of the GNU GPL. +You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. + +2. Conveying Modified Versions. +If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: + + a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. + +3. Object Code Incorporating Material from Library Header Files. +The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license document. + +4. Combined Works. +You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: + + a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license document. + + c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. + + e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) + +5. Combined Libraries. +You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. + +6. Revised Versions of the GNU Lesser General Public License. +The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. + +If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library. + +GNU GENERAL PUBLIC LICENSE +Version 3, 29 June 2007 + +Copyright © 2007 Free Software Foundation, Inc. + +Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. + +Preamble + +The GNU General Public License is a free, copyleft license for software and other kinds of works. + +The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. + +When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. + +To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. + +For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. + +Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. + +For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. + +Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. + +Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. + +The precise terms and conditions for copying, distribution and modification follow. + +TERMS AND CONDITIONS + +0. Definitions. + +“This License” refers to version 3 of the GNU General Public License. + +“Copyright” also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. + +“The Program” refers to any copyrightable work licensed under this License. Each licensee is addressed as “you”. “Licensees” and “recipients” may be individuals or organizations. + +To “modify” a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a “modified version” of the earlier work or a work “based on” the earlier work. + +A “covered work” means either the unmodified Program or a work based on the Program. + +To “propagate” a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. + +To “convey” a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. + +An interactive user interface displays “Appropriate Legal Notices” to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. + +1. Source Code. +The “source code” for a work means the preferred form of the work for making modifications to it. “Object code” means any non-source form of a work. + +A “Standard Interface” means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. + +The “System Libraries” of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A “Major Component”, in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. + +The “Corresponding Source” for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. + +The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. + +The Corresponding Source for a work in source code form is that same work. + +2. Basic Permissions. +All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. + +You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. + +Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. + +3. Protecting Users' Legal Rights From Anti-Circumvention Law. +No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. + +When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. + +4. Conveying Verbatim Copies. +You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. + +You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. + +5. Conveying Modified Source Versions. +You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to “keep intact all notices”. + + c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. + +A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an “aggregate” if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. + +6. Conveying Non-Source Forms. +You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: + + a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. + + d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. + +A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. + +A “User Product” is either (1) a “consumer product”, which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, “normally used” refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. + +“Installation Information” for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. + +If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). + +The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. + +Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. + +7. Additional Terms. +“Additional permissions” are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. + +When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. + +Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or authors of the material; or + + e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. + +All other non-permissive additional terms are considered “further restrictions” within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. + +If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. + +Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. + +8. Termination. +You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). + +However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. + +Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. + +Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. + +9. Acceptance Not Required for Having Copies. +You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. + +10. Automatic Licensing of Downstream Recipients. +Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. + +An “entity transaction” is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. + +You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. + +11. Patents. +A “contributor” is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's “contributor version”. + +A contributor's “essential patent claims” are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, “control” includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. + +Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. + +In the following three paragraphs, a “patent license” is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To “grant” such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. + +If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. “Knowingly relying” means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. + +If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. + +A patent license is “discriminatory” if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. + +Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. + +12. No Surrender of Others' Freedom. +If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. + +13. Use with the GNU Affero General Public License. +Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. + +14. Revised Versions of this License. +The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. + +If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. + +Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. + +15. Disclaimer of Warranty. +THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +16. Limitation of Liability. +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +17. Interpretation of Sections 15 and 16. +If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. + +END OF TERMS AND CONDITIONS + +How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + +If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an “about box”. + +You should also get your employer (if you work as a programmer) or school, if any, to sign a “copyright disclaimer” for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . + +The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . diff -Nru dde-calendar-5.9.1/LICENSES/LGPL-3.0-or-later.txt dde-calendar-5.10.0/LICENSES/LGPL-3.0-or-later.txt --- dde-calendar-5.9.1/LICENSES/LGPL-3.0-or-later.txt 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/LICENSES/LGPL-3.0-or-later.txt 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,304 @@ +GNU LESSER GENERAL PUBLIC LICENSE +Version 3, 29 June 2007 + +Copyright (C) 2007 Free Software Foundation, Inc. + +Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. + +This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. + +0. Additional Definitions. + +As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. + +"The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. + +An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. + +A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". + +The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. + +The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. + +1. Exception to Section 3 of the GNU GPL. +You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. + +2. Conveying Modified Versions. +If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: + + a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. + +3. Object Code Incorporating Material from Library Header Files. +The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license document. + +4. Combined Works. +You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: + + a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license document. + + c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. + + e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) + +5. Combined Libraries. +You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. + +6. Revised Versions of the GNU Lesser General Public License. +The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. + +If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library. + +GNU GENERAL PUBLIC LICENSE +Version 3, 29 June 2007 + +Copyright © 2007 Free Software Foundation, Inc. + +Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. + +Preamble + +The GNU General Public License is a free, copyleft license for software and other kinds of works. + +The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. + +When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. + +To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. + +For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. + +Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. + +For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. + +Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. + +Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. + +The precise terms and conditions for copying, distribution and modification follow. + +TERMS AND CONDITIONS + +0. Definitions. + +“This License” refers to version 3 of the GNU General Public License. + +“Copyright” also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. + +“The Program” refers to any copyrightable work licensed under this License. Each licensee is addressed as “you”. “Licensees” and “recipients” may be individuals or organizations. + +To “modify” a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a “modified version” of the earlier work or a work “based on” the earlier work. + +A “covered work” means either the unmodified Program or a work based on the Program. + +To “propagate” a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. + +To “convey” a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. + +An interactive user interface displays “Appropriate Legal Notices” to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. + +1. Source Code. +The “source code” for a work means the preferred form of the work for making modifications to it. “Object code” means any non-source form of a work. + +A “Standard Interface” means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. + +The “System Libraries” of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A “Major Component”, in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. + +The “Corresponding Source” for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. + +The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. + +The Corresponding Source for a work in source code form is that same work. + +2. Basic Permissions. +All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. + +You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. + +Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. + +3. Protecting Users' Legal Rights From Anti-Circumvention Law. +No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. + +When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. + +4. Conveying Verbatim Copies. +You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. + +You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. + +5. Conveying Modified Source Versions. +You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to “keep intact all notices”. + + c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. + +A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an “aggregate” if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. + +6. Conveying Non-Source Forms. +You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: + + a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. + + d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. + +A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. + +A “User Product” is either (1) a “consumer product”, which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, “normally used” refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. + +“Installation Information” for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. + +If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). + +The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. + +Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. + +7. Additional Terms. +“Additional permissions” are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. + +When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. + +Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or authors of the material; or + + e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. + +All other non-permissive additional terms are considered “further restrictions” within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. + +If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. + +Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. + +8. Termination. +You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). + +However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. + +Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. + +Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. + +9. Acceptance Not Required for Having Copies. +You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. + +10. Automatic Licensing of Downstream Recipients. +Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. + +An “entity transaction” is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. + +You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. + +11. Patents. +A “contributor” is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's “contributor version”. + +A contributor's “essential patent claims” are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, “control” includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. + +Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. + +In the following three paragraphs, a “patent license” is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To “grant” such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. + +If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. “Knowingly relying” means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. + +If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. + +A patent license is “discriminatory” if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. + +Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. + +12. No Surrender of Others' Freedom. +If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. + +13. Use with the GNU Affero General Public License. +Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. + +14. Revised Versions of this License. +The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. + +If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. + +Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. + +15. Disclaimer of Warranty. +THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +16. Limitation of Liability. +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +17. Interpretation of Sections 15 and 16. +If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. + +END OF TERMS AND CONDITIONS + +How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + +If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an “about box”. + +You should also get your employer (if you work as a programmer) or school, if any, to sign a “copyright disclaimer” for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . + +The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . diff -Nru dde-calendar-5.9.1/linglong.yaml dde-calendar-5.10.0/linglong.yaml --- dde-calendar-5.9.1/linglong.yaml 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/linglong.yaml 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,35 @@ +package: + id: org.dde.calendar + name: "dde-calendar" + version: 5.7.0.4 + kind: app + description: | + calendar for deepin os. + +variables: + extra_args: | + -DVERSION=${VERSION} + +runtime: + id: org.deepin.Runtime + version: 23.0.0 + +depends: + - id: "dde-qt-dbus-factory" + version: 5.5.12 + type: runtime + - id: icu + version: 63.1 + type: runtime + - id: xcb-util + version: 0.3.8.1 + type: runtime + - id: libical3 + version: 3.0.4 + type: runtime + +source: + kind: local + +build: + kind: cmake diff -Nru dde-calendar-5.9.1/.obs/workflows.yml dde-calendar-5.10.0/.obs/workflows.yml --- dde-calendar-5.9.1/.obs/workflows.yml 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/.obs/workflows.yml 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,44 @@ +test_build: + steps: + - link_package: + source_project: deepin:Develop:dde + source_package: %{SCM_REPOSITORY_NAME} + target_project: deepin:CI + + - configure_repositories: + project: deepin:CI + repositories: + - name: deepin_develop + paths: + - target_project: deepin:CI + target_repository: deepin_develop + architectures: + - x86_64 + - aarch64 + + - name: debian + paths: + - target_project: deepin:CI + target_repository: debian_sid + architectures: + - x86_64 + + filters: + event: pull_request + +tag_build: + steps: + - branch_package: + source_project: deepin:Develop:dde + source_package: %{SCM_REPOSITORY_NAME} + target_project: deepin:Unstable:dde + filters: + event: tag_push + +commit_build: + steps: + - trigger_services: + project: deepin:Develop:dde + package: %{SCM_REPOSITORY_NAME} + filters: + event: push diff -Nru dde-calendar-5.9.1/README.md dde-calendar-5.10.0/README.md --- dde-calendar-5.9.1/README.md 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/README.md 2023-04-07 06:02:09.000000000 +0000 @@ -1,3 +1,82 @@ # dde-calendar -Calendar for Deepin Desktop Environment. +Calendar is a small management tool for personal life that combines time and events and integrates the function of memorizing and scheduling. + +### Dependencies + +### Build dependencies + +_The **master** branch is current development branch, build dependencies may changes without update README.md, refer to `./debian/control` for a working build depends list_ + +* debhelper-compat (=11) +* cmake +* deepin-gettext-tools +* libdframeworkdbus-dev (>= 5.4.20~) +* libdtkgui-dev (>= 5.5.17~) +* libdtkwidget-dev (>= 5.5.17~) +* libgtest-dev +* libqt5svg5-dev +* pkg-config +* qtbase5-dev +* qttools5-dev +* qttools5-dev-tools + +## Installation + +### Build from source code + +1. Make sure you have installed all dependencies. + +_Package name may be different between distros, if dde-calendar is available from your distro, check the packaging script delivered from your distro is a better idea._ + +Assume you are using [Deepin](https://distrowatch.com/table.php?distribution=deepin) or other debian-based distro which got dde-calendar delivered: + +``` shell +$ sudo apt-get build-dep dde-calendar +``` + +2. Build: + +``` +$ cd dde-calendar +$ mkdir Build +$ cd Build +$ cmake ../ +$ make +``` + +3. Install: + +``` +$ sudo make install +``` + +The executable binary file could be found at `/usr/bin/dde-calendar + +## Usage + +Execute `dde-calendar` + +## Documentations + + - [Development Documentation](https://linuxdeepin.github.io/) + - [User Documentation](https://wikidev.uniontech.com/index.php?title=%E7%94%BB%E6%9D%BF) + +## Getting help + +Any usage issues can ask for help via + +* [Gitter](https://gitter.im/orgs/linuxdeepin/rooms) +* [IRC channel](https://webchat.freenode.net/?channels=deepin) +* [Forum](https://bbs.deepin.org) +* [WiKi](https://wiki.deepin.org/) + +## Getting involved + +We encourage you to report issues and contribute changes + +* [Contribution guide for developers](https://github.com/linuxdeepin/developer-center/wiki/Contribution-Guidelines-for-Developers-en). + +## License + +dde-calendar is licensed under [GPL-3.0-or-later](LICENSE.txt). \ No newline at end of file diff -Nru dde-calendar-5.9.1/README.zh_CN.md dde-calendar-5.10.0/README.zh_CN.md --- dde-calendar-5.9.1/README.zh_CN.md 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/README.zh_CN.md 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,82 @@ +# 日历 + +日历是一款查看日期、管理日程的小工具。 + +### 依赖 + +### 编译依赖 + +_**master**分支是当前开发分支,编译依赖可能在未更新README.md文件的情况下变更,请参考./debian/control文件获取有效的编译依赖列表_ + +* debhelper-compat (=11) +* cmake +* deepin-gettext-tools +* libdframeworkdbus-dev (>= 5.4.20~) +* libdtkgui-dev (>= 5.5.17~) +* libdtkwidget-dev (>= 5.5.17~) +* libgtest-dev +* libqt5svg5-dev +* pkg-config +* qtbase5-dev +* qttools5-dev +* qttools5-dev-tools + +## 安装 + +### 构建过程 + +1. 确保已安装所有依赖库. + +_不同发行版的软件包名称可能不同,如果您的发行版提供了日历,请检查发行版提供的打包脚本。_ + +如果你使用的是 [Deepin](https://distrowatch.com/table.php?distribution=deepin) 或者其它提供了日历的发行版: + +``` shell +$ sudo apt-get build-dep dde-calendar +``` + +2. 构建: + +``` +$ cd dde-calendar +$ mkdir Build +$ cd Build +$ cmake ../ +$ make +``` + +3. 安装: + +``` +$ sudo make install +``` + +可执行程序为 `/usr/bin/dde-calendar + +## 使用 + +命令行执行 `dde-calendar` + +## 文档 + + - [Development Documentation](https://linuxdeepin.github.io/) + - [用户文档](https://wikidev.uniontech.com/index.php?title=%E7%94%BB%E6%9D%BF) + +## 帮助 + +任何使用问题都可以通过以下方式寻求帮助: + +* [Gitter](https://gitter.im/orgs/linuxdeepin/rooms) +* [IRC channel](https://webchat.freenode.net/?channels=deepin) +* [Forum](https://bbs.deepin.org) +* [WiKi](https://wiki.deepin.org/) + +## 贡献指南 + +我们鼓励您报告问题并做出更改 + +* [开发者代码贡献指南](https://github.com/linuxdeepin/developer-center/wiki/Contribution-Guidelines-for-Developers) + +## 开源许可证 + +日历是在 [GPL-3.0-or-later](LICENSE.txt) 下发布. \ No newline at end of file diff -Nru dde-calendar-5.9.1/.reuse/dep5 dde-calendar-5.10.0/.reuse/dep5 --- dde-calendar-5.9.1/.reuse/dep5 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/.reuse/dep5 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,79 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: dde-calendar +Upstream-Contact: haifeng.chen +Source: + +# README +Files: README.md CHANGELOG.md README.zh_CN.md calendar-client/README.md +Copyright: None +License: CC-BY-4.0 + +# assets +Files: calendar-client/assets/* schedule-plugin/assets/* calendar-service/assets/* # 匹配这个文件夹下所有文件 +Copyright: UnionTech Software Technology Co., Ltd. +License: GPL-3.0-or-later + +# Project file +Files: *.pro *.prf *.pri *.txt *.cmake +Copyright: None +License: CC0-1.0 + +# css +Files: *.css +Copyright: None +License: CC0-1.0 + +# ts +Files: *.ts +Copyright: None +License: CC0-1.0 + +# qrc +Files: *.qrc +Copyright: None +License: CC0-1.0 + +# png svg +Files: calendar-client/assets/dde-calendar/calendar/common/*.svg calendar-client/assets/dde-calendar/calendar/en_US/fig/*.png calendar-client/assets/resources/DynamicIcon/*.svg calendar-client/assets/resources/icon/*.svg schedule-plugin/assets/resources/DynamicIcon/*.svg +Copyright: None +License: CC0-1.0 + +# sh +Files: *.sh +Copyright: None +License: CC0-1.0 + +# ci +Files: .github/* .gitlab-ci.yml .obs/workflows.yml +Copyright: None +License: CC0-1.0 + +# gitignore +Files: .gitignore +Copyright: None +License: CC0-1.0 + +# xml toml json conf yaml +Files: *.xml *.toml *.json *conf *.yaml +Copyright: None +License: CC0-1.0 + +# rpm +Files: rpm/* +Copyright: None +License: CC0-1.0 + +# debian +Files: debian/* +Copyright: None +License: CC0-1.0 + +# Arch +Files: archlinux/* +Copyright: None +License: CC0-1.0 + +# other files +Files: *.db +Copyright: None +License: CC0-1.0 \ No newline at end of file diff -Nru dde-calendar-5.9.1/schedule-plugin/CMakeLists.txt dde-calendar-5.10.0/schedule-plugin/CMakeLists.txt --- dde-calendar-5.9.1/schedule-plugin/CMakeLists.txt 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/CMakeLists.txt 2023-04-07 06:02:09.000000000 +0000 @@ -55,7 +55,7 @@ SUBDIRLIST(all_src ${CMAKE_CURRENT_SOURCE_DIR}/src) -#Include all app own subdirectorys +#Include all app own subdirectories foreach(subdir ${all_src}) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/${subdir}) endforeach() @@ -74,14 +74,15 @@ # Tell CMake to create the lib add_library(${PROJECT_NAME} SHARED ${Schedule_Plugin_SRC} ${APP_QRC} src/interface/service.h) -target_include_directories(${PROJECT_NAME} PUBLIC ${DtkWidget_INCLUDE_DIRS} ${OBJECT_BINARY_DIR}) +target_include_directories(${PROJECT_NAME} PUBLIC ${DtkWidget_INCLUDE_DIRS} ${OBJECT_BINARY_DIR} ../calendar-common/src) target_link_libraries(${PROJECT_NAME} ${Qt5Svg_LIBRARIES} ${Qt5DBus_LIBRARIES} ${DtkWidget_LIBRARIES} ${DFrameworkdbus_LIBRARIES} + commondata ) # Install files -install(TARGETS ${PROJECT_NAME} DESTINATION /usr/lib/deepin-aiassistant/serivce-plugins) +install(TARGETS ${PROJECT_NAME} DESTINATION lib/deepin-aiassistant/serivce-plugins) diff -Nru dde-calendar-5.9.1/schedule-plugin/src/calendarData/accountitem.cpp dde-calendar-5.10.0/schedule-plugin/src/calendarData/accountitem.cpp --- dde-calendar-5.9.1/schedule-plugin/src/calendarData/accountitem.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/calendarData/accountitem.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,297 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "accountitem.h" + +AccountItem::AccountItem(const DAccount::Ptr &account, QObject *parent) + : QObject(parent) + , m_account(account) + , m_dbusRequest(new DbusAccountRequest(account->dbusPath(), account->dbusInterface(), this)) +{ + initConnect(); +} + +void AccountItem::initConnect() +{ + connect(m_dbusRequest, &DbusAccountRequest::signalCreateScheduleFinish, this, &AccountItem::signalCreateFinish); + connect(m_dbusRequest, &DbusAccountRequest::signalGetScheduleFinish, this, &AccountItem::signalGetScheduleFinish); + connect(m_dbusRequest, &DbusAccountRequest::signalGetAccountInfoFinish, this, &AccountItem::slotGetAccountInfoFinish); + connect(m_dbusRequest, &DbusAccountRequest::signalGetScheduleTypeListFinish, this, &AccountItem::slotGetScheduleTypeListFinish); + connect(m_dbusRequest, &DbusAccountRequest::signalGetScheduleListFinish, this, &AccountItem::slotGetScheduleListFinish); + connect(m_dbusRequest, &DbusAccountRequest::signalGetSysColorsFinish, this, &AccountItem::slotGetSysColorsFinish); +} + +/** + * @brief AccountItem::resetAccount + * 重新获取账户相关数据 + */ +void AccountItem::resetAccount() +{ + m_scheduleTypeList = m_dbusRequest->getScheduleTypeList(); + m_typeColorList = m_dbusRequest->getSysColors(); +} + +/** + * @brief AccountItem::getAccount + * 获取账户数据 + * @return + */ +DAccount::Ptr AccountItem::getAccount() +{ + return m_account; +} + +//获取日程 +QMap AccountItem::getScheduleMap() +{ + return m_scheduleMap; +} + +/** + * @brief getScheduleTypeList 获取日程类型信息集 + * @return + */ +DScheduleType::List AccountItem::getScheduleTypeList() +{ + DScheduleType::List list; + for (DScheduleType::Ptr p : m_scheduleTypeList) { + if (p->privilege() != DScheduleType::None) { + list.push_back(p); + } + } + return list; +} + +//根据类型ID获取日程类型 +DScheduleType::Ptr AccountItem::getScheduleTypeByID(const QString &typeID) +{ + for (DScheduleType::Ptr p : m_scheduleTypeList) { + if (p->typeID() == typeID) { + return p; + } + } + return nullptr; +} + +DScheduleType::Ptr AccountItem::getScheduleTypeByName(const QString &typeName) +{ + for (DScheduleType::Ptr p : m_scheduleTypeList) { + if (p->typeName() == typeName || p->displayName() == typeName) { + return p; + } + } + return nullptr; +} + +DSchedule::Ptr AccountItem::getScheduleByID(const QString &scheduleID) +{ + return m_dbusRequest->getScheduleByID(scheduleID); +} + +DTypeColor::List AccountItem::getColorTypeList() +{ + return m_typeColorList; +} + +/** + * @brief AccountItem::updateAccountInfo + * 更新账户信息 + * @param callback + */ +void AccountItem::updateAccountInfo(CallbackFunc callback) +{ + m_dbusRequest->setCallbackFunc(callback); + m_dbusRequest->updateAccountInfo(m_account); +} + +/** + * @brief AccountItem::createJobType + * 创建日程类型 + * @param typeInfo 日程类型数据 + * @param callback + */ +void AccountItem::createJobType(const DScheduleType::Ptr &typeInfo, CallbackFunc callback) +{ + m_dbusRequest->setCallbackFunc(callback); + typeInfo->setPrivilege(DScheduleType::User); + m_dbusRequest->createScheduleType(typeInfo); +} + +/** + * @brief AccountItem::updateScheduleType + * 更新类型信息 + * @param typeInfo 新的日程类型数据 + * @param callback + */ +void AccountItem::updateScheduleType(const DScheduleType::Ptr &typeInfo, CallbackFunc callback) +{ + m_dbusRequest->setCallbackFunc(callback); + m_dbusRequest->updateScheduleType(typeInfo); +} + +/** + * @brief AccountItem::deleteScheduleTypeByID + * 根据类型ID删除日程类型 + * @param typeID 日程类型id + * @param callback 回调函数 + */ +void AccountItem::deleteScheduleTypeByID(const QString &typeID, CallbackFunc callback) +{ + m_dbusRequest->setCallbackFunc(callback); + m_dbusRequest->deleteScheduleTypeByID(typeID); +} + +/** + * @brief AccountItem::scheduleTypeIsUsed + * 类型是否被日程使用 + * @param typeID 日程类型id + * @param callback 回调函数 + */ +void AccountItem::scheduleTypeIsUsed(const QString &typeID, CallbackFunc callback) +{ + m_dbusRequest->setCallbackFunc(callback); + m_dbusRequest->scheduleTypeByUsed(typeID); +} + +/** + * @brief AccountItem::createSchedule + * 创建日程 + * @param scheduleInfo 日程数据 + * @param callback 回调函数 + */ +QString AccountItem::createSchedule(const DSchedule::Ptr &scheduleInfo) +{ + return m_dbusRequest->createSchedule(scheduleInfo); +} + +/** + * @brief AccountItem::updateSchedule + * 更新日程 + * @param scheduleInfo 新的日程数据 + * @param callback 回调函数 + */ +void AccountItem::updateSchedule(const DSchedule::Ptr &scheduleInfo, CallbackFunc callback) +{ + m_dbusRequest->setCallbackFunc(callback); + m_dbusRequest->updateSchedule(scheduleInfo); +} + +/** + * @brief AccountItem::deleteScheduleByID + * 根据日程ID删除日程 + * @param schedule ID日程id + * @param callback 回调函数 + */ +void AccountItem::deleteScheduleByID(const QString &scheduleID, CallbackFunc callback) +{ + m_dbusRequest->setCallbackFunc(callback); + m_dbusRequest->deleteScheduleByScheduleID(scheduleID); +} + +/** + * @brief AccountItem::deleteSchedulesByTypeID + * 根据类型ID删除日程 + * @param typeID 日程类型id + * @param callback 回调函数 + */ +void AccountItem::deleteSchedulesByTypeID(const QString &typeID, CallbackFunc callback) +{ + m_dbusRequest->setCallbackFunc(callback); + m_dbusRequest->deleteSchedulesByScheduleTypeID(typeID); +} + +/** + * @brief AccountItem::querySchedulesWithParameter + * 根据查询条件查询数据 + * @param params 查询条件 + * @param callback 回调函数 + */ +DSchedule::Map AccountItem::querySchedulesWithParameter(const DScheduleQueryPar::Ptr ¶ms) +{ + return m_dbusRequest->querySchedulesWithParameter(params); +} + +/** + * @brief AccountItem::monitorScheduleTypeData + * 监听日程类型数据完成事件 + * @param callback 回调函数 + */ +void AccountItem::monitorScheduleTypeData(Func callback) +{ + auto statusIterator = m_dataStatus.find("ScheduleType"); + if (statusIterator != m_dataStatus.end() && statusIterator.value()) { + callback(); + } else { + m_dataStatus.insert("ScheduleType", false); + } + auto iterator = m_callbackMap.find("ScheduleType"); + QList funcList; + if (iterator == m_callbackMap.end()) { + funcList.append(callback); + } else { + funcList = iterator.value(); + } + m_callbackMap.insert("ScheduleType", funcList); +} + +/** + * @brief AccountItem::slotGetAccountInfoFinish + * 获取账户信息完成事件 + * @param account 账户数据 + */ +void AccountItem::slotGetAccountInfoFinish(DAccount::Ptr account) +{ + m_account = account; + emit signalAccountDataUpdate(); +} + +/** + * @brief AccountItem::slotGetScheduleTypeListFinish + * 获取日程类型数据完成事件 + * @param scheduleTypeList 日程类型数据 + */ +void AccountItem::slotGetScheduleTypeListFinish(DScheduleType::List scheduleTypeList) +{ + m_scheduleTypeList = scheduleTypeList; + + m_dataStatus.insert("ScheduleType", true); + auto iterator = m_callbackMap.find("ScheduleType"); + if (iterator != m_callbackMap.end()) { + for (Func func : iterator.value()) { + func(); + } + } + emit signalScheduleTypeUpdate(); +} + +/** + * @brief AccountItem::slotGetScheduleListFinish + * 获取日程数据完成事件 + * @param map 日程数据 + */ +void AccountItem::slotGetScheduleListFinish(QMap map) +{ + m_scheduleMap = map; + emit signalScheduleUpdate(); +} + +/** + * @brief AccountItem::slotSearchScheduleListFinish + * 搜索日程数据完成事件 + * @param map 日程数据 + */ +void AccountItem::slotSearchScheduleListFinish(QMap map) +{ + m_searchedScheduleMap = map; + emit signalSearchScheduleUpdate(); +} + +/** + * @brief AccountItem::slotGetSysColorsFinish + * 获取系统颜色完成事件 + */ +void AccountItem::slotGetSysColorsFinish(DTypeColor::List typeColorList) +{ + m_typeColorList = typeColorList; +} diff -Nru dde-calendar-5.9.1/schedule-plugin/src/calendarData/accountitem.h dde-calendar-5.10.0/schedule-plugin/src/calendarData/accountitem.h --- dde-calendar-5.9.1/schedule-plugin/src/calendarData/accountitem.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/calendarData/accountitem.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,117 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef ACCOUNTITEM_H +#define ACCOUNTITEM_H + +#include "dbus/dbusaccountrequest.h" +#include + +//单项账户信息管理类 +class AccountItem : public QObject +{ + Q_OBJECT +public: + explicit AccountItem(const DAccount::Ptr &account, QObject *parent = nullptr); + + typedef std::function Func; + typedef QSharedPointer Ptr; + + void resetAccount(); + + //获取账户数据 + DAccount::Ptr getAccount(); + + //获取日程 + QMap getScheduleMap(); + + // 获取日程类型信息集 + DScheduleType::List getScheduleTypeList(); + + //根据类型ID获取日程类型 + DScheduleType::Ptr getScheduleTypeByID(const QString &typeID); + DScheduleType::Ptr getScheduleTypeByName(const QString &typeName); + + DSchedule::Ptr getScheduleByID(const QString &scheduleID); + + //获取颜色类型列表 + DTypeColor::List getColorTypeList(); + + //更新账户信息 + void updateAccountInfo(CallbackFunc callback = nullptr); + + //创建日程类型 + void createJobType(const DScheduleType::Ptr &typeInfo, CallbackFunc callback = nullptr); + + //更新类型信息 + void updateScheduleType(const DScheduleType::Ptr &typeInfo, CallbackFunc callback = nullptr); + + //根据类型ID删除日程类型 + void deleteScheduleTypeByID(const QString &typeID, CallbackFunc callback = nullptr); + + //类型是否被日程使用 + void scheduleTypeIsUsed(const QString &typeID, CallbackFunc callback); + + //创建日程 + QString createSchedule(const DSchedule::Ptr &scheduleInfo); + + //更新日程 + void updateSchedule(const DSchedule::Ptr &scheduleInfo, CallbackFunc callback = nullptr); + + //根据日程ID删除日程 + void deleteScheduleByID(const QString &scheduleID, CallbackFunc callback = nullptr); + + //根据类型ID删除日程 + void deleteSchedulesByTypeID(const QString &typeID, CallbackFunc callback = nullptr); + + //根据查询条件查询数据 + DSchedule::Map querySchedulesWithParameter(const DScheduleQueryPar::Ptr &); + + //监听日程类型数据完成事件 + void monitorScheduleTypeData(Func callback); + +signals: + void signalAccountDataUpdate(); + void signalScheduleUpdate(); + void signalScheduleTypeUpdate(); + void signalSearchScheduleUpdate(); + void signalCreateFinish(const QString &scheduleID); + void signalGetScheduleFinish(const DSchedule::Ptr &); + +public slots: + //获取账户信息完成事件 + void slotGetAccountInfoFinish(DAccount::Ptr); + //获取日程类型数据完成事件 + void slotGetScheduleTypeListFinish(DScheduleType::List); + //获取日程数据完成事件 + void slotGetScheduleListFinish(QMap); + //搜索日程数据完成事件 + void slotSearchScheduleListFinish(QMap); + //获取系统颜色完成 + void slotGetSysColorsFinish(DTypeColor::List); + +private: + void initConnect(); + +private: + DAccount::Ptr m_account; //账户数据 + DScheduleType::List m_scheduleTypeList; //日程类型数据 + DTypeColor::List m_typeColorList; //颜色数据 + DbusAccountRequest *m_dbusRequest = nullptr; //dbus请求实例 + //一年的日程信息 + QMap m_scheduleMap {}; + //搜索的日程信息 + QMap m_searchedScheduleMap {}; + //一年是否含有日程 + QMap m_fullInfo {}; + //一年的班休信息 + QMap m_festivalInfo {}; + QVector m_searchScheduleInfoVector {}; + + //回调函数 + QMap> m_callbackMap; + QMap m_dataStatus; //数据状态 +}; + +#endif // ACCOUNTITEM_H diff -Nru dde-calendar-5.9.1/schedule-plugin/src/calendarData/accountmanager.cpp dde-calendar-5.10.0/schedule-plugin/src/calendarData/accountmanager.cpp --- dde-calendar-5.9.1/schedule-plugin/src/calendarData/accountmanager.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/calendarData/accountmanager.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,220 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "accountmanager.h" + +AccountManager *AccountManager::m_accountManager = nullptr; +AccountManager::AccountManager(QObject *parent) + : QObject(parent) + , m_dbusRequest(new DbusAccountManagerRequest(this)) +{ + initConnect(); + m_dbusRequest->clientIsShow(true); +} + +void AccountManager::initConnect() +{ + connect(m_dbusRequest, &DbusAccountManagerRequest::signalGetAccountListFinish, this, &AccountManager::slotGetAccountListFinish); + connect(m_dbusRequest, &DbusAccountManagerRequest::signalGetGeneralSettingsFinish, this, &AccountManager::slotGetGeneralSettingsFinish); +} + +AccountManager::~AccountManager() +{ + m_dbusRequest->clientIsShow(false); +} + +AccountManager *AccountManager::getInstance() +{ + static AccountManager m_accountManager; + return &m_accountManager; +} + +/** + * @brief AccountManager::getAccountList + * 获取帐户列表 + * @return 帐户列表 + */ +QList AccountManager::getAccountList() +{ + return m_accountItemList; +} + +/** + * @brief AccountManager::getLocalAccountItem + * 获取本地帐户 + * @return + */ +AccountItem::Ptr AccountManager::getLocalAccountItem() +{ + return m_localAccountItem; +} + +/** + * @brief AccountManager::getUnionAccountItem + * 获取unionID帐户 + * @return + */ +AccountItem::Ptr AccountManager::getUnionAccountItem() +{ + return m_unionAccountItem; +} + +DScheduleType::Ptr AccountManager::getScheduleTypeByScheduleTypeId(const QString &schduleTypeId) +{ + DScheduleType::Ptr type = nullptr; + for (AccountItem::Ptr p : gAccounManager->getAccountList()) { + type = p->getScheduleTypeByID(schduleTypeId); + if (nullptr != type) { + break; + } + } + return type; +} + +AccountItem::Ptr AccountManager::getAccountItemByScheduleTypeId(const QString &schduleTypeId) +{ + DScheduleType::Ptr type = getScheduleTypeByScheduleTypeId(schduleTypeId); + return getAccountItemByAccountId(type->accountID()); +} + +AccountItem::Ptr AccountManager::getAccountItemByAccountId(const QString &accountId) +{ + AccountItem::Ptr account = nullptr; + for (AccountItem::Ptr p : gAccounManager->getAccountList()) { + if (p->getAccount()->accountID() == accountId) { + account = p; + break; + } + } + return account; +} + +AccountItem::Ptr AccountManager::getAccountItemByAccountName(const QString &accountName) +{ + AccountItem::Ptr account = nullptr; + for (AccountItem::Ptr p : gAccounManager->getAccountList()) { + if (p->getAccount()->accountName() == accountName) { + account = p; + break; + } + } + return account; +} + +DCalendarGeneralSettings::Ptr AccountManager::getGeneralSettings() +{ + return m_settings; +} + +/** + * @brief AccountManager::resetAccount + * 重置帐户信息 + */ +void AccountManager::resetAccount() +{ + m_dataInitFinished = false; + m_localAccountItem.clear(); + m_unionAccountItem.clear(); + slotGetAccountListFinish(m_dbusRequest->getAccountList()); +} + +/** + * @brief AccountManager::downloadByAccountID + * 根据帐户ID下拉数据 + * @param accountID 帐户id + * @param callback 回调函数 + */ +void AccountManager::downloadByAccountID(const QString &accountID, CallbackFunc callback) +{ + m_dbusRequest->setCallbackFunc(callback); + m_dbusRequest->downloadByAccountID(accountID); +} + +/** + * @brief AccountManager::uploadNetWorkAccountData + * 更新网络帐户数据 + * @param callback 回调函数 + */ +void AccountManager::uploadNetWorkAccountData(CallbackFunc callback) +{ + m_dbusRequest->setCallbackFunc(callback); + m_dbusRequest->uploadNetWorkAccountData(); +} + +void AccountManager::setCalendarGeneralSettings(DCalendarGeneralSettings::Ptr ptr, CallbackFunc callback) +{ + m_dbusRequest->setCallbackFunc(callback); + m_dbusRequest->setCalendarGeneralSettings(ptr); +} + +/** + * @brief AccountManager::waitingData + * 等待数据获取完成的事件,若数据已获取完成则直接执行回调函数,若数据还没有获取完成则将回调函数保存,待数据获取完成后执行 + * @param callback 回调函数 + */ +void AccountManager::waitingData(Func callback) +{ + if (m_dataInitFinished) { + callback(); + } else { + m_waitingCallList.append(callback); + } +} + +/** + * @brief AccountManager::execWaitingCall + * 执行回调函数 + */ +void AccountManager::execWaitingCall() +{ + m_dataInitFinished = true; + for (Func call : m_waitingCallList) { + call(); + } + //回调函数只是用一次 + m_waitingCallList.clear(); +} + +/** + * @brief AccountManager::slotGetAccountListFinish + * 获取帐户信息完成事件 + * @param accountList 帐户列表 + */ +void AccountManager::slotGetAccountListFinish(DAccount::List accountList) +{ + for (DAccount::Ptr account : accountList) { + if (account->accountType() == DAccount::Account_Local) { + m_localAccountItem.reset(new AccountItem(account, this)); + m_localAccountItem->resetAccount(); + m_accountItemList.append(m_localAccountItem); + } + + if (account->accountType() == DAccount::Account_UnionID) { + m_unionAccountItem.reset(new AccountItem(account, this)); + m_unionAccountItem->resetAccount(); + m_accountItemList.append(m_unionAccountItem); + } + } + + for (AccountItem::Ptr p : getAccountList()) { + connect(p.data(), &AccountItem::signalScheduleUpdate, this, &AccountManager::signalScheduleUpdate); + connect(p.data(), &AccountItem::signalSearchScheduleUpdate, this, &AccountManager::signalSearchScheduleUpdate); + connect(p.data(), &AccountItem::signalScheduleTypeUpdate, this, &AccountManager::signalScheduleTypeUpdate); + } +} + +/** + * @brief AccountManager::slotGetGeneralSettingsFinish + * 获取通用设置完成事件 + * @param ptr 通用设置数据 + */ +void AccountManager::slotGetGeneralSettingsFinish(DCalendarGeneralSettings::Ptr ptr) +{ + m_settings = ptr; + if (!m_dataInitFinished) { + execWaitingCall(); + } + emit signalDataInitFinished(); + emit signalGeneralSettingsUpdate(); +} diff -Nru dde-calendar-5.9.1/schedule-plugin/src/calendarData/accountmanager.h dde-calendar-5.10.0/schedule-plugin/src/calendarData/accountmanager.h --- dde-calendar-5.9.1/schedule-plugin/src/calendarData/accountmanager.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/calendarData/accountmanager.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,86 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef ACCOUNTMANAGER_H +#define ACCOUNTMANAGER_H + +#include "dbus/dbusaccountmanagerrequest.h" +#include "accountitem.h" + +//所有账户管理类 +class AccountManager : public QObject +{ + Q_OBJECT +public: + typedef std::function Func; + + ~AccountManager() override; + + static AccountManager *getInstance(); + QList getAccountList(); + AccountItem::Ptr getLocalAccountItem(); + AccountItem::Ptr getUnionAccountItem(); + DScheduleType::Ptr getScheduleTypeByScheduleTypeId(const QString &schduleTypeId); + AccountItem::Ptr getAccountItemByScheduleTypeId(const QString &schduleTypeId); + AccountItem::Ptr getAccountItemByAccountId(const QString &accountId); + AccountItem::Ptr getAccountItemByAccountName(const QString &accountName); + DCalendarGeneralSettings::Ptr getGeneralSettings(); + + //重新获取账户信息 + void resetAccount(); + + //根据帐户ID下拉数据 + void downloadByAccountID(const QString &accountID, CallbackFunc callback = nullptr); + //更新网络帐户数据 + void uploadNetWorkAccountData(CallbackFunc callback = nullptr); + + //设置通用设置 + void setCalendarGeneralSettings(DCalendarGeneralSettings::Ptr ptr, CallbackFunc callback = nullptr); + + //等待数据获取完成的事件 + void waitingData(Func callback); + +signals: + void signalDataInitFinished(); + void signalAccountUpdate(); + void signalGeneralSettingsUpdate(); + + void signalAccountDataUpdate(); + void signalScheduleUpdate(); + void signalScheduleTypeUpdate(); + void signalSearchScheduleUpdate(); + +public slots: + //获取账户信息完成事件 + void slotGetAccountListFinish(DAccount::List accountList); + //获取通用设置完成事件 + void slotGetGeneralSettingsFinish(DCalendarGeneralSettings::Ptr ptr); + +protected: + explicit AccountManager(QObject *parent = nullptr); + +private: + void initConnect(); + + //运行等待数据完成的回调函数 + void execWaitingCall(); + +private: + static AccountManager *m_accountManager; + AccountItem::Ptr m_localAccountItem; + AccountItem::Ptr m_unionAccountItem; + DCalendarGeneralSettings::Ptr m_settings; + + QList m_accountItemList; + + DbusAccountManagerRequest *m_dbusRequest; + + QList m_waitingCallList; + + bool m_dataInitFinished = false; +}; +#define gAccounManager AccountManager::getInstance() +#define gLocalAccountItem AccountManager::getLocalAccountItem() +#define gUosAccountItem AccountManager::getUosAccountItem() +#endif // ACCOUNTMANAGER_H diff -Nru dde-calendar-5.9.1/schedule-plugin/src/calendarData/dscheduledatamanager.cpp dde-calendar-5.10.0/schedule-plugin/src/calendarData/dscheduledatamanager.cpp --- dde-calendar-5.9.1/schedule-plugin/src/calendarData/dscheduledatamanager.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/calendarData/dscheduledatamanager.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,103 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "dscheduledatamanager.h" + +#include "accountmanager.h" + +DScheduleDataManager *DScheduleDataManager::getInstance() +{ + static DScheduleDataManager scheduleManager; + return &scheduleManager; +} + +QString DScheduleDataManager::createSchedule(const DSchedule::Ptr &schedule) +{ + AccountItem::Ptr account = gAccounManager->getLocalAccountItem(); + if (account.isNull()) { + qWarning() << "account is null"; + return QString(); + } + return account->createSchedule(schedule); +} + +DSchedule::Ptr DScheduleDataManager::queryScheduleByScheduleID(const QString &scheduleID) +{ + DSchedule::Ptr schedule; + AccountItem::Ptr account = gAccounManager->getLocalAccountItem(); + if (account.isNull()) { + qWarning() << "account is null"; + return nullptr; + } + return account->getScheduleByID(scheduleID); +} + +bool DScheduleDataManager::deleteScheduleByScheduleID(const QString &scheduleID) +{ + AccountItem::Ptr account = gAccounManager->getLocalAccountItem(); + if (account.isNull()) { + qWarning() << "account is null"; + return false; + } + account->deleteScheduleByID(scheduleID); + return true; +} + +bool DScheduleDataManager::updateSchedule(const DSchedule::Ptr &schedule) +{ + AccountItem::Ptr account = gAccounManager->getLocalAccountItem(); + if (account.isNull()) { + qWarning() << "account is null"; + return false; + } + account->updateSchedule(schedule); + return true; +} + +bool DScheduleDataManager::isFestivalSchedule(const QString &scheduleTypeID) +{ + return gAccounManager->getLocalAccountItem()->getScheduleTypeByID(scheduleTypeID)->privilege() == DScheduleType::Privilege::None; +} + +DSchedule::Map DScheduleDataManager::querySchedulesWithParameter(const DScheduleQueryPar::Ptr ¶ms) +{ + DSchedule::Map scheduleMap; + AccountItem::Ptr account = gAccounManager->getLocalAccountItem(); + return account.isNull() ? scheduleMap : account->querySchedulesWithParameter(params); +} + +DSchedule::Map DScheduleDataManager::queryScheduleByRRule(const QDateTime &dtStart, const QDateTime &dtEnd, const DScheduleQueryPar::RRuleType &rrultTyep) +{ + DScheduleQueryPar::Ptr queryPar(new DScheduleQueryPar); + queryPar->setDtStart(dtStart); + queryPar->setDtEnd(dtEnd); + queryPar->setQueryType(DScheduleQueryPar::Query_RRule); + queryPar->setRruleType(rrultTyep); + return querySchedulesWithParameter(queryPar); +} + +DSchedule::Map DScheduleDataManager::queryScheduleByLimit(const QDateTime &dtStart, const QDateTime &dtEnd, int topNum) +{ + DScheduleQueryPar::Ptr queryPar(new DScheduleQueryPar); + queryPar->setDtStart(dtStart); + queryPar->setDtEnd(dtEnd); + queryPar->setQueryType(DScheduleQueryPar::Query_Top); + queryPar->setQueryTop(topNum); + return querySchedulesWithParameter(queryPar); +} + +DSchedule::Map DScheduleDataManager::queryScheduleBySummary(const QDateTime &dtStart, const QDateTime &dtEnd, const QString &summary) +{ + DScheduleQueryPar::Ptr queryPar(new DScheduleQueryPar); + queryPar->setDtStart(dtStart); + queryPar->setDtEnd(dtEnd); + queryPar->setKey(summary); + queryPar->setQueryType(DScheduleQueryPar::Query_None); + return querySchedulesWithParameter(queryPar); +} + +DScheduleDataManager::DScheduleDataManager() +{ + gAccounManager->resetAccount(); +} diff -Nru dde-calendar-5.9.1/schedule-plugin/src/calendarData/dscheduledatamanager.h dde-calendar-5.10.0/schedule-plugin/src/calendarData/dscheduledatamanager.h --- dde-calendar-5.9.1/schedule-plugin/src/calendarData/dscheduledatamanager.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/calendarData/dscheduledatamanager.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,39 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef DSCHEDULEDATAMANAGER_H +#define DSCHEDULEDATAMANAGER_H + +#include "dschedule.h" +#include "dschedulequerypar.h" + +#include + +//日程数据管理模块 +class DScheduleDataManager +{ +public: + static DScheduleDataManager *getInstance(); + + QString createSchedule(const DSchedule::Ptr &schedule); + + DSchedule::Ptr queryScheduleByScheduleID(const QString &scheduleID); + + bool deleteScheduleByScheduleID(const QString &scheduleID); + + bool updateSchedule(const DSchedule::Ptr &schedule); + + //根据类型ID判断是否为节假日日程 + bool isFestivalSchedule(const QString &scheduleTypeID); + + DSchedule::Map querySchedulesWithParameter(const DScheduleQueryPar::Ptr ¶ms); + DSchedule::Map queryScheduleByRRule(const QDateTime &dtStart, const QDateTime &dtEnd, const DScheduleQueryPar::RRuleType &rrultTyep); + DSchedule::Map queryScheduleByLimit(const QDateTime &dtStart, const QDateTime &dtEnd, int topNum); + DSchedule::Map queryScheduleBySummary(const QDateTime &dtStart, const QDateTime &dtEnd, const QString &summary); + +private: + DScheduleDataManager(); +}; + +#endif // DSCHEDULEDATAMANAGER_H diff -Nru dde-calendar-5.9.1/schedule-plugin/src/calendarData/scheduledatamanage.cpp dde-calendar-5.10.0/schedule-plugin/src/calendarData/scheduledatamanage.cpp --- dde-calendar-5.9.1/schedule-plugin/src/calendarData/scheduledatamanage.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/calendarData/scheduledatamanage.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,66 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "scheduledatamanage.h" +#include "accountmanager.h" +#include "accountmanager.h" + +#include +#include + +CScheduleDataManage *CScheduleDataManage::m_vscheduleDataManage = new CScheduleDataManage; + +// +CSchedulesColor CScheduleDataManage::getScheduleColorByType(const QString &type) +{ + CSchedulesColor color; + DTypeColor colorinfo; + DScheduleType::Ptr typePtr = gAccounManager->getScheduleTypeByScheduleTypeId(type); + QColor typeColor; + if (!typePtr.isNull()) { + typeColor = QColor(gAccounManager->getScheduleTypeByScheduleTypeId(type)->typeColor().colorCode()); + } + color.orginalColor = typeColor; + color.normalColor = color.orginalColor; + color.normalColor.setAlphaF(0.2); + color.pressColor = color.orginalColor; + color.pressColor.setAlphaF(0.35); + + color.hoverColor = color.orginalColor; + color.hoverColor.setAlphaF(0.3); + + color.hightColor = color.orginalColor; + color.hightColor.setAlphaF(0.35); + + return color; +} + +QColor CScheduleDataManage::getSystemActiveColor() +{ + return DGuiApplicationHelper::instance()->applicationPalette().highlight().color(); +} + +QColor CScheduleDataManage::getTextColor() +{ + return DGuiApplicationHelper::instance()->applicationPalette().text().color(); +} + +void CScheduleDataManage::setTheMe(int type) +{ + m_theme = type; +} + +CScheduleDataManage *CScheduleDataManage::getScheduleDataManage() +{ + return m_vscheduleDataManage; +} + +CScheduleDataManage::CScheduleDataManage(QObject *parent) + : QObject(parent) +{ +} + +CScheduleDataManage::~CScheduleDataManage() +{ +} diff -Nru dde-calendar-5.9.1/schedule-plugin/src/calendarData/scheduledatamanage.h dde-calendar-5.10.0/schedule-plugin/src/calendarData/scheduledatamanage.h --- dde-calendar-5.9.1/schedule-plugin/src/calendarData/scheduledatamanage.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/calendarData/scheduledatamanage.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,48 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef SCHEDULEDATAMANAGE_H +#define SCHEDULEDATAMANAGE_H +#include "dschedule.h" +#include "dscheduletype.h" + +#include + +#include +#include +#include + +DGUI_USE_NAMESPACE +struct CSchedulesColor { + QColor normalColor; //正常状态颜色 + QColor hoverColor; //鼠标悬浮颜色 + QColor pressColor; //鼠标点击颜色 + QColor hightColor; //高亮色 + QColor orginalColor; //最初的颜色 +}; + +class CScheduleDataManage : public QObject +{ + Q_OBJECT +public: + static CScheduleDataManage *getScheduleDataManage(); + //根据日程类型ID获取颜色信息 + CSchedulesColor getScheduleColorByType(const QString &type); + static QColor getSystemActiveColor(); + static QColor getTextColor(); + void setTheMe(int type = 0); + int getTheme() const + { + return m_theme; + } + +private: + CScheduleDataManage(QObject *parent = nullptr); + ~CScheduleDataManage(); + +private: + int m_theme = 0; + static CScheduleDataManage *m_vscheduleDataManage; +}; +#endif // SCHEDULEVIEW_H diff -Nru dde-calendar-5.9.1/schedule-plugin/src/data/canceljsondata.cpp dde-calendar-5.10.0/schedule-plugin/src/data/canceljsondata.cpp --- dde-calendar-5.9.1/schedule-plugin/src/data/canceljsondata.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/data/canceljsondata.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "canceljsondata.h" #include diff -Nru dde-calendar-5.9.1/schedule-plugin/src/data/canceljsondata.h dde-calendar-5.10.0/schedule-plugin/src/data/canceljsondata.h --- dde-calendar-5.9.1/schedule-plugin/src/data/canceljsondata.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/data/canceljsondata.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef CANCELJSONDATA_H #define CANCELJSONDATA_H #include "jsondata.h" diff -Nru dde-calendar-5.9.1/schedule-plugin/src/data/changejsondata.cpp dde-calendar-5.10.0/schedule-plugin/src/data/changejsondata.cpp --- dde-calendar-5.9.1/schedule-plugin/src/data/changejsondata.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/data/changejsondata.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "changejsondata.h" #include "../globaldef.h" diff -Nru dde-calendar-5.9.1/schedule-plugin/src/data/changejsondata.h dde-calendar-5.10.0/schedule-plugin/src/data/changejsondata.h --- dde-calendar-5.9.1/schedule-plugin/src/data/changejsondata.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/data/changejsondata.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef CHANGEJSONDATA_H #define CHANGEJSONDATA_H diff -Nru dde-calendar-5.9.1/schedule-plugin/src/data/clocaldata.cpp dde-calendar-5.10.0/schedule-plugin/src/data/clocaldata.cpp --- dde-calendar-5.9.1/schedule-plugin/src/data/clocaldata.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/data/clocaldata.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,45 +1,29 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "clocaldata.h" CLocalData::CLocalData() { } -QVector CLocalData::scheduleInfoVector() const +DSchedule::List CLocalData::scheduleInfoVector() const { return m_scheduleInfoVector; } -void CLocalData::setScheduleInfoVector(const QVector &scheduleInfoVector) +void CLocalData::setScheduleInfoVector(const DSchedule::List &scheduleInfoVector) { m_scheduleInfoVector = scheduleInfoVector; } -ScheduleDtailInfo CLocalData::SelectInfo() const +DSchedule::Ptr CLocalData::SelectInfo() const { return m_SelectInfo; } -void CLocalData::setSelectInfo(const ScheduleDtailInfo &SelectInfo) +void CLocalData::setSelectInfo(const DSchedule::Ptr &SelectInfo) { m_SelectInfo = SelectInfo; } @@ -74,24 +58,12 @@ m_offset = offset; } -CLocalData *CLocalData::getDataByPoint(const CLocalData *localData) -{ - if (this == localData || localData == nullptr) - return this; - this->m_offset = localData->m_offset; - this->m_SelectInfo = localData->m_SelectInfo; - this->m_ToTime = localData->m_ToTime; - this->m_scheduleInfoVector = localData->m_scheduleInfoVector; - this->m_ToTitleName = localData->m_ToTitleName; - return this; -} - -void CLocalData::setNewInfo(const ScheduleDtailInfo &newInfo) +void CLocalData::setNewInfo(const DSchedule::Ptr &newInfo) { m_NewInfo = newInfo; } -ScheduleDtailInfo CLocalData::getNewInfo() const +DSchedule::Ptr CLocalData::getNewInfo() const { return m_NewInfo; } diff -Nru dde-calendar-5.9.1/schedule-plugin/src/data/clocaldata.h dde-calendar-5.10.0/schedule-plugin/src/data/clocaldata.h --- dde-calendar-5.9.1/schedule-plugin/src/data/clocaldata.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/data/clocaldata.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,36 +1,24 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef CLOCALDATA_H #define CLOCALDATA_H -#include "schedulestructs.h" +#include "dschedule.h" #include "timedatastruct.h" + +#include + class CLocalData { public: + typedef QSharedPointer Ptr; CLocalData(); - QVector scheduleInfoVector() const; - void setScheduleInfoVector(const QVector &scheduleInfoVector); - ScheduleDtailInfo SelectInfo() const; - void setSelectInfo(const ScheduleDtailInfo &SelectInfo); + DSchedule::List scheduleInfoVector() const; + void setScheduleInfoVector(const DSchedule::List &scheduleInfoVector); + DSchedule::Ptr SelectInfo() const; + void setSelectInfo(const DSchedule::Ptr &SelectInfo); void setToTitleName(const QString &title); QString getToTitleName() const; /** @@ -45,14 +33,13 @@ SemanticsDateTime getToTime() const; int getOffet() const; void setOffset(int offset); - CLocalData *getDataByPoint(const CLocalData *localData); - void setNewInfo(const ScheduleDtailInfo &newInfo); - ScheduleDtailInfo getNewInfo() const; + void setNewInfo(const DSchedule::Ptr &newInfo); + DSchedule::Ptr getNewInfo() const; private: - QVector m_scheduleInfoVector {}; - ScheduleDtailInfo m_SelectInfo {}; - ScheduleDtailInfo m_NewInfo {}; + DSchedule::List m_scheduleInfoVector {}; + DSchedule::Ptr m_SelectInfo {}; + DSchedule::Ptr m_NewInfo {}; QString m_ToTitleName {""}; SemanticsDateTime m_ToTime {}; int m_offset {-1}; diff -Nru dde-calendar-5.9.1/schedule-plugin/src/data/createjsondata.cpp dde-calendar-5.10.0/schedule-plugin/src/data/createjsondata.cpp --- dde-calendar-5.9.1/schedule-plugin/src/data/createjsondata.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/data/createjsondata.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "createjsondata.h" #include diff -Nru dde-calendar-5.9.1/schedule-plugin/src/data/createjsondata.h dde-calendar-5.10.0/schedule-plugin/src/data/createjsondata.h --- dde-calendar-5.9.1/schedule-plugin/src/data/createjsondata.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/data/createjsondata.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef CREATEJSONDATA_H #define CREATEJSONDATA_H diff -Nru dde-calendar-5.9.1/schedule-plugin/src/data/jsondata.cpp dde-calendar-5.10.0/schedule-plugin/src/data/jsondata.cpp --- dde-calendar-5.9.1/schedule-plugin/src/data/jsondata.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/data/jsondata.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "jsondata.h" #include diff -Nru dde-calendar-5.9.1/schedule-plugin/src/data/jsondata.h dde-calendar-5.10.0/schedule-plugin/src/data/jsondata.h --- dde-calendar-5.9.1/schedule-plugin/src/data/jsondata.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/data/jsondata.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef JSONDATA_H #define JSONDATA_H diff -Nru dde-calendar-5.9.1/schedule-plugin/src/data/queryjsondata.cpp dde-calendar-5.10.0/schedule-plugin/src/data/queryjsondata.cpp --- dde-calendar-5.9.1/schedule-plugin/src/data/queryjsondata.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/data/queryjsondata.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "queryjsondata.h" #include diff -Nru dde-calendar-5.9.1/schedule-plugin/src/data/queryjsondata.h dde-calendar-5.10.0/schedule-plugin/src/data/queryjsondata.h --- dde-calendar-5.9.1/schedule-plugin/src/data/queryjsondata.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/data/queryjsondata.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef QUERYJSONDATA_H #define QUERYJSONDATA_H diff -Nru dde-calendar-5.9.1/schedule-plugin/src/data/schedulecolourmanage.cpp dde-calendar-5.10.0/schedule-plugin/src/data/schedulecolourmanage.cpp --- dde-calendar-5.9.1/schedule-plugin/src/data/schedulecolourmanage.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/data/schedulecolourmanage.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,401 +0,0 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ -#include "schedulecolourmanage.h" - -ScheduleColourManage::ScheduleColourManage() - : m_LifeScheduleColour(new CSchedulesColor()) - , m_WorkScheduleColour(new CSchedulesColor()) - , m_OtherScheduleColour(new CSchedulesColor()) - , m_SolarScheduleColour(new CSchedulesColor()) -{ -} - -ScheduleColourManage::~ScheduleColourManage() -{ - delete m_LifeScheduleColour; - m_LifeScheduleColour = nullptr; - delete m_WorkScheduleColour; - m_WorkScheduleColour = nullptr; - delete m_OtherScheduleColour; - m_OtherScheduleColour = nullptr; - delete m_SolarScheduleColour; - m_SolarScheduleColour = nullptr; -} - -void ScheduleColourManage::setTheMe(int type) -{ - setLifeScheduleTheme(type); - setOtherScheduleTheme(type); - setWorkScheduleTheme(type); - setSolarScheduleTheme(type); -} - -CSchedulesColor ScheduleColourManage::getColorByTypeId(const int &id) -{ - //1工作 2 生活 3其他 - CSchedulesColor color; - switch (id) { - case 1: - color = WorkScheduleColour(); - break; - case 2: - color = LifeScheduleColour(); - break; - case 3: - color = OtherScheduleColour(); - break; - case 4: - color = SolarScheduleColour(); - break; - default: - color = OtherScheduleColour(); - break; - } - return color; -} - -CSchedulesColor ScheduleColourManage::LifeScheduleColour() const -{ - return *m_LifeScheduleColour; -} - -CSchedulesColor ScheduleColourManage::WorkScheduleColour() const -{ - return *m_WorkScheduleColour; -} - -CSchedulesColor ScheduleColourManage::OtherScheduleColour() const -{ - return *m_OtherScheduleColour; -} - -CSchedulesColor ScheduleColourManage::SolarScheduleColour() const -{ - return *m_SolarScheduleColour; -} - -void ScheduleColourManage::setLifeScheduleTheme(int type) -{ - if (type == 0 || type == 1) { - m_LifeScheduleColour->type = 2; - m_LifeScheduleColour->dotColor = "#82D245"; - m_LifeScheduleColour->dotColor.setAlphaF(1); - m_LifeScheduleColour->gradientFromC = "#B7E6FB"; - m_LifeScheduleColour->gradientFromC.setAlphaF(0.7); - m_LifeScheduleColour->gradientToC = "#D4FFB3"; - m_LifeScheduleColour->gradientToC.setAlphaF(0.7); - m_LifeScheduleColour->Purecolor = "#6FFF00"; - m_LifeScheduleColour->Purecolor.setAlphaF(0.2); - m_LifeScheduleColour->shadowcolor = "#82D245"; - m_LifeScheduleColour->textColor = "#000000"; - m_LifeScheduleColour->timeColor = "#53A316"; - m_LifeScheduleColour->hightlightgradientFromC = "#9AE5FF"; - m_LifeScheduleColour->hightlightgradientToC = "#C7FF94"; - QColor lifeP("#C7FF94"); - //lifeP.setAlphaF(0.8); - m_LifeScheduleColour->hightlightPurecolor = lifeP; - - m_LifeScheduleColour->hovergradientFromC = "#A8E9FF"; - m_LifeScheduleColour->hovergradientToC = "#D5FFAF"; - m_LifeScheduleColour->hovergradientFromC.setAlphaF(0.95); - m_LifeScheduleColour->hovergradientToC.setAlphaF(0.95); - QColor lifehP("#C4FF98"); - lifehP.setAlphaF(0.8); - m_LifeScheduleColour->hoverPurecolor = lifehP; - m_LifeScheduleColour->splitColor = "#82D245"; - m_LifeScheduleColour->pressgradientToC = m_LifeScheduleColour->gradientToC; - m_LifeScheduleColour->pressgradientFromC = m_LifeScheduleColour->gradientFromC; - m_LifeScheduleColour->pressPurecolor = m_LifeScheduleColour->Purecolor; - m_LifeScheduleColour->pressgradientToC.setAlphaF(0.8); - m_LifeScheduleColour->pressgradientFromC.setAlphaF(0.8); - m_LifeScheduleColour->pressPurecolor.setAlphaF(0.2); - - } else { - m_LifeScheduleColour->type = 2; - m_LifeScheduleColour->dotColor = "#59F88D"; - m_LifeScheduleColour->dotColor.setAlphaF(0.5); - m_LifeScheduleColour->gradientFromC = "#2D6883"; - m_LifeScheduleColour->gradientToC = "#5D7D44"; - m_LifeScheduleColour->gradientToC.setAlphaF(0.5); - m_LifeScheduleColour->gradientFromC.setAlphaF(0.5); - m_LifeScheduleColour->Purecolor = "#59F88D"; - m_LifeScheduleColour->Purecolor.setAlphaF(0.1); - m_LifeScheduleColour->shadowcolor = "#25FA6B"; - m_LifeScheduleColour->shadowcolor.setAlphaF(0.5); - m_LifeScheduleColour->textColor = "#C0C6D4"; - // m_LifeScheduleColour->textColor.setAlphaF(1); - m_LifeScheduleColour->timeColor = "#38A35B"; - m_LifeScheduleColour->hightlightgradientFromC = "#2D6883"; - m_LifeScheduleColour->hightlightgradientFromC.setAlphaF(0.8); - m_LifeScheduleColour->hightlightgradientToC = "#5D7D44"; - m_LifeScheduleColour->hightlightgradientToC.setAlphaF(0.8); - QColor lifeP("#337044"); - lifeP.setAlphaF(0.8); - m_LifeScheduleColour->hightlightPurecolor = lifeP; - m_LifeScheduleColour->splitColor = "#25FA6B"; - m_LifeScheduleColour->splitColor.setAlphaF(0.3); - m_LifeScheduleColour->hovergradientFromC = "#2D6883"; - m_LifeScheduleColour->hovergradientToC = "#5D7D44"; - m_LifeScheduleColour->hovergradientFromC.setAlphaF(0.65); - m_LifeScheduleColour->hovergradientToC.setAlphaF(0.65); - QColor lifehP("#59F88D"); - lifehP.setAlphaF(0.2); - m_LifeScheduleColour->hoverPurecolor = lifehP; - m_LifeScheduleColour->pressgradientToC = m_LifeScheduleColour->gradientToC; - m_LifeScheduleColour->pressgradientFromC = m_LifeScheduleColour->gradientFromC; - m_LifeScheduleColour->pressPurecolor = m_LifeScheduleColour->Purecolor; - m_LifeScheduleColour->pressgradientToC.setAlphaF(0.4); - m_LifeScheduleColour->pressgradientFromC.setAlphaF(0.4); - m_LifeScheduleColour->pressPurecolor.setAlphaF(0.15); - } -} - -void ScheduleColourManage::setWorkScheduleTheme(int type) -{ - if (type == 0 || type == 1) { - m_WorkScheduleColour->type = 1; - m_WorkScheduleColour->dotColor = "#FB2525"; - m_WorkScheduleColour->dotColor.setAlphaF(0.5); - m_WorkScheduleColour->gradientFromC = "#FBCEB7"; - m_WorkScheduleColour->gradientFromC.setAlphaF(0.7); - m_WorkScheduleColour->gradientToC = "#FA9D9A"; - m_WorkScheduleColour->gradientToC.setAlphaF(0.7); - m_WorkScheduleColour->Purecolor = "#F85566"; - m_WorkScheduleColour->Purecolor.setAlphaF(0.2); - m_WorkScheduleColour->shadowcolor = "#FB2525"; - m_WorkScheduleColour->shadowcolor.setAlphaF(0.5); - m_WorkScheduleColour->textColor = "#000000"; - m_WorkScheduleColour->timeColor = "#B54A4B"; - m_WorkScheduleColour->hightlightgradientFromC = "#FFD0B8"; - m_WorkScheduleColour->hightlightgradientToC = "#FF908D"; - QColor workP("#F9AEB8"); - //workP.setAlphaF(0.8); - m_WorkScheduleColour->hightlightPurecolor = workP; - m_WorkScheduleColour->splitColor = "#FB2525"; - m_WorkScheduleColour->splitColor.setAlphaF(0.5); - - m_WorkScheduleColour->hovergradientFromC = "#FFD0B8"; - m_WorkScheduleColour->hovergradientFromC.setAlphaF(0.95); - m_WorkScheduleColour->hovergradientToC = "#FF9D9A"; - m_WorkScheduleColour->hovergradientToC.setAlphaF(0.95); - QColor workhP("#FFB6BD"); - workhP.setAlphaF(0.8); - m_WorkScheduleColour->hoverPurecolor = workhP; - - m_WorkScheduleColour->pressgradientToC = m_WorkScheduleColour->gradientToC; - m_WorkScheduleColour->pressgradientFromC = m_WorkScheduleColour->gradientFromC; - m_WorkScheduleColour->pressPurecolor = m_WorkScheduleColour->Purecolor; - m_WorkScheduleColour->pressgradientToC.setAlphaF(0.8); - m_WorkScheduleColour->pressgradientFromC.setAlphaF(0.8); - m_WorkScheduleColour->pressPurecolor.setAlphaF(0.2); - - } else { - m_WorkScheduleColour->type = 1; - m_WorkScheduleColour->dotColor = "#F85566"; - m_WorkScheduleColour->dotColor.setAlphaF(0.5); - m_WorkScheduleColour->gradientFromC = "#965A26"; - m_WorkScheduleColour->gradientToC = "#8B2521"; - m_WorkScheduleColour->gradientToC.setAlphaF(0.5); - m_WorkScheduleColour->gradientFromC.setAlphaF(0.5); - m_WorkScheduleColour->Purecolor = "#F85566"; - m_WorkScheduleColour->Purecolor.setAlphaF(0.1); - m_WorkScheduleColour->shadowcolor = "#FB2525"; - m_WorkScheduleColour->shadowcolor.setAlphaF(0.5); - m_WorkScheduleColour->textColor = "#C0C6D4"; - // m_WorkScheduleColour->textColor.setAlphaF(1); - m_WorkScheduleColour->timeColor = "#B54A4B"; - m_WorkScheduleColour->hightlightgradientToC = "#992D2A"; - m_WorkScheduleColour->hightlightgradientToC.setAlphaF(0.8); - m_WorkScheduleColour->hightlightgradientFromC = "#8B521F"; - m_WorkScheduleColour->hightlightgradientFromC.setAlphaF(0.8); - QColor workP("#77373E"); - workP.setAlphaF(0.8); - m_WorkScheduleColour->hightlightPurecolor = workP; - - m_WorkScheduleColour->hovergradientFromC = "#965A26"; - m_WorkScheduleColour->hovergradientToC = "#8B2521"; - m_WorkScheduleColour->hovergradientFromC.setAlphaF(0.65); - m_WorkScheduleColour->hovergradientToC.setAlphaF(0.65); - QColor workhP("#F85566"); - workhP.setAlphaF(0.2); - m_WorkScheduleColour->hoverPurecolor = workhP; - m_WorkScheduleColour->splitColor = "#F85566"; - m_WorkScheduleColour->splitColor.setAlphaF(0.5); - m_WorkScheduleColour->pressgradientToC = m_WorkScheduleColour->gradientToC; - m_WorkScheduleColour->pressgradientFromC = m_WorkScheduleColour->gradientFromC; - m_WorkScheduleColour->pressPurecolor = m_WorkScheduleColour->Purecolor; - m_WorkScheduleColour->pressgradientToC.setAlphaF(0.4); - m_WorkScheduleColour->pressgradientFromC.setAlphaF(0.4); - m_WorkScheduleColour->pressPurecolor.setAlphaF(0.15); - } -} - -void ScheduleColourManage::setOtherScheduleTheme(int type) -{ - if (type == 0 || type == 1) { - m_OtherScheduleColour->type = 3; - m_OtherScheduleColour->dotColor = "#BA60FA"; - m_OtherScheduleColour->dotColor.setAlphaF(1); - m_OtherScheduleColour->gradientFromC = "#FBE9B7"; - m_OtherScheduleColour->gradientFromC.setAlphaF(0.7); - m_OtherScheduleColour->gradientToC = "#DFB3FF"; - m_OtherScheduleColour->gradientToC.setAlphaF(0.7); - m_OtherScheduleColour->Purecolor = "#D191FF"; - m_OtherScheduleColour->Purecolor.setAlphaF(0.2); - m_OtherScheduleColour->shadowcolor = "#BA60FA"; - m_OtherScheduleColour->textColor = "#000000"; - m_OtherScheduleColour->timeColor = "#8548B1"; - m_OtherScheduleColour->hightlightgradientFromC = "#FFE8AC"; - m_OtherScheduleColour->hightlightgradientToC = "#FBA5FF"; - QColor otherP("#EAC4FF"); - //otherP.setAlphaF(0.8); - m_OtherScheduleColour->hightlightPurecolor = otherP; - - m_OtherScheduleColour->hovergradientFromC = "#FFE8AC"; - m_OtherScheduleColour->hovergradientToC = "#E2A5FF"; - m_OtherScheduleColour->hovergradientFromC.setAlphaF(0.95); - m_OtherScheduleColour->hovergradientToC.setAlphaF(0.95); - QColor otherhP("#E6C5FF"); - otherhP.setAlphaF(0.8); - m_OtherScheduleColour->hoverPurecolor = otherhP; - m_OtherScheduleColour->splitColor = "#BA60FA"; - m_OtherScheduleColour->pressgradientToC = m_OtherScheduleColour->gradientToC; - m_OtherScheduleColour->pressgradientFromC = m_OtherScheduleColour->gradientFromC; - m_OtherScheduleColour->pressPurecolor = m_OtherScheduleColour->Purecolor; - m_OtherScheduleColour->pressgradientToC.setAlphaF(0.8); - m_OtherScheduleColour->pressgradientFromC.setAlphaF(0.8); - m_OtherScheduleColour->pressPurecolor.setAlphaF(0.2); - } else { - m_OtherScheduleColour->type = 3; - m_OtherScheduleColour->dotColor = "#C155F8"; - m_OtherScheduleColour->dotColor.setAlphaF(0.7); - m_OtherScheduleColour->gradientFromC = "#8C4E2C"; - m_OtherScheduleColour->gradientToC = "#7D37AF"; - m_OtherScheduleColour->gradientToC.setAlphaF(0.5); - m_OtherScheduleColour->gradientFromC.setAlphaF(0.5); - m_OtherScheduleColour->Purecolor = "#C155F8"; - m_OtherScheduleColour->Purecolor.setAlphaF(0.1); - m_OtherScheduleColour->shadowcolor = "#BE3DFF"; - m_OtherScheduleColour->shadowcolor.setAlphaF(0.5); - m_OtherScheduleColour->textColor = "#C0C6D4"; - // m_OtherScheduleColour->textColor.setAlphaF(1); - m_OtherScheduleColour->timeColor = "#9857C8"; - m_OtherScheduleColour->hightlightgradientFromC = "#8C4E2C"; - m_OtherScheduleColour->hightlightgradientFromC.setAlphaF(0.8); - m_OtherScheduleColour->hightlightgradientToC = "#803BAE"; - m_OtherScheduleColour->hightlightgradientToC.setAlphaF(0.8); - QColor otherP("#613776"); - otherP.setAlphaF(0.8); - m_OtherScheduleColour->hightlightPurecolor = otherP; - - m_OtherScheduleColour->hovergradientFromC = "#8C4E2C"; - m_OtherScheduleColour->hovergradientToC = "#7D37AF"; - m_OtherScheduleColour->hovergradientFromC.setAlphaF(0.65); - m_OtherScheduleColour->hovergradientToC.setAlphaF(0.65); - QColor otherhP("#C155F8"); - otherhP.setAlphaF(0.2); - m_OtherScheduleColour->hoverPurecolor = otherhP; - m_OtherScheduleColour->splitColor = "#BA32FF"; - m_OtherScheduleColour->splitColor.setAlphaF(0.5); - m_OtherScheduleColour->pressgradientToC = m_OtherScheduleColour->gradientToC; - m_OtherScheduleColour->pressgradientFromC = m_OtherScheduleColour->gradientFromC; - m_OtherScheduleColour->pressPurecolor = m_OtherScheduleColour->Purecolor; - m_OtherScheduleColour->pressgradientToC.setAlphaF(0.4); - m_OtherScheduleColour->pressgradientFromC.setAlphaF(0.4); - m_OtherScheduleColour->pressPurecolor.setAlphaF(0.15); - } -} - -void ScheduleColourManage::setSolarScheduleTheme(int type) -{ - if (type == 0 || type == 1) { - m_SolarScheduleColour->type = 4; - m_SolarScheduleColour->dotColor = "#FF7272"; - m_SolarScheduleColour->dotColor.setAlphaF(1); - m_SolarScheduleColour->gradientFromC = "#FF7272"; - m_SolarScheduleColour->gradientFromC.setAlphaF(0.3); - m_SolarScheduleColour->gradientToC = "#FF7272"; - m_SolarScheduleColour->gradientToC.setAlphaF(0.3); - m_SolarScheduleColour->Purecolor = "#FF7272"; - m_SolarScheduleColour->Purecolor.setAlphaF(0.3); - m_SolarScheduleColour->shadowcolor = "#BA60FA"; - m_SolarScheduleColour->textColor = "#000000"; - m_SolarScheduleColour->timeColor = "#8548B1"; - m_SolarScheduleColour->hightlightgradientFromC = "#F9AAAA"; - m_SolarScheduleColour->hightlightgradientFromC.setAlphaF(1); - m_SolarScheduleColour->hightlightgradientToC = "#F9AAAA"; - m_SolarScheduleColour->hightlightgradientToC.setAlphaF(1); - m_SolarScheduleColour->hightlightPurecolor = "#F9AAAA"; - m_SolarScheduleColour->hightlightPurecolor.setAlphaF(1); - - m_SolarScheduleColour->hovergradientFromC = "#FFB0B1"; - m_SolarScheduleColour->hovergradientToC = "#FFB0B1"; - m_SolarScheduleColour->hovergradientFromC.setAlphaF(0.95); - m_SolarScheduleColour->hovergradientToC.setAlphaF(0.95); - m_SolarScheduleColour->hoverPurecolor = "#FF7272"; - m_SolarScheduleColour->splitColor = "#FF7272"; - m_SolarScheduleColour->pressgradientFromC = "#FF7272"; - m_SolarScheduleColour->pressgradientFromC.setAlphaF(0.3); - m_SolarScheduleColour->pressgradientToC = "#FF7272"; - m_SolarScheduleColour->pressgradientToC.setAlphaF(0.3); - - m_SolarScheduleColour->pressPurecolor = m_SolarScheduleColour->Purecolor; - m_SolarScheduleColour->pressgradientToC.setAlphaF(0.4); - m_SolarScheduleColour->pressgradientFromC.setAlphaF(0.4); - m_SolarScheduleColour->pressPurecolor.setAlphaF(0.1); - } else { - m_SolarScheduleColour->type = 4; - m_SolarScheduleColour->dotColor = "#FF7272"; - m_SolarScheduleColour->dotColor.setAlphaF(0.8); - m_SolarScheduleColour->gradientFromC = "#FF7272"; - m_SolarScheduleColour->gradientFromC.setAlphaF(0.3); - m_SolarScheduleColour->gradientToC = "#FF7272"; - m_SolarScheduleColour->gradientToC.setAlphaF(0.3); - m_SolarScheduleColour->Purecolor = "#FF7272"; - m_SolarScheduleColour->Purecolor.setAlphaF(0.3); - m_SolarScheduleColour->shadowcolor = "#BA60FA"; - m_SolarScheduleColour->textColor = "#C0C6D4"; - m_SolarScheduleColour->timeColor = "#8548B1"; - m_SolarScheduleColour->hightlightgradientFromC = "#A24545"; - m_SolarScheduleColour->hightlightgradientFromC.setAlphaF(0.8); - m_SolarScheduleColour->hightlightgradientToC = "#A24545"; - m_SolarScheduleColour->hightlightgradientToC.setAlphaF(0.8); - m_SolarScheduleColour->hightlightPurecolor = "#A24545"; - m_SolarScheduleColour->hightlightPurecolor.setAlphaF(0.8); - - m_SolarScheduleColour->hovergradientFromC = "#E56464"; - m_SolarScheduleColour->hovergradientToC = "#E56464"; - m_SolarScheduleColour->hovergradientFromC.setAlphaF(0.35); - m_SolarScheduleColour->hovergradientToC.setAlphaF(0.35); - m_SolarScheduleColour->hoverPurecolor = "#E56464"; - m_SolarScheduleColour->splitColor = "#FF7272"; - m_SolarScheduleColour->pressgradientFromC = "#FF7272"; - m_SolarScheduleColour->pressgradientFromC.setAlphaF(0.3); - m_SolarScheduleColour->pressgradientToC = m_SolarScheduleColour->pressgradientFromC; - // m_SolarScheduleColour->pressgradientToC = "#000000"; - // m_SolarScheduleColour->pressgradientToC.setAlphaF(0.05); - - m_SolarScheduleColour->pressPurecolor = m_SolarScheduleColour->Purecolor; - m_SolarScheduleColour->pressgradientToC.setAlphaF(0.4); - m_SolarScheduleColour->pressgradientFromC.setAlphaF(0.4); - m_SolarScheduleColour->pressPurecolor.setAlphaF(0.1); - } -} diff -Nru dde-calendar-5.9.1/schedule-plugin/src/data/schedulecolourmanage.h dde-calendar-5.10.0/schedule-plugin/src/data/schedulecolourmanage.h --- dde-calendar-5.9.1/schedule-plugin/src/data/schedulecolourmanage.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/data/schedulecolourmanage.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,79 +0,0 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ -#ifndef SCHEDULECOLOURMANAGE_H -#define SCHEDULECOLOURMANAGE_H - -#include -#include - -struct CSchedulesColor { - int type; - QColor gradientFromC; - QColor gradientToC; - QColor dotColor; - QColor Purecolor; - QColor shadowcolor; - QColor textColor; - QColor timeColor; - QColor hightlightgradientFromC; - QColor hightlightgradientToC; - QColor hightlightPurecolor; - QColor hovergradientFromC; - QColor hovergradientToC; - QColor hoverPurecolor; - QColor splitColor; - QColor pressgradientFromC; - QColor pressgradientToC; - QColor pressPurecolor; -}; - -class ScheduleColourManage -{ -public: - ScheduleColourManage(); - ~ScheduleColourManage(); - -public: - void setTheMe(int type = 0); - CSchedulesColor getColorByTypeId(const int &id); -private: - CSchedulesColor LifeScheduleColour() const; - - CSchedulesColor WorkScheduleColour() const; - - CSchedulesColor OtherScheduleColour() const; - - CSchedulesColor SolarScheduleColour() const; - -private: - void setLifeScheduleTheme(int type = 0); - void setWorkScheduleTheme(int type = 0); - void setOtherScheduleTheme(int type = 0); - void setSolarScheduleTheme(int type = 0); - -private: - CSchedulesColor *m_LifeScheduleColour {nullptr}; - CSchedulesColor *m_WorkScheduleColour {nullptr}; - CSchedulesColor *m_OtherScheduleColour {nullptr}; - CSchedulesColor *m_SolarScheduleColour {nullptr}; -}; - -#endif // SCHEDULECOLOURMANAGE_H diff -Nru dde-calendar-5.9.1/schedule-plugin/src/data/schedulestructs.h dde-calendar-5.10.0/schedule-plugin/src/data/schedulestructs.h --- dde-calendar-5.9.1/schedule-plugin/src/data/schedulestructs.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/data/schedulestructs.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,127 +0,0 @@ -/* - * Copyright (C) 2017 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: kirigaya - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -#ifndef SCHEDULESTURCTS_H -#define SCHEDULESTURCTS_H - -#include -#include -#include -#include - -typedef struct _tagScheduleRemindInfo { - int id = 0; - QDateTime remindDateTime; - int times = 1; -} ScheduleRemindInfo; -typedef struct _tagScheduleRemindData { - int n = 0; //全天代表天数 非全天代表分钟 - QTime time; //全天该变量才有效 -} ScheduleRemindData; -typedef struct _tagScheduleEndRepeatData { - int type = 0; //0 永不 1 多少次结束 2 结束日期 - QDateTime date; //为2时才有效 - int tcount = 0; //1时有效 -} ScheduleEndRepeatData; -typedef struct _tagScheduleType { - QString typeName; //work life other - QColor color; //颜色 - int ID = -1; -} ScheduleType; -typedef struct _tagScheduleDtailInfo { - int id = 0; - QDateTime beginDateTime; - QDateTime endDateTime; - QVector ignore; - QString titleName; - QString description; - bool allday = true; //1全天 - ScheduleType type; //1工作 2 生活 3其他 - int RecurID = 0; //0 代表原始 大于0 代表克隆 - bool remind = true; //0无 1 提醒 - ScheduleRemindData remindData; - int rpeat = 0; //0 无 1 每天 2 每个工作日 3 每周 4每月 5每年 - ScheduleEndRepeatData enddata; - explicit _tagScheduleDtailInfo() - { - type.ID = -1; - } - bool operator==(const _tagScheduleDtailInfo &info) const - { - if (info.type.ID == 4) { - return this->id == info.id && this->RecurID == info.RecurID && titleName == info.titleName && beginDateTime == info.beginDateTime; - } else { - return this->id == info.id && this->RecurID == info.RecurID && titleName == info.titleName; - } - } - bool operator<(const _tagScheduleDtailInfo &info) const - { - if (beginDateTime.date() != endDateTime.date() && info.beginDateTime.date() == info.endDateTime.date()) { - return true; - } else if (beginDateTime.date() == endDateTime.date() && info.beginDateTime.date() != info.endDateTime.date()) { - return false; - } else if (beginDateTime.date() != endDateTime.date() && info.beginDateTime.date() != info.endDateTime.date()) { - if (beginDateTime.date() == info.beginDateTime.date()) { - return beginDateTime.daysTo(endDateTime) > info.beginDateTime.daysTo(info.endDateTime); - } - return beginDateTime.date() < info.beginDateTime.date(); - } else { - if (type.ID == 4) - return true; - if (info.type.ID == 4) - return false; - if (beginDateTime == info.beginDateTime) { - if (titleName == info.titleName) { - return id < info.id; - } - return titleName < info.titleName; - } else { - return beginDateTime < info.beginDateTime; - } - } - } -} ScheduleDtailInfo; - -typedef struct _tagScheduleDateRangeInfo { - QDate date; - QVector vData; -} ScheduleDateRangeInfo; -typedef struct _tagMScheduleDateRangeInfo { - QDate bdate; - QDate edate; - bool state = true; - int num = 0; - ScheduleDtailInfo tData; - bool operator<(const _tagMScheduleDateRangeInfo &info) const - { - if (bdate == info.bdate) { - if (bdate.daysTo(edate) == info.bdate.daysTo(info.edate)) { - return tData < info.tData; - } else { - return bdate.daysTo(edate) > info.bdate.daysTo(info.edate); - } - } else { - return bdate < info.bdate; - } - } - bool operator==(const _tagMScheduleDateRangeInfo &info) const - { - return bdate == info.bdate && edate == info.edate && tData == info.tData && state == info.state && num == info.num; - } -} MScheduleDateRangeInfo; -#endif diff -Nru dde-calendar-5.9.1/schedule-plugin/src/data/timedatastruct.h dde-calendar-5.10.0/schedule-plugin/src/data/timedatastruct.h --- dde-calendar-5.9.1/schedule-plugin/src/data/timedatastruct.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/data/timedatastruct.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TIMEDATASTRUCT_H #define TIMEDATASTRUCT_H diff -Nru dde-calendar-5.9.1/schedule-plugin/src/dbus/cdbuspendingcallwatcher.cpp dde-calendar-5.10.0/schedule-plugin/src/dbus/cdbuspendingcallwatcher.cpp --- dde-calendar-5.9.1/schedule-plugin/src/dbus/cdbuspendingcallwatcher.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/dbus/cdbuspendingcallwatcher.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,45 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "cdbuspendingcallwatcher.h" + +CDBusPendingCallWatcher::CDBusPendingCallWatcher(const QDBusPendingCall &call, QString member, QObject *parent) + : QDBusPendingCallWatcher(call, parent) + , m_member(member) +{ + connect(this, &QDBusPendingCallWatcher::finished, this, [this]() { + //转发调用完成事件 + emit this->signalCallFinished(this); + }); +} + +/** + * @brief CDBusPendingCallWatcher::setCallbackFunc + * 设置回调函数 + * @param func 回调函数 + */ +void CDBusPendingCallWatcher::setCallbackFunc(CallbackFunc func) +{ + m_func = func; +} + +/** + * @brief CDBusPendingCallWatcher::getCallbackFunc + * 获取回调函数 + * @return 回调函数 + */ +CallbackFunc CDBusPendingCallWatcher::getCallbackFunc() +{ + return m_func; +} + +/** + * @brief CDBusPendingCallWatcher::getmember + * 设置调用方法名 + * @return 方法名 + */ +QString CDBusPendingCallWatcher::getmember() +{ + return m_member; +} diff -Nru dde-calendar-5.9.1/schedule-plugin/src/dbus/cdbuspendingcallwatcher.h dde-calendar-5.10.0/schedule-plugin/src/dbus/cdbuspendingcallwatcher.h --- dde-calendar-5.9.1/schedule-plugin/src/dbus/cdbuspendingcallwatcher.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/dbus/cdbuspendingcallwatcher.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,50 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef CDBUSPENDINGCALLWATCHER_H +#define CDBUSPENDINGCALLWATCHER_H + +#include + +/** + * @brief The CallMessge struct + * dbus请求回调数据 + */ +struct CallMessge { + int code; //返回码,0:请求成功,大于0:请求失败 + QString msg; //返回码说明,根据实际需求可返回任意字符串 +}; + +/** + * @brief CallbackFunc + * dbus请求回调函数类型 + */ +typedef std::function CallbackFunc; + +//继承QDbus回调观察者,将部分自定义的数据包装在回调类中 +class CDBusPendingCallWatcher : public QDBusPendingCallWatcher +{ + Q_OBJECT +public: + explicit CDBusPendingCallWatcher(const QDBusPendingCall &call, QString member, QObject *parent = nullptr); + + //设置回调函数 + void setCallbackFunc(CallbackFunc func); + //获取回调函数 + CallbackFunc getCallbackFunc(); + + //设置调用方法名 + QString getmember(); + +signals: + void signalCallFinished(CDBusPendingCallWatcher *); + +public slots: + +private: + QString m_member; //调用的dbus方法名 + CallbackFunc m_func = nullptr; //回调函数指针 +}; + +#endif // CDBUSPENDINGCALLWATCHER_H diff -Nru dde-calendar-5.9.1/schedule-plugin/src/dbus/dbusaccountmanagerrequest.cpp dde-calendar-5.10.0/schedule-plugin/src/dbus/dbusaccountmanagerrequest.cpp --- dde-calendar-5.9.1/schedule-plugin/src/dbus/dbusaccountmanagerrequest.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/dbus/dbusaccountmanagerrequest.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "dbusaccountmanagerrequest.h" +#include + +DbusAccountManagerRequest::DbusAccountManagerRequest(QObject *parent) + : DbusRequestBase("/com/deepin/dataserver/Calendar/AccountManager", "com.deepin.dataserver.Calendar.AccountManager", QDBusConnection::sessionBus(), parent) +{ +} + +/** + * @brief DbusAccountManagerRequest::getAccountList + * 请求帐户列表 + */ +DAccount::List DbusAccountManagerRequest::getAccountList() +{ + DAccount::List accountList; + QList argumentList; + QDBusPendingCall pCall = asyncCallWithArgumentList(QStringLiteral("getAccountList"), argumentList); + pCall.waitForFinished(); + QDBusPendingReply reply = pCall.reply(); + + //获取返回值 + QString str = reply.argumentAt<0>(); + //解析字符串 + DAccount::fromJsonListString(accountList, str); + return accountList; +} + +/** + * @brief DbusAccountManagerRequest::downloadByAccountID + * 根据帐户id下拉数据 + * @param accountID 帐户id + */ +void DbusAccountManagerRequest::downloadByAccountID(const QString &accountID) +{ + QList argumentList; + argumentList << QVariant(accountID); + asyncCall("downloadByAccountID", argumentList); +} + +/** + * @brief DbusAccountManagerRequest::uploadNetWorkAccountData + * 更新网络帐户数据 + */ +void DbusAccountManagerRequest::uploadNetWorkAccountData() +{ + asyncCall("uploadNetWorkAccountData"); +} + +/** + * @brief DbusAccountManagerRequest::getCalendarGeneralSettings + * 获取通用设置 + */ +void DbusAccountManagerRequest::getCalendarGeneralSettings() +{ + asyncCall("getCalendarGeneralSettings"); +} + +/** + * @brief DbusAccountManagerRequest::setCalendarGeneralSettings + * 设置通用设置 + * @param ptr 通用设置 + */ +void DbusAccountManagerRequest::setCalendarGeneralSettings(DCalendarGeneralSettings::Ptr ptr) +{ + QString jsonStr; + DCalendarGeneralSettings::toJsonString(ptr, jsonStr); + asyncCall("setCalendarGeneralSettings", QVariant(jsonStr)); +} + +void DbusAccountManagerRequest::clientIsShow(bool isShow) +{ + QList argumentList; + argumentList << isShow; + //不需要返回结果,发送完直接结束 + callWithArgumentList(QDBus::NoBlock, QStringLiteral("calendarIsShow"), argumentList); +} + +/** + * @brief DbusAccountManagerRequest::slotCallFinished + * dbus调用完成事件 + * @param call 回调类 + */ +void DbusAccountManagerRequest::slotCallFinished(CDBusPendingCallWatcher *call) +{ + int ret = 0; + bool canCall = true; + //错误处理 + if (call->isError()) { + //打印错误信息 + qWarning() << call->reply().member() << call->error().message(); + ret = 1; + } else if (call->getmember() == "getAccountList") { + //"getAccountList"方法回调事件 + QDBusPendingReply reply = *call; + //获取返回值 + QString str = reply.argumentAt<0>(); + DAccount::List accountList; + //解析字符串 + if (DAccount::fromJsonListString(accountList, str)) { + emit signalGetAccountListFinish(accountList); + } else { + qWarning()<< "AccountList Parsing failed!"; + ret = 2; + } + } else if (call->getmember() == "getCalendarGeneralSettings") { + qInfo() << "getCalendarGeneralSettings"; + QDBusPendingReply reply = *call; + QString str = reply.argumentAt<0>(); + DCalendarGeneralSettings::Ptr ptr; + ptr.reset(new DCalendarGeneralSettings()); + if (DCalendarGeneralSettings::fromJsonString(ptr, str)) { + emit signalGetGeneralSettingsFinish(ptr); + } else { + qWarning() <<"AccountList Parsing failed!"; + ret = 2; + } + } else if (call->getmember() == "setCalendarGeneralSettings") { + canCall = false; + setCallbackFunc(call->getCallbackFunc()); + getCalendarGeneralSettings(); + } + + //执行回调函数 + if (canCall && call->getCallbackFunc() != nullptr) { + call->getCallbackFunc()({ret, ""}); + } + //释放内存 + call->deleteLater(); +} diff -Nru dde-calendar-5.9.1/schedule-plugin/src/dbus/dbusaccountmanagerrequest.h dde-calendar-5.10.0/schedule-plugin/src/dbus/dbusaccountmanagerrequest.h --- dde-calendar-5.9.1/schedule-plugin/src/dbus/dbusaccountmanagerrequest.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/dbus/dbusaccountmanagerrequest.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,43 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef DBUSACCOUNTMANAGERREQUEST_H +#define DBUSACCOUNTMANAGERREQUEST_H + +#include "dbusrequestbase.h" +#include "daccount.h" +#include "dcalendargeneralsettings.h" + +//所有账户信息管理类 +class DbusAccountManagerRequest : public DbusRequestBase +{ + Q_OBJECT +public: + explicit DbusAccountManagerRequest(QObject *parent = nullptr); + + //获取账户列表 + DAccount::List getAccountList(); + //根据账户id下拉数据 + void downloadByAccountID(const QString &accountID); + //更新网络账户数据 + void uploadNetWorkAccountData(); + //获取通用设置 + void getCalendarGeneralSettings(); + //设置通用设置 + void setCalendarGeneralSettings(DCalendarGeneralSettings::Ptr ptr); + // + void clientIsShow(bool isShow); + +signals: + //获取账户列表数据完成信号 + void signalGetAccountListFinish(DAccount::List accountList); + //获取通用设置完成信号 + void signalGetGeneralSettingsFinish(DCalendarGeneralSettings::Ptr ptr); + +public slots: + //dbus调用完成事件 + void slotCallFinished(CDBusPendingCallWatcher *) override; +}; + +#endif // DBUSACCOUNTMANAGERREQUEST_H diff -Nru dde-calendar-5.9.1/schedule-plugin/src/dbus/dbusaccountrequest.cpp dde-calendar-5.10.0/schedule-plugin/src/dbus/dbusaccountrequest.cpp --- dde-calendar-5.9.1/schedule-plugin/src/dbus/dbusaccountrequest.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/dbus/dbusaccountrequest.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,292 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "dbusaccountrequest.h" + +#include + +DbusAccountRequest::DbusAccountRequest(const QString &path, const QString &interface, QObject *parent) + : DbusRequestBase(path, interface, QDBusConnection::sessionBus(), parent) +{ +} + +/** + * @brief getAccountInfo 获取帐户信息 + * @return + */ +void DbusAccountRequest::getAccountInfo() +{ + asyncCall("getAccountInfo"); +} + +void DbusAccountRequest::updateAccountInfo(const DAccount::Ptr &account) +{ + QString jsonStr; + DAccount::toJsonString(account, jsonStr); + asyncCall("updateAccountInfo", QVariant(jsonStr)); +} + +/** + * @brief getScheduleTypeList 获取日程类型信息集 + * @return + */ +DScheduleType::List DbusAccountRequest::getScheduleTypeList() +{ + DScheduleType::List typeList; + QList argumentList; + QDBusPendingCall pCall = asyncCallWithArgumentList(QStringLiteral("getScheduleTypeList"), argumentList); + pCall.waitForFinished(); + QDBusMessage reply = pCall.reply(); + if (reply.type() != QDBusMessage::ReplyMessage) { + qWarning() << "getScheduleTypeList error ," << reply; + return typeList; + } + QDBusReply scheduleReply = reply; + DScheduleType::fromJsonListString(typeList, scheduleReply.value()); + return typeList; +} + +/** + * @brief getScheduleTypeByID 根据日程类型ID获取日程类型信息 + * @param typeID 日程类型ID + * @return + */ +void DbusAccountRequest::getScheduleTypeByID(const QString &typeID) +{ + asyncCall("getScheduleTypeByID", QVariant(typeID)); +} + +/** + * @brief createScheduleType 创建日程类型 + * @param typeInfo 类型信息 + * @return 日程类型ID + */ +void DbusAccountRequest::createScheduleType(const DScheduleType::Ptr &typeInfo) +{ + QString jsonStr; + DScheduleType::toJsonString(typeInfo, jsonStr); + asyncCall("createScheduleType", QVariant(jsonStr)); +} + +/** + * @brief updateScheduleType 更新日程类型 + * @param typeInfo 类型信息 + * @return 是否成功,true:更新成功 + */ +void DbusAccountRequest::updateScheduleType(const DScheduleType::Ptr &typeInfo) +{ + QString jsonStr; + DScheduleType::toJsonString(typeInfo, jsonStr); + asyncCall("updateScheduleType", QVariant(jsonStr)); +} + +/** + * @brief deleteScheduleTypeByID 根据日程类型ID删除日程类型 + * @param typeID 日程类型ID + * @return 是否成功,true:更新成功 + */ +void DbusAccountRequest::deleteScheduleTypeByID(const QString &typeID) +{ + QList argumentList; + asyncCall("deleteScheduleTypeByID", QVariant(typeID)); +} + +/** + * @brief scheduleTypeByUsed 日程类型是否被使用 + * @param typeID 日程类型ID + * @return + */ +void DbusAccountRequest::scheduleTypeByUsed(const QString &typeID) +{ + asyncCall("scheduleTypeByUsed", QVariant(typeID)); +} + +/** + * @brief createSchedule 创建日程 + * @param ScheduleInfo 日程信息 + * @return 返回日程ID + */ +QString DbusAccountRequest::createSchedule(const DSchedule::Ptr &scheduleInfo) +{ + QString jsonStr; + DSchedule::toJsonString(scheduleInfo, jsonStr); + + QList argumentList; + argumentList << QVariant::fromValue(jsonStr); + QDBusPendingCall pCall = asyncCallWithArgumentList(QStringLiteral("createSchedule"), argumentList); + pCall.waitForFinished(); + QDBusMessage reply = pCall.reply(); + if (reply.type() != QDBusMessage::ReplyMessage) { + qWarning() << "getScheduleTypeByID error ," << reply; + return nullptr; + } + QDBusReply scheduleReply = reply; + return scheduleReply.value(); +} + +/** + * @brief updateSchedule 更新日程 + * @param ScheduleInfo 日程信息 + * @return 是否成功,true:更新成功 + */ +void DbusAccountRequest::updateSchedule(const DSchedule::Ptr &scheduleInfo) +{ + QString jsonStr; + DSchedule::toJsonString(scheduleInfo, jsonStr); + asyncCall("updateSchedule", QVariant(jsonStr)); +} + +DSchedule::Ptr DbusAccountRequest::getScheduleByID(const QString &scheduleID) +{ + QList argumentList; + argumentList << QVariant::fromValue(scheduleID); + QDBusPendingCall pCall = asyncCallWithArgumentList(QStringLiteral("getScheduleByScheduleID"), argumentList); + pCall.waitForFinished(); + QDBusMessage reply = pCall.reply(); + if (reply.type() != QDBusMessage::ReplyMessage) { + qWarning() << "getScheduleTypeByID error ," << reply; + return nullptr; + } + QDBusReply scheduleReply = reply; + + QString scheduleStr = scheduleReply.value(); + DSchedule::Ptr schedule; + DSchedule::fromJsonString(schedule, scheduleStr); + return schedule; +} + +/** + * @brief deleteScheduleByScheduleID 根据日程ID删除日程 + * @param ScheduleID 日程ID + * @return 是否成功,true:删除成功 + */ +void DbusAccountRequest::deleteScheduleByScheduleID(const QString &scheduleID) +{ + QList argumentList; + asyncCall("deleteScheduleByScheduleID", QVariant(scheduleID)); +} + +/** + * @brief deleteSchedulesByScheduleTypeID 根据日程类型ID删除日程 + * @param typeID 日程类型ID + * @return 是否成功,true:删除成功 + */ +void DbusAccountRequest::deleteSchedulesByScheduleTypeID(const QString &typeID) +{ + QList argumentList; + asyncCall("deleteSchedulesByScheduleTypeID", QVariant(typeID)); +} + +/** + * @brief querySchedulesWithParameter 根据查询参数查询日程 + * @param params 具体的查询参数 + * @return 查询到的日程集 + */ +DSchedule::Map DbusAccountRequest::querySchedulesWithParameter(const DScheduleQueryPar::Ptr ¶ms) +{ + DSchedule::Map scheduleMap; + QList argumentList; + QString jsonStr = DScheduleQueryPar::toJsonString(params); + argumentList << jsonStr; + QDBusPendingCall pCall = asyncCallWithArgumentList(QStringLiteral("querySchedulesWithParameter"), argumentList); + pCall.waitForFinished(); + QDBusMessage reply = pCall.reply(); + if (reply.type() != QDBusMessage::ReplyMessage) { + qWarning() << "getSysColors error ," << reply; + return scheduleMap; + } + QDBusReply scheduleReply = reply; + scheduleMap = DSchedule::fromMapString(scheduleReply.value()); + return scheduleMap; +} + +DTypeColor::List DbusAccountRequest::getSysColors() +{ + DTypeColor::List colorList; + QList argumentList; + QDBusPendingCall pCall = asyncCallWithArgumentList(QStringLiteral("getSysColors"), argumentList); + pCall.waitForFinished(); + QDBusMessage reply = pCall.reply(); + if (reply.type() != QDBusMessage::ReplyMessage) { + qWarning() << "getSysColors error ," << reply; + return colorList; + } + QDBusReply scheduleReply = reply; + colorList = DTypeColor::fromJsonString(scheduleReply.value()); + return colorList; +} + +void DbusAccountRequest::slotCallFinished(CDBusPendingCallWatcher *call) +{ + int ret = 0; + bool canCall = true; + QString msg = ""; + + if (call->isError()) { + qWarning() << call->reply().member() << call->error().message(); + ret = 1; + } else { + QDBusPendingReply reply = *call; + QVariant str = reply.argumentAt<0>(); + if (call->getmember() == "getAccountInfo") { + DAccount::Ptr ptr; + ptr.reset(new DAccount()); + if (DAccount::fromJsonString(ptr, str.toString())) { + emit signalGetAccountInfoFinish(ptr); + } else { + qWarning() << "AccountInfo Parsing failed!"; + ret = 2; + } + } else if (call->getmember() == "getScheduleTypeList") { + DScheduleType::List stList; + if (DScheduleType::fromJsonListString(stList, str.toString())) { + emit signalGetScheduleTypeListFinish(stList); + } else { + qWarning() << "ScheduleTypeList Parsing failed!"; + ret = 2; + } + } else if (call->getmember() == "querySchedulesWithParameter") { + QMap map = DSchedule::fromMapString(str.toString()); + emit signalGetScheduleListFinish(map); + } else if (call->getmember() == "searchSchedulesWithParameter") { + QMap map = DSchedule::fromMapString(str.toString()); + emit signalSearchScheduleListFinish(map); + } else if (call->getmember() == "getSysColors") { + DTypeColor::List list = DTypeColor::fromJsonString(str.toString()); + emit signalGetSysColorsFinish(list); + } else if (call->getmember() == "createScheduleType") { + //创建日程类型结束 + canCall = false; + //在发起数据获取刷新数据,并将本回调函数和数据传到下一个事件中 + CallbackFunc func = call->getCallbackFunc(); + setCallbackFunc([=](CallMessge) { + func({0, str.toString()}); + }); + getScheduleTypeList(); + } else if (call->getmember() == "createSchedule") { + //创建日程结束 + // canCall = false; + //重新读取日程数据 + setCallbackFunc(call->getCallbackFunc()); + querySchedulesWithParameter(m_priParams); + msg = str.toString(); + + } else if (call->getmember() == "deleteScheduleByScheduleID") { + //删除日程结束 + canCall = false; + //重新读取日程数据 + setCallbackFunc(call->getCallbackFunc()); + querySchedulesWithParameter(m_priParams); + } else if (call->getmember() == "getScheduleByID") { + DSchedule::Ptr schedule(new DSchedule); + DSchedule::fromJsonString(schedule, str.toString()); + emit signalGetScheduleFinish(schedule); + } + + if (canCall && call->getCallbackFunc() != nullptr) { + call->getCallbackFunc()({ret, msg}); + } + } + call->deleteLater(); +} diff -Nru dde-calendar-5.9.1/schedule-plugin/src/dbus/dbusaccountrequest.h dde-calendar-5.10.0/schedule-plugin/src/dbus/dbusaccountrequest.h --- dde-calendar-5.9.1/schedule-plugin/src/dbus/dbusaccountrequest.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/dbus/dbusaccountrequest.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,129 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef DBUSACCOUNTREQUEST_H +#define DBUSACCOUNTREQUEST_H + +#include "dbusrequestbase.h" +#include "daccount.h" +#include "dschedule.h" +#include "dscheduletype.h" +#include "dtypecolor.h" +#include "dschedulequerypar.h" + +//单项账户信息请求类 +class DbusAccountRequest : public DbusRequestBase +{ + Q_OBJECT +public: + explicit DbusAccountRequest(const QString &path, const QString &interface, QObject *parent = nullptr); + + /** + * @brief getAccountInfo 获取帐户信息 + * @return + */ + void getAccountInfo(); + /** + * @brief updateAccountInfo 更新帐户信息 + * @param accountInfo 帐户信息 + */ + void updateAccountInfo(const DAccount::Ptr &accountInfo); + /** + * @brief getScheduleTypeList 获取日程类型信息集 + * @return + */ + DScheduleType::List getScheduleTypeList(); + + /** + * @brief getScheduleTypeByID 根据日程类型ID获取日程类型信息 + * @param typeID 日程类型ID + * @return + */ + void getScheduleTypeByID(const QString &typeID); + + /** + * @brief createScheduleType 创建日程类型 + * @param typeInfo 类型信息 + * @return 日程类型ID + */ + void createScheduleType(const DScheduleType::Ptr &typeInfo); + + /** + * @brief updateScheduleType 更新日程类型 + * @param typeInfo 类型信息 + * @return 是否成功,true:更新成功 + */ + void updateScheduleType(const DScheduleType::Ptr &typeInfo); + + /** + * @brief deleteScheduleTypeByID 根据日程类型ID删除日程类型 + * @param typeID 日程类型ID + * @return 是否成功,true:更新成功 + */ + void deleteScheduleTypeByID(const QString &typeID); + + /** + * @brief scheduleTypeByUsed 日程类型是否被使用 + * @param typeID 日程类型ID + * @return + */ + void scheduleTypeByUsed(const QString &typeID); + + /** + * @brief createSchedule 创建日程 + * @param ScheduleInfo 日程信息 + * @return 返回日程ID + */ + QString createSchedule(const DSchedule::Ptr &scheduleInfo); + + /** + * @brief updateSchedule 更新日程 + * @param ScheduleInfo 日程信息 + * @return 是否成功,true:更新成功 + */ + void updateSchedule(const DSchedule::Ptr &scheduleInfo); + + DSchedule::Ptr getScheduleByID(const QString &scheduleID); + + /** + * @brief deleteScheduleByScheduleID 根据日程ID删除日程 + * @param ScheduleID 日程ID + * @return 是否成功,true:删除成功 + */ + void deleteScheduleByScheduleID(const QString &scheduleID); + + /** + * @brief deleteSchedulesByScheduleTypeID 根据日程类型ID删除日程 + * @param typeID 日程类型ID + * @return 是否成功,true:删除成功 + */ + void deleteSchedulesByScheduleTypeID(const QString &typeID); + + /** + * @brief querySchedulesWithParameter 根据查询参数查询日程 + * @param params 具体的查询参数 + * @return 查询到的日程集 + */ + DSchedule::Map querySchedulesWithParameter(const DScheduleQueryPar::Ptr ¶ms); + + DTypeColor::List getSysColors(); + +signals: + void signalCreateScheduleFinish(const QString &scheduleID); + void signalGetAccountInfoFinish(DAccount::Ptr); + void signalGetScheduleFinish(const DSchedule::Ptr &); + void signalGetScheduleTypeListFinish(DScheduleType::List); + void signalGetScheduleListFinish(QMap); + void signalSearchScheduleListFinish(QMap); + void signalGetSysColorsFinish(DTypeColor::List); + +public slots: + + void slotCallFinished(CDBusPendingCallWatcher *) override; + +private: + DScheduleQueryPar::Ptr m_priParams; //上一次查询日程的数据 +}; + +#endif // DBUSACCOUNTREQUEST_H diff -Nru dde-calendar-5.9.1/schedule-plugin/src/dbus/dbushuanglirequest.cpp dde-calendar-5.10.0/schedule-plugin/src/dbus/dbushuanglirequest.cpp --- dde-calendar-5.9.1/schedule-plugin/src/dbus/dbushuanglirequest.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/dbus/dbushuanglirequest.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,84 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "dbushuanglirequest.h" +#include + +DbusHuangLiRequest::DbusHuangLiRequest(QObject *parent) + : DbusRequestBase("/com/deepin/dataserver/Calendar/HuangLi", "com.deepin.dataserver.Calendar.HuangLi", QDBusConnection::sessionBus(), parent) +{ +} + +/** + * @brief DbusHuangLiRequest::getFestivalMonth + * 按月获取节假日信息 + * @param year + * @param month + */ +void DbusHuangLiRequest::getFestivalMonth(quint32 year, quint32 month) +{ + asyncCall("getFestivalMonth", QVariant(year), QVariant(month)); +} + +/** + * @brief DbusHuangLiRequest::getHuangLiDay + * 按天获取黄历信息 + * @param year + * @param month + * @param day + */ +void DbusHuangLiRequest::getHuangLiDay(quint32 year, quint32 month, quint32 day) +{ + asyncCall("getHuangLiDay", QVariant(year), QVariant(month), QVariant(day)); +} + +/** + * @brief DbusHuangLiRequest::getHuangLiMonth + * 按月获取黄历信息 + * @param year + * @param month + * @param fill + */ +void DbusHuangLiRequest::getHuangLiMonth(quint32 year, quint32 month, bool fill) +{ + asyncCall("getHuangLiMonth", QVariant(year), QVariant(month), QVariant(fill)); +} + +/** + * @brief DbusHuangLiRequest::getLunarInfoBySolar + * 获取农历信息 + * @param year + * @param month + * @param day + */ +void DbusHuangLiRequest::getLunarInfoBySolar(quint32 year, quint32 month, quint32 day) +{ + asyncCall("getLunarInfoBySolar", QVariant(year), QVariant(month), QVariant(day)); +} + +/** + * @brief DbusHuangLiRequest::getLunarMonthCalendar + * 获取农历月日程 + * @param year + * @param month + * @param fill + */ +void DbusHuangLiRequest::getLunarMonthCalendar(quint32 year, quint32 month, bool fill) +{ + asyncCall("getLunarMonthCalendar", QVariant(year), QVariant(month), QVariant(fill)); +} + +void DbusHuangLiRequest::slotCallFinished(CDBusPendingCallWatcher *call) +{ + if (call->isError()) { + qWarning() << call->reply().member() << call->error().message(); + return; + } + + if (call->getmember() == "getFestivalMonth") { + QDBusPendingReply reply = *call; + QString str = reply.argumentAt<0>(); + } + call->deleteLater(); +} diff -Nru dde-calendar-5.9.1/schedule-plugin/src/dbus/dbushuanglirequest.h dde-calendar-5.10.0/schedule-plugin/src/dbus/dbushuanglirequest.h --- dde-calendar-5.9.1/schedule-plugin/src/dbus/dbushuanglirequest.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/dbus/dbushuanglirequest.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,34 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef DBUSHUANGLIREQUEST_H +#define DBUSHUANGLIREQUEST_H + +#include "dbusrequestbase.h" + +//黄历数据请求类 +class DbusHuangLiRequest : public DbusRequestBase +{ + Q_OBJECT +public: + explicit DbusHuangLiRequest(QObject *parent = nullptr); + + //按月获取节假日信息 + void getFestivalMonth(quint32 year, quint32 month); + //按天获取黄历信息 + void getHuangLiDay(quint32 year, quint32 month, quint32 day); + //按月获取黄历信息 + void getHuangLiMonth(quint32 year, quint32 month, bool fill); + //获取农历信息 + void getLunarInfoBySolar(quint32 year, quint32 month, quint32 day); + //获取农历月日程 + void getLunarMonthCalendar(quint32 year, quint32 month, bool fill); + +signals: + +public slots: + void slotCallFinished(CDBusPendingCallWatcher *) override; +}; + +#endif // DBUSHUANGLIREQUEST_H diff -Nru dde-calendar-5.9.1/schedule-plugin/src/dbus/dbusrequestbase.cpp dde-calendar-5.10.0/schedule-plugin/src/dbus/dbusrequestbase.cpp --- dde-calendar-5.9.1/schedule-plugin/src/dbus/dbusrequestbase.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/dbus/dbusrequestbase.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,79 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "dbusrequestbase.h" +#include + +DbusRequestBase::DbusRequestBase(const QString &path, const QString &interface, const QDBusConnection &connection, QObject *parent) + : QDBusAbstractInterface(DBUS_SERVER_NAME, path, interface.toStdString().c_str(), connection, parent) +{ + //关联后端dbus触发信号 + if (!QDBusConnection::sessionBus().connect(this->service(), this->path(), this->interface(), "", this, SLOT(slotDbusCall(QDBusMessage)))) { + qWarning() << "the connection was fail!" + << "path: " << this->path() << "interface: " << this->interface(); + }; +} + +void DbusRequestBase::setCallbackFunc(CallbackFunc func) +{ + m_callbackFunc = func; +} + +/** + * @brief DbusRequestBase::asyncCall + * 异步访问dbus接口 + * @param method dbus方法名 + * @param args 参数 + */ +void DbusRequestBase::asyncCall(const QString &method, const QList &args) +{ + QDBusPendingCall async = QDBusAbstractInterface::asyncCall(method, args); + CDBusPendingCallWatcher *watcher = new CDBusPendingCallWatcher(async, method, this); + //将回调函数放进CallWatcher中,随CallWatcher调用结果返回 + watcher->setCallbackFunc(m_callbackFunc); + //清楚回调函数,防止多方法调用时混淆 + setCallbackFunc(nullptr); + connect(watcher, &CDBusPendingCallWatcher::signalCallFinished, this, &DbusRequestBase::slotCallFinished); +} + +/** + * @brief DbusRequestBase::asyncCall + * 异步访问dbus接口 + * @param method dbus方法名 + * @param args 参数 + */ +void DbusRequestBase::asyncCall(const QString &method, + const QVariant &arg1, const QVariant &arg2, const QVariant &arg3, const QVariant &arg4, + const QVariant &arg5, const QVariant &arg6, const QVariant &arg7, const QVariant &arg8) +{ + asyncCall(method, method, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); +} + +/** + * @brief DbusRequestBase::asyncCall + * 异步访问dbus接口 + * @param method dbus方法名 + * @param args 参数 + */ +void DbusRequestBase::asyncCall(const QString &method, QString callName, + const QVariant &arg1, const QVariant &arg2, const QVariant &arg3, const QVariant &arg4, + const QVariant &arg5, const QVariant &arg6, const QVariant &arg7, const QVariant &arg8) +{ + QDBusPendingCall async = QDBusAbstractInterface::asyncCall(method, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); + CDBusPendingCallWatcher *watcher = new CDBusPendingCallWatcher(async, callName, this); + //将回调函数放进CallWatcher中,随CallWatcher调用结果返回 + watcher->setCallbackFunc(m_callbackFunc); + //清楚回调函数,防止多方法调用时混淆 + setCallbackFunc(nullptr); + connect(watcher, &CDBusPendingCallWatcher::signalCallFinished, this, &DbusRequestBase::slotCallFinished); +} + +/** + * @brief slotDbusCall + * dbus服务端调用 + * @param msg 调用消息 + */ +void DbusRequestBase::slotDbusCall(const QDBusMessage &msg) +{ +} diff -Nru dde-calendar-5.9.1/schedule-plugin/src/dbus/dbusrequestbase.h dde-calendar-5.10.0/schedule-plugin/src/dbus/dbusrequestbase.h --- dde-calendar-5.9.1/schedule-plugin/src/dbus/dbusrequestbase.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/dbus/dbusrequestbase.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,60 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef DBUSREQUESTBASE_H +#define DBUSREQUESTBASE_H + +#include "cdbuspendingcallwatcher.h" +#include +#include + +#define DBUS_SERVER_NAME "com.deepin.dataserver.Calendar" + +//继承QDbus接口类,包装自定义接口访问 +class DbusRequestBase : public QDBusAbstractInterface +{ + Q_OBJECT +public: + explicit DbusRequestBase(const QString &path, const QString &interface, + const QDBusConnection &connection = QDBusConnection::sessionBus(), + QObject *parent = nullptr); + + //设置回调函数 + void setCallbackFunc(CallbackFunc func); + +signals: + +public slots: + //dbus服务端调用 + virtual void slotDbusCall(const QDBusMessage &msg); + //dbus调用完成事件 + virtual void slotCallFinished(CDBusPendingCallWatcher *) = 0; + +protected: + //异步调用,包装异步调用事件 + void asyncCall(const QString &method, const QList &args); + void asyncCall(const QString &method, + const QVariant &arg1 = QVariant(), + const QVariant &arg2 = QVariant(), + const QVariant &arg3 = QVariant(), + const QVariant &arg4 = QVariant(), + const QVariant &arg5 = QVariant(), + const QVariant &arg6 = QVariant(), + const QVariant &arg7 = QVariant(), + const QVariant &arg8 = QVariant()); + void asyncCall(const QString &method, QString callName, + const QVariant &arg1 = QVariant(), + const QVariant &arg2 = QVariant(), + const QVariant &arg3 = QVariant(), + const QVariant &arg4 = QVariant(), + const QVariant &arg5 = QVariant(), + const QVariant &arg6 = QVariant(), + const QVariant &arg7 = QVariant(), + const QVariant &arg8 = QVariant()); + +private: + CallbackFunc m_callbackFunc = nullptr; //回调函数 +}; + +#endif // DBUSREQUESTBASE_H diff -Nru dde-calendar-5.9.1/schedule-plugin/src/dbus/schedulesdbus.cpp dde-calendar-5.10.0/schedule-plugin/src/dbus/schedulesdbus.cpp --- dde-calendar-5.9.1/schedule-plugin/src/dbus/schedulesdbus.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/dbus/schedulesdbus.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,666 +0,0 @@ -/* - * Copyright (C) 2015 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: kirigaya - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/* - * This file was generated by qdbusxml2cpp version 0.8 - * Command line was: qdbusxml2cpp -c DCalendarDBus -p dcalendardbus com.deepin.dataserver.Calendar.xml - * - * qdbusxml2cpp is Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies). - * - * This is an auto-generated file. - * This file may have been hand-edited. Look for HAND-EDIT comments - * before re-generating it. - */ - -#include "schedulesdbus.h" -#include -#include -#include -/* - * Implementation of interface class DCalendarDBus - */ - -CSchedulesDBus::CSchedulesDBus(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent) - : QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent) -{ - QDBusConnection::sessionBus().connect(this->service(), this->path(), "org.freedesktop.DBus.Properties", "PropertiesChanged", "sa{sv}as", this, SLOT(__propertyChanged__(QDBusMessage))); -} - -CSchedulesDBus::~CSchedulesDBus() -{ - QDBusConnection::sessionBus().disconnect(service(), path(), "org.freedesktop.DBus.Properties", "PropertiesChanged", "sa{sv}as", this, SLOT(propertyChanged(QDBusMessage))); -} - -QString CSchedulesDBus::createScheduleDtailInfojson(const ScheduleDtailInfo &info) -{ - QJsonObject json; - json.insert("ID", info.id); - json.insert("AllDay", info.allday); - json.insert("Remind", createScheduleRemind(info)); - json.insert("RRule", createScheduleRRule(info)); - json.insert("Title", info.titleName); - json.insert("Description", info.description); - json.insert("Type", info.type.ID); - json.insert("Start", toconvertData(info.beginDateTime)); - json.insert("End", toconvertData(info.endDateTime)); - //json.insert("Start", "2006-01-02T15:04:05+07:00"); - //json.insert("End", "2006-01-02T17:04:05+07:00"); - json.insert("RecurID", info.RecurID); - QJsonArray jsonarry; - for (int i = 0; i < info.ignore.count(); i++) { - jsonarry.append(toconvertData(info.ignore.at(i))); - } - json.insert("Ignore", jsonarry); - // 构建 JSON 文档 - QJsonDocument document; - document.setObject(json); - QByteArray byteArray = document.toJson(QJsonDocument::Compact); - QString strJson(byteArray); - return strJson; -} - -QString CSchedulesDBus::createScheduleTypejson(const ScheduleType &info) -{ - QJsonObject json; - json.insert("ID", info.ID); - json.insert("Name", info.typeName); - QString colorName = QString("#%1%2%3").arg(info.color.red(), 2, 16, QChar('0')).arg(info.color.green(), 2, 16, QChar('0')).arg(info.color.blue(), 2, 16, QChar('0')); - json.insert("Color", info.color.name()); - // 构建 JSON 文档 - QJsonDocument document; - document.setObject(json); - QByteArray byteArray = document.toJson(QJsonDocument::Compact); - QString strJson(byteArray); - return strJson; -} - -ScheduleType CSchedulesDBus::parsingScheduleTypejson(QJsonObject &object) -{ - ScheduleType type; - QJsonObject &rootObj = object; - - //因为是预先定义好的JSON数据格式,所以这里可以这样读取 - if (rootObj.contains("ID")) { - type.ID = rootObj.value("ID").toInt(); - } - if (rootObj.contains("Name")) { - type.typeName = rootObj.value("Name").toString(); - } - if (rootObj.contains("Color")) { - QString str = rootObj.value("Color").toString(); - type.color = QColor(rootObj.value("Color").toString()); - } - return type; -} - -ScheduleDtailInfo CSchedulesDBus::parsingScheduleDtailInfojsonID(QJsonObject &obj) -{ - ScheduleDtailInfo info; - - QJsonObject &rootObj = obj; - //因为是预先定义好的JSON数据格式,所以这里可以这样读取 - if (rootObj.contains("ID")) { - info.id = rootObj.value("ID").toInt(); - } - if (rootObj.contains("AllDay")) { - info.allday = rootObj.value("AllDay").toBool(); - } - if (rootObj.contains("Remind")) { - parsingScheduleRemind(rootObj.value("Remind").toString(), info); - } - if (rootObj.contains("Title")) { - info.titleName = rootObj.value("Title").toString(); - } - if (rootObj.contains("Description")) { - info.description = rootObj.value("Description").toString(); - } - if (rootObj.contains("Type")) { - GetType(rootObj.value("Type").toInt(), info.type); - } - if (rootObj.contains("Start")) { - info.beginDateTime = fromconvertData(rootObj.value("Start").toString()); - } - if (rootObj.contains("End")) { - info.endDateTime = fromconvertData(rootObj.value("End").toString()); - } - if (rootObj.contains("RecurID")) { - info.RecurID = rootObj.value("RecurID").toInt(); - } - if (rootObj.contains("RRule")) { - parsingScheduleRRule(rootObj.value("RRule").toString(), info); - } - if (rootObj.contains("Ignore")) { - QJsonArray subArray = rootObj.value("Ignore").toArray(); - for (int i = 0; i < subArray.size(); i++) { - QString subObj = subArray.at(i).toString(); - info.ignore.append(fromconvertData(subObj)); - } - } - return info; -} - -QString CSchedulesDBus::createScheduleRRule(const ScheduleDtailInfo &info) -{ - if (info.rpeat == 0) - return QString(); - // QString str = "'"; - QString str; - switch (info.rpeat) { - case 1: { - str += "FREQ=DAILY"; - } break; - case 2: { - str += "FREQ=DAILY;BYDAY=MO,TU,WE,TH,FR"; - } break; - case 3: { - str += "FREQ=WEEKLY"; - } break; - case 4: { - str += "FREQ=MONTHLY"; - } break; - case 5: { - str += "FREQ=YEARLY"; - } break; - } - switch (info.enddata.type) { - case 1: { - str += QString(";COUNT=%1").arg(info.enddata.tcount + 1); - } break; - case 2: { - QDateTime datetime = info.enddata.date; - //datetime.setDate(datetime); - str += ";UNTIL=" + datetime.toString("yyyyMMddThhmmss") + "Z"; - // str += ";UNTIL=" + toconvertData(datetime); - } break; - } - //str += "'"; - return str; -} - -void CSchedulesDBus::parsingScheduleRRule(QString str, ScheduleDtailInfo &info) -{ - if (str.isEmpty()) { - info.rpeat = 0; - return; - } - QString rrulestrs = str; - QStringList rruleslist = rrulestrs.split(";", QString::SkipEmptyParts); - if (rruleslist.count() > 0) { - if (rruleslist.contains("FREQ=DAILY") && rruleslist.contains("BYDAY=MO,TU,WE,TH,FR")) - info.rpeat = 2; - else if (rruleslist.contains("FREQ=DAILY")) { - info.rpeat = 1; - } else if (rruleslist.contains("FREQ=WEEKLY")) { - info.rpeat = 3; - } else if (rruleslist.contains("FREQ=MONTHLY")) { - info.rpeat = 4; - } else if (rruleslist.contains("FREQ=YEARLY")) { - info.rpeat = 5; - } - info.enddata.type = 0; - for (int i = 0; i < rruleslist.count(); i++) { - if (rruleslist.at(i).contains("COUNT=")) { - QStringList liststr = rruleslist.at(i).split("=", QString::SkipEmptyParts); - info.enddata.type = 1; - info.enddata.tcount = liststr.at(1).toInt() - 1; - } - - if (rruleslist.at(i).contains("UNTIL=")) { - QStringList liststr = rruleslist.at(i).split("=", QString::SkipEmptyParts); - info.enddata.type = 2; - info.enddata.date = QDateTime::fromString(liststr.at(1).left(liststr.at(1).count() - 1), "yyyyMMddThhmmss"); - //info.enddata.date = fromconvertData(liststr.at(1)); - info.enddata.date = info.enddata.date; - } - } - } -} - -QString CSchedulesDBus::createScheduleRemind(const ScheduleDtailInfo &info) -{ - if (!info.remind) - return QString(); - QString str; - if (info.allday) { - str = QString::number(info.remindData.n) + ";" + info.remindData.time.toString("hh:mm"); - } else { - str = QString::number(info.remindData.n); - } - return str; -} - -void CSchedulesDBus::parsingScheduleRemind(QString str, ScheduleDtailInfo &info) -{ - if (str.isEmpty()) { - info.remind = false; - return; - } - info.remind = true; - if (info.allday) { - QStringList liststr = str.split(";", QString::SkipEmptyParts); - info.remindData.n = liststr.at(0).toInt(); - info.remindData.time = QTime::fromString(liststr.at(1), "hh:mm"); - } else { - info.remindData.n = str.toInt(); - } -} - -QString CSchedulesDBus::toconvertData(QDateTime date) -{ - QDateTime datetimeutc = QDateTime::fromTime_t(0); - QString str = date.toString("yyyy-MM-ddThh:mm:ss") + "+" + datetimeutc.toString("hh:mm"); - //QString str = date.toString("yyyy-MM-ddThh:mm:ss") + "Z07:00"; - return str; -} - -QDateTime CSchedulesDBus::fromconvertData(QString str) -{ - QStringList liststr = str.split("+", QString::SkipEmptyParts); - return QDateTime::fromString(liststr.at(0), "yyyy-MM-ddThh:mm:ss"); -} - -QString CSchedulesDBus::toconvertIGData(QDateTime date) -{ - QDateTime datetimeutc = QDateTime::fromTime_t(0); - QString str = date.toString("yyyy-MM-ddThh:mm:ss") + "Z" + datetimeutc.toString("hh:mm"); - //QString str = date.toString("yyyy-MM-ddThh:mm:ss") + "Z07:00"; - return str; -} - -QDateTime CSchedulesDBus::fromconvertiIGData(QString str) -{ - QStringList liststr = str.split("Z", QString::SkipEmptyParts); - return QDateTime::fromString(liststr.at(0), "yyyy-MM-ddThh:mm:ss"); -} - -qint64 CSchedulesDBus::CreateJob(const ScheduleDtailInfo &info) -{ - QList argumentList; - argumentList << QVariant::fromValue(createScheduleDtailInfojson(info)); - QDBusMessage reply = callWithArgumentList(QDBus::Block, QStringLiteral("CreateJob"), argumentList); - if (reply.type() != QDBusMessage::ReplyMessage) { - qDebug() << reply; - return -1; - } - QDBusReply id = reply; - - return id.value(); -} - -bool CSchedulesDBus::GetJobs(int startYear, int startMonth, int startDay, int endYear, int endMonth, int endDay, QVector &out) -{ - QList argumentList; - argumentList << QVariant::fromValue(startYear) << QVariant::fromValue(startMonth) << QVariant::fromValue(startDay); - argumentList << QVariant::fromValue(endYear) << QVariant::fromValue(endMonth) << QVariant::fromValue(endDay); - QDBusMessage reply = callWithArgumentList(QDBus::Block, QStringLiteral("GetJobs"), argumentList); - if (reply.type() != QDBusMessage::ReplyMessage) { - return false; - } - QDBusReply jobs = reply; - - if (!jobs.isValid()) - return false; - QJsonParseError json_error; - QJsonDocument jsonDoc(QJsonDocument::fromJson(jobs.value().toLocal8Bit(), &json_error)); - - if (json_error.error != QJsonParseError::NoError) { - return false; - } - - QJsonArray rootarry = jsonDoc.array(); - for (int i = 0; i < rootarry.size(); i++) { - QJsonObject subObj = rootarry.at(i).toObject(); - - ScheduleDateRangeInfo info; - //因为是预先定义好的JSON数据格式,所以这里可以这样读取 - if (subObj.contains("Date")) { - info.date = QDate::fromString(subObj.value("Date").toString(), "yyyy-MM-dd"); - } - if (subObj.contains("Jobs")) { - QJsonArray subarry = subObj.value("Jobs").toArray(); - for (int j = 0; j < subarry.size(); j++) { - QJsonObject ssubObj = subarry.at(j).toObject(); - info.vData.append(parsingScheduleDtailInfojsonID(ssubObj)); - } - } - out.append(info); - } - - return true; -} - -bool CSchedulesDBus::GetJob(qint64 jobId, ScheduleDtailInfo &out) -{ - QList argumentList; - argumentList << QVariant::fromValue(jobId); - QDBusMessage reply = callWithArgumentList(QDBus::Block, QStringLiteral("GetJob"), argumentList); - if (reply.type() != QDBusMessage::ReplyMessage) { - return false; - } - QDBusReply jobs = reply; - - if (!jobs.isValid()) - return false; - QJsonParseError json_error; - QJsonDocument jsonDoc(QJsonDocument::fromJson(jobs.value().toLocal8Bit(), &json_error)); - - if (json_error.error != QJsonParseError::NoError) { - return false; - } - - QJsonObject ssubObj = jsonDoc.object(); - out = parsingScheduleDtailInfojsonID(ssubObj); - - return true; -} - -bool CSchedulesDBus::UpdateJob(const ScheduleDtailInfo &info) -{ - QList argumentList; - argumentList << QVariant::fromValue(createScheduleDtailInfojson(info)); - QDBusMessage reply = callWithArgumentList(QDBus::Block, QStringLiteral("UpdateJob"), argumentList); - if (reply.type() != QDBusMessage::ReplyMessage) { - //dbus UpdateJob 错误提醒 - qDebug() << "UpdateJob Err"; - qDebug() << argumentList; - return false; - } - //QDBusReply jobs = reply; - - //if (!jobs.isValid()) return false; - - return true; -} - -bool CSchedulesDBus::DeleteJob(qint64 jobId) -{ - QList argumentList; - argumentList << QVariant::fromValue(jobId); - QDBusMessage reply = callWithArgumentList(QDBus::Block, QStringLiteral("DeleteJob"), argumentList); - if (reply.type() != QDBusMessage::ReplyMessage) { - return false; - } - - return true; -} - -bool CSchedulesDBus::QueryJobs(QString key, QDateTime starttime, QDateTime endtime, QVector &out) -{ - QJsonObject qjson; - qjson.insert("Key", key); - qjson.insert("Start", toconvertData(starttime)); - qjson.insert("End", toconvertData(endtime)); - // 构建 JSON 文档 - QJsonDocument qdocument; - qdocument.setObject(qjson); - QByteArray qbyteArray = qdocument.toJson(QJsonDocument::Compact); - QString strJson(qbyteArray); - - QList argumentList; - argumentList << QVariant::fromValue(strJson); - QDBusMessage reply = callWithArgumentList(QDBus::Block, QStringLiteral("QueryJobs"), argumentList); - if (reply.type() != QDBusMessage::ReplyMessage) { - return false; - } - QDBusReply jobs = reply; - - if (!jobs.isValid()) - return false; - QJsonParseError json_error; - QJsonDocument jsonDoc(QJsonDocument::fromJson(jobs.value().toLocal8Bit(), &json_error)); - - if (json_error.error != QJsonParseError::NoError) { - return false; - } - - QJsonArray rootarry = jsonDoc.array(); - for (int i = 0; i < rootarry.size(); i++) { - QJsonObject subObj = rootarry.at(i).toObject(); - - ScheduleDateRangeInfo info; - //因为是预先定义好的JSON数据格式,所以这里可以这样读取 - if (subObj.contains("Date")) { - info.date = QDate::fromString(subObj.value("Date").toString(), "yyyy-MM-dd"); - } - if (subObj.contains("Jobs")) { - QJsonArray subarry = subObj.value("Jobs").toArray(); - for (int j = 0; j < subarry.size(); j++) { - QJsonObject ssubObj = subarry.at(j).toObject(); - info.vData.append(parsingScheduleDtailInfojsonID(ssubObj)); - } - } - out.append(info); - } - return true; -} - -bool CSchedulesDBus::QueryJobs(QString key, QDateTime starttime, QDateTime endtime, QString &out) -{ - QJsonObject qjson; - qjson.insert("Key", key); - qjson.insert("Start", toconvertData(starttime)); - qjson.insert("End", toconvertData(endtime)); - // 构建 JSON 文档 - QJsonDocument qdocument; - qdocument.setObject(qjson); - QByteArray qbyteArray = qdocument.toJson(QJsonDocument::Compact); - QString strJson(qbyteArray); - - QList argumentList; - argumentList << QVariant::fromValue(strJson); - QDBusMessage reply = callWithArgumentList(QDBus::Block, QStringLiteral("QueryJobs"), argumentList); - if (reply.type() != QDBusMessage::ReplyMessage) { - return false; - } - QDBusReply jobs = reply; - - if (!jobs.isValid()) - return false; - out = jobs.value().toLocal8Bit(); - return true; -} - -bool CSchedulesDBus::QueryJobsWithLimit(QDateTime starttime, QDateTime endtime, qint32 maxNum, QVector &out) -{ - QJsonObject qjson; - qjson.insert("Start", toconvertData(starttime)); - qjson.insert("End", toconvertData(endtime)); - qjson.insert("key", ""); - // 构建 JSON 文档 - QJsonDocument qdocument; - qdocument.setObject(qjson); - QByteArray qbyteArray = qdocument.toJson(QJsonDocument::Compact); - QString strJson(qbyteArray); - - QList argumentList; - argumentList << QVariant::fromValue(strJson); - argumentList << maxNum; - QDBusMessage reply = callWithArgumentList(QDBus::Block, QStringLiteral("QueryJobsWithLimit"), argumentList); - if (reply.type() != QDBusMessage::ReplyMessage) { - return false; - } - QDBusReply jobs = reply; - - if (!jobs.isValid()) - return false; - QJsonParseError json_error; - QJsonDocument jsonDoc(QJsonDocument::fromJson(jobs.value().toLocal8Bit(), &json_error)); - - if (json_error.error != QJsonParseError::NoError) { - return false; - } - - QJsonArray rootarry = jsonDoc.array(); - for (int i = 0; i < rootarry.size(); i++) { - QJsonObject subObj = rootarry.at(i).toObject(); - - ScheduleDateRangeInfo info; - //因为是预先定义好的JSON数据格式,所以这里可以这样读取 - if (subObj.contains("Date")) { - info.date = QDate::fromString(subObj.value("Date").toString(), "yyyy-MM-dd"); - } - if (subObj.contains("Jobs")) { - QJsonArray subarry = subObj.value("Jobs").toArray(); - for (int j = 0; j < subarry.size(); j++) { - QJsonObject ssubObj = subarry.at(j).toObject(); - info.vData.append(parsingScheduleDtailInfojsonID(ssubObj)); - } - } - out.append(info); - } - return true; -} - -bool CSchedulesDBus::QueryJobsWithRule(QDateTime starttime, QDateTime endtime, const QString &rule, QVector &out) -{ - - QJsonObject qjson; - qjson.insert("Start", toconvertData(starttime)); - qjson.insert("End", toconvertData(endtime)); - qjson.insert("key", ""); - // 构建 JSON 文档 - QJsonDocument qdocument; - qdocument.setObject(qjson); - QByteArray qbyteArray = qdocument.toJson(QJsonDocument::Compact); - QString strJson(qbyteArray); - - QList argumentList; - argumentList << QVariant::fromValue(strJson); - argumentList << rule; - QDBusMessage reply = callWithArgumentList(QDBus::Block, QStringLiteral("QueryJobsWithRule"), argumentList); - if (reply.type() != QDBusMessage::ReplyMessage) { - return false; - } - QDBusReply jobs = reply; - - if (!jobs.isValid()) - return false; - QJsonParseError json_error; - QJsonDocument jsonDoc(QJsonDocument::fromJson(jobs.value().toLocal8Bit(), &json_error)); - - if (json_error.error != QJsonParseError::NoError) { - return false; - } - - QJsonArray rootarry = jsonDoc.array(); - for (int i = 0; i < rootarry.size(); i++) { - QJsonObject subObj = rootarry.at(i).toObject(); - - ScheduleDateRangeInfo info; - //因为是预先定义好的JSON数据格式,所以这里可以这样读取 - if (subObj.contains("Date")) { - info.date = QDate::fromString(subObj.value("Date").toString(), "yyyy-MM-dd"); - } - if (subObj.contains("Jobs")) { - QJsonArray subarry = subObj.value("Jobs").toArray(); - for (int j = 0; j < subarry.size(); j++) { - QJsonObject ssubObj = subarry.at(j).toObject(); - info.vData.append(parsingScheduleDtailInfojsonID(ssubObj)); - } - } - out.append(info); - } - return true; -} - -bool CSchedulesDBus::GetTypes(QVector &out) -{ - QList argumentList; - //argumentList << QVariant::fromValue(jobId); - QDBusMessage reply = callWithArgumentList(QDBus::Block, QStringLiteral("GetTypes"), argumentList); - if (reply.type() != QDBusMessage::ReplyMessage) { - return false; - } - QDBusReply jobs = reply; - - if (!jobs.isValid()) - return false; - QJsonParseError json_error; - QJsonDocument jsonDoc(QJsonDocument::fromJson(jobs.value().toLocal8Bit(), &json_error)); - - if (json_error.error != QJsonParseError::NoError) { - return false; - } - - QJsonArray rootarry = jsonDoc.array(); - for (int i = 0; i < rootarry.size(); i++) { - QJsonObject subObj = rootarry.at(i).toObject(); - out.append(parsingScheduleTypejson(subObj)); - } - return true; -} - -bool CSchedulesDBus::GetType(qint64 jobId, ScheduleType &out) -{ - QList argumentList; - argumentList << QVariant::fromValue(jobId); - QDBusMessage reply = callWithArgumentList(QDBus::Block, QStringLiteral("GetType"), argumentList); - if (reply.type() != QDBusMessage::ReplyMessage) { - return false; - } - QDBusReply jobs = reply; - - if (!jobs.isValid()) - return false; - QJsonParseError json_error; - QJsonDocument jsonDoc(QJsonDocument::fromJson(jobs.value().toLocal8Bit(), &json_error)); - - if (json_error.error != QJsonParseError::NoError) { - return false; - } - - QJsonObject subObj = jsonDoc.object(); - out = parsingScheduleTypejson(subObj); - return true; -} - -qint64 CSchedulesDBus::CreateType(const ScheduleType &info) -{ - QList argumentList; - argumentList << QVariant::fromValue(createScheduleTypejson(info)); - QDBusMessage reply = callWithArgumentList(QDBus::Block, QStringLiteral("CreateType"), argumentList); - if (reply.type() != QDBusMessage::ReplyMessage) { - return -1; - } - QDBusReply id = reply; - - return id.value(); -} - -bool CSchedulesDBus::DeleteType(qint64 jobId) -{ - QList argumentList; - argumentList << QVariant::fromValue(jobId); - QDBusMessage reply = callWithArgumentList(QDBus::Block, QStringLiteral("DeleteType"), argumentList); - if (reply.type() != QDBusMessage::ReplyMessage) { - return false; - } - return true; -} - -bool CSchedulesDBus::UpdateType(const ScheduleType &info) -{ - QList argumentList; - argumentList << QVariant::fromValue(createScheduleTypejson(info)); - QDBusMessage reply = callWithArgumentList(QDBus::Block, QStringLiteral("UpdateType"), argumentList); - if (reply.type() != QDBusMessage::ReplyMessage) { - return false; - } - return true; -} diff -Nru dde-calendar-5.9.1/schedule-plugin/src/dbus/schedulesdbus.h dde-calendar-5.10.0/schedule-plugin/src/dbus/schedulesdbus.h --- dde-calendar-5.9.1/schedule-plugin/src/dbus/schedulesdbus.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/dbus/schedulesdbus.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,121 +0,0 @@ -/* - * Copyright (C) 2015 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: kirigaya - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/* - * This file was generated by qdbusxml2cpp version 0.8 - * Command line was: qdbusxml2cpp -c DCalendarDBus -p dcalendardbus com.deepin.dataserver.Calendar.xml - * - * qdbusxml2cpp is Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies). - * - * This is an auto-generated file. - * Do not edit! All changes made to it will be lost. - */ - -#ifndef SCHEDULESDBUS_H -#define SCHEDULESDBUS_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "../data/schedulestructs.h" - -/* - * Proxy class for interface com.deepin.dataserver.Calendar - */ -class CSchedulesDBus : public QDBusAbstractInterface -{ - Q_OBJECT - - Q_SLOT void __propertyChanged__(const QDBusMessage &msg) - { - QList arguments = msg.arguments(); - if (3 != arguments.count()) - return; - QString interfaceName = msg.arguments().at(0).toString(); - if (interfaceName != "com.deepin.dataserver.Calendar") - return; - QVariantMap changedProps = qdbus_cast(arguments.at(1).value()); - foreach (const QString &prop, changedProps.keys()) { - const QMetaObject *self = metaObject(); - for (int i = self->propertyOffset(); i < self->propertyCount(); ++i) { - QMetaProperty p = self->property(i); - if (p.name() == prop) { - Q_EMIT p.notifySignal().invoke(this); - } - } - } - } - -public: - static inline const char *staticInterfaceName() - { - return "com.deepin.dataserver.Calendar"; - } - -public: - CSchedulesDBus(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = nullptr); - - ~CSchedulesDBus(); - QString toconvertIGData(QDateTime date); - QDateTime fromconvertiIGData(QString str); - static QString createScheduleDtailInfojson(const ScheduleDtailInfo &info); - ScheduleDtailInfo parsingScheduleDtailInfojsonID(QJsonObject &obj); - -private: - QString createScheduleTypejson(const ScheduleType &info); - ScheduleType parsingScheduleTypejson(QJsonObject &object); - - static QString createScheduleRRule(const ScheduleDtailInfo &info); - void parsingScheduleRRule(QString str, ScheduleDtailInfo &info); - static QString createScheduleRemind(const ScheduleDtailInfo &info); - void parsingScheduleRemind(QString str, ScheduleDtailInfo &info); - static QString toconvertData(QDateTime date); - QDateTime fromconvertData(QString str); -public Q_SLOTS: // METHODS - - qint64 CreateJob(const ScheduleDtailInfo &info); - bool GetJobs(int startYear, int startMonth, int startDay, int endYear, int endMonth, int endDay, QVector &out); - bool GetJob(qint64 jobId, ScheduleDtailInfo &out); - bool UpdateJob(const ScheduleDtailInfo &info); - bool DeleteJob(qint64 jobId); - bool QueryJobs(QString key, QDateTime starttime, QDateTime endtime, QVector &out); - bool QueryJobs(QString key, QDateTime starttime, QDateTime endtime, QString &out); - bool QueryJobsWithLimit(QDateTime starttime, QDateTime endtime, qint32 maxNum, QVector &out); - bool QueryJobsWithRule(QDateTime starttime, QDateTime endtime, const QString &rule, QVector &out); - - bool GetTypes(QVector &out); - bool GetType(qint64 jobId, ScheduleType &out); - qint64 CreateType(const ScheduleType &info); - bool DeleteType(qint64 jobId); - bool UpdateType(const ScheduleType &info); - -Q_SIGNALS: // SIGNALS - // begin property changed signals -}; -#endif diff -Nru dde-calendar-5.9.1/schedule-plugin/src/globaldef.h dde-calendar-5.10.0/schedule-plugin/src/globaldef.h --- dde-calendar-5.9.1/schedule-plugin/src/globaldef.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/globaldef.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef GLOBALDEF_H #define GLOBALDEF_H @@ -124,7 +108,7 @@ //没有日程提醒回复语 #define NO_SCHEDULE_TTS "您还没有日程提醒。" //删除重复日程询问回复语 -#define REPEST_SCHEDULE_CANCEL_TTS "该日程是循环的日程,请问是删除当前日程还是所有日程?" +#define REPEST_SCHEDULE_CANCEL_TTS "该日程是循环的日程,请问是仅删除此日程还是删除全部?" //删除普通日程询问回复语 #define CONFIRM_SCHEDULE_CANCEL_TTS "我要帮您取消这个日程吗?操作后将在日历中同步删除。" //删除选择日程回复语 diff -Nru dde-calendar-5.9.1/schedule-plugin/src/interface/reply.h dde-calendar-5.10.0/schedule-plugin/src/interface/reply.h --- dde-calendar-5.9.1/schedule-plugin/src/interface/reply.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/interface/reply.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef REPLY_H #define REPLY_H diff -Nru dde-calendar-5.9.1/schedule-plugin/src/interface/service.h dde-calendar-5.10.0/schedule-plugin/src/interface/service.h --- dde-calendar-5.9.1/schedule-plugin/src/interface/service.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/interface/service.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef SERVICE_H #define SERVICE_H #include diff -Nru dde-calendar-5.9.1/schedule-plugin/src/interface/systemsemanticplugin.h dde-calendar-5.10.0/schedule-plugin/src/interface/systemsemanticplugin.h --- dde-calendar-5.9.1/schedule-plugin/src/interface/systemsemanticplugin.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/interface/systemsemanticplugin.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef SYSTEM_SEMANTIC_PLUGIN_H #define SYSTEM_SEMANTIC_PLUGIN_H #include diff -Nru dde-calendar-5.9.1/schedule-plugin/src/scheduleplugin.cpp dde-calendar-5.10.0/schedule-plugin/src/scheduleplugin.cpp --- dde-calendar-5.9.1/schedule-plugin/src/scheduleplugin.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/scheduleplugin.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "scheduleplugin.h" #include "scheduleservice.h" diff -Nru dde-calendar-5.9.1/schedule-plugin/src/scheduleplugin.h dde-calendar-5.10.0/schedule-plugin/src/scheduleplugin.h --- dde-calendar-5.9.1/schedule-plugin/src/scheduleplugin.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/scheduleplugin.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef SCHEDULEPLUGIN_H #define SCHEDULEPLUGIN_H diff -Nru dde-calendar-5.9.1/schedule-plugin/src/scheduleservice.cpp dde-calendar-5.10.0/schedule-plugin/src/scheduleservice.cpp --- dde-calendar-5.9.1/schedule-plugin/src/scheduleservice.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/scheduleservice.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "scheduleservice.h" #include "globaldef.h" diff -Nru dde-calendar-5.9.1/schedule-plugin/src/scheduleservice.h dde-calendar-5.10.0/schedule-plugin/src/scheduleservice.h --- dde-calendar-5.9.1/schedule-plugin/src/scheduleservice.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/scheduleservice.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef SCHEDULESERVICE_H #define SCHEDULESERVICE_H diff -Nru dde-calendar-5.9.1/schedule-plugin/src/state/confirwfeedbackstate.cpp dde-calendar-5.10.0/schedule-plugin/src/state/confirwfeedbackstate.cpp --- dde-calendar-5.9.1/schedule-plugin/src/state/confirwfeedbackstate.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/state/confirwfeedbackstate.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "confirwfeedbackstate.h" #include "../globaldef.h" @@ -25,8 +9,8 @@ #include "../data/clocaldata.h" #include "../data/changejsondata.h" -confirwFeedbackState::confirwFeedbackState(CSchedulesDBus *dbus, scheduleBaseTask *task) - : scheduleState(dbus, task) +confirwFeedbackState::confirwFeedbackState(scheduleBaseTask *task) + : scheduleState(task) { } @@ -44,7 +28,7 @@ || jsonData->offset() > 0) { return Fileter_Err; } - Filter_Flag result = changeDateErrJudge(jsonData,Fileter_Init); + Filter_Flag result = changeDateErrJudge(jsonData, Fileter_Init); return result; } diff -Nru dde-calendar-5.9.1/schedule-plugin/src/state/confirwfeedbackstate.h dde-calendar-5.10.0/schedule-plugin/src/state/confirwfeedbackstate.h --- dde-calendar-5.9.1/schedule-plugin/src/state/confirwfeedbackstate.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/state/confirwfeedbackstate.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef CONFIRWFEEDBACKSTATE_H #define CONFIRWFEEDBACKSTATE_H @@ -26,7 +10,7 @@ class confirwFeedbackState : public scheduleState { public: - confirwFeedbackState(CSchedulesDBus *dbus, scheduleBaseTask *task); + explicit confirwFeedbackState(scheduleBaseTask *task); Reply getReplyByIntent(bool isOK) override; protected: diff -Nru dde-calendar-5.9.1/schedule-plugin/src/state/getchangedatastate.cpp dde-calendar-5.10.0/schedule-plugin/src/state/getchangedatastate.cpp --- dde-calendar-5.9.1/schedule-plugin/src/state/getchangedatastate.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/state/getchangedatastate.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,33 +1,16 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "getchangedatastate.h" #include "../globaldef.h" #include "../data/changejsondata.h" #include "../task/changescheduletask.h" -getChangeDataState::getChangeDataState(CSchedulesDBus *dbus, scheduleBaseTask *task) - :scheduleState(dbus,task) +getChangeDataState::getChangeDataState(scheduleBaseTask *task) + : scheduleState(task) { - } Reply getChangeDataState::getReplyByIntent(bool isOK) @@ -39,37 +22,37 @@ scheduleState::Filter_Flag getChangeDataState::eventFilter(const JsonData *jsonData) { //如果语义包含全部关键字则为修改初始状态 - if (jsonData->getPropertyStatus() == JsonData::ALL - //如果语义包含下一个关键字则为修改初始状态 - || jsonData->getPropertyStatus() == JsonData::NEXT - || jsonData->isVaild() - //如果语义包含时间则为修改初始状态 - || jsonData->getDateTime().suggestDatetime.size()>0 - // 如果语义包含内容则为修改初始状态 - || !jsonData->TitleName().isEmpty() - //如果语义包含重复类型则为修改初始状态 - || jsonData->getRepeatStatus() != JsonData::NONE) { - return Filter_Flag::Fileter_Init; - } - if (jsonData->getPropertyStatus() == JsonData::LAST) - return Fileter_Err; - if (jsonData->offset() > 0) { - return Fileter_Err; - } - //类型转换 - JsonData *queryData = const_cast(jsonData); - changejsondata *mchangeJsonData = dynamic_cast(queryData); - //如果存在form信息则表示一个新的修改 - if(mchangeJsonData->fromDateTime().suggestDatetime.size() > 0){ - return Fileter_Init; - } - //如果存在修改的信息则为正常状态 - if (mchangeJsonData->toDateTime().suggestDatetime.size() > 0 - || !mchangeJsonData->toPlaceStr().isEmpty()) { - return Fileter_Normal; - }else { - return Fileter_Err; - } + if (jsonData->getPropertyStatus() == JsonData::ALL + //如果语义包含下一个关键字则为修改初始状态 + || jsonData->getPropertyStatus() == JsonData::NEXT + || jsonData->isVaild() + //如果语义包含时间则为修改初始状态 + || jsonData->getDateTime().suggestDatetime.size() > 0 + // 如果语义包含内容则为修改初始状态 + || !jsonData->TitleName().isEmpty() + //如果语义包含重复类型则为修改初始状态 + || jsonData->getRepeatStatus() != JsonData::NONE) { + return Filter_Flag::Fileter_Init; + } + if (jsonData->getPropertyStatus() == JsonData::LAST) + return Fileter_Err; + if (jsonData->offset() > 0) { + return Fileter_Err; + } + //类型转换 + JsonData *queryData = const_cast(jsonData); + changejsondata *mchangeJsonData = dynamic_cast(queryData); + //如果存在form信息则表示一个新的修改 + if (mchangeJsonData->fromDateTime().suggestDatetime.size() > 0) { + return Fileter_Init; + } + //如果存在修改的信息则为正常状态 + if (mchangeJsonData->toDateTime().suggestDatetime.size() > 0 + || !mchangeJsonData->toPlaceStr().isEmpty()) { + return Fileter_Normal; + } else { + return Fileter_Err; + } } Reply getChangeDataState::ErrEvent() @@ -86,11 +69,11 @@ JsonData *queryData = const_cast(jsonData); changejsondata *mchangeJsonData = dynamic_cast(queryData); //如果有修改时间的信息则赋值 - if(mchangeJsonData->toDateTime().suggestDatetime.size()>0){ - m_localData->setToTime(mchangeJsonData->toDateTime()); + if (mchangeJsonData->toDateTime().suggestDatetime.size() > 0) { + m_localData->setToTime(mchangeJsonData->toDateTime()); } //如果有修改内容的信息则获取 - if(!mchangeJsonData->toPlaceStr().isEmpty()){ + if (!mchangeJsonData->toPlaceStr().isEmpty()) { m_localData->setToTitleName(mchangeJsonData->toPlaceStr()); } return m_Task->getReplyBySelectSchedule(m_localData->SelectInfo()); diff -Nru dde-calendar-5.9.1/schedule-plugin/src/state/getchangedatastate.h dde-calendar-5.10.0/schedule-plugin/src/state/getchangedatastate.h --- dde-calendar-5.9.1/schedule-plugin/src/state/getchangedatastate.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/state/getchangedatastate.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,34 +1,18 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef GETCHANGEDATASTATE_H #define GETCHANGEDATASTATE_H #include "schedulestate.h" /** - * @brief The getChangeDataState class 获取修改信息状态 + * @brief The getChangeDataState class 获取修改信息状态 */ class getChangeDataState : public scheduleState { public: - getChangeDataState(CSchedulesDBus *dbus, scheduleBaseTask *task); + explicit getChangeDataState(scheduleBaseTask *task); /** * @brief getReplyByIntent 根据意图判断回复 * @param isOK 确认 或 取消 diff -Nru dde-calendar-5.9.1/schedule-plugin/src/state/queryschedulestate.cpp dde-calendar-5.10.0/schedule-plugin/src/state/queryschedulestate.cpp --- dde-calendar-5.9.1/schedule-plugin/src/state/queryschedulestate.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/state/queryschedulestate.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,33 +1,17 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "queryschedulestate.h" #include "../task/queryscheduleproxy.h" #include "../task/schedulebasetask.h" -#include "../data/schedulestructs.h" +#include "dschedule.h" #include "../data/changejsondata.h" #include "../globaldef.h" #include "../data/clocaldata.h" -queryScheduleState::queryScheduleState(CSchedulesDBus *dbus, scheduleBaseTask *task) - : scheduleState(dbus, task) +queryScheduleState::queryScheduleState(scheduleBaseTask *task) + : scheduleState(task) { } @@ -46,17 +30,17 @@ Reply queryScheduleState::normalEvent(const JsonData *jsonData) { - QVector m_scheduleInfo {}; + DSchedule::List m_scheduleInfo {}; JsonData *queryData = const_cast(jsonData); - queryScheduleProxy m_querySchedule(queryData, m_dbus); - m_scheduleInfo = m_querySchedule.querySchedule(); + queryScheduleProxy m_querySchedule(queryData); + m_scheduleInfo = m_querySchedule.scheduleMapToList(m_querySchedule.querySchedule()); if (m_querySchedule.getTimeIsExpired()) { return m_Task->overdueScheduleProcess(); } else { changejsondata *mchangeJsonData = dynamic_cast(queryData); if (mchangeJsonData != nullptr) { - if (m_localData == nullptr) - m_localData = new CLocalData(); + if (m_localData.isNull()) + m_localData = CLocalData::Ptr(new CLocalData()); if (mchangeJsonData->toDateTime().suggestDatetime.size() > 0) { m_localData->setToTime(mchangeJsonData->toDateTime()); } diff -Nru dde-calendar-5.9.1/schedule-plugin/src/state/queryschedulestate.h dde-calendar-5.10.0/schedule-plugin/src/state/queryschedulestate.h --- dde-calendar-5.9.1/schedule-plugin/src/state/queryschedulestate.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/state/queryschedulestate.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,32 +1,17 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef QUERYSCHEDULESTATE_H #define QUERYSCHEDULESTATE_H #include "schedulestate.h" +#include "accountitem.h" class queryScheduleState : public scheduleState { public: - queryScheduleState(CSchedulesDBus *dbus, scheduleBaseTask *task); + explicit queryScheduleState(scheduleBaseTask *task); Reply getReplyByIntent(bool isOK) override; protected: diff -Nru dde-calendar-5.9.1/schedule-plugin/src/state/repeatfeedbackstate.cpp dde-calendar-5.10.0/schedule-plugin/src/state/repeatfeedbackstate.cpp --- dde-calendar-5.9.1/schedule-plugin/src/state/repeatfeedbackstate.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/state/repeatfeedbackstate.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,31 +1,15 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "repeatfeedbackstate.h" #include "../globaldef.h" #include "../task/schedulebasetask.h" #include "../data/clocaldata.h" #include "../data/changejsondata.h" -repeatfeedbackstate::repeatfeedbackstate(CSchedulesDBus *dbus, scheduleBaseTask *task) - : scheduleState(dbus, task) +repeatfeedbackstate::repeatfeedbackstate(scheduleBaseTask *task) + : scheduleState(task) { } @@ -44,11 +28,11 @@ scheduleState::Filter_Flag repeatfeedbackstate::eventFilter(const JsonData *jsonData) { if (jsonData->getPropertyStatus() == JsonData::NEXT - //如果语义包含时间则为修改初始状态 - || jsonData->getDateTime().suggestDatetime.size()>0 - // 如果语义包含内容则为修改初始状态 - || !jsonData->TitleName().isEmpty() - //如果语义包含重复类型则为修改初始状态 + //如果语义包含时间则为修改初始状态 + || jsonData->getDateTime().suggestDatetime.size() > 0 + // 如果语义包含内容则为修改初始状态 + || !jsonData->TitleName().isEmpty() + //如果语义包含重复类型则为修改初始状态 || jsonData->getRepeatStatus() != JsonData::NONE) { return Fileter_Init; } @@ -60,7 +44,7 @@ || jsonData->offset() > 0) { return Fileter_Err; } - Filter_Flag result = changeDateErrJudge(jsonData,Fileter_Init); + Filter_Flag result = changeDateErrJudge(jsonData, Fileter_Init); return result; } diff -Nru dde-calendar-5.9.1/schedule-plugin/src/state/repeatfeedbackstate.h dde-calendar-5.10.0/schedule-plugin/src/state/repeatfeedbackstate.h --- dde-calendar-5.9.1/schedule-plugin/src/state/repeatfeedbackstate.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/state/repeatfeedbackstate.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef REPEATFEEDBACKSTATE_H #define REPEATFEEDBACKSTATE_H #include "schedulestate.h" @@ -25,7 +9,7 @@ class repeatfeedbackstate : public scheduleState { public: - repeatfeedbackstate(CSchedulesDBus *dbus, scheduleBaseTask *task); + explicit repeatfeedbackstate(scheduleBaseTask *task); Reply getReplyByIntent(bool isOK) override; protected: diff -Nru dde-calendar-5.9.1/schedule-plugin/src/state/schedulestate.cpp dde-calendar-5.10.0/schedule-plugin/src/state/schedulestate.cpp --- dde-calendar-5.9.1/schedule-plugin/src/state/schedulestate.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/state/schedulestate.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "schedulestate.h" #include "../task/schedulebasetask.h" @@ -25,16 +9,13 @@ #include "../globaldef.h" #include "../state/queryschedulestate.h" -scheduleState::scheduleState(CSchedulesDBus *dbus, scheduleBaseTask *task) - : m_dbus(dbus) - , m_Task(task) +scheduleState::scheduleState(scheduleBaseTask *task) + : m_Task(task) { } scheduleState::~scheduleState() { - if (m_localData != nullptr) - delete m_localData; } Reply scheduleState::process(const JsonData *jsonData) @@ -42,7 +23,7 @@ Reply reply; //如果时间无效 if (jsonData->getDateTimeInvalid()) { - scheduleState *nextState = new queryScheduleState(m_dbus, m_Task); + scheduleState *nextState = new queryScheduleState(m_Task); setNextState(nextState); REPLY_ONLY_TTS(reply, DATETIME_ERR_TTS, DATETIME_ERR_TTS, true); return reply; @@ -71,21 +52,12 @@ return m_nextState; } -void scheduleState::setLocalData(CLocalData *localData) +void scheduleState::setLocalData(const CLocalData::Ptr &localData) { - if (m_localData == localData) { - return; - } - if (m_localData != nullptr) { - delete m_localData; - m_localData = nullptr; - } - if (localData == nullptr) - return; m_localData = localData; } -CLocalData *scheduleState::getLocalData() const +CLocalData::Ptr scheduleState::getLocalData() const { return m_localData; } diff -Nru dde-calendar-5.9.1/schedule-plugin/src/state/schedulestate.h dde-calendar-5.10.0/schedule-plugin/src/state/schedulestate.h --- dde-calendar-5.9.1/schedule-plugin/src/state/schedulestate.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/state/schedulestate.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef SCHEDULESTATE_H #define SCHEDULESTATE_H @@ -33,16 +17,17 @@ public: enum Filter_Flag { Fileter_Err, Fileter_Normal, - Fileter_Init }; + Fileter_Init + }; public: - scheduleState(CSchedulesDBus *dbus, scheduleBaseTask *task); + scheduleState(scheduleBaseTask *task); virtual ~scheduleState(); Reply process(const JsonData *jsonData); void setNextState(scheduleState *nextState); scheduleState *getNextState() const; - void setLocalData(CLocalData *localData); - CLocalData *getLocalData() const; + void setLocalData(const CLocalData::Ptr &localData); + CLocalData::Ptr getLocalData() const; virtual Reply getReplyByIntent(bool isOK) = 0; protected: @@ -56,12 +41,12 @@ * @param defaultflag 默认返回标志 * @return 过滤标志 */ - Filter_Flag changeDateErrJudge(const JsonData *jsonData,const Filter_Flag &defaultflag); + Filter_Flag changeDateErrJudge(const JsonData *jsonData, const Filter_Flag &defaultflag); + protected: - CSchedulesDBus *m_dbus {nullptr}; scheduleBaseTask *m_Task {nullptr}; scheduleState *m_nextState {nullptr}; - CLocalData *m_localData {nullptr}; + CLocalData::Ptr m_localData {nullptr}; }; #endif // SCHEDULESTATE_H diff -Nru dde-calendar-5.9.1/schedule-plugin/src/state/selectandquerystate.cpp dde-calendar-5.10.0/schedule-plugin/src/state/selectandquerystate.cpp --- dde-calendar-5.9.1/schedule-plugin/src/state/selectandquerystate.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/state/selectandquerystate.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,30 +1,14 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "selectandquerystate.h" #include "../globaldef.h" #include "../task/schedulebasetask.h" #include "../data/changejsondata.h" -SelectAndQueryState::SelectAndQueryState(CSchedulesDBus *dbus, scheduleBaseTask *task) - : scheduleState(dbus, task) +SelectAndQueryState::SelectAndQueryState(scheduleBaseTask *task) + : scheduleState(task) { } @@ -40,14 +24,14 @@ { //如果语义包含全部关键字则为修改初始状态 if (jsonData->getPropertyStatus() == JsonData::ALL - //如果语义包含下一个关键字则为修改初始状态 + //如果语义包含下一个关键字则为修改初始状态 || jsonData->getPropertyStatus() == JsonData::NEXT || jsonData->isVaild() //如果语义包含时间则为修改初始状态 - || jsonData->getDateTime().suggestDatetime.size()>0 - // 如果语义包含内容则为修改初始状态 - || !jsonData->TitleName().isEmpty() - //如果语义包含重复类型则为修改初始状态 + || jsonData->getDateTime().suggestDatetime.size() > 0 + // 如果语义包含内容则为修改初始状态 + || !jsonData->TitleName().isEmpty() + //如果语义包含重复类型则为修改初始状态 || jsonData->getRepeatStatus() != JsonData::NONE) { return Filter_Flag::Fileter_Init; } @@ -85,30 +69,30 @@ //获取第N个日程 if (jsonData->getPropertyStatus() == JsonData::LAST) { offset = showcount; - }else { + } else { offset = jsonData->offset(); } - if(offset > 0){ + if (offset > 0) { m_localData->setOffset(offset); m_localData->setSelectInfo(m_localData->scheduleInfoVector().at(offset - 1)); - ScheduleDtailInfo info = m_localData->SelectInfo(); + DSchedule::Ptr info = m_localData->SelectInfo(); //如果语义为“第xx个修改到xxx”,添加对修改信息的获取 //类型转换 JsonData *queryData = const_cast(jsonData); changejsondata *mchangeJsonData = dynamic_cast(queryData); //如果有修改时间的信息则赋值 - if(mchangeJsonData->toDateTime().suggestDatetime.size()>0){ + if (mchangeJsonData->toDateTime().suggestDatetime.size() > 0) { m_localData->setToTime(mchangeJsonData->toDateTime()); } //如果有修改内容的信息则获取 - if(!mchangeJsonData->toPlaceStr().isEmpty()){ + if (!mchangeJsonData->toPlaceStr().isEmpty()) { m_localData->setToTitleName(mchangeJsonData->toPlaceStr()); } return m_Task->getReplyBySelectSchedule(m_localData->SelectInfo()); - }else { - qDebug()<<"offset <=0"; + } else { + qDebug() << "offset <=0"; Reply reply; - REPLY_ONLY_TTS(reply,G_ERR_TTS,G_ERR_TTS,false); + REPLY_ONLY_TTS(reply, G_ERR_TTS, G_ERR_TTS, false); return reply; } } diff -Nru dde-calendar-5.9.1/schedule-plugin/src/state/selectandquerystate.h dde-calendar-5.10.0/schedule-plugin/src/state/selectandquerystate.h --- dde-calendar-5.9.1/schedule-plugin/src/state/selectandquerystate.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/state/selectandquerystate.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef SELECTANDQUERYSTATE_H #define SELECTANDQUERYSTATE_H @@ -26,7 +10,7 @@ class SelectAndQueryState : public scheduleState { public: - SelectAndQueryState(CSchedulesDBus *dbus, scheduleBaseTask *task); + explicit SelectAndQueryState(scheduleBaseTask *task); Reply getReplyByIntent(bool isOK) override; protected: diff -Nru dde-calendar-5.9.1/schedule-plugin/src/state/selectinquirystate.cpp dde-calendar-5.10.0/schedule-plugin/src/state/selectinquirystate.cpp --- dde-calendar-5.9.1/schedule-plugin/src/state/selectinquirystate.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/state/selectinquirystate.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,31 +1,15 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "selectinquirystate.h" #include "../globaldef.h" #include "../widget/repeatschedulewidget.h" #include "../task/schedulebasetask.h" -selectInquiryState::selectInquiryState(CSchedulesDBus *dbus, scheduleBaseTask *task) - : scheduleState(dbus, task) +selectInquiryState::selectInquiryState(scheduleBaseTask *task) + : scheduleState(task) { } @@ -79,7 +63,7 @@ offset = jsonData->offset(); } Reply m_reply; - ScheduleDtailInfo info = m_localData->scheduleInfoVector().at(offset - 1); + DSchedule::Ptr info = m_localData->scheduleInfoVector().at(offset - 1); return m_Task->getReplyBySelectSchedule(info); } diff -Nru dde-calendar-5.9.1/schedule-plugin/src/state/selectinquirystate.h dde-calendar-5.10.0/schedule-plugin/src/state/selectinquirystate.h --- dde-calendar-5.9.1/schedule-plugin/src/state/selectinquirystate.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/state/selectinquirystate.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,33 +1,17 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef SELECTINQUIRYSTATE_H #define SELECTINQUIRYSTATE_H #include "schedulestate.h" -#include "../data/schedulestructs.h" +#include "dschedule.h" class selectInquiryState : public scheduleState { public: - selectInquiryState(CSchedulesDBus *dbus, scheduleBaseTask *task); + explicit selectInquiryState(scheduleBaseTask *task); Reply getReplyByIntent(bool isOK) override; protected: diff -Nru dde-calendar-5.9.1/schedule-plugin/src/task/cancelscheduletask.cpp dde-calendar-5.10.0/schedule-plugin/src/task/cancelscheduletask.cpp --- dde-calendar-5.9.1/schedule-plugin/src/task/cancelscheduletask.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/task/cancelscheduletask.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "cancelscheduletask.h" #include "../data/canceljsondata.h" #include "../globaldef.h" @@ -29,16 +13,17 @@ #include "../state/repeatfeedbackstate.h" #include "../data/clocaldata.h" #include "../state/confirwfeedbackstate.h" +#include "dscheduledatamanager.h" -cancelScheduleTask::cancelScheduleTask(CSchedulesDBus *dbus) - : scheduleBaseTask(dbus, new queryScheduleState(dbus, this)) +cancelScheduleTask::cancelScheduleTask() + : scheduleBaseTask(new queryScheduleState(this)) { } void cancelScheduleTask::slotSelectScheduleIndex(int index) { scheduleState *currentState = getCurrentState(); - CLocalData *localData = currentState->getLocalData(); + CLocalData::Ptr localData = currentState->getLocalData(); if (!(localData->scheduleInfoVector().size() < index)) { Reply reply = getReplyBySelectSchedule(localData->scheduleInfoVector().at(index - 1)); updateState(); @@ -81,7 +66,7 @@ return currentState; } -Reply cancelScheduleTask::getFeedbackByQuerySchedule(const QVector &infoVector) +Reply cancelScheduleTask::getFeedbackByQuerySchedule(const DSchedule::List &infoVector) { Reply m_reply; scheduleState *nextState = nullptr; @@ -96,8 +81,8 @@ } else if (infoVector.size() == 1) { m_reply = getReplyBySelectSchedule(infoVector.at(0)); } else { - nextState = new selectInquiryState(m_dbus, this); - CLocalData *m_Data = new CLocalData(); + nextState = new selectInquiryState(this); + CLocalData::Ptr m_Data(new CLocalData()); m_Data->setScheduleInfoVector(infoVector); nextState->setLocalData(m_Data); m_reply = getListScheduleReply(infoVector); @@ -106,18 +91,18 @@ return m_reply; } -Reply cancelScheduleTask::getReplyBySelectSchedule(const ScheduleDtailInfo &info) +Reply cancelScheduleTask::getReplyBySelectSchedule(const DSchedule::Ptr &info) { Reply m_reply; - CLocalData *m_Data = new CLocalData(); + CLocalData::Ptr m_Data(new CLocalData()); scheduleState *nextState = nullptr; scheduleState *currentState = getCurrentState(); m_Data->setSelectInfo(info); - if (info.rpeat == 0) { - nextState = new confirwFeedbackState(m_dbus, this); + if (info->getRRuleType() == DSchedule::RRuleType::RRule_None) { + nextState = new confirwFeedbackState(this); m_reply = getConfirwScheduleReply(info); } else { - nextState = new repeatfeedbackstate(m_dbus, this); + nextState = new repeatfeedbackstate(this); m_reply = getRepeatReply(info); } nextState->setLocalData(m_Data); @@ -128,7 +113,7 @@ Reply cancelScheduleTask::InitState(const JsonData *jsonData, bool isUpdateState) { Reply m_reply; - scheduleState *nextState = new queryScheduleState(m_dbus, this); + scheduleState *nextState = new queryScheduleState(this); scheduleState *currentState = getCurrentState(); currentState->setNextState(nextState); if (jsonData != nullptr) { @@ -142,23 +127,23 @@ return m_reply; } -Reply cancelScheduleTask::repeatScheduleHandle(const ScheduleDtailInfo &info, bool isOnlyOne) +Reply cancelScheduleTask::repeatScheduleHandle(const DSchedule::Ptr &info, bool isOnlyOne) { deleteRepeatSchedule(info, isOnlyOne); Reply reply; REPLY_ONLY_TTS(reply, CONFIRM_DELETION_TTS, CONFIRM_DELETION_TTS, true); - scheduleState *nextState = new queryScheduleState(m_dbus, this); + scheduleState *nextState = new queryScheduleState(this); scheduleState *currentState = getCurrentState(); currentState->setNextState(nextState); return reply; } -Reply cancelScheduleTask::confirwScheduleHandle(const ScheduleDtailInfo &info) +Reply cancelScheduleTask::confirwScheduleHandle(const DSchedule::Ptr &info) { deleteOrdinarySchedule(info); Reply reply; REPLY_ONLY_TTS(reply, CONFIRM_DELETION_TTS, CONFIRM_DELETION_TTS, true); - scheduleState *nextState = new queryScheduleState(m_dbus, this); + scheduleState *nextState = new queryScheduleState(this); scheduleState *currentState = getCurrentState(); currentState->setNextState(nextState); return reply; @@ -174,7 +159,7 @@ } } -QWidget *cancelScheduleTask::createRepeatWidget(const ScheduleDtailInfo &info) +QWidget *cancelScheduleTask::createRepeatWidget(const DSchedule::Ptr &info) { repeatScheduleWidget *repeatWidget = new repeatScheduleWidget(repeatScheduleWidget::Operation_Cancel, repeatScheduleWidget::Widget_Repeat); repeatWidget->setSchedule(info); @@ -182,7 +167,7 @@ return repeatWidget; } -QWidget *cancelScheduleTask::createConfirmWidget(const ScheduleDtailInfo &info) +QWidget *cancelScheduleTask::createConfirmWidget(const DSchedule::Ptr &info) { repeatScheduleWidget *cwidget = new repeatScheduleWidget(repeatScheduleWidget::Operation_Cancel, repeatScheduleWidget::Widget_Confirm); cwidget->setSchedule(info); @@ -190,7 +175,7 @@ return cwidget; } -Reply cancelScheduleTask::getListScheduleReply(const QVector &infoVector) +Reply cancelScheduleTask::getListScheduleReply(const DSchedule::List &infoVector) { scheduleListWidget *m_viewWidget = new scheduleListWidget(); m_viewWidget->setScheduleInfoVector(infoVector); @@ -204,7 +189,7 @@ return reply; } -Reply cancelScheduleTask::getConfirwScheduleReply(const ScheduleDtailInfo &info) +Reply cancelScheduleTask::getConfirwScheduleReply(const DSchedule::Ptr &info) { QString m_TTSMessage; QString m_DisplyMessage; @@ -216,7 +201,7 @@ return reply; } -Reply cancelScheduleTask::getRepeatReply(const ScheduleDtailInfo &info) +Reply cancelScheduleTask::getRepeatReply(const DSchedule::Ptr &info) { QString m_TTSMessage; QString m_DisplyMessage; @@ -228,27 +213,25 @@ return reply; } -void cancelScheduleTask::deleteRepeatSchedule(const ScheduleDtailInfo &info, bool isOnlyOne) +void cancelScheduleTask::deleteRepeatSchedule(const DSchedule::Ptr &info, bool isOnlyOne) { if (isOnlyOne) { - ScheduleDtailInfo newschedule; - m_dbus->GetJob(info.id, newschedule); - newschedule.ignore.append(info.beginDateTime); - m_dbus->UpdateJob(newschedule); + DSchedule::Ptr newschedule = DScheduleDataManager::getInstance()->queryScheduleByScheduleID(info->uid()); + newschedule->recurrence()->addExDateTime(info->dtStart()); + DScheduleDataManager::getInstance()->updateSchedule(newschedule); } else { - if (info.RecurID == 0) { - m_dbus->DeleteJob(info.id); + if (info->recurrenceId().isValid() == 0) { + DScheduleDataManager::getInstance()->deleteScheduleByScheduleID(info->uid()); } else { - ScheduleDtailInfo newschedule; - m_dbus->GetJob(info.id, newschedule); - newschedule.enddata.type = 2; - newschedule.enddata.date = info.beginDateTime.addDays(-1); - m_dbus->UpdateJob(newschedule); + DSchedule::Ptr newschedule = DScheduleDataManager::getInstance()->queryScheduleByScheduleID(info->uid()); + newschedule->recurrence()->setDuration(0); + newschedule->recurrence()->setEndDateTime(info->dtStart().addDays(-1)); + DScheduleDataManager::getInstance()->updateSchedule(newschedule); } } } -void cancelScheduleTask::deleteOrdinarySchedule(const ScheduleDtailInfo &info) +void cancelScheduleTask::deleteOrdinarySchedule(const DSchedule::Ptr &info) { - m_dbus->DeleteJob(info.id); + DScheduleDataManager::getInstance()->deleteScheduleByScheduleID(info->uid()); } diff -Nru dde-calendar-5.9.1/schedule-plugin/src/task/cancelscheduletask.h dde-calendar-5.10.0/schedule-plugin/src/task/cancelscheduletask.h --- dde-calendar-5.9.1/schedule-plugin/src/task/cancelscheduletask.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/task/cancelscheduletask.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef CANCELSCHEDULETASK_H #define CANCELSCHEDULETASK_H @@ -29,12 +13,12 @@ { Q_OBJECT public: - explicit cancelScheduleTask(CSchedulesDBus *dbus); - Reply getFeedbackByQuerySchedule(const QVector &infoVector) override; - Reply getReplyBySelectSchedule(const ScheduleDtailInfo &info) override; + cancelScheduleTask(); + Reply getFeedbackByQuerySchedule(const DSchedule::List &infoVector) override; + Reply getReplyBySelectSchedule(const DSchedule::Ptr &info) override; Reply InitState(const JsonData *jsonData, bool isUpdateState = false) override; - Reply repeatScheduleHandle(const ScheduleDtailInfo &info, bool isOnlyOne) override; - Reply confirwScheduleHandle(const ScheduleDtailInfo &info) override; + Reply repeatScheduleHandle(const DSchedule::Ptr &info, bool isOnlyOne) override; + Reply confirwScheduleHandle(const DSchedule::Ptr &info) override; Reply confirmInfo(bool isOK) override; public slots: void slotSelectScheduleIndex(int index); @@ -42,16 +26,16 @@ private: scheduleState *getCurrentState(); - QWidget *createRepeatWidget(const ScheduleDtailInfo &info); - QWidget *createConfirmWidget(const ScheduleDtailInfo &info); + QWidget *createRepeatWidget(const DSchedule::Ptr &info); + QWidget *createConfirmWidget(const DSchedule::Ptr &info); - Reply getListScheduleReply(const QVector &infoVector); + Reply getListScheduleReply(const DSchedule::List &infoVector); - Reply getConfirwScheduleReply(const ScheduleDtailInfo &info); - Reply getRepeatReply(const ScheduleDtailInfo &info); + Reply getConfirwScheduleReply(const DSchedule::Ptr &info); + Reply getRepeatReply(const DSchedule::Ptr &info); - void deleteRepeatSchedule(const ScheduleDtailInfo &info, bool isOnlyOne = true); - void deleteOrdinarySchedule(const ScheduleDtailInfo &info); + void deleteRepeatSchedule(const DSchedule::Ptr &info, bool isOnlyOne = true); + void deleteOrdinarySchedule(const DSchedule::Ptr &info); private: }; diff -Nru dde-calendar-5.9.1/schedule-plugin/src/task/changescheduletask.cpp dde-calendar-5.10.0/schedule-plugin/src/task/changescheduletask.cpp --- dde-calendar-5.9.1/schedule-plugin/src/task/changescheduletask.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/task/changescheduletask.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "changescheduletask.h" #include "../data/changejsondata.h" #include "../globaldef.h" @@ -29,13 +13,14 @@ #include "../state/queryschedulestate.h" #include "../state/repeatfeedbackstate.h" #include "../state/getchangedatastate.h" +#include "dscheduledatamanager.h" -changeScheduleTask::changeScheduleTask(CSchedulesDBus *dbus) - : scheduleBaseTask(dbus, new queryScheduleState(dbus, this)) +changeScheduleTask::changeScheduleTask() + : scheduleBaseTask(new queryScheduleState(this)) { } -Reply changeScheduleTask::getFeedbackByQuerySchedule(const QVector &infoVector) +Reply changeScheduleTask::getFeedbackByQuerySchedule(const DSchedule::List &infoVector) { Reply m_reply; scheduleState *nextState = nullptr; @@ -51,9 +36,8 @@ currentState->getLocalData()->setSelectInfo(infoVector.at(0)); m_reply = getReplyBySelectSchedule(infoVector.at(0)); } else { - nextState = new SelectAndQueryState(m_dbus, this); - CLocalData *m_Data = new CLocalData(); - m_Data->getDataByPoint(currentState->getLocalData()); + nextState = new SelectAndQueryState(this); + CLocalData::Ptr m_Data = currentState->getLocalData(); m_Data->setScheduleInfoVector(infoVector); nextState->setLocalData(m_Data); m_reply = getListScheduleReply(infoVector); @@ -65,7 +49,7 @@ void changeScheduleTask::slotSelectScheduleIndex(int index) { scheduleState *currentState = getCurrentState(); - CLocalData *localData = currentState->getLocalData(); + CLocalData::Ptr localData = currentState->getLocalData(); if (!(localData->scheduleInfoVector().size() < index)) { localData->setSelectInfo(localData->scheduleInfoVector().at(index - 1)); Reply reply = getReplyBySelectSchedule(localData->scheduleInfoVector().at(index - 1)); @@ -109,13 +93,12 @@ return currentState; } -Reply changeScheduleTask::getReplyBySelectSchedule(const ScheduleDtailInfo &info) +Reply changeScheduleTask::getReplyBySelectSchedule(const DSchedule::Ptr &info) { Reply m_reply; scheduleState *nextState = nullptr; - CLocalData *m_Data = new CLocalData(); scheduleState *currentState = getCurrentState(); - m_Data->getDataByPoint(currentState->getLocalData()); + CLocalData::Ptr m_Data = currentState->getLocalData(); m_Data->setSelectInfo(info); if (m_Data->getOffet() < 0) { m_Data->setOffset(1); @@ -124,7 +107,7 @@ QWidget *infoWidget = createInquiryWidget(info); REPLY_WIDGET_TTS(m_reply, infoWidget, CHANGE_TO_TTS, CHANGE_TO_TTS, false); //添加获取修改信息状态 - nextState = new getChangeDataState(m_dbus, this); + nextState = new getChangeDataState(this); nextState->setLocalData(m_Data); } else { //获取下一个状态 @@ -137,7 +120,7 @@ Reply changeScheduleTask::InitState(const JsonData *jsonData, bool isUpdateState) { Reply m_reply; - scheduleState *nextState = new queryScheduleState(m_dbus, this); + scheduleState *nextState = new queryScheduleState(this); scheduleState *currentState = getCurrentState(); currentState->setNextState(nextState); if (jsonData != nullptr) { @@ -154,25 +137,25 @@ return m_reply; } -Reply changeScheduleTask::repeatScheduleHandle(const ScheduleDtailInfo &info, bool isOnlyOne) +Reply changeScheduleTask::repeatScheduleHandle(const DSchedule::Ptr &info, bool isOnlyOne) { changeRepeatSchedule(info, isOnlyOne); Reply reply; REPLY_ONLY_TTS(reply, CONFIRM_CHANGE_TTS, CONFIRM_CHANGE_TTS, true); - scheduleState *nextState = new queryScheduleState(m_dbus, this); + scheduleState *nextState = new queryScheduleState(this); scheduleState *currentState = getCurrentState(); currentState->setNextState(nextState); return reply; } -Reply changeScheduleTask::confirwScheduleHandle(const ScheduleDtailInfo &info) +Reply changeScheduleTask::confirwScheduleHandle(const DSchedule::Ptr &info) { Q_UNUSED(info); scheduleState *currentState = getCurrentState(); changeOrdinarySchedule(currentState->getLocalData()->getNewInfo()); Reply reply; REPLY_ONLY_TTS(reply, CONFIRM_CHANGE_TTS, CONFIRM_CHANGE_TTS, true); - scheduleState *nextState = new queryScheduleState(m_dbus, this); + scheduleState *nextState = new queryScheduleState(this); currentState->setNextState(nextState); return reply; } @@ -191,7 +174,7 @@ } } -QWidget *changeScheduleTask::createRepeatWidget(const ScheduleDtailInfo &info) +QWidget *changeScheduleTask::createRepeatWidget(const DSchedule::Ptr &info) { repeatScheduleWidget *repeatWidget = new repeatScheduleWidget(repeatScheduleWidget::Operation_Change, repeatScheduleWidget::Widget_Repeat); repeatWidget->setSchedule(info); @@ -199,7 +182,7 @@ return repeatWidget; } -QWidget *changeScheduleTask::createConfirmWidget(const ScheduleDtailInfo &info) +QWidget *changeScheduleTask::createConfirmWidget(const DSchedule::Ptr &info) { repeatScheduleWidget *cwidget = new repeatScheduleWidget(repeatScheduleWidget::Operation_Change, repeatScheduleWidget::Widget_Confirm); cwidget->setSchedule(info); @@ -207,7 +190,7 @@ return cwidget; } -QWidget *changeScheduleTask::createInquiryWidget(const ScheduleDtailInfo &info) +QWidget *changeScheduleTask::createInquiryWidget(const DSchedule::Ptr &info) { repeatScheduleWidget *infoWidget = new repeatScheduleWidget(repeatScheduleWidget::Operation_Change, repeatScheduleWidget::Widget_Confirm, false); @@ -215,7 +198,7 @@ return infoWidget; } -Reply changeScheduleTask::getListScheduleReply(const QVector &infoVector) +Reply changeScheduleTask::getListScheduleReply(const DSchedule::List &infoVector) { scheduleListWidget *m_viewWidget = new scheduleListWidget(); connect(m_viewWidget, &scheduleListWidget::signalSelectScheduleIndex, this, &changeScheduleTask::slotSelectScheduleIndex); @@ -229,7 +212,7 @@ return reply; } -scheduleState *changeScheduleTask::getNextStateBySelectScheduleInfo(const ScheduleDtailInfo &info, CLocalData *localData, Reply &reply) +scheduleState *changeScheduleTask::getNextStateBySelectScheduleInfo(const DSchedule::Ptr &info, const CLocalData::Ptr &localData, Reply &reply) { QString m_TTSMessage; QString m_DisplyMessage; @@ -241,18 +224,18 @@ if (getNewInfo()) { //需要显示的窗口 QWidget *_showWidget; - if (info.rpeat == 0) { + if (info->getRRuleType() == DSchedule::RRule_None) { m_TTSMessage = CONFIRM_SCHEDULE_CHANGE_TTS; m_DisplyMessage = CONFIRM_SCHEDULE_CHANGE_TTS; _showWidget = createConfirmWidget(currentState->getLocalData()->getNewInfo()); //设置下一个状态为普通日程确认状态 - nextState = new confirwFeedbackState(m_dbus, this); + nextState = new confirwFeedbackState(this); } else { m_TTSMessage = REPEST_SCHEDULE_CHANGE_TTS; m_DisplyMessage = REPEST_SCHEDULE_CHANGE_TTS; _showWidget = createRepeatWidget(currentState->getLocalData()->getNewInfo()); //设置下一个状态为重复日程确认状态 - nextState = new repeatfeedbackstate(m_dbus, this); + nextState = new repeatfeedbackstate(this); } //设置修改的日程信息 localData->setNewInfo(currentState->getLocalData()->getNewInfo()); @@ -264,7 +247,7 @@ m_TTSMessage = CHANGE_TIME_OUT_TTS; m_DisplyMessage = CHANGE_TIME_OUT_TTS; REPLY_ONLY_TTS(reply, m_TTSMessage, m_DisplyMessage, true); - nextState = new queryScheduleState(m_dbus, this); + nextState = new queryScheduleState(this); }; return nextState; } @@ -272,9 +255,9 @@ bool changeScheduleTask::getNewInfo() { scheduleState *currentState = getCurrentState(); - ScheduleDtailInfo m_NewInfo = currentState->getLocalData()->SelectInfo(); + DSchedule::Ptr m_NewInfo = currentState->getLocalData()->SelectInfo(); if (!currentState->getLocalData()->getToTitleName().isEmpty()) - m_NewInfo.titleName = currentState->getLocalData()->getToTitleName(); + m_NewInfo->setSummary(currentState->getLocalData()->getToTitleName()); QVector m_ToTime = currentState->getLocalData()->getToTime().dateTime; //获取建议时间 QVector m_suggestDatetime = currentState->getLocalData()->getToTime().suggestDatetime; @@ -282,25 +265,27 @@ if (m_ToTime.size() == 1) { //如果存在日期信息 if (m_ToTime.at(0).hasDate) { + //获取日程的开始结束时间差 + qint64 interval = m_NewInfo->dtStart().secsTo(m_NewInfo->dtEnd()); //设置修改的开始日期 - m_NewInfo.beginDateTime.setDate(m_ToTime.at(0).m_Date); + m_NewInfo->setDtStart(QDateTime(m_ToTime.at(0).m_Date, m_NewInfo->dtStart().time())); //设置修改的结束日期 - m_NewInfo.endDateTime.setDate(m_ToTime.at(0).m_Date); + m_NewInfo->setDtEnd(m_NewInfo->dtStart().addSecs(interval)); } //如果修改的DateTime带时间则设置该时间,否则保持原来的时间点 if (m_ToTime.at(0).hasTime) { //如果修改的日期为当天则取suggestTime时间 - if (m_NewInfo.beginDateTime.date() == QDate::currentDate()) { - m_NewInfo.beginDateTime = m_suggestDatetime.at(0).datetime; + if (m_NewInfo->dtStart().date() == QDate::currentDate()) { + m_NewInfo->setDtStart(m_suggestDatetime.at(0).datetime); } else { - m_NewInfo.beginDateTime.setTime(m_ToTime.at(0).m_Time); + m_NewInfo->setDtStart(QDateTime(m_NewInfo->dtStart().date(), m_ToTime.at(0).m_Time)); } - m_NewInfo.endDateTime = m_NewInfo.beginDateTime.addSecs(3600); + m_NewInfo->setDtEnd(m_NewInfo->dtStart().addSecs(3600)); //如果存在时间点则将全天的日程修改为非全天并修改提醒规则 - if (m_NewInfo.allday) { - m_NewInfo.allday = false; - m_NewInfo.remind = true; - m_NewInfo.remindData.n = 0; + if (m_NewInfo->allDay()) { + m_NewInfo->setAllDay(false); + //非全天设置为立即提醒 + m_NewInfo->setAlarmType(DSchedule::Alarm_Begin); } } } @@ -308,23 +293,23 @@ //如果存在日期信息 if (m_ToTime.at(0).hasDate) { //设置修改的开始日期 - m_NewInfo.beginDateTime.setDate(m_ToTime.at(0).m_Date); + m_NewInfo->setDtStart(QDateTime(m_ToTime.at(0).m_Date)); } //如果修改的DateTime带时间则设置该时间,否则保持原来的时间点 if (m_ToTime.at(0).hasTime) { - m_NewInfo.beginDateTime.setTime(m_ToTime.at(0).m_Time); + m_NewInfo->setDtStart(QDateTime(m_NewInfo->dtStart().date(), m_ToTime.at(0).m_Time)); } //如果存在日期信息 if (m_ToTime.at(1).hasDate) { //设置修改的结束日期 - m_NewInfo.endDateTime.setDate(m_ToTime.at(1).m_Date); + m_NewInfo->setDtEnd(QDateTime(m_ToTime.at(1).m_Date)); } //如果修改的DateTime带时间则设置该时间,否则保持原来的时间点 if (m_ToTime.at(1).hasTime) - m_NewInfo.endDateTime.setTime(m_ToTime.at(1).m_Time); + m_NewInfo->setDtEnd(QDateTime(m_NewInfo->dtEnd().date(), m_ToTime.at(1).m_Time)); //如果开始时间大于结束时间则设置结束时间为开始时间往后一小时 - if (m_NewInfo.endDateTime < m_NewInfo.beginDateTime) { - m_NewInfo.endDateTime = m_NewInfo.beginDateTime.addSecs(3600); + if (m_NewInfo->dtEnd() < m_NewInfo->dtStart()) { + m_NewInfo->setDtEnd(m_NewInfo->dtStart().addSecs(3600)); } //TODO 对于多个时间点还未支持,全天非全天的修改待做 } @@ -333,7 +318,7 @@ return changeDateTimeIsInNormalRange(m_NewInfo); } -void changeScheduleTask::changeRepeatSchedule(const ScheduleDtailInfo &info, bool isOnlyOne) +void changeScheduleTask::changeRepeatSchedule(const DSchedule::Ptr &info, bool isOnlyOne) { if (isOnlyOne) { changeOnlyInfo(info); @@ -342,70 +327,80 @@ } } -void changeScheduleTask::changeOnlyInfo(const ScheduleDtailInfo &info) +void changeScheduleTask::changeOnlyInfo(const DSchedule::Ptr &info) { + Q_UNUSED(info) scheduleState *currentState = getCurrentState(); - ScheduleDtailInfo newschedule = currentState->getLocalData()->getNewInfo(); - newschedule.rpeat = 0; - newschedule.RecurID = 0; - newschedule.id = 0; - newschedule.ignore.clear(); - m_dbus->CreateJob(newschedule); - ScheduleDtailInfo updatescheduleData; - m_dbus->GetJob(info.id, updatescheduleData); - updatescheduleData.ignore.append(info.beginDateTime); - m_dbus->UpdateJob(updatescheduleData); -} - -void changeScheduleTask::changeAllInfo(const ScheduleDtailInfo &info) -{ - scheduleState *currentState = getCurrentState(); - ScheduleDtailInfo newinfo = currentState->getLocalData()->getNewInfo(); - if (info.RecurID == 0) { - ScheduleDtailInfo scheduleDtailInfo = newinfo; - if (scheduleDtailInfo.enddata.type == 1 && scheduleDtailInfo.enddata.tcount < 1) { - scheduleDtailInfo.enddata.type = 0; - } else if (scheduleDtailInfo.enddata.type == 2 && scheduleDtailInfo.beginDateTime.daysTo(scheduleDtailInfo.enddata.date) < 0) { - scheduleDtailInfo.enddata.type = 0; - scheduleDtailInfo.rpeat = 0; - } - m_dbus->UpdateJob(scheduleDtailInfo); + DSchedule::Ptr newschedule = currentState->getLocalData()->getNewInfo(); + //原始信息 + DSchedule::Ptr updatescheduleData = DScheduleDataManager::getInstance()->queryScheduleByScheduleID(newschedule->uid()); + updatescheduleData->recurrence()->addExDateTime(newschedule->dtStart()); + newschedule->setRRuleType(DSchedule::RRule_None); + newschedule->setUid(DScheduleDataManager::getInstance()->createSchedule(newschedule)); + + DScheduleDataManager::getInstance()->updateSchedule(updatescheduleData); +} + +void changeScheduleTask::changeAllInfo(const DSchedule::Ptr &info) +{ + scheduleState *currentState = getCurrentState(); + DSchedule::Ptr newinfo = currentState->getLocalData()->getNewInfo(); + if (info->getRRuleType() == DSchedule::RRule_None) { + DSchedule::Ptr schedule = newinfo; + DScheduleDataManager::getInstance()->updateSchedule(schedule); } else { - ScheduleDtailInfo newschedule = newinfo; - newschedule.RecurID = 0; - newschedule.id = 0; - if (newschedule.enddata.type == 1) { - newschedule.enddata.tcount = qAbs(newinfo.enddata.tcount - newinfo.RecurID); - if (newschedule.enddata.tcount < 1) { - newschedule.enddata.type = 0; - newschedule.rpeat = 0; - } - } - m_dbus->CreateJob(newschedule); - ScheduleDtailInfo updatescheduleData; - m_dbus->GetJob(info.id, updatescheduleData); - if (updatescheduleData.enddata.type == 1) { - updatescheduleData.enddata.tcount = newinfo.RecurID - 1; - if (updatescheduleData.enddata.tcount < 1) { - updatescheduleData.enddata.type = 0; - updatescheduleData.rpeat = 0; - } + //获取原始日程信息 + DSchedule::Ptr updatescheduleData = DScheduleDataManager::getInstance()->queryScheduleByScheduleID(info->uid()); + //第几次重复日程 + int repetNum = DSchedule::numberOfRepetitions(updatescheduleData, newinfo->dtStart()); + if (repetNum == 1) { + //如果为第一个 + DScheduleDataManager::getInstance()->updateSchedule(newinfo); + } else { - //如果为结束与日期或永不,则都修改为结束语日期并修改结束日期 - updatescheduleData.enddata.type = 2; - updatescheduleData.enddata.date = - info.beginDateTime.addDays(-1); + //如果不是第一个 + if (newinfo->recurrence()->duration() > 1) { + int duration = newinfo->recurrence()->duration() - repetNum + 1; + //结束于次数 + if (duration < 2) { + newinfo->setRRuleType(DSchedule::RRule_None); + } else { + newinfo->recurrence()->setDuration(duration); + } + //修改原始日程,如果原始日程剩余的重复次数为1,则修改为普通日程 + updatescheduleData->recurrence()->setDuration(repetNum - 1); + if (updatescheduleData->recurrence()->duration() == 1) { + updatescheduleData->setRRuleType(DSchedule::RRule_None); + } + } else if (newinfo->recurrence()->duration() == 0) { + //结束于时间 + if (newinfo->dtStart().date() == newinfo->recurrence()->endDateTime().date()) { + newinfo->setRRuleType(DSchedule::RRule_None); + } + updatescheduleData->recurrence()->setEndDate(newinfo->dtStart().date().addDays(-1)); + if (updatescheduleData->dtStart().date() == updatescheduleData->recurrence()->endDate()) { + updatescheduleData->setRRuleType(DSchedule::RRule_None); + } + } else { + //永不 + updatescheduleData->recurrence()->setEndDate(newinfo->dtStart().date().addDays(-1)); + if (updatescheduleData->dtStart().date() == updatescheduleData->recurrence()->endDate()) { + updatescheduleData->setRRuleType(DSchedule::RRule_None); + } + } + DScheduleDataManager::getInstance()->createSchedule(newinfo); + //修改原始日程 + DScheduleDataManager::getInstance()->updateSchedule(updatescheduleData); } - m_dbus->UpdateJob(updatescheduleData); } } -void changeScheduleTask::changeOrdinarySchedule(const ScheduleDtailInfo &info) +void changeScheduleTask::changeOrdinarySchedule(const DSchedule::Ptr &info) { - m_dbus->UpdateJob(info); + DScheduleDataManager::getInstance()->updateSchedule(info); } -bool changeScheduleTask::changeDateTimeIsInNormalRange(const ScheduleDtailInfo &info) +bool changeScheduleTask::changeDateTimeIsInNormalRange(const DSchedule::Ptr &info) { bool result {true}; //当前时间 @@ -413,12 +408,12 @@ //最大时间 QDateTime maxDateTime = currentDateTime.addMonths(6); //如果开始时间为过期时间则为false - if (info.beginDateTime < currentDateTime) { + if (info->dtStart() < currentDateTime) { result = false; }; //如果开始时间或结束时间大于最大时间则为false - if (info.beginDateTime > maxDateTime - || info.endDateTime > maxDateTime) { + if (info->dtStart() > maxDateTime + || info->dtEnd() > maxDateTime) { result = false; } return result; diff -Nru dde-calendar-5.9.1/schedule-plugin/src/task/changescheduletask.h dde-calendar-5.10.0/schedule-plugin/src/task/changescheduletask.h --- dde-calendar-5.9.1/schedule-plugin/src/task/changescheduletask.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/task/changescheduletask.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,39 +1,24 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef CHANGESCHEDULETASK_H #define CHANGESCHEDULETASK_H #include "schedulebasetask.h" +#include "dschedule.h" +#include "clocaldata.h" -class CLocalData; class changeScheduleTask : public scheduleBaseTask { Q_OBJECT public: - explicit changeScheduleTask(CSchedulesDBus *dbus); - Reply getFeedbackByQuerySchedule(const QVector &infoVector) override; - Reply getReplyBySelectSchedule(const ScheduleDtailInfo &info) override; + explicit changeScheduleTask(); + Reply getFeedbackByQuerySchedule(const DSchedule::List &infoVector) override; + Reply getReplyBySelectSchedule(const DSchedule::Ptr &info) override; Reply InitState(const JsonData *jsonData, bool isUpdateState = false) override; - Reply repeatScheduleHandle(const ScheduleDtailInfo &info, bool isOnlyOne) override; - Reply confirwScheduleHandle(const ScheduleDtailInfo &info) override; + Reply repeatScheduleHandle(const DSchedule::Ptr &info, bool isOnlyOne) override; + Reply confirwScheduleHandle(const DSchedule::Ptr &info) override; Reply confirmInfo(bool isOK) override; public slots: @@ -42,11 +27,11 @@ private: scheduleState *getCurrentState(); - QWidget *createRepeatWidget(const ScheduleDtailInfo &info); - QWidget *createConfirmWidget(const ScheduleDtailInfo &info); - QWidget *createInquiryWidget(const ScheduleDtailInfo &info); + QWidget *createRepeatWidget(const DSchedule::Ptr &info); + QWidget *createConfirmWidget(const DSchedule::Ptr &info); + QWidget *createInquiryWidget(const DSchedule::Ptr &info); - Reply getListScheduleReply(const QVector &infoVector); + Reply getListScheduleReply(const DSchedule::List &infoVector); /** * @brief getNextStateBySelectScheduleInfo 根据选择的日程获取下一个修改状态 * @param info 选择的日程信息 @@ -54,26 +39,26 @@ * @param reply 修改的回复 * @return 下一个状态 */ - scheduleState *getNextStateBySelectScheduleInfo(const ScheduleDtailInfo &info, CLocalData *localData, Reply &reply); + scheduleState *getNextStateBySelectScheduleInfo(const DSchedule::Ptr &info, const CLocalData::Ptr &localData, Reply &reply); /** * @brief getNewInfo 根据修改信息获取新的日程信息 * @return 在时间范围内返回true */ bool getNewInfo(); - void changeRepeatSchedule(const ScheduleDtailInfo &info, bool isOnlyOne); - void changeOnlyInfo(const ScheduleDtailInfo &info); - void changeAllInfo(const ScheduleDtailInfo &info); - void changeOrdinarySchedule(const ScheduleDtailInfo &info); + void changeRepeatSchedule(const DSchedule::Ptr &info, bool isOnlyOne); + void changeOnlyInfo(const DSchedule::Ptr &info); + void changeAllInfo(const DSchedule::Ptr &info); + void changeOrdinarySchedule(const DSchedule::Ptr &info); /** * @brief changeDateTimeIsInRange 判断修改的日期在正确的时间范围内 * @param info 修改过的日程 * @return 在正常范围内则返回true */ - bool changeDateTimeIsInNormalRange(const ScheduleDtailInfo &info); + bool changeDateTimeIsInNormalRange(const DSchedule::Ptr &info); private: - QVector m_scheduleInfo; + DSchedule::List m_scheduleInfo; }; #endif // CHANGESCHEDULETASK_H diff -Nru dde-calendar-5.9.1/schedule-plugin/src/task/createscheduletask.cpp dde-calendar-5.10.0/schedule-plugin/src/task/createscheduletask.cpp --- dde-calendar-5.9.1/schedule-plugin/src/task/createscheduletask.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/task/createscheduletask.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,29 +1,14 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "createscheduletask.h" #include "../globaldef.h" +#include "dscheduledatamanager.h" -createScheduleTask::createScheduleTask(CSchedulesDBus *dbus) - : scheduleBaseTask(dbus) +createScheduleTask::createScheduleTask() + : scheduleBaseTask() { } @@ -76,8 +61,8 @@ //设置日程titlename setScheduleTitleName(createJsonData); //创建日程和插件 - QVector scheduleinfo = createScheduleWithRepeatStatus(createJsonData); - creareScheduleUI(scheduleinfo); + QString scheduleID = createScheduleWithRepeatStatus(createJsonData); + creareScheduleUI(scheduleID); //带有插件的回复语 REPLY_WIDGET_TTS(m_reply, m_widget, getReply(createJsonData), getReply(createJsonData), true); } @@ -156,8 +141,6 @@ replyNotValidDT = "您输入的时间不正确,请重新输入"; } break; } - qInfo() << "scheduleBeginTime: " << m_begintime - << "scheduleEndTime: " << m_endtime; } void createScheduleTask::setScheduleTitleName(CreateJsonData *createJsonData) @@ -170,10 +153,10 @@ m_widget->setTitleName(createJsonData->TitleName()); } -QVector createScheduleTask::createScheduleWithRepeatStatus(CreateJsonData *createJsonData) +QString createScheduleTask::createScheduleWithRepeatStatus(CreateJsonData *createJsonData) { //创建的日程信息 - QVector schedule; + QString scheduleID; //重复日程的时间 QVector getDayNum = createJsonData->getRepeatNum(); //根据不同类型分别创建日程 @@ -181,53 +164,49 @@ case CreateJsonData::NONE: { //非重复日程,不能创建过期日程 if (m_begintime >= QDateTime::currentDateTime() && m_begintime < QDateTime::currentDateTime().addMonths(6)) { - schedule = getNotRepeatDaySchedule(); + scheduleID = getNotRepeatDaySchedule(); } } break; case CreateJsonData::EVED: //每天重复日程 - schedule = getEveryDaySchedule(); + scheduleID = getEveryDaySchedule(); break; case CreateJsonData::EVEW: { //每周重复日程 - schedule = getEveryWeekSchedule(getDayNum); + scheduleID = getEveryWeekSchedule(getDayNum); } break; case CreateJsonData::EVEM: { //每月重复日程 - schedule = getEveryMonthSchedule(getDayNum); + scheduleID = getEveryMonthSchedule(getDayNum); } break; case CreateJsonData::EVEY: { //每年重复日程,不能创建过期或者超过半年的日程 if (m_begintime > QDateTime::currentDateTime() && m_begintime < QDateTime::currentDateTime().addMonths(6)) - schedule = getEveryYearSchedule(); + scheduleID = getEveryYearSchedule(); } break; case CreateJsonData::WORKD: //工作日 - schedule = getEveryWorkDaySchedule(); + scheduleID = getEveryWorkDaySchedule(); break; case CreateJsonData::RESTD: { //休息日 - schedule = getEveryRestDaySchedule(); + scheduleID = getEveryRestDaySchedule(); } break; } - return schedule; + return scheduleID; } -void createScheduleTask::creareScheduleUI(QVector schedule) +void createScheduleTask::creareScheduleUI(const QString &scheduleID) { - if (!schedule.isEmpty()) { - //设置日程时间 - setDateTimeAndGetSchedule(getFirstSchedule(schedule).beginDateTime, getFirstSchedule(schedule).endDateTime); - //设置dbus - m_widget->setScheduleDbus(m_dbus); + if (!scheduleID.isEmpty()) { m_widget->scheduleEmpty(true); //更新界面 - m_widget->updateUI(); + m_widget->updateUI(scheduleID); } else { qCritical("Creat ScheduleInfo is Empty!"); } @@ -285,42 +264,32 @@ return false; } -QVector createScheduleTask::getNotRepeatDaySchedule() +QString createScheduleTask::getNotRepeatDaySchedule() { - QVector schedule; //设置重复类型 m_widget->setRpeat(0); //创建日程 - ScheduleDtailInfo scheduleinfo = setDateTimeAndGetSchedule(m_begintime, m_endtime); - m_dbus->CreateJob(scheduleinfo); - //将所有日程添加到日程容器中 - schedule.append(scheduleinfo); - - return schedule; + DSchedule::Ptr scheduleinfo = setDateTimeAndGetSchedule(m_begintime, m_endtime); + return DScheduleDataManager::getInstance()->createSchedule(scheduleinfo); } -QVector createScheduleTask::getEveryDaySchedule() +QString createScheduleTask::getEveryDaySchedule() { - QVector schedule; //设置重复类型 m_widget->setRpeat(1); - ScheduleDtailInfo scheduleinfo = setDateTimeAndGetSchedule(m_begintime, m_endtime); - //创建日程 - m_dbus->CreateJob(scheduleinfo); - //将所有日程添加到日程容器中 - schedule.append(scheduleinfo); + DSchedule::Ptr scheduleinfo = setDateTimeAndGetSchedule(m_begintime, m_endtime); //设置完成后,将everyDayState设置为false everyDayState = false; - - return schedule; + //创建日程 + return DScheduleDataManager::getInstance()->createSchedule(scheduleinfo); } -QVector createScheduleTask::getEveryWeekSchedule(QVector dateRange) +QString createScheduleTask::getEveryWeekSchedule(QVector dateRange) { - QVector beginDateTime {}; - QVector schedule; + QStringList scheduleIDs; //设置重复类型 m_widget->setRpeat(3); + QVector beginDateTime {}; //获取解析时间 beginDateTime = analysisEveryWeekDate(dateRange); //每天重复 @@ -331,18 +300,16 @@ //设置日程结束时间 m_endtime.setDate(beginDateTime.at(i).date()); //创建日程 - m_dbus->CreateJob(setDateTimeAndGetSchedule(beginDateTime.at(i), m_endtime)); - //将所有日程添加到日程容器中 - schedule.append(setDateTimeAndGetSchedule(beginDateTime.at(i), m_endtime)); + scheduleIDs.append(DScheduleDataManager::getInstance()->createSchedule(setDateTimeAndGetSchedule(beginDateTime.at(i), m_endtime))); } - - return schedule; + //创建多个日程返回第一个 + return scheduleIDs.isEmpty() ? QString() : scheduleIDs.first(); } -QVector createScheduleTask::getEveryMonthSchedule(QVector dateRange) +QString createScheduleTask::getEveryMonthSchedule(QVector dateRange) { QVector beginDateTime {}; - QVector schedule; + QStringList scheduleIDs; //设置重复类型 m_widget->setRpeat(4); //获取解析日期 @@ -355,53 +322,48 @@ //设置日程结束时间 m_endtime.setDate(beginDateTime.at(i).date()); //创建日程 - m_dbus->CreateJob(setDateTimeAndGetSchedule(beginDateTime.at(i), m_endtime)); - //将所有日程添加到日程容器中 - schedule.append(setDateTimeAndGetSchedule(beginDateTime.at(i), m_endtime)); + scheduleIDs.append(DScheduleDataManager::getInstance()->createSchedule(setDateTimeAndGetSchedule(beginDateTime.at(i), m_endtime))); } - - return schedule; + //创建多个日程返回第一个 + return scheduleIDs.isEmpty() ? QString() : scheduleIDs.first(); } -QVector createScheduleTask::getEveryYearSchedule() +QString createScheduleTask::getEveryYearSchedule() { - QVector schedule; //设置重复类型 m_widget->setRpeat(5); //创建日程 - m_dbus->CreateJob(setDateTimeAndGetSchedule(m_begintime, m_endtime)); - //将多有日程添加到日程容器中 - schedule.append(setDateTimeAndGetSchedule(m_begintime, m_endtime)); - - return schedule; + return DScheduleDataManager::getInstance()->createSchedule(setDateTimeAndGetSchedule(m_begintime, m_endtime)); } -QVector createScheduleTask::getEveryWorkDaySchedule() +QString createScheduleTask::getEveryWorkDaySchedule() { - QVector beginDateTime {}; - QVector schedule; + // QVector beginDateTime {}; + // DSchedule::List schedule; //获取解析日期 - beginDateTime = analysisWorkDayDate(); + // beginDateTime = analysisWorkDayDate(); //设置重复类型 m_widget->setRpeat(2); + //创建日程 + return DScheduleDataManager::getInstance()->createSchedule(setDateTimeAndGetSchedule(m_begintime, m_endtime)); - for (int i = 0; i < beginDateTime.count(); i++) { - //设置日程结束时间 - m_endtime.setDate(beginDateTime.at(i).date()); - //创建日程 - m_dbus->CreateJob(setDateTimeAndGetSchedule(beginDateTime.at(i), m_endtime)); - //将所有日程添加到日程容器中 - schedule.append(setDateTimeAndGetSchedule(beginDateTime.at(i), m_endtime)); - } + // for (int i = 0; i < beginDateTime.count(); i++) { + // //设置日程结束时间 + // m_endtime.setDate(beginDateTime.at(i).date()); + // //创建日程 + // DScheduleDataManager::getInstance()->createSchedule(setDateTimeAndGetSchedule(beginDateTime.at(i), m_endtime)); + // //将所有日程添加到日程容器中 + // schedule.append(setDateTimeAndGetSchedule(beginDateTime.at(i), m_endtime)); + // } - return schedule; + // return schedule; } -QVector createScheduleTask::getEveryRestDaySchedule() +QString createScheduleTask::getEveryRestDaySchedule() { QVector beginDateTime {}; - QVector schedule; + QStringList scheduleIDs; //设置重复类型 m_widget->setRpeat(3); //获取解析的时间 @@ -411,23 +373,22 @@ //设置日程结束时间 m_endtime.setDate(beginDateTime.at(i).date()); //创建日程 - m_dbus->CreateJob(setDateTimeAndGetSchedule(beginDateTime.at(i), m_endtime)); - //将所有日程添加到日程容器中 - schedule.append(setDateTimeAndGetSchedule(beginDateTime.at(i), m_endtime)); + scheduleIDs.append(DScheduleDataManager::getInstance()->createSchedule(setDateTimeAndGetSchedule(beginDateTime.at(i), m_endtime))); } - return schedule; + //创建多个日程返回第一个 + return scheduleIDs.isEmpty() ? QString() : scheduleIDs.first(); } -ScheduleDtailInfo createScheduleTask::getFirstSchedule(QVector scheduleInfo) +DSchedule::Ptr createScheduleTask::getFirstSchedule(DSchedule::List scheduleInfo) { //第一个日程的时间 - QDate earlyDate = scheduleInfo.at(0).beginDateTime.date(); + QDate earlyDate = scheduleInfo.at(0)->dtStart().date(); //第一个日程的索引 int index = 0; for (int i = 1; i < scheduleInfo.count(); i++) { - if (earlyDate > scheduleInfo.at(i).beginDateTime.date()) { - earlyDate = scheduleInfo.at(i).beginDateTime.date(); + if (earlyDate > scheduleInfo.at(i)->dtStart().date()) { + earlyDate = scheduleInfo.at(i)->dtStart().date(); index = i; } } @@ -616,7 +577,7 @@ return beginDateTime; } -ScheduleDtailInfo createScheduleTask::setDateTimeAndGetSchedule(QDateTime beginDateTime, QDateTime endDateTime) +DSchedule::Ptr createScheduleTask::setDateTimeAndGetSchedule(QDateTime beginDateTime, QDateTime endDateTime) { m_widget->setDateTime(beginDateTime, endDateTime); m_widget->setschedule(); diff -Nru dde-calendar-5.9.1/schedule-plugin/src/task/createscheduletask.h dde-calendar-5.10.0/schedule-plugin/src/task/createscheduletask.h --- dde-calendar-5.9.1/schedule-plugin/src/task/createscheduletask.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/task/createscheduletask.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef CREATESCHEDULETASK_H #define CREATESCHEDULETASK_H @@ -33,7 +17,7 @@ { Q_OBJECT public: - explicit createScheduleTask(CSchedulesDBus *dbus); + createScheduleTask(); Reply SchedulePress(semanticAnalysisTask &semanticTask) override; private: @@ -52,12 +36,12 @@ * @param createJsonData jsondata句柄 * @return 日程信息 */ - QVector createScheduleWithRepeatStatus(CreateJsonData *createJsonData); + QString createScheduleWithRepeatStatus(CreateJsonData *createJsonData); /** * @brief creareScheduleUI 新建日程插件 * @param schedule 日程信息 */ - void creareScheduleUI(QVector schedule); + void creareScheduleUI(const QString &scheduleID); /** * @brief getReply 获取回复语 * @param createJsonData jsondata句柄 @@ -83,45 +67,45 @@ * @brief setNotRepeatDay 获取非重复的日程 * @return 日程信息 */ - QVector getNotRepeatDaySchedule(); + QString getNotRepeatDaySchedule(); /** * @brief getEveryDaySchedule 获取每天重复的日程 * @return 日程信息 */ - QVector getEveryDaySchedule(); + QString getEveryDaySchedule(); /** * @brief getEveryWeekSchedule 获取每周重复的日程 * @param dateRange 开始和结束的周数 * @return 日程信息 */ - QVector getEveryWeekSchedule(QVector dateRange); + QString getEveryWeekSchedule(QVector dateRange); /** * @brief getEveryMonthSchedule 获取每月重复的日程 * @param dateRange 开始和结束的日期数 * @return 日程信息 */ - QVector getEveryMonthSchedule(QVector dateRange); + QString getEveryMonthSchedule(QVector dateRange); /** * @brief getEveryDYearSchedule 获取每年重复的日程 * @return 日程信息 */ - QVector getEveryYearSchedule(); + QString getEveryYearSchedule(); /** * @brief getEveryWorkDaySchedule 获取工作日的日程 * @return 日程信息 */ - QVector getEveryWorkDaySchedule(); + QString getEveryWorkDaySchedule(); /** * @brief getEveryRestDaySchedule 获取休息日的日程 * @return 日程信息 */ - QVector getEveryRestDaySchedule(); + QString getEveryRestDaySchedule(); /** * @brief getFirstSchedule 获取第一个日程 * @param scheduleInfo 所有日程信息的容器 * @return 第一个日程的日程信息 */ - ScheduleDtailInfo getFirstSchedule(QVector scheduleInfo); + DSchedule::Ptr getFirstSchedule(DSchedule::List scheduleInfo); /** * @brief getCreatesDays 获取新建日程的天数 * @param firstDay 开始日期 @@ -265,7 +249,7 @@ * @param endDateTime 日程结束时间 * @return 日程信息 */ - ScheduleDtailInfo setDateTimeAndGetSchedule(QDateTime beginDateTime, QDateTime endDateTime); + DSchedule::Ptr setDateTimeAndGetSchedule(QDateTime beginDateTime, QDateTime endDateTime); /** * @brief analysisWorkDayDate 解析工作日的日程的日期 * @return 日期容器 diff -Nru dde-calendar-5.9.1/schedule-plugin/src/task/queryscheduleproxy.cpp dde-calendar-5.10.0/schedule-plugin/src/task/queryscheduleproxy.cpp --- dde-calendar-5.9.1/schedule-plugin/src/task/queryscheduleproxy.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/task/queryscheduleproxy.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,48 +1,32 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "queryscheduleproxy.h" #include "../globaldef.h" #include "../data/changejsondata.h" +#include "dscheduledatamanager.h" -bool scheduleSort(const ScheduleDtailInfo &s1, const ScheduleDtailInfo &s2) +bool scheduleSort(const DSchedule::Ptr &s1, const DSchedule::Ptr &s2) { - if (s1.beginDateTime < s2.beginDateTime) { + if (s1->dtStart() < s2->dtStart()) { return true; - } else if (s1.beginDateTime == s2.beginDateTime) { - return s1.endDateTime < s2.endDateTime; + } else if (s1->dtStart() == s2->dtStart()) { + return s1->dtEnd() < s2->dtEnd(); } else { return false; } } -queryScheduleProxy::queryScheduleProxy(JsonData *jsonData, CSchedulesDBus *dbus) +queryScheduleProxy::queryScheduleProxy(JsonData *jsonData) : m_queryJsonData(jsonData) - , m_dbus(dbus) { } -QVector queryScheduleProxy::querySchedule() +DSchedule::Map queryScheduleProxy::querySchedule() { - QVector scheduleInfo {}; + DSchedule::Map scheduleInfo {}; scheduleInfo.clear(); switch (m_queryJsonData->getRepeatStatus()) { case JsonData::RepeatStatus::NONE: @@ -102,7 +86,7 @@ if (queryDatetime.suggestDatetime.size() == 1) { //查询的日期 QDate beginD = queryDatetime.suggestDatetime.at(0).datetime.date(); - QDate endD = beginD; + QDate endD = endTime.date(); //过滤包含查询日期的日程 scheduleInfo = scheduleFileterByDate(scheduleInfo, beginD, endD); } @@ -134,7 +118,17 @@ return scheduleInfo; } -QVector queryScheduleProxy::queryWeeklySchedule(QDateTime &beginTime, QDateTime &endTime, int beginW, int endW) +DSchedule::List queryScheduleProxy::scheduleMapToList(const DSchedule::Map &scheduleMap) +{ + DSchedule::List scheduleList; + DSchedule::Map::const_iterator iter = scheduleMap.constBegin(); + for (; iter != scheduleMap.constEnd(); ++iter) { + scheduleList.append(iter.value()); + } + return scheduleList; +} + +DSchedule::Map queryScheduleProxy::queryWeeklySchedule(QDateTime &beginTime, QDateTime &endTime, int beginW, int endW) { QSet weeklySet; if (beginW == endW) { @@ -164,8 +158,9 @@ weeklySet.insert(w); } } - QVector out {}; - m_dbus->QueryJobsWithRule(beginTime, endTime, DBUS_RRUL_EVEW, out); + //TODO:查询数据 + // m_dbus->QueryJobsWithRule(beginTime, endTime, DBUS_RRUL_EVEW, out); + DSchedule::Map out = DScheduleDataManager::getInstance()->queryScheduleByRRule(beginTime, endTime, DScheduleQueryPar::RRule_Week); if (beginW == 0 || endW == 0) { weeklySet.clear(); @@ -174,37 +169,33 @@ return WeeklyScheduleFileter(out, weeklySet); } -QVector queryScheduleProxy::queryMonthlySchedule(QDateTime &beginTime, QDateTime &endTime, int beginM, int endM) +DSchedule::Map queryScheduleProxy::queryMonthlySchedule(QDateTime &beginTime, QDateTime &endTime, int beginM, int endM) { - QVector out {}; - m_dbus->QueryJobsWithRule(beginTime, endTime, DBUS_RRUL_EVEM, out); + DSchedule::Map out = DScheduleDataManager::getInstance()->queryScheduleByRRule(beginTime, endTime, DScheduleQueryPar::RRule_Month); return MonthlyScheduleFileter(out, beginM, endM); } -QVector queryScheduleProxy::queryEveryDaySchedule(QDateTime &beginTime, QDateTime &endTime) +DSchedule::Map queryScheduleProxy::queryEveryDaySchedule(QDateTime &beginTime, QDateTime &endTime) { - QVector out {}; - m_dbus->QueryJobsWithRule(beginTime, endTime, DBUS_RRUL_EVED, out); + DSchedule::Map out = DScheduleDataManager::getInstance()->queryScheduleByRRule(beginTime, endTime, DScheduleQueryPar::RRule_Day); return sortAndFilterSchedule(out); } -QVector queryScheduleProxy::queryEveryYearSchedule(QDateTime &beginTime, QDateTime &endTime) +DSchedule::Map queryScheduleProxy::queryEveryYearSchedule(QDateTime &beginTime, QDateTime &endTime) { - QVector out {}; - m_dbus->QueryJobsWithRule(beginTime, endTime, DBUS_RRUL_EVEY, out); + DSchedule::Map out = DScheduleDataManager::getInstance()->queryScheduleByRRule(beginTime, endTime, DScheduleQueryPar::RRule_Year); return sortAndFilterSchedule(out); } -QVector queryScheduleProxy::queryWorkingDaySchedule(QDateTime &beginTime, QDateTime &endTime) +DSchedule::Map queryScheduleProxy::queryWorkingDaySchedule(QDateTime &beginTime, QDateTime &endTime) { - QVector out {}; - m_dbus->QueryJobsWithRule(beginTime, endTime, DBUS_RRUL_WORK, out); + DSchedule::Map out = DScheduleDataManager::getInstance()->queryScheduleByRRule(beginTime, endTime, DScheduleQueryPar::RRule_Work); return sortAndFilterSchedule(out); } -QVector queryScheduleProxy::queryNonRepeatingSchedule() +DSchedule::Map queryScheduleProxy::queryNonRepeatingSchedule() { - QVector mScheduleInfoVector {}; + DSchedule::Map mScheduleInfoVector {}; mScheduleInfoVector.clear(); SemanticsDateTime queryDatetime = getQueryDateTime(m_queryJsonData); //如果开始时间大于结束时间则退出 @@ -213,12 +204,14 @@ } switch (m_queryJsonData->getPropertyStatus()) { case JsonData::PropertyStatus::ALL: { + //查询所有日程 DateTimeLimit timeLimit = getTimeLimitByTimeInfo(queryDatetime); if (!getTimeIsExpired()) { mScheduleInfoVector = queryAllSchedule(m_queryJsonData->TitleName(), timeLimit.beginTime, timeLimit.endTime); } } break; case JsonData::PropertyStatus::NEXT: { + //查询下个日程 TIME_FRAME_IN_THE_NEXT_SIX_MONTHT mScheduleInfoVector = queryNextNumSchedule(beginTime, endTime, 1); } break; @@ -226,6 +219,7 @@ } break; default: { //NONE + //查询所有日程 DateTimeLimit timeLimit = getTimeLimitByTimeInfo(queryDatetime); if (!getTimeIsExpired()) { mScheduleInfoVector = queryAllSchedule(m_queryJsonData->TitleName(), timeLimit.beginTime, timeLimit.endTime); @@ -235,69 +229,88 @@ return mScheduleInfoVector; } -QVector queryScheduleProxy::queryNextNumSchedule(QDateTime &beginTime, QDateTime &endTime, int NextNum) +DSchedule::Map queryScheduleProxy::queryNextNumSchedule(QDateTime &beginTime, QDateTime &endTime, int NextNum) { - QVector mScheduleInfoVector {}; - QVector out {}; - m_dbus->QueryJobsWithLimit(beginTime, endTime, NextNum, out); + DSchedule::Map out = DScheduleDataManager::getInstance()->queryScheduleByLimit(beginTime, endTime, NextNum); return sortAndFilterSchedule(out); } -QVector queryScheduleProxy::queryAllSchedule(QString key, QDateTime &beginTime, QDateTime &endTime) +DSchedule::Map queryScheduleProxy::queryAllSchedule(QString key, QDateTime &beginTime, QDateTime &endTime) { - QVector out {}; - m_dbus->QueryJobs(key, beginTime, endTime, out); + DSchedule::Map out = DScheduleDataManager::getInstance()->queryScheduleBySummary(beginTime, endTime, key); return sortAndFilterSchedule(out); } -QVector queryScheduleProxy::sortAndFilterSchedule(QVector &out) +DSchedule::Map queryScheduleProxy::sortAndFilterSchedule(DSchedule::Map &out) { - QVector scheduleInfo {}; - for (int i = 0; i < out.size(); ++i) { - for (int j = 0; j < out[i].vData.size(); ++j) { - if (!(scheduleInfo.contains(out[i].vData[j]) || out[i].vData[j].type.ID == 4)) { - scheduleInfo.append(out[i].vData[j]); + DSchedule::Map scheduleInfo {}; + DSchedule::Iter iter = out.begin(); + for (; iter != out.end(); ++iter) { + DSchedule::List scheduleList; + for (int i = 0; i < iter->size(); ++i) { + if (!(scheduleList.contains(iter.value().at(i)) + || DScheduleDataManager::getInstance()->isFestivalSchedule(iter.value().at(i)->scheduleTypeID()))) { + scheduleList.append(iter.value().at(i)); } } + if (scheduleList.size() > 0) { + scheduleInfo[iter.key()] = scheduleList; + } } - std::sort(scheduleInfo.begin(), scheduleInfo.end(), scheduleSort); + //TODO:排序 + // std::sort(scheduleInfo.begin(), scheduleInfo.end(), scheduleSort); return scheduleInfo; } -QVector queryScheduleProxy::WeeklyScheduleFileter(QVector &out, QSet &weeklySet) +DSchedule::Map queryScheduleProxy::WeeklyScheduleFileter(DSchedule::Map &out, QSet &weeklySet) { - QVector scheduleInfo {}; + DSchedule::Map scheduleInfo {}; if (weeklySet.size() == 0) { return sortAndFilterSchedule(out); } else { - for (int i = 0; i < out.size(); ++i) { - for (int j = 0; j < out[i].vData.size(); ++j) { - if (!(scheduleInfo.contains(out[i].vData[j])) && weeklyIsIntersections(out[i].vData[j].beginDateTime, out[i].vData[j].endDateTime, weeklySet)) { - scheduleInfo.append(out[i].vData[j]); + DSchedule::Iter iter = out.begin(); + for (; iter != out.end(); ++iter) { + DSchedule::List scheduleList; + for (int i = 0; i < iter->size(); ++i) { + DSchedule::Ptr schedule = iter.value().at(i); + if (!scheduleList.contains(schedule) + && weeklyIsIntersections(schedule->dtStart(), schedule->dtEnd(), weeklySet)) { + scheduleList.append(iter.value().at(i)); } } + if (scheduleList.size() > 0) { + scheduleInfo[iter.key()] = scheduleList; + } } } return scheduleInfo; } -QVector queryScheduleProxy::MonthlyScheduleFileter(QVector &out, int beginM, int endM) +DSchedule::Map queryScheduleProxy::MonthlyScheduleFileter(DSchedule::Map &out, int beginM, int endM) { if (beginM == 0 || endM == 0) { return sortAndFilterSchedule(out); } - QVector scheduleInfo {}; - for (int i = 0; i < out.size(); ++i) { - for (int j = 0; j < out[i].vData.size(); ++j) { - if (!(scheduleInfo.contains(out[i].vData[j])) && monthlyIsIntersections(out[i].vData[j].beginDateTime, out[i].vData[j].endDateTime, beginM, endM)) { - scheduleInfo.append(out[i].vData[j]); + DSchedule::Map scheduleInfo {}; + + DSchedule::Iter iter = out.begin(); + for (; iter != out.end(); ++iter) { + DSchedule::List scheduleList; + for (int i = 0; i < iter->size(); ++i) { + DSchedule::Ptr schedule = iter.value().at(i); + if (!scheduleList.contains(schedule) + && monthlyIsIntersections(schedule->dtStart(), schedule->dtEnd(), beginM, endM)) { + scheduleList.append(iter.value().at(i)); } } + if (scheduleList.size() > 0) { + scheduleInfo[iter.key()] = scheduleList; + } } return scheduleInfo; } -bool queryScheduleProxy::monthlyIsIntersections(QDateTime &beginTime, QDateTime &endTime, int beginM, int endM) +bool queryScheduleProxy::monthlyIsIntersections(const QDateTime &beginTime, const QDateTime &endTime, int beginM, int endM) { bool b_monthly = false; int beginDay = beginTime.date().day(); @@ -331,24 +344,32 @@ return b_checked; } -QVector queryScheduleProxy::scheduleFileterByTime(QVector &scheduleInfo, QTime &fileterBeginTime, QTime &fileterEndTime) +DSchedule::Map queryScheduleProxy::scheduleFileterByTime(DSchedule::Map &scheduleInfo, QTime &fileterBeginTime, QTime &fileterEndTime) { - QVector mScheduleFileter {}; + DSchedule::Map mScheduleFileter {}; qint64 timeoffset_Secs = 0; bool isApppend = false; - for (int i = 0; i < scheduleInfo.size(); ++i) { - timeoffset_Secs = scheduleInfo.at(i).beginDateTime.secsTo(scheduleInfo.at(i).endDateTime); - if (timeoffset_Secs < ONE_DAY_SECS) { - QTime begTime = scheduleInfo.at(i).beginDateTime.time(); - QTime endTime = scheduleInfo.at(i).endDateTime.time(); - isApppend = checkedTimeIsIntersection(begTime, endTime, fileterBeginTime, fileterEndTime); - } else { - isApppend = true; + DSchedule::Map::const_iterator iter = scheduleInfo.constBegin(); + for (; iter != scheduleInfo.constEnd(); ++iter) { + DSchedule::List scheduleList; + for (int i = 0; i < iter.value().size(); ++i) { + timeoffset_Secs = iter.value().at(i)->dtStart().secsTo(iter.value().at(i)->dtEnd()); + if (timeoffset_Secs < ONE_DAY_SECS) { + QTime begTime = iter.value().at(i)->dtStart().time(); + QTime endTime = iter.value().at(i)->dtEnd().time(); + isApppend = checkedTimeIsIntersection(begTime, endTime, fileterBeginTime, fileterEndTime); + } else { + isApppend = true; + } + if (isApppend) { + scheduleList.append(iter.value().at(i)); + } } - if (isApppend) { - mScheduleFileter.append(scheduleInfo.at(i)); + if (scheduleList.size() > 0) { + mScheduleFileter[iter.key()] = scheduleList; } } + return mScheduleFileter; } @@ -359,35 +380,51 @@ * @param fileterEndDate 查询的结束时间 * @return 过滤后的日程信息 */ -QVector queryScheduleProxy::scheduleFileterByDate(QVector &scheduleInfo, QDate &fileterBeginDate, QDate &fileterEndDate) +DSchedule::Map queryScheduleProxy::scheduleFileterByDate(DSchedule::Map &scheduleInfo, QDate &fileterBeginDate, QDate &fileterEndDate) { - QVector mScheduleFileter {}; + DSchedule::Map mScheduleFileter {}; //遍历查询到的日程 - for (int i = 0; i < scheduleInfo.size(); i++) { - //查询到的日程的开始结束日期 - QDate beginD = scheduleInfo.at(i).beginDateTime.date(); - QDate endD = scheduleInfo.at(i).endDateTime.date(); - //过滤添加包含查询日期的日程 - if ((fileterBeginDate <= beginD && fileterEndDate >= beginD) - || (fileterBeginDate >= beginD && fileterBeginDate <= endD)) { - mScheduleFileter.append(scheduleInfo.at(i)); + + DSchedule::Map::const_iterator iter = scheduleInfo.constBegin(); + for (; iter != scheduleInfo.constEnd(); ++iter) { + DSchedule::List scheduleList; + for (int i = 0; i < iter.value().size(); ++i) { + //查询到的日程的开始结束日期 + QDate beginD = iter.value().at(i)->dtStart().date(); + QDate endD = iter.value().at(i)->dtEnd().date(); + //过滤添加包含查询日期的日程 + if ((fileterBeginDate <= beginD && fileterEndDate >= beginD) + || (fileterBeginDate >= endD && fileterBeginDate <= endD)) { + scheduleList.append(iter.value().at(i)); + } + } + if (scheduleList.size() > 0) { + mScheduleFileter[iter.key()] = scheduleList; } } + return mScheduleFileter; } -QVector queryScheduleProxy::scheduleFileterByTitleName(QVector &scheduleInfo, const QString &strName) +DSchedule::Map queryScheduleProxy::scheduleFileterByTitleName(DSchedule::Map &scheduleInfo, const QString &strName) { - QVector mScheduleFileter {}; - for (int i = 0; i < scheduleInfo.size(); ++i) { - if (scheduleInfo.at(i).titleName.contains(strName)) { - mScheduleFileter.append(scheduleInfo.at(i)); + DSchedule::Map mScheduleFileter {}; + DSchedule::Map::const_iterator iter = scheduleInfo.constBegin(); + for (; iter != scheduleInfo.constEnd(); ++iter) { + DSchedule::List scheduleList; + for (int i = 0; i < iter.value().size(); ++i) { + if (iter.value().at(i)->summary().contains(strName)) { + scheduleList.append(iter.value().at(i)); + } + } + if (scheduleList.size() > 0) { + mScheduleFileter[iter.key()] = scheduleList; } } return mScheduleFileter; } -bool queryScheduleProxy::weeklyIsIntersections(QDateTime &beginTime, QDateTime &endTime, QSet &weeklySet) +bool queryScheduleProxy::weeklyIsIntersections(const QDateTime &beginTime, const QDateTime &endTime, QSet &weeklySet) { QSet scheduleWeekSet; bool returnValue = false; diff -Nru dde-calendar-5.9.1/schedule-plugin/src/task/queryscheduleproxy.h dde-calendar-5.10.0/schedule-plugin/src/task/queryscheduleproxy.h --- dde-calendar-5.9.1/schedule-plugin/src/task/queryscheduleproxy.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/task/queryscheduleproxy.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,35 +1,20 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef QUERYSCHEDULEPROXY_H #define QUERYSCHEDULEPROXY_H -#include "../data/schedulestructs.h" +#include "dschedule.h" #include "../data/jsondata.h" -#include "../dbus/schedulesdbus.h" +#include "accountitem.h" class queryScheduleProxy { public: - queryScheduleProxy(JsonData *jsonData, CSchedulesDBus *dbus); - QVector querySchedule(); + queryScheduleProxy(JsonData *jsonData); + DSchedule::Map querySchedule(); + DSchedule::List scheduleMapToList(const DSchedule::Map &scheduleMap); bool getTimeIsExpired() const; private: @@ -42,26 +27,26 @@ QTime endTime; bool isInvalid {false}; }; - QVector queryWeeklySchedule(QDateTime &beginTime, QDateTime &endTime, int beginW = 0, int endW = 0); - QVector queryMonthlySchedule(QDateTime &beginTime, QDateTime &endTime, int beginM = 0, int endM = 0); - QVector queryEveryDaySchedule(QDateTime &beginTime, QDateTime &endTime); - QVector queryEveryYearSchedule(QDateTime &beginTime, QDateTime &endTime); - QVector queryWorkingDaySchedule(QDateTime &beginTime, QDateTime &endTime); - QVector queryNonRepeatingSchedule(); - QVector queryNextNumSchedule(QDateTime &beginTime, QDateTime &endTime, int NextNum); - QVector queryAllSchedule(QString key, QDateTime &beginTime, QDateTime &endTime); - - QVector sortAndFilterSchedule(QVector &out); - QVector WeeklyScheduleFileter(QVector &out, QSet &weeklySet); - QVector MonthlyScheduleFileter(QVector &out, int beginM = 0, int endM = 0); - bool monthlyIsIntersections(QDateTime &beginTime, QDateTime &endTime, int beginM = 0, int endM = 0); + DSchedule::Map queryWeeklySchedule(QDateTime &beginTime, QDateTime &endTime, int beginW = 0, int endW = 0); + DSchedule::Map queryMonthlySchedule(QDateTime &beginTime, QDateTime &endTime, int beginM = 0, int endM = 0); + DSchedule::Map queryEveryDaySchedule(QDateTime &beginTime, QDateTime &endTime); + DSchedule::Map queryEveryYearSchedule(QDateTime &beginTime, QDateTime &endTime); + DSchedule::Map queryWorkingDaySchedule(QDateTime &beginTime, QDateTime &endTime); + DSchedule::Map queryNonRepeatingSchedule(); + DSchedule::Map queryNextNumSchedule(QDateTime &beginTime, QDateTime &endTime, int NextNum); + DSchedule::Map queryAllSchedule(QString key, QDateTime &beginTime, QDateTime &endTime); + + DSchedule::Map sortAndFilterSchedule(DSchedule::Map &out); + DSchedule::Map WeeklyScheduleFileter(DSchedule::Map &out, QSet &weeklySet); + DSchedule::Map MonthlyScheduleFileter(DSchedule::Map &out, int beginM = 0, int endM = 0); + bool monthlyIsIntersections(const QDateTime &beginTime, const QDateTime &endTime, int beginM = 0, int endM = 0); bool checkedTimeIsIntersection(QTime &beginTime, QTime &endTime, QTime &fixbeginTime, QTime &fixendTime); - QVector scheduleFileterByTime(QVector &scheduleInfo, QTime &fileterBeginTime, QTime &fileterEndTime); - QVector scheduleFileterByDate(QVector &scheduleInfo, QDate &fileterBeginDate, QDate &fileterEndDate); - QVector scheduleFileterByTitleName(QVector &scheduleInfo, const QString &strName); - bool weeklyIsIntersections(QDateTime &beginTime, QDateTime &endTime, QSet &weeklySet); + DSchedule::Map scheduleFileterByTime(DSchedule::Map &scheduleInfo, QTime &fileterBeginTime, QTime &fileterEndTime); + DSchedule::Map scheduleFileterByDate(DSchedule::Map &scheduleInfo, QDate &fileterBeginDate, QDate &fileterEndDate); + DSchedule::Map scheduleFileterByTitleName(DSchedule::Map &scheduleInfo, const QString &strName); + bool weeklyIsIntersections(const QDateTime &beginTime, const QDateTime &endTime, QSet &weeklySet); SemanticsDateTime getQueryDateTime(JsonData *jsonData); @@ -76,7 +61,6 @@ bool timeFrameIsValid(const SemanticsDateTime &timeInfoVect); private: JsonData *m_queryJsonData; - CSchedulesDBus *m_dbus {nullptr}; bool m_TimeIsExpired {false}; }; diff -Nru dde-calendar-5.9.1/schedule-plugin/src/task/queryscheduletask.cpp dde-calendar-5.10.0/schedule-plugin/src/task/queryscheduletask.cpp --- dde-calendar-5.9.1/schedule-plugin/src/task/queryscheduletask.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/task/queryscheduletask.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,28 +1,14 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "queryscheduletask.h" #include "../globaldef.h" +#include "dscheduledatamanager.h" +#include "queryscheduleproxy.h" -queryScheduleTask::queryScheduleTask(CSchedulesDBus *dbus) - : scheduleBaseTask(dbus) +queryScheduleTask::queryScheduleTask() + : scheduleBaseTask() { } @@ -45,52 +31,13 @@ REPLY_ONLY_TTS(m_reply, CANCEL_ERR_TTS, CANCEL_ERR_TTS, true); return m_reply; } - - QString m_queryTitleName = queryJsonData->TitleName(); - QVector getDayNum = queryJsonData->getRepeatNum(); viewWidget = new viewschedulewidget(); - QVector showdate; - TIME_FRAME_IN_THE_NEXT_SIX_MONTHT - QVector schedule = getSchedule(m_queryTitleName, beginTime, endTime); + queryScheduleProxy m_querySchedule(queryJsonData); + DSchedule::Map showdate = m_querySchedule.querySchedule(); setDateTime(queryJsonData); - switch (queryJsonData->getRepeatStatus()) { - case QueryJsonData::RepeatStatus::EVED: { - showdate = getEveryDayOrWorkDaySchedule(queryJsonData, 1); - } - break; - case QueryJsonData::RepeatStatus::WORKD: { - showdate = getEveryDayOrWorkDaySchedule(queryJsonData, 2); - } - break; - case QueryJsonData::RepeatStatus::RESTD: { - QVector queryRest; - queryRest.append(6); - queryRest.append(7); - - showdate = getRestDaySchedule(queryJsonData, queryRest); - } - break; - case QueryJsonData::RepeatStatus::EVEW: { - showdate = getEveryWeekSchedule(queryJsonData, getDayNum); - } - break; - case QueryJsonData::RepeatStatus::EVEM: { - showdate = getEveryMonthSchedule(queryJsonData, getDayNum); - } - break; - case QueryJsonData::RepeatStatus::EVEY: { - showdate = getEveryYearSchedule(queryJsonData); - } - break; - default: { - showdate = getNonePropertyStatusSchedule(queryJsonData, schedule); - } - break; - } - viewWidget->viewScheduleInfoShow(showdate); Reply m_reply; @@ -191,216 +138,6 @@ } } -QVector queryScheduleTask::getSchedule(QString titleName, QDateTime beginDatetime, QDateTime endDateTime) -{ - QVector schedule; - //使用dbus查询日程 - m_dbus->QueryJobs(titleName, beginDatetime, endDateTime, schedule); - //设置查询的日程 - viewWidget->setScheduleDateRangeInfo(schedule); - //返回过滤后的日程 - return viewWidget->getAllScheduleInfo(); -} - -QVector queryScheduleTask::getEveryDayOrWorkDaySchedule(QueryJsonData *queryJsonData, int repeat) -{ - QTime m_BTime; - QTime m_ETime; - QVector schedule; - schedule = viewWidget->getAllRpeatScheduleInfo(repeat); - if (queryJsonData->getDateTime().suggestDatetime.at(0).hasTime) { - m_BTime = m_BeginDateTime.time(); - m_ETime = m_EndDateTime.time(); - schedule = viewWidget->queryScheduleWithTime(schedule, m_BTime, m_ETime); - } - return schedule; -} - -QVector queryScheduleTask::getRestDaySchedule(QueryJsonData *queryJsonData, QVector queryWeek) -{ - QVector schedule; - QTime m_BTime; - QTime m_ETime; - //查询所有周重复的日程 - schedule = viewWidget->getAllRpeatScheduleInfo(3); - //查询周几-周几的重复日程 - schedule = viewWidget->queryScheduleWithWeek(schedule, queryWeek); - //如果有时间,则再按照时间进行过滤 - if (queryJsonData->getDateTime().suggestDatetime.at(0).hasTime) { - m_BTime = queryJsonData->getDateTime().suggestDatetime.at(0).datetime.time(); - m_ETime = m_BTime; - schedule = viewWidget->queryScheduleWithTime(schedule, m_BTime, m_ETime); - } - return schedule; -} - -QVector queryScheduleTask::getEveryWeekSchedule(QueryJsonData *queryJsonData, QVector repeatNum) -{ - QTime m_BTime; - QTime m_ETime; - QVector schedule; - //查询所有周重复的日程 - schedule = viewWidget->getAllRpeatScheduleInfo(3); - - if (repeatNum.size() == 1) { - QVector queryWeek; - queryWeek.append(repeatNum[0]); - - schedule = viewWidget->queryScheduleWithWeek(schedule, queryWeek); - if (queryJsonData->getDateTime().suggestDatetime.at(0).hasTime) { - m_BTime = queryJsonData->getDateTime().suggestDatetime.at(0).datetime.time(); - m_ETime = m_BTime; - schedule = viewWidget->queryScheduleWithTime(schedule, m_BTime, m_ETime); - } - } else if (repeatNum.size() == 2) { - int start = repeatNum[0]; - int end = repeatNum[1]; - QVector queryWeek; - - if (start == end) { - return viewWidget->getAllRpeatScheduleInfo(1); - } else if (start < end) { - if (start == 1 && end == 5) { - return viewWidget->getAllRpeatScheduleInfo(2); - } else if (end - start == 6) { - return viewWidget->getAllRpeatScheduleInfo(1); - } else { - for (int i = start; i <= end; i++) { - queryWeek.append(i); - } - } - } else { - if (start - end == 1) { - return viewWidget->getAllRpeatScheduleInfo(1); - } else { - for (int i = 0; i <= 7 - start; i++) { - queryWeek.append(i + start); - } - for (int i = 0; i < end; i++) { - queryWeek.append(i + 1); - } - } - } - //查询周几-周几的重复日程 - schedule = viewWidget->queryScheduleWithWeek(schedule, queryWeek); - if (queryJsonData->getDateTime().suggestDatetime.size() == 1) { - if (queryJsonData->getDateTime().suggestDatetime.at(0).hasTime) { - m_BTime = QTime(0, 0, 0); - m_ETime = queryJsonData->getDateTime().suggestDatetime.at(0).datetime.time(); - schedule = viewWidget->queryScheduleWithWeek(schedule, queryWeek, end, m_BTime, m_ETime); - } - } - } - return schedule; -} - -QVector queryScheduleTask::getEveryMonthSchedule(QueryJsonData *queryJsonData, QVector repeatNum) -{ - QTime m_BTime; - QTime m_ETime; - QVector schedule; - //查询所有月重复的日程 - schedule = viewWidget->getAllRpeatScheduleInfo(4); - - if (repeatNum.size() == 1) { - QVector queryMonth; - queryMonth.append(repeatNum[0]); - - schedule = viewWidget->queryScheduleWithMonth(schedule, queryMonth); - if (queryJsonData->getDateTime().suggestDatetime.size() == 1) { - if (queryJsonData->getDateTime().suggestDatetime.at(0).hasTime) { - m_BTime = queryJsonData->getDateTime().suggestDatetime.at(0).datetime.time(); - m_ETime = m_BTime; - schedule = viewWidget->queryScheduleWithTime(schedule, m_BTime, m_ETime); - } - } else if (queryJsonData->getDateTime().suggestDatetime.size() == 2) { - m_BTime = queryJsonData->getDateTime().suggestDatetime.at(0).datetime.time(); - m_ETime = queryJsonData->getDateTime().suggestDatetime.at(1).datetime.time(); - schedule = viewWidget->queryScheduleWithTime(schedule, m_BTime, m_ETime); - } - } else if (repeatNum.size() == 2) { - int start = repeatNum[0]; - int end = repeatNum[1]; - QVector queryMonth; - - if (start == end) { - return viewWidget->getAllRpeatScheduleInfo(1); - } else if (start < end) { - for (int i = start; i <= end; i++) { - queryMonth.append(i); - } - } - - schedule = viewWidget->queryScheduleWithMonth(schedule, queryMonth); - } else { - if (queryJsonData->getDateTime().suggestDatetime.at(0).hasTime) { - m_BTime = queryJsonData->getDateTime().suggestDatetime.at(0).datetime.time(); - m_ETime = m_BTime; - schedule = viewWidget->queryScheduleWithTime(schedule, m_BTime, m_ETime); - } - } - return schedule; -} - -QVector queryScheduleTask::getEveryYearSchedule(QueryJsonData *queryJsonData) -{ - Q_UNUSED(queryJsonData) - QVector schedule; - - if (queryJsonData->getDateTime().suggestDatetime.size() == 1) { - //查询所有年重复的日程 - schedule = viewWidget->getAllRpeatScheduleInfo(5); - //设置查询的开始结束日期 - QDate m_beginD = queryJsonData->getDateTime().suggestDatetime.at(0).datetime.date(); - QDate m_endD = m_beginD; - //按照日期查询日程 - schedule = viewWidget->queryScheduleWithDate(schedule, m_beginD, m_endD); - //如果有时间,则按照时间查询 - if (queryJsonData->getDateTime().suggestDatetime.at(0).hasTime) { - QTime m_beginT = queryJsonData->getDateTime().suggestDatetime.at(0).datetime.time(); - QTime m_endT = m_beginT; - schedule = viewWidget->queryScheduleWithTime(schedule, m_beginT, m_endT); - } - } - - return schedule; -} - -QVector queryScheduleTask::getNonePropertyStatusSchedule(QueryJsonData *queryJsonData, QVector schedule) -{ - QVector scheduleInfo; - scheduleInfo.clear(); - - switch (queryJsonData->getPropertyStatus()) { - case QueryJsonData::PropertyStatus::ALL: { - //查询所有的日程,因此不需要对已查询到的日程进行过滤操作 - return schedule; - } - case QueryJsonData::PropertyStatus::NEXT: { - if (schedule.isEmpty()) { - //如果半年内没有日程,返回空容器 - return scheduleInfo; - } else { - schedule.clear(); - scheduleInfo = viewWidget->getNextScheduleInfo(); - } - //返回下一个日程信息 - return scheduleInfo; - } - case QueryJsonData::PropertyStatus::LAST: - break; - default: { - if (m_BeginDateTime.isValid()) { - qDebug() << m_BeginDateTime << m_EndDateTime; - //返回过滤的日程 - return getSchedule(queryJsonData->TitleName(), m_BeginDateTime, m_EndDateTime); - } - } - } - //如果以上情况都没有返回半年所有日程 - return schedule; -} - bool queryScheduleTask::queryOverDueDate(QueryJsonData *queryJsonData) { bool overduedate = false; diff -Nru dde-calendar-5.9.1/schedule-plugin/src/task/queryscheduletask.h dde-calendar-5.10.0/schedule-plugin/src/task/queryscheduletask.h --- dde-calendar-5.9.1/schedule-plugin/src/task/queryscheduletask.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/task/queryscheduletask.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef QUERYSCHEDULETASK_H #define QUERYSCHEDULETASK_H @@ -29,7 +13,7 @@ { Q_OBJECT public: - explicit queryScheduleTask(CSchedulesDBus *dbus); + queryScheduleTask(); Reply SchedulePress(semanticAnalysisTask &semanticTask) override; private: @@ -38,55 +22,7 @@ * @param queryJsonData jsondata句柄 */ void setDateTime(QueryJsonData *queryJsonData); - /** - * @brief getHalfAYearSchedule 获取半年的日程信息 - * @param titleName 日程titlename - * @param beginDatetime 查询开始时间 - * @param endDateTime 查询结束时间 - * @return 日程信息 - */ - QVector getSchedule(QString titleName, QDateTime beginDatetime, QDateTime endDateTime); - /** - * @brief getEveryDayOrWorkDaySchedule 获取每天或者工作日的日程信息 - * @param queryJsonData jsondatajubing - * @param repeat 重复类型 - * @return 日程信息 - */ - QVector getEveryDayOrWorkDaySchedule(QueryJsonData *queryJsonData, int repeat); - /** - * @brief getRestDaySchedule 获取休息日的日程信息 - * @param queryJsonData jsondata句柄 - * @param queryWeek 需要查询周几的容器 - * @return 日程信息 - */ - QVector getRestDaySchedule(QueryJsonData *queryJsonData, QVector queryWeek); - /** - * @brief getEveryWeekSchedule 获取每周的日程信息 - * @param queryJsonData jsondata句柄 - * @param repeatNum 需要查询每周几-周几的容器 - * @return 日程信息 - */ - QVector getEveryWeekSchedule(QueryJsonData *queryJsonData, QVector repeatNum); - /** - * @brief getEveryMonthSchedule 获取每月的日程信息 - * @param queryJsonData jsondata句柄 - * @param repeatNum 需要查询每月几号-几号的容器 - * @return 日程信息 - */ - QVector getEveryMonthSchedule(QueryJsonData *queryJsonData, QVector repeatNum); - /** - * @brief getEveryYearSchedule 获取每年的日程信息 - * @param queryJsonData jsondata句柄 - * @return 日程信息 - */ - QVector getEveryYearSchedule(QueryJsonData *queryJsonData); - /** - * @brief getNonePropertyStatusSchedule 查询不是重复类型的日程 - * @param queryJsonData jsondata句柄 - * @param schedule 获取到的半年的日程信息 - * @return 日程信息 - */ - QVector getNonePropertyStatusSchedule(QueryJsonData *queryJsonData, QVector schedule); + /** * @brief queryOverDueDate 是否查询的是过去的日程 * @param queryJsonData jsondata句柄 @@ -99,7 +35,6 @@ QDateTime m_EndDateTime; viewschedulewidget *viewWidget = nullptr; - protected: }; diff -Nru dde-calendar-5.9.1/schedule-plugin/src/task/schedulebasetask.cpp dde-calendar-5.10.0/schedule-plugin/src/task/schedulebasetask.cpp --- dde-calendar-5.9.1/schedule-plugin/src/task/schedulebasetask.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/task/schedulebasetask.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,30 +1,13 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "schedulebasetask.h" #include "../state/schedulestate.h" #include "../globaldef.h" -scheduleBaseTask::scheduleBaseTask(CSchedulesDBus *dbus, scheduleState *state) +scheduleBaseTask::scheduleBaseTask(scheduleState *state) : QObject() - , m_dbus(dbus) , m_State(state) { } @@ -53,13 +36,13 @@ return reply; } -Reply scheduleBaseTask::getFeedbackByQuerySchedule(const QVector &info) +Reply scheduleBaseTask::getFeedbackByQuerySchedule(const DSchedule::List &info) { Q_UNUSED(info); return Reply(); } -Reply scheduleBaseTask::getReplyBySelectSchedule(const ScheduleDtailInfo &info) +Reply scheduleBaseTask::getReplyBySelectSchedule(const DSchedule::Ptr &info) { Q_UNUSED(info); return Reply(); @@ -72,14 +55,14 @@ return Reply(); } -Reply scheduleBaseTask::repeatScheduleHandle(const ScheduleDtailInfo &info, bool isOnlyOne) +Reply scheduleBaseTask::repeatScheduleHandle(const DSchedule::Ptr &info, bool isOnlyOne) { Q_UNUSED(info); Q_UNUSED(isOnlyOne); return Reply(); } -Reply scheduleBaseTask::confirwScheduleHandle(const ScheduleDtailInfo &info) +Reply scheduleBaseTask::confirwScheduleHandle(const DSchedule::Ptr &info) { Q_UNUSED(info); return Reply(); diff -Nru dde-calendar-5.9.1/schedule-plugin/src/task/schedulebasetask.h dde-calendar-5.10.0/schedule-plugin/src/task/schedulebasetask.h --- dde-calendar-5.9.1/schedule-plugin/src/task/schedulebasetask.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/task/schedulebasetask.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,30 +1,14 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef SCHEDULEBASETASK_H #define SCHEDULEBASETASK_H #include "semanticanalysistask.h" #include "../interface/reply.h" -#include "../dbus/schedulesdbus.h" -#include "../data/schedulestructs.h" +#include "dschedule.h" + #include class scheduleState; @@ -32,14 +16,14 @@ { Q_OBJECT public: - scheduleBaseTask(CSchedulesDBus *dbus, scheduleState *state = nullptr); + scheduleBaseTask(scheduleState *state = nullptr); virtual ~scheduleBaseTask(); virtual Reply SchedulePress(semanticAnalysisTask &semanticTask); - virtual Reply getFeedbackByQuerySchedule(const QVector &info); - virtual Reply getReplyBySelectSchedule(const ScheduleDtailInfo &info); + virtual Reply getFeedbackByQuerySchedule(const DSchedule::List &info); + virtual Reply getReplyBySelectSchedule(const DSchedule::Ptr &info); virtual Reply InitState(const JsonData *jsonData, bool isUpdateState = false); - virtual Reply repeatScheduleHandle(const ScheduleDtailInfo &info, bool isOnlyOne); - virtual Reply confirwScheduleHandle(const ScheduleDtailInfo &info); + virtual Reply repeatScheduleHandle(const DSchedule::Ptr &info, bool isOnlyOne); + virtual Reply confirwScheduleHandle(const DSchedule::Ptr &info); virtual Reply confirmInfo(bool isOK); scheduleState *getState() const; Reply overdueScheduleProcess(); @@ -55,7 +39,6 @@ Reply errorMessage(); protected: - CSchedulesDBus *m_dbus {nullptr}; scheduleState *m_State {nullptr}; }; diff -Nru dde-calendar-5.9.1/schedule-plugin/src/task/schedulemanagetask.cpp dde-calendar-5.10.0/schedule-plugin/src/task/schedulemanagetask.cpp --- dde-calendar-5.9.1/schedule-plugin/src/task/schedulemanagetask.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/task/schedulemanagetask.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,50 +1,32 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "schedulemanagetask.h" -#include "../dbus/schedulesdbus.h" #include "../globaldef.h" #include "../widget/schedulelistwidget.h" #include "../data/createjsondata.h" #include "../data/queryjsondata.h" #include "../data/canceljsondata.h" #include "../data/changejsondata.h" -#include "../widget/viewschedulewidget.h" #include "createscheduletask.h" #include "queryscheduletask.h" #include "cancelscheduletask.h" #include "changescheduletask.h" +#include "accountmanager.h" DWIDGET_USE_NAMESPACE -ScheduleManageTask *ScheduleManageTask::m_scheduleManageTask = nullptr; ScheduleManageTask::ScheduleManageTask(QObject *parent) : QObject(parent) - , m_dbus(new CSchedulesDBus(DBUS_SERVICE, DBUS_PATCH, QDBusConnection::sessionBus(), this)) { - m_scheduleTaskMap[JSON_CREATE] = new createScheduleTask(m_dbus); - m_scheduleTaskMap[JSON_VIEW] = new queryScheduleTask(m_dbus); - m_scheduleTaskMap[JSON_CANCEL] = new cancelScheduleTask(m_dbus); - m_scheduleTaskMap[JSON_CHANGE] = new changeScheduleTask(m_dbus); + gAccounManager->resetAccount(); + m_scheduleTaskMap[JSON_CREATE] = new createScheduleTask(); + m_scheduleTaskMap[JSON_VIEW] = new queryScheduleTask(); + m_scheduleTaskMap[JSON_CANCEL] = new cancelScheduleTask(); + m_scheduleTaskMap[JSON_CHANGE] = new changeScheduleTask(); QMap::Iterator inter = m_scheduleTaskMap.begin(); for (; inter != m_scheduleTaskMap.end(); ++inter) { @@ -65,18 +47,12 @@ ScheduleManageTask *ScheduleManageTask::getInstance() { - if (m_scheduleManageTask == nullptr) { - m_scheduleManageTask = new ScheduleManageTask(); - } - return m_scheduleManageTask; + static ScheduleManageTask scheduleManageTask; + return &scheduleManageTask; } void ScheduleManageTask::releaseInstance() { - if (m_scheduleManageTask != nullptr) { - delete m_scheduleManageTask; - m_scheduleManageTask = nullptr; - } } void ScheduleManageTask::process(semanticAnalysisTask &semanticTask) @@ -89,10 +65,10 @@ } } Reply reply; - if (m_preScheduleTask == nullptr){ + if (m_preScheduleTask == nullptr) { REPLY_ONLY_TTS(reply, G_ERR_TTS, G_ERR_TTS, true); } else { - reply =m_preScheduleTask->SchedulePress(semanticTask); + reply = m_preScheduleTask->SchedulePress(semanticTask); connectHideEventToInitState(reply); } setReply(reply); @@ -113,10 +89,10 @@ void ScheduleManageTask::connectHideEventToInitState(Reply reply) { //判断回复内容是否有回复窗口 - if(reply.getReplyWidget() !=nullptr){ + if (reply.getReplyWidget() != nullptr) { //转换为IconDFrame窗口 IconDFrame *_iconWidget = qobject_cast(reply.getReplyWidget()); - if(_iconWidget != nullptr){ + if (_iconWidget != nullptr) { //如果转换成功则关联 connect(_iconWidget, &IconDFrame::widgetIsHide, this, &ScheduleManageTask::slotWidgetHideInitState, Qt::UniqueConnection); diff -Nru dde-calendar-5.9.1/schedule-plugin/src/task/schedulemanagetask.h dde-calendar-5.10.0/schedule-plugin/src/task/schedulemanagetask.h --- dde-calendar-5.9.1/schedule-plugin/src/task/schedulemanagetask.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/task/schedulemanagetask.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,39 +1,20 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef SCHEDULEMANAGETASK_H #define SCHEDULEMANAGETASK_H -#include - #include "../interface/reply.h" #include "semanticanalysistask.h" -#include "../dbus/schedulesdbus.h" #include "../widget/icondframe.h" -#include "../data/schedulestructs.h" +#include "dschedule.h" #include "../widget/createschedulewidget.h" -#include "../interface/reply.h" #include "schedulebasetask.h" +#include "accountitem.h" + +#include -//class widgetStrategy; -class CSchedulesDBus; class ScheduleManageTask : public QObject { Q_OBJECT @@ -58,14 +39,13 @@ */ void slotWidgetHideInitState(); private: - static ScheduleManageTask *m_scheduleManageTask; /** * @brief connectHideEventToInitState 窗口隐藏绑定状态初始化 * @param reply 回复 */ void connectHideEventToInitState(Reply reply); private: - CSchedulesDBus *m_dbus {nullptr}; + AccountItem::Ptr m_account; QMap m_scheduleTaskMap; Reply m_Reply; scheduleBaseTask *m_preScheduleTask {nullptr}; diff -Nru dde-calendar-5.9.1/schedule-plugin/src/task/semanticanalysistask.cpp dde-calendar-5.10.0/schedule-plugin/src/task/semanticanalysistask.cpp --- dde-calendar-5.9.1/schedule-plugin/src/task/semanticanalysistask.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/task/semanticanalysistask.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "semanticanalysistask.h" #include diff -Nru dde-calendar-5.9.1/schedule-plugin/src/task/semanticanalysistask.h dde-calendar-5.10.0/schedule-plugin/src/task/semanticanalysistask.h --- dde-calendar-5.9.1/schedule-plugin/src/task/semanticanalysistask.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/task/semanticanalysistask.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef SEMANTICANALYSISTASK_H #define SEMANTICANALYSISTASK_H diff -Nru dde-calendar-5.9.1/schedule-plugin/src/widget/buttonwidget.cpp dde-calendar-5.10.0/schedule-plugin/src/widget/buttonwidget.cpp --- dde-calendar-5.9.1/schedule-plugin/src/widget/buttonwidget.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/widget/buttonwidget.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "buttonwidget.h" #include #include diff -Nru dde-calendar-5.9.1/schedule-plugin/src/widget/buttonwidget.h dde-calendar-5.10.0/schedule-plugin/src/widget/buttonwidget.h --- dde-calendar-5.9.1/schedule-plugin/src/widget/buttonwidget.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/widget/buttonwidget.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef BUTTONWIDGET_H #define BUTTONWIDGET_H #include diff -Nru dde-calendar-5.9.1/schedule-plugin/src/widget/createschedulewidget.cpp dde-calendar-5.10.0/schedule-plugin/src/widget/createschedulewidget.cpp --- dde-calendar-5.9.1/schedule-plugin/src/widget/createschedulewidget.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/widget/createschedulewidget.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,42 +1,29 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "createschedulewidget.h" + +#include "buttonwidget.h" +#include "../globaldef.h" +#include "dscheduledatamanager.h" + #include #include #include #include - -#include "buttonwidget.h" -#include "../globaldef.h" +#include +#include createSchedulewidget::createSchedulewidget(QWidget *parent) : IconDFrame(parent) - , m_scheduleDtailInfo(ScheduleDtailInfo()) + , m_scheduleDtailInfo(new DSchedule) , m_scheduleitemwidget(new scheduleitemwidget(this)) { connect(m_scheduleitemwidget, &scheduleitemwidget::signalItemPress, this, &createSchedulewidget::slotItemPress); - // updateUI(); } -ScheduleDtailInfo &createSchedulewidget::getScheduleDtailInfo() +DSchedule::Ptr createSchedulewidget::getScheduleDtailInfo() { return m_scheduleDtailInfo; } @@ -64,20 +51,37 @@ m_beginTime = m_BeginDateTime; m_endTime = m_EndDateTime; - m_scheduleDtailInfo.beginDateTime = m_beginTime; - m_scheduleDtailInfo.endDateTime = m_endTime; - m_scheduleDtailInfo.titleName = m_titleName; - m_scheduleDtailInfo.type.ID = 3; - m_scheduleDtailInfo.id = 0; - m_scheduleDtailInfo.RecurID = 0; - m_scheduleDtailInfo.allday = false; - m_scheduleDtailInfo.remind = true; - m_scheduleDtailInfo.remindData.n = 0; - m_scheduleDtailInfo.rpeat = m_rpeat; - // if (m_rpeat != 0) { - //结束重复于类型为:永不 - m_scheduleDtailInfo.enddata.type = 0; - // } + m_scheduleDtailInfo->setDtStart(m_beginTime); + m_scheduleDtailInfo->setDtEnd(m_endTime); + m_scheduleDtailInfo->setSummary(m_titleName); + m_scheduleDtailInfo->setScheduleTypeID("403bf009-2005-4679-9c76-e73d9f83a8b4"); + m_scheduleDtailInfo->setAllDay(false); + + m_scheduleDtailInfo->setAlarmType(DSchedule::Alarm_Begin); + switch (m_rpeat) { + case 1: + m_scheduleDtailInfo->setRRuleType(DSchedule::RRule_Day); + break; + case 2: + m_scheduleDtailInfo->setRRuleType(DSchedule::RRule_Work); + break; + case 3: + m_scheduleDtailInfo->setRRuleType(DSchedule::RRule_Week); + break; + case 4: + m_scheduleDtailInfo->setRRuleType(DSchedule::RRule_Month); + break; + case 5: + m_scheduleDtailInfo->setRRuleType(DSchedule::RRule_Year); + break; + default: + m_scheduleDtailInfo->setRRuleType(DSchedule::RRule_None); + break; + } + if (m_scheduleDtailInfo->getRRuleType() != DSchedule::RRule_None) { + //结束重复于类型为:永不 + m_scheduleDtailInfo->recurrence()->setDuration(-1); + } } void createSchedulewidget::scheduleEmpty(bool isEmpty) @@ -85,11 +89,11 @@ m_scheduleEmpty = isEmpty; } -void createSchedulewidget::updateUI() +void createSchedulewidget::updateUI(const QString &scheduleID) { if (m_scheduleEmpty) { //获取筛选到的日程信息 - getCreatScheduleFromDbus(); + getCreatScheduleFromDbus(scheduleID); //如果筛选到的日程不为空,则展示日程插件 if (!m_scheduleInfo.isEmpty()) { QVBoxLayout *mainlayout = new QVBoxLayout(); @@ -116,11 +120,6 @@ } } -void createSchedulewidget::setScheduleDbus(CSchedulesDBus *dbus) -{ - m_dbus = dbus; -} - bool createSchedulewidget::buttonclicked() { return m_buttonclicked; @@ -137,12 +136,13 @@ } } -void createSchedulewidget::slotItemPress(const ScheduleDtailInfo &info) +void createSchedulewidget::slotItemPress(const DSchedule::Ptr &info) { QProcess proc; proc.startDetached(PROCESS_OPEN_CALENDAR); QThread::msleep(750); - QString schedulestr = CSchedulesDBus::createScheduleDtailInfojson(info); + QString schedulestr; + DSchedule::toJsonString(info, schedulestr); QDBusMessage message = QDBusMessage::createMethodCall(DBUS_CALENDAR_SERVICE, DBUS_CALENDAR_PATCH, DBUS_CALENDAR_INTFACE, @@ -152,48 +152,8 @@ QDBusMessage response = QDBusConnection::sessionBus().call(message); } -void createSchedulewidget::getCreatScheduleFromDbus() +void createSchedulewidget::getCreatScheduleFromDbus(const QString &scheduleID) { - //存放查询的日程信息 - QVector out; - //存放符合筛选条件的日程信息 - QVector scheduleinfo; - //清空容器 - scheduleinfo.clear(); - out.clear(); - //通过dbus获取和新建的日程具有相同titlename,beginDateTime,endDateTime的日程 - m_dbus->QueryJobs(m_scheduleDtailInfo.titleName, m_scheduleDtailInfo.beginDateTime, m_scheduleDtailInfo.endDateTime, out); - //筛选具体日程 - for (int i = 0; i < out.count(); i++) { - for (int j = 0; j < out.at(i).vData.count(); j++) { - //筛选条件 - if (out.at(i).vData.at(j).titleName == m_scheduleDtailInfo.titleName - && out.at(i).vData.at(j).beginDateTime == m_scheduleDtailInfo.beginDateTime - && out.at(i).vData.at(j).endDateTime == m_scheduleDtailInfo.endDateTime - && out.at(i).vData.at(j).rpeat == m_scheduleDtailInfo.rpeat - && out.at(i).vData.at(j).allday == m_scheduleDtailInfo.allday - && out.at(i).vData.at(j).type.ID == m_scheduleDtailInfo.type.ID - && out.at(i).vData.at(j).RecurID == m_scheduleDtailInfo.RecurID - && out.at(i).vData.at(j).remind == m_scheduleDtailInfo.remind - && out.at(i).vData.at(j).remindData.n == m_scheduleDtailInfo.remindData.n) { - if (m_scheduleDtailInfo.rpeat > 0 && out.at(i).vData.at(j).enddata.type != m_scheduleDtailInfo.enddata.type) - continue; - scheduleinfo.append(out.at(i).vData.at(j)); - } - } - } - //如果和新建日程具有相同信息的日程有多个,则取id最大的那一个 - if (scheduleinfo.count() > 1) { - for (int i = 0; i < scheduleinfo.count() - 1; i++) { - if (scheduleinfo.at(i).id < scheduleinfo.at(i + 1).id) { - m_scheduleInfo.clear(); - m_scheduleInfo.append(scheduleinfo.at(i + 1)); - } else { - m_scheduleInfo.clear(); - m_scheduleInfo.append(scheduleinfo.at(i)); - } - } - } else { - m_scheduleInfo = scheduleinfo; - } + DSchedule::Ptr schedule = DScheduleDataManager::getInstance()->queryScheduleByScheduleID(scheduleID); + m_scheduleInfo.append(schedule); } diff -Nru dde-calendar-5.9.1/schedule-plugin/src/widget/createschedulewidget.h dde-calendar-5.10.0/schedule-plugin/src/widget/createschedulewidget.h --- dde-calendar-5.9.1/schedule-plugin/src/widget/createschedulewidget.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/widget/createschedulewidget.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,33 +1,17 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef CREATESCHEDULE_H #define CREATESCHEDULE_H +#include "dschedule.h" +#include "icondframe.h" +#include "scheduleitemwidget.h" + #include #include #include -#include "../data/schedulestructs.h" -#include "icondframe.h" -#include "scheduleitemwidget.h" -#include "../dbus/schedulesdbus.h" DWIDGET_USE_NAMESPACE @@ -38,35 +22,33 @@ explicit createSchedulewidget(QWidget *parent = nullptr); public: - ScheduleDtailInfo &getScheduleDtailInfo(); + DSchedule::Ptr getScheduleDtailInfo(); void setTitleName(const QString &titleName); void setDateTime(QDateTime begintime, QDateTime endtime); void setRpeat(int rpeat); void setschedule(); void scheduleEmpty(bool isEmpty); - void updateUI(); - void setScheduleDbus(CSchedulesDBus *dbus); + void updateUI(const QString &scheduleID); bool buttonclicked(); + public slots: void slotsbuttonchance(int index, const QString &text); - void slotItemPress(const ScheduleDtailInfo &info); + void slotItemPress(const DSchedule::Ptr &info); /** * @brief getCreatScheduleFromDbus 通过dbus获取新建的日程信息 */ - void getCreatScheduleFromDbus(); + void getCreatScheduleFromDbus(const QString &scheduleID); private: - ScheduleDtailInfo m_scheduleDtailInfo; + DSchedule::Ptr m_scheduleDtailInfo; QDateTime m_BeginDateTime; QDateTime m_EndDateTime; QString m_titleName; int m_rpeat; bool m_scheduleEmpty = false; scheduleitemwidget *m_scheduleitemwidget; - QVector m_scheduleInfo; - CSchedulesDBus *m_dbus = nullptr; + DSchedule::List m_scheduleInfo; bool m_buttonclicked = false; - signals: public slots: diff -Nru dde-calendar-5.9.1/schedule-plugin/src/widget/icondframe.cpp dde-calendar-5.10.0/schedule-plugin/src/widget/icondframe.cpp --- dde-calendar-5.9.1/schedule-plugin/src/widget/icondframe.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/widget/icondframe.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "icondframe.h" #include #include diff -Nru dde-calendar-5.9.1/schedule-plugin/src/widget/icondframe.h dde-calendar-5.10.0/schedule-plugin/src/widget/icondframe.h --- dde-calendar-5.9.1/schedule-plugin/src/widget/icondframe.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/widget/icondframe.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef ICONDFRAME_H #define ICONDFRAME_H diff -Nru dde-calendar-5.9.1/schedule-plugin/src/widget/itemwidget.cpp dde-calendar-5.10.0/schedule-plugin/src/widget/itemwidget.cpp --- dde-calendar-5.9.1/schedule-plugin/src/widget/itemwidget.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/widget/itemwidget.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "itemwidget.h" #include @@ -97,7 +81,6 @@ void ItemWidget::setTheMe(const int type) { - m_scheduleColor.setTheMe(type); QColor titleColor; QColor datetimeColor; if (type == 0 || type == 1) { @@ -119,18 +102,16 @@ m_BackgroundColor = "#FFFFFF"; m_BackgroundColor.setAlphaF(0.05); } - // DPalette palette; - // setTitleColor(palette.color(DPalette::Normal, DPalette::BrightText)); setTitleColor(titleColor); setDateTimeColor(datetimeColor); } QColor ItemWidget::ScheduleColor() { - return m_scheduleColor.getColorByTypeId(m_scheduleInfo.type.ID).splitColor; + return CScheduleDataManage::getScheduleDataManage()->getScheduleColorByType(m_scheduleInfo->scheduleTypeID()).orginalColor; } -ScheduleDtailInfo ItemWidget::getScheduleInfo() const +DSchedule::Ptr ItemWidget::getScheduleInfo() const { return m_scheduleInfo; } @@ -150,18 +131,18 @@ m_DateTimeColor = DateTimeColor; } -ScheduleDtailInfo ItemWidget::scheduleInfo() const +DSchedule::Ptr ItemWidget::scheduleInfo() const { return m_scheduleInfo; } -void ItemWidget::setScheduleInfo(const ScheduleDtailInfo &scheduleInfo) +void ItemWidget::setScheduleInfo(const DSchedule::Ptr &scheduleInfo) { m_scheduleInfo = scheduleInfo; - setScheduleBeginTime(scheduleInfo.beginDateTime); - setScheduleEndTime(scheduleInfo.endDateTime); - setShowDate(scheduleInfo.beginDateTime.date()); - setTitleContent(scheduleInfo.titleName); + setScheduleBeginTime(scheduleInfo->dtStart()); + setScheduleEndTime(scheduleInfo->dtEnd()); + setShowDate(scheduleInfo->dtStart().date()); + setTitleContent(scheduleInfo->summary()); } void ItemWidget::setTitleColor(const QColor &TitleColor) diff -Nru dde-calendar-5.9.1/schedule-plugin/src/widget/itemwidget.h dde-calendar-5.10.0/schedule-plugin/src/widget/itemwidget.h --- dde-calendar-5.9.1/schedule-plugin/src/widget/itemwidget.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/widget/itemwidget.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,28 +1,12 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef ITEMWIDGET_H #define ITEMWIDGET_H -#include "../data/schedulecolourmanage.h" -#include "../data/schedulestructs.h" +#include "scheduledatamanage.h" +#include "dschedule.h" #include #include @@ -38,7 +22,8 @@ enum Item_Position { ItemTop, ItemMiddle, ItemBottom, - ItemOnly }; + ItemOnly + }; public: explicit ItemWidget(QWidget *parent = nullptr); @@ -59,10 +44,10 @@ QDateTime getScheduleEndTime() const; void setScheduleEndTime(const QDateTime &ScheduleEndTime); - ScheduleDtailInfo scheduleInfo() const; - void setScheduleInfo(const ScheduleDtailInfo &scheduleInfo); + DSchedule::Ptr scheduleInfo() const; + void setScheduleInfo(const DSchedule::Ptr &scheduleInfo); - ScheduleDtailInfo getScheduleInfo() const; + DSchedule::Ptr getScheduleInfo() const; protected: QFont getTitleFont() const; @@ -107,8 +92,7 @@ */ QColor m_BackgroundColor{"#000000"}; - ScheduleColourManage m_scheduleColor; - ScheduleDtailInfo m_scheduleInfo; + DSchedule::Ptr m_scheduleInfo; }; #endif // ITEMWIDGET_H diff -Nru dde-calendar-5.9.1/schedule-plugin/src/widget/modifyscheduleitem.cpp dde-calendar-5.10.0/schedule-plugin/src/widget/modifyscheduleitem.cpp --- dde-calendar-5.9.1/schedule-plugin/src/widget/modifyscheduleitem.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/widget/modifyscheduleitem.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "modifyscheduleitem.h" #include "../globaldef.h" @@ -105,7 +89,7 @@ painter.setPen(getDateTimeColor()); painter.setFont(getDateTimeFont()); QString timestr; - if (scheduleInfo().allday) { + if (scheduleInfo()->allDay()) { timestr = ALL_DAY; } else { timestr = QString("%1-%2").arg(getScheduleBeginTime().toString("hh:mm")).arg(getScheduleEndTime().toString("hh:mm")); diff -Nru dde-calendar-5.9.1/schedule-plugin/src/widget/modifyscheduleitem.h dde-calendar-5.10.0/schedule-plugin/src/widget/modifyscheduleitem.h --- dde-calendar-5.9.1/schedule-plugin/src/widget/modifyscheduleitem.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/widget/modifyscheduleitem.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef MODIFYSCHEDULEITEM_H #define MODIFYSCHEDULEITEM_H diff -Nru dde-calendar-5.9.1/schedule-plugin/src/widget/opencalendarwidget.cpp dde-calendar-5.10.0/schedule-plugin/src/widget/opencalendarwidget.cpp --- dde-calendar-5.9.1/schedule-plugin/src/widget/opencalendarwidget.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/widget/opencalendarwidget.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "opencalendarwidget.h" #include #include diff -Nru dde-calendar-5.9.1/schedule-plugin/src/widget/opencalendarwidget.h dde-calendar-5.10.0/schedule-plugin/src/widget/opencalendarwidget.h --- dde-calendar-5.9.1/schedule-plugin/src/widget/opencalendarwidget.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/widget/opencalendarwidget.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef OPENCALENDARWIDGET_H #define OPENCALENDARWIDGET_H diff -Nru dde-calendar-5.9.1/schedule-plugin/src/widget/repeatschedulewidget.cpp dde-calendar-5.10.0/schedule-plugin/src/widget/repeatschedulewidget.cpp --- dde-calendar-5.9.1/schedule-plugin/src/widget/repeatschedulewidget.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/widget/repeatschedulewidget.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "repeatschedulewidget.h" #include "scheduleitemwidget.h" #include "buttonwidget.h" @@ -31,7 +15,7 @@ { } -void repeatScheduleWidget::setSchedule(const ScheduleDtailInfo &info) +void repeatScheduleWidget::setSchedule(const DSchedule::Ptr &info) { m_scheduleInfo.clear(); m_scheduleInfo.append(info); diff -Nru dde-calendar-5.9.1/schedule-plugin/src/widget/repeatschedulewidget.h dde-calendar-5.10.0/schedule-plugin/src/widget/repeatschedulewidget.h --- dde-calendar-5.9.1/schedule-plugin/src/widget/repeatschedulewidget.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/widget/repeatschedulewidget.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,28 +1,12 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef REPEATSCHEDULEWIDGET_H #define REPEATSCHEDULEWIDGET_H #include "icondframe.h" -#include "../data/schedulestructs.h" +#include "dschedule.h" class scheduleitemwidget; class repeatScheduleWidget : public IconDFrame @@ -38,7 +22,7 @@ public: explicit repeatScheduleWidget(Operation_type operation, Widget_type widgetype, bool tocreateBtn = true, QWidget *parent = nullptr); - void setSchedule(const ScheduleDtailInfo &info); + void setSchedule(const DSchedule::Ptr &info); private: void initUI(); @@ -49,7 +33,7 @@ private: scheduleitemwidget *m_scheduleitemwidget {nullptr}; - QVector m_scheduleInfo; + DSchedule::List m_scheduleInfo; Operation_type m_OperationType {Operation_Cancel}; Widget_type m_WidgetType {Widget_Confirm}; int m_buttonCount {0}; diff -Nru dde-calendar-5.9.1/schedule-plugin/src/widget/scheduleitemwidget.cpp dde-calendar-5.10.0/schedule-plugin/src/widget/scheduleitemwidget.cpp --- dde-calendar-5.9.1/schedule-plugin/src/widget/scheduleitemwidget.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/widget/scheduleitemwidget.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "scheduleitemwidget.h" #include "../globaldef.h" @@ -36,7 +20,7 @@ { } -void scheduleitemwidget::setScheduleDtailInfo(QVector &scheduleInfo) +void scheduleitemwidget::setScheduleDtailInfo(const DSchedule::List &scheduleInfo) { m_scheduleInfo = scheduleInfo; sortScheduleWithTime(); @@ -84,7 +68,7 @@ { for (int i = 0; i < m_scheduleInfo.count(); i++) { for (int j = 0; j < m_scheduleInfo.count() - i - 1; j++) { - if (m_scheduleInfo[j].beginDateTime > m_scheduleInfo[j + 1].beginDateTime) + if (m_scheduleInfo[j]->dtStart() > m_scheduleInfo[j + 1]->dtStart()) std::swap(m_scheduleInfo[j], m_scheduleInfo[j + 1]); } } @@ -123,10 +107,10 @@ painter.setPen(getDateTimeColor()); painter.setFont(getDateTimeFont()); QString timestr; - if (scheduleInfo().allday) { + if (scheduleInfo()->allDay()) { timestr = ALL_DAY; } else { - timestr = QString("%1-%2").arg(scheduleInfo().beginDateTime.toString("hh:mm")).arg(scheduleInfo().endDateTime.toString("hh:mm")); + timestr = QString("%1-%2").arg(scheduleInfo()->dtStart().toString("hh:mm")).arg(scheduleInfo()->dtEnd().toString("hh:mm")); } painter.drawText(rect, Qt::AlignLeft | Qt::AlignVCenter, timestr); @@ -159,7 +143,7 @@ setFixedHeight(20); } -void scheduleitemdate::setScheduleDtailInfo(ScheduleDtailInfo &scheduelDtailInfo) +void scheduleitemdate::setScheduleDtailInfo(const DSchedule::Ptr &scheduelDtailInfo) { m_scheduleDtailInfo = scheduelDtailInfo; } @@ -184,6 +168,6 @@ painter.setRenderHint(QPainter::Antialiasing); painter.setPen(DetailsColor()); painter.drawText(QRect(m_LeftMargin, 0, this->rect().width(), 20), Qt::AlignLeft | Qt::AlignVCenter, - QString("%1 %2").arg(m_scheduleDtailInfo.beginDateTime.date().toString("yyyy年MM月dd日")).arg(m_scheduleDtailInfo.beginDateTime.toString("dddd"))); + QString("%1 %2").arg(m_scheduleDtailInfo->dtStart().date().toString("yyyy年MM月dd日")).arg(m_scheduleDtailInfo->dtStart().toString("dddd"))); painter.restore(); } diff -Nru dde-calendar-5.9.1/schedule-plugin/src/widget/scheduleitemwidget.h dde-calendar-5.10.0/schedule-plugin/src/widget/scheduleitemwidget.h --- dde-calendar-5.9.1/schedule-plugin/src/widget/scheduleitemwidget.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/widget/scheduleitemwidget.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,29 +1,13 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef CREATSHCEDULEITEM_H #define CREATSHCEDULEITEM_H #include "itemwidget.h" -#include "../data/schedulestructs.h" -#include "../data/schedulecolourmanage.h" +#include "dschedule.h" + #include class scheduleitemdate; @@ -35,17 +19,17 @@ explicit scheduleitemwidget(QWidget *parent = nullptr); ~scheduleitemwidget(); - void setScheduleDtailInfo(QVector &scheduleInfo); + void setScheduleDtailInfo(const DSchedule::List &scheduleInfo); void addscheduleitem(); signals: - void signalItemPress(const ScheduleDtailInfo &info); + void signalItemPress(const DSchedule::Ptr &info); private: void sortScheduleWithTime(); private: - ScheduleDtailInfo m_scheduleDtailInfo; - QVector m_scheduleInfo; + DSchedule::Ptr m_scheduleDtailInfo; + DSchedule::List m_scheduleInfo; }; class scheduleitem : public ItemWidget @@ -63,7 +47,7 @@ protected: void mousePressEvent(QMouseEvent *event) override; signals: - void signalItemPress(const ScheduleDtailInfo &info); + void signalItemPress(const DSchedule::Ptr &info); private: const int m_timeLeftMargin = 13; @@ -80,7 +64,7 @@ Q_OBJECT public: explicit scheduleitemdate(QWidget *parent = nullptr); - void setScheduleDtailInfo(ScheduleDtailInfo &scheduelDtailInfo); + void setScheduleDtailInfo(const DSchedule::Ptr &scheduelDtailInfo); QColor DetailsColor(); @@ -88,7 +72,7 @@ void paintEvent(QPaintEvent *event); private: - ScheduleDtailInfo m_scheduleDtailInfo; + DSchedule::Ptr m_scheduleDtailInfo; QColor m_DateTimeColor; const int m_LeftMargin = 13; diff -Nru dde-calendar-5.9.1/schedule-plugin/src/widget/schedulelistwidget.cpp dde-calendar-5.10.0/schedule-plugin/src/widget/schedulelistwidget.cpp --- dde-calendar-5.9.1/schedule-plugin/src/widget/schedulelistwidget.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/widget/schedulelistwidget.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "schedulelistwidget.h" #include @@ -30,7 +14,7 @@ { } -void scheduleListWidget::setScheduleInfoVector(const QVector &ScheduleInfoVector) +void scheduleListWidget::setScheduleInfoVector(const DSchedule::List &ScheduleInfoVector) { m_ScheduleInfoVector = ScheduleInfoVector; updateUI(); diff -Nru dde-calendar-5.9.1/schedule-plugin/src/widget/schedulelistwidget.h dde-calendar-5.10.0/schedule-plugin/src/widget/schedulelistwidget.h --- dde-calendar-5.9.1/schedule-plugin/src/widget/schedulelistwidget.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/widget/schedulelistwidget.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,29 +1,13 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: uniontech -* -* Maintainer: uniontech -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef SCHEDULELISTWIDGET_H #define SCHEDULELISTWIDGET_H #include -#include "../data/schedulestructs.h" +#include "dschedule.h" #include "icondframe.h" DWIDGET_USE_NAMESPACE @@ -33,14 +17,14 @@ public: explicit scheduleListWidget(QWidget *parent = nullptr); - void setScheduleInfoVector(const QVector &ScheduleInfoVector); + void setScheduleInfoVector(const DSchedule::List &ScheduleInfoVector); void updateUI(); signals: void signalSelectScheduleIndex(int index); private: - QVector m_ScheduleInfoVector; + DSchedule::List m_ScheduleInfoVector; }; #endif // SCHEDULELISTWIDGET_H diff -Nru dde-calendar-5.9.1/schedule-plugin/src/widget/viewschedulewidget.cpp dde-calendar-5.10.0/schedule-plugin/src/widget/viewschedulewidget.cpp --- dde-calendar-5.9.1/schedule-plugin/src/widget/viewschedulewidget.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/widget/viewschedulewidget.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,30 +1,17 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "viewschedulewidget.h" #include "opencalendarwidget.h" -#include -#include +#include "dscheduledatamanager.h" #include "../globaldef.h" -#include "../dbus/schedulesdbus.h" + +#include +#include +#include +#include viewschedulewidget::viewschedulewidget(QWidget *parent) : IconDFrame(parent) @@ -35,26 +22,25 @@ { } -void viewschedulewidget::setScheduleDateRangeInfo(QVector &scheduleDateInfo) +void viewschedulewidget::setScheduleDateRangeInfo(const DSchedule::Map &scheduleDateInfo) { m_scheduleDateInfo = scheduleDateInfo; } -void viewschedulewidget::viewScheduleInfoShow(QVector m_showdate) +void viewschedulewidget::viewScheduleInfoShow(const DSchedule::Map &showSchedule) { QVBoxLayout *mainlayout = new QVBoxLayout(); mainlayout->setSpacing(10); int scheduleNum = 0; - QVector scheduleInfo; - for (int i = 0; i < m_showdate.count(); i++) { - for (int j = 0; j < m_showdate.at(i).vData.count(); j++) { - scheduleInfo.append(m_showdate.at(i).vData.at(j)); - + DSchedule::List scheduleInfo; + DSchedule::Map::const_iterator iter = showSchedule.constBegin(); + for (; iter != showSchedule.constEnd(); ++iter) { + for (int i = 0; i < iter.value().size(); ++i) { + scheduleInfo.append(iter.value().at(i)); scheduleNum++; if (scheduleNum == 10) break; } - scheduleitemwidget *item = new scheduleitemwidget(); connect(item, &scheduleitemwidget::signalItemPress, this, &viewschedulewidget::slotItemPress); item->setScheduleDtailInfo(scheduleInfo); @@ -66,21 +52,23 @@ break; } - if (getScheduleNum(m_showdate) > 10) { + // + int scheduleCount = getScheduleNum(showSchedule); + if (scheduleCount > 10) { OpenCalendarWidget *openWidget = new OpenCalendarWidget(); - openWidget->setScheduleCount(getScheduleNum(m_showdate)); + openWidget->setScheduleCount(scheduleCount); mainlayout->addWidget(openWidget); } setCenterLayout(mainlayout); } -int viewschedulewidget::getScheduleNum(QVector m_showdate) +int viewschedulewidget::getScheduleNum(DSchedule::Map scheduleList) { int scheduleTotalNum = 0; - - for (int i = 0; i < m_showdate.count(); i++) { - scheduleTotalNum += m_showdate.at(i).vData.count(); + DSchedule::Map::const_iterator iter = scheduleList.constBegin(); + for (; iter != scheduleList.constEnd(); ++iter) { + scheduleTotalNum += iter.value().size(); } return scheduleTotalNum; } @@ -95,67 +83,13 @@ m_endDateTime = enddatetime; } -QVector viewschedulewidget::getAllRpeatScheduleInfo(int rpeat) -{ - QVector scheduleInfo; - ScheduleDateRangeInfo scheduleDtailInfo; - - for (int i = 0; i < getAllScheduleInfo().count(); i++) { - for (int j = 0; j < getAllScheduleInfo().at(i).vData.count(); j++) { - if (getAllScheduleInfo().at(i).vData.at(j).rpeat == rpeat) { - scheduleDtailInfo.vData.append(getAllScheduleInfo().at(i).vData.at(j)); - } - } - if (scheduleDtailInfo.vData.count() > 0) - scheduleInfo.append(scheduleDtailInfo); - scheduleDtailInfo.vData.clear(); - } - return scheduleInfo; -} - -QVector viewschedulewidget::getNextScheduleInfo() -{ - //返回的日程信息 - QVector showdate; - //下一个日程当天的所有日程 - ScheduleDateRangeInfo scheduleinfo; - //当天最早的日程 - ScheduleDateRangeInfo viewScheduleInfo; - //下一个日程的时间 - QTime earlyTime; - //下一个日程的索引 - int index = 0; - //下一个日程的id - int scheduleid = 0; - - scheduleinfo = getAllScheduleInfo().first(); - earlyTime = scheduleinfo.vData.at(0).beginDateTime.time(); - scheduleid = scheduleinfo.vData.at(0).id; - //在一天的日程中筛选时间最早(如果时间最早有多个,取id最小的)的日程 - for (int i = 1; i < scheduleinfo.vData.count(); i++) { - QTime viewTime = scheduleinfo.vData.at(i).beginDateTime.time(); - int viewScheduleid = scheduleinfo.vData.at(i).id; - if (earlyTime > viewTime) { - earlyTime = viewTime; - index = i; - } else if (earlyTime == viewTime) { - if (scheduleid > viewScheduleid) { - index = i; - } - } - } - //将筛选到的日程信息添加到当天最早的日程容器中 - viewScheduleInfo.vData.append(scheduleinfo.vData.at(index)); - showdate.append(viewScheduleInfo); - return showdate; -} - -void viewschedulewidget::slotItemPress(const ScheduleDtailInfo &info) +void viewschedulewidget::slotItemPress(const DSchedule::Ptr &info) { QProcess proc; proc.startDetached(PROCESS_OPEN_CALENDAR); QThread::msleep(750); - QString schedulestr = CSchedulesDBus::createScheduleDtailInfojson(info); + QString schedulestr; + DSchedule::toJsonString(info, schedulestr); QDBusMessage message = QDBusMessage::createMethodCall(DBUS_CALENDAR_SERVICE, DBUS_CALENDAR_PATCH, DBUS_CALENDAR_INTFACE, @@ -165,130 +99,4 @@ QDBusMessage response = QDBusConnection::sessionBus().call(message); } -QVector viewschedulewidget::queryScheduleWithTime(QVector &scheduleinfo, QTime beginT, QTime endT) -{ - QVector scheduleDateInfo; - ScheduleDateRangeInfo scheduleDInfo; - - for (int i = 0; i < scheduleinfo.count(); i++) { - for (int j = 0; j < scheduleinfo.at(i).vData.count(); j++) { - if (scheduleinfo.at(i).vData.at(j).beginDateTime.time() <= endT - && scheduleinfo.at(i).vData.at(j).endDateTime.time() >= beginT) { - scheduleDInfo.vData.append(scheduleinfo.at(i).vData.at(j)); - } - } - if (scheduleDInfo.vData.count() > 0) - scheduleDateInfo.append(scheduleDInfo); - scheduleDInfo.vData.clear(); - } - return scheduleDateInfo; -} - -QVector viewschedulewidget::queryScheduleWithDate(QVector &scheduleinfo, QDate beginD, QDate endD) -{ - QVector scheduleDateInfo; - ScheduleDateRangeInfo scheduleDInfo; - for (int i = 0; i < scheduleinfo.count(); i++) { - for (int j = 0; j < scheduleinfo.at(i).vData.count(); j++) { - if (scheduleinfo.at(i).vData.at(j).beginDateTime.date() <= endD - && scheduleinfo.at(i).vData.at(j).endDateTime.date() >= beginD) { - scheduleDInfo.vData.append(scheduleinfo.at(i).vData.at(j)); - } - } - if (scheduleDInfo.vData.count() > 0) - scheduleDateInfo.append(scheduleDInfo); - scheduleDInfo.vData.clear(); - } - return scheduleDateInfo; -} - -QVector viewschedulewidget::queryScheduleWithWeek(QVector &scheduleinfo, QVector weekDay, int dayofweek, QTime beginT, QTime endT) -{ - QVector scheduleDateInfo; - ScheduleDateRangeInfo scheduleDInfo; - - for (int i = 0; i < scheduleinfo.count(); i++) { - for (int j = 0; j < scheduleinfo.at(i).vData.count(); j++) { - for (int k = 0; k < weekDay.count(); k++) { - if (scheduleinfo.at(i).vData.at(j).beginDateTime.date().dayOfWeek() == weekDay[k]) { - if (weekDay[k] == dayofweek) { - if (scheduleinfo.at(i).vData.at(j).beginDateTime.time() <= endT - && scheduleinfo.at(i).vData.at(j).endDateTime.time() >= beginT) { - scheduleDInfo.vData.append(scheduleinfo.at(i).vData.at(j)); - } - } else { - scheduleDInfo.vData.append(scheduleinfo.at(i).vData.at(j)); - } - break; - } - } - } - if (scheduleDInfo.vData.count() > 0) - scheduleDateInfo.append(scheduleDInfo); - scheduleDInfo.vData.clear(); - } - - return scheduleDateInfo; -} - -QVector viewschedulewidget::queryScheduleWithMonth(QVector &scheduleinfo, QVector monthDay, int dayofmonth, QTime beginT, QTime endT) -{ - QVector scheduleDateInfo; - ScheduleDateRangeInfo scheduleDInfo; - - for (int i = 0; i < scheduleinfo.count(); i++) { - for (int j = 0; j < scheduleinfo.at(i).vData.count(); j++) { - for (int k = 0; k < monthDay.count(); k++) { - if (scheduleinfo.at(i).vData.at(j).beginDateTime.date().day() == monthDay[k]) { - if (monthDay[k] == dayofmonth) { - if (scheduleinfo.at(i).vData.at(j).beginDateTime.time() <= endT - && scheduleinfo.at(i).vData.at(j).endDateTime.time() >= beginT) { - scheduleDInfo.vData.append(scheduleinfo.at(i).vData.at(j)); - } - } else { - scheduleDInfo.vData.append(scheduleinfo.at(i).vData.at(j)); - } - break; - } - } - } - if (scheduleDInfo.vData.count() > 0) - scheduleDateInfo.append(scheduleDInfo); - scheduleDInfo.vData.clear(); - } - - return scheduleDateInfo; -} - -QVector viewschedulewidget::getAllScheduleInfo() -{ - //查询到的一天的日程 - ScheduleDateRangeInfo showdate; - //查询到的所有日程 - QVector showDate; - //判断查询到的日程是否有重复的 - QVector allScheduleInfo; - - for (int i = 0; i < m_scheduleDateInfo.count(); i++) { - for (int j = 0; j < m_scheduleDateInfo.at(i).vData.count(); j++) { - if (!(m_scheduleDateInfo[i].vData[j].type.ID == 4 || allScheduleInfo.contains(m_scheduleDateInfo[i].vData[j]))) { - //不是节假日并且allScheduleInfo中没有该日程 - allScheduleInfo.append(m_scheduleDateInfo.at(i).vData.at(j)); - showdate.vData.append(m_scheduleDateInfo.at(i).vData.at(j)); - } - } - if (showdate.vData.count() > 0) { - showDate.append(showdate); - } - showdate.vData.clear(); - } - - for (int i = 0; i < showDate.count(); i++) { - for (int j = 0; j < showDate.count() - i - 1; j++) { - if (showDate[j].date > showDate[j + 1].date) - std::swap(showDate[j], showDate[j + 1]); - } - } - return showDate; -} diff -Nru dde-calendar-5.9.1/schedule-plugin/src/widget/viewschedulewidget.h dde-calendar-5.10.0/schedule-plugin/src/widget/viewschedulewidget.h --- dde-calendar-5.9.1/schedule-plugin/src/widget/viewschedulewidget.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/schedule-plugin/src/widget/viewschedulewidget.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,62 +1,39 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef VIEWSCHEDULEWIDGET_H #define VIEWSCHEDULEWIDGET_H -#include #include "icondframe.h" -#include "../data/schedulestructs.h" +#include "dschedule.h" #include "scheduleitemwidget.h" +#include + class viewschedulewidget : public IconDFrame { Q_OBJECT public: explicit viewschedulewidget(QWidget *parent = nullptr); ~viewschedulewidget(); - void setScheduleDateRangeInfo(QVector &scheduleDateInfo); - void viewScheduleInfoShow(QVector m_showdate); - int getScheduleNum(QVector m_showdate); + void setScheduleDateRangeInfo(const DSchedule::Map &scheduleDateInfo); + void viewScheduleInfoShow(const DSchedule::Map &showSchedule); + int getScheduleNum(DSchedule::Map scheduleList); void setQueryBeginDateTime(QDateTime begindatetime); void setQueryEndDateTime(QDateTime enddatetime); - - QVector queryScheduleWithTime(QVector &scheduleinfo, QTime beginT, QTime endT); - QVector queryScheduleWithDate(QVector &scheduleinfo, QDate beginD, QDate endD); - QVector queryScheduleWithWeek(QVector &scheduleinfo, QVector weekDay, int dayofweek = 0, QTime beginT = QTime(0, 0, 0), QTime endT = QTime(0, 0, 0)); - QVector queryScheduleWithMonth(QVector &scheduleinfo, QVector monthDay, int dayofmonth = 0, QTime beginT = QTime(0, 0, 0), QTime endT = QTime(0, 0, 0)); - - QVector getAllScheduleInfo(); - QVector getAllRpeatScheduleInfo(int rpeat); /** * @brief getNextScheduleInfo 获取下一个日程 * @return 下一个日程信息 */ - QVector getNextScheduleInfo(); + DSchedule::Map getNextScheduleInfo(); public slots: - void slotItemPress(const ScheduleDtailInfo &info); + void slotItemPress(const DSchedule::Ptr &info); private: - QVector m_scheduleInfo; - QVector m_scheduleDateInfo; - QVector m_showdate; + DSchedule::List m_scheduleInfo; + DSchedule::Map m_scheduleDateInfo; + DSchedule::Map m_showdate; QDateTime m_beginDateTime; QDateTime m_endDateTime; }; diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/CMakeLists.txt dde-calendar-5.10.0/tests/dde-calendar-client-test/CMakeLists.txt --- dde-calendar-5.9.1/tests/dde-calendar-client-test/CMakeLists.txt 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/CMakeLists.txt 2023-04-07 06:02:09.000000000 +0000 @@ -5,8 +5,10 @@ ADD_COMPILE_OPTIONS(-fno-access-control) set(APP_CLIENT_DIR "${CMAKE_SOURCE_DIR}/calendar-client") -set(APP_RES_DIR "${APP_CLIENT_DIR}/assets") -set(APP_QRC "${APP_RES_DIR}/resources.qrc") +set(APP_COMMON_DIR "${CMAKE_SOURCE_DIR}/calendar-common") +set(APP_3PARTY_DIR "${CMAKE_SOURCE_DIR}/3rdparty/kcalendarcore") +#set(APP_RES_DIR "${APP_CLIENT_DIR}/assets") +#set(APP_QRC "${APP_RES_DIR}/resources.qrc") set(APP_BIN_NAME "dde-calendar-test") set(PROJECT_NAME_TEST ${APP_BIN_NAME}) @@ -30,17 +32,28 @@ set(CMAKE_EXE_LINKER_FLAGS "-pie") include_directories(${APP_CLIENT_DIR}/src) - SUBDIRLIST(all_src ${APP_CLIENT_DIR}/src) -#Include all app own subdirectorys +include_directories(${APP_COMMON_DIR}/src) +SUBDIRLIST(all_src ${APP_COMMON_DIR}/src) + +include_directories(${APP_3PARTY_DIR}/src) +SUBDIRLIST(all_src ${APP_3PARTY_DIR}/src) + +#Include all app own subdirectories foreach(subdir ${all_src}) include_directories(${APP_CLIENT_DIR}/src/${subdir}) + include_directories(${APP_COMMON_DIR}/src/${subdir}) + include_directories(${APP_COMMON_DIR}/src/${subdir}) endforeach() -file(GLOB_RECURSE Calendar_SRC ${APP_CLIENT_DIR}/src/*.cpp) +file(GLOB_RECURSE Calendar_CLIENTSRC ${APP_CLIENT_DIR}/src/*.cpp) +file(GLOB_RECURSE Calendar_COMMONSRC ${APP_COMMON_DIR}/src/*.cpp) +file(GLOB_RECURSE Calendar_3PARTYSRC ${APP_3PARTY_DIR}/src/*.cpp) include_directories(${Qt5Gui_PRIVATE_INCLUDE_DIRS}) -list(REMOVE_ITEM Calendar_SRC ${APP_CLIENT_DIR}/src/main.cpp) +list(REMOVE_ITEM Calendar_CLIENTSRC ${APP_CLIENT_DIR}/src/main.cpp) +list(REMOVE_ITEM Calendar_COMMONSRC ${APP_COMMON_DIR}/src/main.cpp) +list(REMOVE_ITEM Calendar_3PARTYSRC ${APP_3PARTY_DIR}/src/main.cpp) #test SRC SUBDIRLIST(TEST_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src) @@ -55,7 +68,7 @@ include(asan) # Tell CMake to create the executable -add_executable(${APP_BIN_NAME} ${Calendar_TEST_SRC} ${Calendar_SRC} ${APP_QRC}) +add_executable(${APP_BIN_NAME} ${Calendar_TEST_SRC} ${Calendar_CLIENTSRC} ${Calendar_COMMONSRC} ${Calendar_3PARTYSRC} ${APP_QRC}) target_include_directories(${APP_BIN_NAME} PUBLIC ${DtkWidget_INCLUDE_DIRS} ${OBJECT_BINARY_DIR}) diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/client_main.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/client_main.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/client_main.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/client_main.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "gtest/gtest.h" #if defined(CMAKE_SAFETYTEST_ARG_ON) diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/cscheduledbusstub.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/cscheduledbusstub.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/cscheduledbusstub.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/cscheduledbusstub.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,73 +1,57 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ -#include "cscheduledbusstub.h" - -#include "cscheduledbus.h" - -#include - -qint64 CreateJob_stub(void *obj, const ScheduleDataInfo &info) -{ - Q_UNUSED(obj) - Q_UNUSED(info) - return 1; -} - -bool UpdateJob_stub(void *obj, const ScheduleDataInfo &info) -{ - Q_UNUSED(obj) - Q_UNUSED(info) - return true; -} - -bool DeleteJob_stub(void *obj, qint64 jobId) -{ - Q_UNUSED(obj) - Q_UNUSED(jobId) - return true; -} - -bool GetJob_stub(void *obj, qint64 jobId, ScheduleDataInfo &out) -{ - Q_UNUSED(obj) - Q_UNUSED(jobId) - Q_UNUSED(out) - return true; -} - -bool QueryJobs_stub(void *obj, QString key, QDateTime starttime, QDateTime endtime, QMap> &out) -{ - Q_UNUSED(obj) - Q_UNUSED(key) - Q_UNUSED(starttime) - Q_UNUSED(endtime) - Q_UNUSED(out) - return true; -} - -void cscheduleDbusStub(Stub &stub) -{ - stub.set(ADDR(CScheduleDBus, CreateJob), CreateJob_stub); - stub.set(ADDR(CScheduleDBus, UpdateJob), UpdateJob_stub); - stub.set(ADDR(CScheduleDBus, DeleteJob), DeleteJob_stub); - stub.set(ADDR(CScheduleDBus, GetJob), GetJob_stub); - stub.set((bool (CScheduleDBus::*)(QString, QDateTime, QDateTime, QMap> &))ADDR(CScheduleDBus, QueryJobs), QueryJobs_stub); -} +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +//#include "cscheduledbusstub.h" + +//#include "cscheduledbus.h" + +//#include + +//qint64 CreateJob_stub(void *obj, const ScheduleDataInfo &info) +//{ +// Q_UNUSED(obj) +// Q_UNUSED(info) +// return 1; +//} + +//bool UpdateJob_stub(void *obj, const ScheduleDataInfo &info) +//{ +// Q_UNUSED(obj) +// Q_UNUSED(info) +// return true; +//} + +//bool DeleteJob_stub(void *obj, qint64 jobId) +//{ +// Q_UNUSED(obj) +// Q_UNUSED(jobId) +// return true; +//} + +//bool GetJob_stub(void *obj, qint64 jobId, ScheduleDataInfo &out) +//{ +// Q_UNUSED(obj) +// Q_UNUSED(jobId) +// Q_UNUSED(out) +// return true; +//} + +//bool QueryJobs_stub(void *obj, QString key, QDateTime starttime, QDateTime endtime, QMap> &out) +//{ +// Q_UNUSED(obj) +// Q_UNUSED(key) +// Q_UNUSED(starttime) +// Q_UNUSED(endtime) +// Q_UNUSED(out) +// return true; +//} + +//void cscheduleDbusStub(Stub &stub) +//{ +// stub.set(ADDR(CScheduleDBus, CreateJob), CreateJob_stub); +// stub.set(ADDR(CScheduleDBus, UpdateJob), UpdateJob_stub); +// stub.set(ADDR(CScheduleDBus, DeleteJob), DeleteJob_stub); +// stub.set(ADDR(CScheduleDBus, GetJob), GetJob_stub); +// stub.set((bool (CScheduleDBus::*)(QString, QDateTime, QDateTime, QMap> &))ADDR(CScheduleDBus, QueryJobs), QueryJobs_stub); +//} diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/cscheduledbusstub.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/cscheduledbusstub.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/cscheduledbusstub.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/cscheduledbusstub.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef CSCHEDULEDBUSSTUB_H #define CSCHEDULEDBUSSTUB_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/dialog_stub.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/dialog_stub.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/dialog_stub.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/dialog_stub.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "dialog_stub.h" #include "dialog/dcalendarddialog.h" @@ -32,10 +16,13 @@ Q_UNUSED(obj) return calendarDDialogExecReturn; } - void calendarDDialogExecStub(Stub &stub) { typedef int (*fptr)(DDialog *); fptr A_foo = (fptr)(&DDialog::exec); stub.set(A_foo, calendar_DDialog_Exec_stub); + + typedef int (*fptr2)(QDialog *); + fptr2 A_foo2 = (fptr2)(&QDialog::exec); + stub.set(A_foo2, calendar_DDialog_Exec_stub); } diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/dialog_stub.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/dialog_stub.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/dialog_stub.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/dialog_stub.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef DIALOG_STUB_H #define DIALOG_STUB_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_configsettings.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_configsettings.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_configsettings.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_configsettings.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: hejinghai -* -* Maintainer: hejinghai -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "test_configsettings.h" test_configsettings::test_configsettings() diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_configsettings.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_configsettings.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_configsettings.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_configsettings.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: hejinghai -* -* Maintainer: hejinghai -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_CONFIGSETTINGS_H #define TEST_CONFIGSETTINGS_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_cscheduleoperation.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_cscheduleoperation.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_cscheduleoperation.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_cscheduleoperation.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,229 +1,213 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "test_cscheduleoperation.h" -#include "cscheduledbus.h" -#include "dialog/dcalendarddialog.h" -#include "schedulectrldlg.h" -#include "dialog_stub.h" -#include "cscheduledbusstub.h" - -test_cscheduleoperation::test_cscheduleoperation() -{ -} - -test_cscheduleoperation::~test_cscheduleoperation() -{ -} - -namespace ScheduleTestBtnNum { -static int button_num = 0; -} -int clickButton_stub(void *obj) -{ - Q_UNUSED(obj) - return ScheduleTestBtnNum::button_num; -} - -void test_cscheduleoperation::SetUp() -{ - cscheduleDbusStub(stub); -} - -void test_cscheduleoperation::TearDown() -{ -} - -TEST_F(test_cscheduleoperation, createSchedule) -{ - ScheduleDataInfo info; - operation.createSchedule(info); -} - -TEST_F(test_cscheduleoperation, changeSchedule) -{ - calendarDDialogExecStub(stub); - stub.set(ADDR(CScheduleCtrlDlg, clickButton), clickButton_stub); - ScheduleDataInfo info; - QDate current = QDate::currentDate(); - info.setBeginDateTime(QDateTime(current, QTime(0, 0, 0))); - info.setEndDateTime(QDateTime(current, QTime(23, 59, 59))); - info.setTitleName(tr("New Event")); - info.setAllDay(true); - info.setRemindData(RemindData(1, QTime(9, 0))); - info.setID(0); - info.setRecurID(0); - - ScheduleDataInfo newinfo = info; - newinfo.setTitleName(tr("test")); - - newinfo.setAllDay(false); - info.getRepetitionRule().setRuleId(RepetitionRule::RRule_NONE); - ScheduleTestBtnNum::button_num = 0; - operation.changeSchedule(newinfo, info); - ScheduleTestBtnNum::button_num = 1; - operation.changeSchedule(newinfo, info); - - newinfo.setAllDay(true); - operation.changeSchedule(newinfo, info); - ScheduleTestBtnNum::button_num = 0; - newinfo.getRepetitionRule().setRuleId(RepetitionRule::RRule_EVEDAY); - operation.changeSchedule(newinfo, info); - ScheduleTestBtnNum::button_num = 1; - operation.changeSchedule(newinfo, info); - info.getRepetitionRule().setRuleId(RepetitionRule::RRule_EVEDAY); - operation.changeSchedule(newinfo, info); - ScheduleTestBtnNum::button_num = 0; - operation.changeSchedule(newinfo, info); - ScheduleTestBtnNum::button_num = 2; - operation.changeSchedule(newinfo, info); - - newinfo.setRecurID(2); - ScheduleTestBtnNum::button_num = 0; - operation.changeSchedule(newinfo, info); - ScheduleTestBtnNum::button_num = 1; - operation.changeSchedule(newinfo, info); - ScheduleTestBtnNum::button_num = 2; - operation.changeSchedule(newinfo, info); -} - -TEST_F(test_cscheduleoperation, changeSchedule_01) -{ - calendarDDialogExecStub(stub); - ScheduleDataInfo oldInfo; - ScheduleDataInfo newInfo; - oldInfo.setAllDay(true); - oldInfo.m_ScheduleRRule.setRuleId(RepetitionRule::RRule_NONE); - newInfo.setAllDay(false); - newInfo.m_ScheduleRRule.setRuleId(RepetitionRule::RRule_EVEDAY); - operation.changeSchedule(oldInfo, newInfo); -} - -TEST_F(test_cscheduleoperation, deleteSchedule) -{ - calendarDDialogExecStub(stub); - stub.set(ADDR(CScheduleCtrlDlg, clickButton), clickButton_stub); - ScheduleDataInfo info; - QDate current = QDate::currentDate(); - info.setBeginDateTime(QDateTime(current, QTime(0, 0, 0))); - info.setEndDateTime(QDateTime(current, QTime(23, 59, 59))); - info.setTitleName(tr("New Event")); - info.setAllDay(true); - info.setRemindData(RemindData(1, QTime(9, 0))); - info.setID(0); - info.setRecurID(0); - ScheduleTestBtnNum::button_num = 0; - operation.deleteSchedule(info); - ScheduleTestBtnNum::button_num = 1; - operation.deleteSchedule(info); - - //删除重复日程 - info.getRepetitionRule().setRuleId(RepetitionRule::RRule_EVEDAY); - ScheduleTestBtnNum::button_num = 0; - operation.deleteSchedule(info); - ScheduleTestBtnNum::button_num = 1; - operation.deleteSchedule(info); - ScheduleTestBtnNum::button_num = 2; - operation.deleteSchedule(info); - - info.setRecurID(2); - ScheduleTestBtnNum::button_num = 0; - operation.deleteSchedule(info); - ScheduleTestBtnNum::button_num = 1; - operation.deleteSchedule(info); - ScheduleTestBtnNum::button_num = 2; - operation.deleteSchedule(info); -} - -TEST_F(test_cscheduleoperation, queryScheduleStr) -{ - QDateTime currenttime = QDateTime::currentDateTime(); - operation.queryScheduleStr("", currenttime, currenttime); -} - -TEST_F(test_cscheduleoperation, deleteOnlyInfo_01) -{ - ScheduleDataInfo info; - operation.deleteOnlyInfo(info); -} - -TEST_F(test_cscheduleoperation, deleteOnlyInfo_02) -{ - ScheduleDataInfo info; - info.m_ScheduleRRule.setRuleId(RepetitionRule::RRule_EVEDAY); - operation.deleteOnlyInfo(info); -} - -TEST_F(test_cscheduleoperation, deleteOnlyInfo_03) -{ - ScheduleDataInfo info; - info.setType(4); - operation.deleteOnlyInfo(info); -} - -TEST_F(test_cscheduleoperation, queryScheduleInfo_01) -{ - ScheduleDataInfo info; - QDateTime date; - QMap> map; - operation.queryScheduleInfo("", date, date, map); -} - -TEST_F(test_cscheduleoperation, updateJobType_01) -{ - calendarDDialogExecStub(stub); - JobTypeInfo oldInfo(0); - JobTypeInfo newInfo; - operation.updateJobType(oldInfo, newInfo); -} - -TEST_F(test_cscheduleoperation, updateJobType_02) -{ - calendarDDialogExecStub(stub); - JobTypeInfo oldInfo(1); - JobTypeInfo newInfo(1); - EXPECT_TRUE(operation.updateJobType(oldInfo, newInfo)); -} - -TEST_F(test_cscheduleoperation, updateJobType_03) -{ - calendarDDialogExecStub(stub); - JobTypeInfo oldInfo(1, "", 10); - JobTypeInfo newInfo(0, "", 0); - operation.updateJobType(oldInfo, newInfo); - EXPECT_EQ(oldInfo.getColorTypeNo(), newInfo.getColorTypeNo()); -} - -TEST_F(test_cscheduleoperation, updateJobType_04) -{ - calendarDDialogExecStub(stub); - JobTypeInfo oldInfo(1, "", 5); - JobTypeInfo newInfo(0, "", 0); - operation.updateJobType(oldInfo, newInfo); - EXPECT_TRUE(newInfo.getColorTypeNo() != 5); -} - -TEST_F(test_cscheduleoperation, updateJobType_05) -{ - calendarDDialogExecStub(stub); - JobTypeInfo oldInfo(1, "", 5); - operation.updateJobType(oldInfo); -} +//#include "cscheduledbus.h" +//#include "dialog/dcalendarddialog.h" +//#include "schedulectrldlg.h" +//#include "dialog_stub.h" +//#include "cscheduledbusstub.h" + +//test_cscheduleoperation::test_cscheduleoperation() +//{ +//} + +//test_cscheduleoperation::~test_cscheduleoperation() +//{ +//} + +//namespace ScheduleTestBtnNum { +//static int button_num = 0; +//} +//int clickButton_stub(void *obj) +//{ +// Q_UNUSED(obj) +// return ScheduleTestBtnNum::button_num; +//} + +//void test_cscheduleoperation::SetUp() +//{ +// cscheduleDbusStub(stub); +//} + +//void test_cscheduleoperation::TearDown() +//{ +//} + +//TEST_F(test_cscheduleoperation, createSchedule) +//{ +// ScheduleDataInfo info; +// operation.createSchedule(info); +//} + +//TEST_F(test_cscheduleoperation, changeSchedule) +//{ +// calendarDDialogExecStub(stub); +// stub.set(ADDR(CScheduleCtrlDlg, clickButton), clickButton_stub); +// ScheduleDataInfo info; +// QDate current = QDate::currentDate(); +// info.setBeginDateTime(QDateTime(current, QTime(0, 0, 0))); +// info.setEndDateTime(QDateTime(current, QTime(23, 59, 59))); +// info.setTitleName(tr("New Event")); +// info.setAllDay(true); +// info.setRemindData(RemindData(1, QTime(9, 0))); +// info.setID(0); +// info.setRecurID(0); + +// ScheduleDataInfo newinfo = info; +// newinfo.setTitleName(tr("test")); + +// newinfo.setAllDay(false); +// info.getRepetitionRule().setRuleId(RepetitionRule::RRule_NONE); +// ScheduleTestBtnNum::button_num = 0; +// operation.changeSchedule(newinfo, info); +// ScheduleTestBtnNum::button_num = 1; +// operation.changeSchedule(newinfo, info); + +// newinfo.setAllDay(true); +// operation.changeSchedule(newinfo, info); +// ScheduleTestBtnNum::button_num = 0; +// newinfo.getRepetitionRule().setRuleId(RepetitionRule::RRule_EVEDAY); +// operation.changeSchedule(newinfo, info); +// ScheduleTestBtnNum::button_num = 1; +// operation.changeSchedule(newinfo, info); +// info.getRepetitionRule().setRuleId(RepetitionRule::RRule_EVEDAY); +// operation.changeSchedule(newinfo, info); +// ScheduleTestBtnNum::button_num = 0; +// operation.changeSchedule(newinfo, info); +// ScheduleTestBtnNum::button_num = 2; +// operation.changeSchedule(newinfo, info); + +// newinfo.setRecurID(2); +// ScheduleTestBtnNum::button_num = 0; +// operation.changeSchedule(newinfo, info); +// ScheduleTestBtnNum::button_num = 1; +// operation.changeSchedule(newinfo, info); +// ScheduleTestBtnNum::button_num = 2; +// operation.changeSchedule(newinfo, info); +//} + +//TEST_F(test_cscheduleoperation, changeSchedule_01) +//{ +// calendarDDialogExecStub(stub); +// ScheduleDataInfo oldInfo; +// ScheduleDataInfo newInfo; +// oldInfo.setAllDay(true); +// oldInfo.m_ScheduleRRule.setRuleId(RepetitionRule::RRule_NONE); +// newInfo.setAllDay(false); +// newInfo.m_ScheduleRRule.setRuleId(RepetitionRule::RRule_EVEDAY); +// operation.changeSchedule(oldInfo, newInfo); +//} + +//TEST_F(test_cscheduleoperation, deleteSchedule) +//{ +// calendarDDialogExecStub(stub); +// stub.set(ADDR(CScheduleCtrlDlg, clickButton), clickButton_stub); +// ScheduleDataInfo info; +// QDate current = QDate::currentDate(); +// info.setBeginDateTime(QDateTime(current, QTime(0, 0, 0))); +// info.setEndDateTime(QDateTime(current, QTime(23, 59, 59))); +// info.setTitleName(tr("New Event")); +// info.setAllDay(true); +// info.setRemindData(RemindData(1, QTime(9, 0))); +// info.setID(0); +// info.setRecurID(0); +// ScheduleTestBtnNum::button_num = 0; +// operation.deleteSchedule(info); +// ScheduleTestBtnNum::button_num = 1; +// operation.deleteSchedule(info); + +// //删除重复日程 +// info.getRepetitionRule().setRuleId(RepetitionRule::RRule_EVEDAY); +// ScheduleTestBtnNum::button_num = 0; +// operation.deleteSchedule(info); +// ScheduleTestBtnNum::button_num = 1; +// operation.deleteSchedule(info); +// ScheduleTestBtnNum::button_num = 2; +// operation.deleteSchedule(info); + +// info.setRecurID(2); +// ScheduleTestBtnNum::button_num = 0; +// operation.deleteSchedule(info); +// ScheduleTestBtnNum::button_num = 1; +// operation.deleteSchedule(info); +// ScheduleTestBtnNum::button_num = 2; +// operation.deleteSchedule(info); +//} + +//TEST_F(test_cscheduleoperation, queryScheduleStr) +//{ +// QDateTime currenttime = QDateTime::currentDateTime(); +// operation.queryScheduleStr("", currenttime, currenttime); +//} + +//TEST_F(test_cscheduleoperation, deleteOnlyInfo_01) +//{ +// ScheduleDataInfo info; +// operation.deleteOnlyInfo(info); +//} + +//TEST_F(test_cscheduleoperation, deleteOnlyInfo_02) +//{ +// ScheduleDataInfo info; +// info.m_ScheduleRRule.setRuleId(RepetitionRule::RRule_EVEDAY); +// operation.deleteOnlyInfo(info); +//} + +//TEST_F(test_cscheduleoperation, deleteOnlyInfo_03) +//{ +// ScheduleDataInfo info; +// info.setType(4); +// operation.deleteOnlyInfo(info); +//} + +//TEST_F(test_cscheduleoperation, queryScheduleInfo_01) +//{ +// ScheduleDataInfo info; +// QDateTime date; +// QMap> map; +// operation.queryScheduleInfo("", date, date, map); +//} + +//TEST_F(test_cscheduleoperation, updateJobType_01) +//{ +// calendarDDialogExecStub(stub); +// JobTypeInfo oldInfo(0); +// JobTypeInfo newInfo; +// operation.updateJobType(oldInfo, newInfo); +//} + +//TEST_F(test_cscheduleoperation, updateJobType_02) +//{ +// calendarDDialogExecStub(stub); +// JobTypeInfo oldInfo(1); +// JobTypeInfo newInfo(1); +// EXPECT_TRUE(operation.updateJobType(oldInfo, newInfo)); +//} + +//TEST_F(test_cscheduleoperation, updateJobType_03) +//{ +// calendarDDialogExecStub(stub); +// JobTypeInfo oldInfo(1, "", 10); +// JobTypeInfo newInfo(0, "", 0); +// operation.updateJobType(oldInfo, newInfo); +// EXPECT_EQ(oldInfo.getColorTypeNo(), newInfo.getColorTypeNo()); +//} + +//TEST_F(test_cscheduleoperation, updateJobType_04) +//{ +// calendarDDialogExecStub(stub); +// JobTypeInfo oldInfo(1, "", 5); +// JobTypeInfo newInfo(0, "", 0); +// operation.updateJobType(oldInfo, newInfo); +// EXPECT_TRUE(newInfo.getColorTypeNo() != 5); +//} + +//TEST_F(test_cscheduleoperation, updateJobType_05) +//{ +// calendarDDialogExecStub(stub); +// JobTypeInfo oldInfo(1, "", 5); +// operation.updateJobType(oldInfo); +//} diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_cscheduleoperation.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_cscheduleoperation.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_cscheduleoperation.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_cscheduleoperation.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_CSCHEDULEOPERATION_H #define TEST_CSCHEDULEOPERATION_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_animationstackedwidget.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_animationstackedwidget.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_animationstackedwidget.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_animationstackedwidget.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "test_animationstackedwidget.h" test_animationstackedwidget::test_animationstackedwidget() diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_animationstackedwidget.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_animationstackedwidget.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_animationstackedwidget.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_animationstackedwidget.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_ANIMATIONSTACKEDWIDGET_H #define TEST_ANIMATIONSTACKEDWIDGET_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_ccustomtimeedit.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_ccustomtimeedit.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_ccustomtimeedit.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_ccustomtimeedit.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "test_ccustomtimeedit.h" #include diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_ccustomtimeedit.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_ccustomtimeedit.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_ccustomtimeedit.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_ccustomtimeedit.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_CCUSTOMTIMEEDIT_H #define TEST_CCUSTOMTIMEEDIT_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_cdateedit.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_cdateedit.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_cdateedit.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_cdateedit.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,152 +1,136 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: leilong -* -* Maintainer: leilong -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ -#include "test_cdateedit.h" - -test_cdateedit::test_cdateedit(QObject *parent) : QObject(parent) -{ - -} - -TEST_F(test_cdateedit, setDate_001) -{ - QDate date = QDate(2022, 4, 20); - mWidget->setDate(date); - EXPECT_EQ(mWidget->date().toString(), date.toString()); -} - -TEST_F(test_cdateedit, setDisplayFormat_001) -{ - mWidget->setDisplayFormat("123"); - EXPECT_EQ(mWidget->m_format, "123") << "123"; - mWidget->setDisplayFormat("yyyy/MM/dd"); - EXPECT_EQ(mWidget->m_format, "yyyy/MM/dd") << "yyyy/MM/dd"; -} - -TEST_F(test_cdateedit, displayFormat_001) -{ - mWidget->setDisplayFormat("123"); - EXPECT_EQ(mWidget->displayFormat(), "123") << "123"; - mWidget->setDisplayFormat("yyyy/MM/dd"); - EXPECT_EQ(mWidget->displayFormat(), "yyyy/MM/dd") << "yyyy/MM/dd"; -} - -TEST_F(test_cdateedit, setLunarCalendarStatus_001) -{ - mWidget->setLunarCalendarStatus(true); - EXPECT_TRUE(mWidget->m_showLunarCalendar) << "true"; - mWidget->setLunarCalendarStatus(false); - EXPECT_FALSE(mWidget->m_showLunarCalendar) << "false"; -} - -TEST_F(test_cdateedit, setLunarTextFormat_001) -{ - QTextCharFormat format; - mWidget->setLunarTextFormat(format); - EXPECT_EQ(mWidget->m_lunarTextFormat, format); -} - -TEST_F(test_cdateedit, getsetLunarTextFormat_001) -{ - QTextCharFormat format; - mWidget->setLunarTextFormat(format); - EXPECT_EQ(mWidget->getsetLunarTextFormat(), format); -} - -TEST_F(test_cdateedit, setCalendarPopup_001) -{ - mWidget->setCalendarPopup(true); -} - -TEST_F(test_cdateedit, slotDateEidtInfo_001) -{ - mWidget->setLunarCalendarStatus(true); - mWidget->slotDateEidtInfo(QDate()); -} - -TEST_F(test_cdateedit, slotDateEidtInfo_002) -{ - mWidget->setLunarCalendarStatus(false); - mWidget->slotDateEidtInfo(QDate()); -} - -TEST_F(test_cdateedit, slotRefreshLineEditTextFormat_001) -{ - mWidget->setLunarCalendarStatus(true); - mWidget->slotRefreshLineEditTextFormat("1232/23/13"); -} - -TEST_F(test_cdateedit, slotCursorPositionChanged_001) -{ - mWidget->setLunarCalendarStatus(true); - mWidget->slotCursorPositionChanged(0, 2); -} - -TEST_F(test_cdateedit, slotCursorPositionChanged_002) -{ - mWidget->setLunarCalendarStatus(false); - mWidget->slotCursorPositionChanged(0, 2); -} - -TEST_F(test_cdateedit, slotCursorPositionChanged_003) -{ - mWidget->setLunarCalendarStatus(true); - mWidget->selectAll(); - mWidget->slotCursorPositionChanged(2, 4); -} - -TEST_F(test_cdateedit, slotSelectionChanged_001) -{ - mWidget->setLunarCalendarStatus(true); - mWidget->selectAll(); - mWidget->slotSelectionChanged(); -} - -TEST_F(test_cdateedit, slotSelectionChanged_002) -{ - mWidget->setLunarCalendarStatus(false); - mWidget->selectAll(); - mWidget->slotSelectionChanged(); -} - -TEST_F(test_cdateedit, getLunarName_001) -{ - mWidget->setLunarCalendarStatus(false); - mWidget->getLunarName(QDate(2022, 4, 20)); -} - -TEST_F(test_cdateedit, setLineEditTextFormat_001) -{ - mWidget->setLineEditTextFormat(mWidget->lineEdit(), QList()); -} - -TEST_F(test_cdateedit, updateCalendarWidget_001) -{ - mWidget->setCalendarPopup(true); - mWidget->setLunarCalendarStatus(true); - mWidget->updateCalendarWidget(); -} - -TEST_F(test_cdateedit, updateCalendarWidget_002) -{ - mWidget->setCalendarPopup(true); - mWidget->setLunarCalendarStatus(false); - mWidget->updateCalendarWidget(); -} +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +//#include "test_cdateedit.h" + +//test_cdateedit::test_cdateedit(QObject *parent) : QObject(parent) +//{ + +//} + +//TEST_F(test_cdateedit, setDate_001) +//{ +// QDate date = QDate(2022, 4, 20); +// mWidget->setDate(date); +// EXPECT_EQ(mWidget->date().toString(), date.toString()); +//} + +//TEST_F(test_cdateedit, setDisplayFormat_001) +//{ +// mWidget->setDisplayFormat("123"); +// EXPECT_EQ(mWidget->m_format, "123") << "123"; +// mWidget->setDisplayFormat("yyyy/MM/dd"); +// EXPECT_EQ(mWidget->m_format, "yyyy/MM/dd") << "yyyy/MM/dd"; +//} + +//TEST_F(test_cdateedit, displayFormat_001) +//{ +// mWidget->setDisplayFormat("123"); +// EXPECT_EQ(mWidget->displayFormat(), "123") << "123"; +// mWidget->setDisplayFormat("yyyy/MM/dd"); +// EXPECT_EQ(mWidget->displayFormat(), "yyyy/MM/dd") << "yyyy/MM/dd"; +//} + +//TEST_F(test_cdateedit, setLunarCalendarStatus_001) +//{ +// mWidget->setLunarCalendarStatus(true); +// EXPECT_TRUE(mWidget->m_showLunarCalendar) << "true"; +// mWidget->setLunarCalendarStatus(false); +// EXPECT_FALSE(mWidget->m_showLunarCalendar) << "false"; +//} + +//TEST_F(test_cdateedit, setLunarTextFormat_001) +//{ +// QTextCharFormat format; +// mWidget->setLunarTextFormat(format); +// EXPECT_EQ(mWidget->m_lunarTextFormat, format); +//} + +//TEST_F(test_cdateedit, getsetLunarTextFormat_001) +//{ +// QTextCharFormat format; +// mWidget->setLunarTextFormat(format); +// EXPECT_EQ(mWidget->getsetLunarTextFormat(), format); +//} + +//TEST_F(test_cdateedit, setCalendarPopup_001) +//{ +// mWidget->setCalendarPopup(true); +//} + +//TEST_F(test_cdateedit, slotDateEidtInfo_001) +//{ +// mWidget->setLunarCalendarStatus(true); +// mWidget->slotDateEidtInfo(QDate()); +//} + +//TEST_F(test_cdateedit, slotDateEidtInfo_002) +//{ +// mWidget->setLunarCalendarStatus(false); +// mWidget->slotDateEidtInfo(QDate()); +//} + +//TEST_F(test_cdateedit, slotRefreshLineEditTextFormat_001) +//{ +// mWidget->setLunarCalendarStatus(true); +// mWidget->slotRefreshLineEditTextFormat("1232/23/13"); +//} + +//TEST_F(test_cdateedit, slotCursorPositionChanged_001) +//{ +// mWidget->setLunarCalendarStatus(true); +// mWidget->slotCursorPositionChanged(0, 2); +//} + +//TEST_F(test_cdateedit, slotCursorPositionChanged_002) +//{ +// mWidget->setLunarCalendarStatus(false); +// mWidget->slotCursorPositionChanged(0, 2); +//} + +//TEST_F(test_cdateedit, slotCursorPositionChanged_003) +//{ +// mWidget->setLunarCalendarStatus(true); +// mWidget->selectAll(); +// mWidget->slotCursorPositionChanged(2, 4); +//} + +//TEST_F(test_cdateedit, slotSelectionChanged_001) +//{ +// mWidget->setLunarCalendarStatus(true); +// mWidget->selectAll(); +// mWidget->slotSelectionChanged(); +//} + +//TEST_F(test_cdateedit, slotSelectionChanged_002) +//{ +// mWidget->setLunarCalendarStatus(false); +// mWidget->selectAll(); +// mWidget->slotSelectionChanged(); +//} + +//TEST_F(test_cdateedit, getLunarName_001) +//{ +// mWidget->setLunarCalendarStatus(false); +// mWidget->getLunarName(QDate(2022, 4, 20)); +//} + +//TEST_F(test_cdateedit, setLineEditTextFormat_001) +//{ +// mWidget->setLineEditTextFormat(mWidget->lineEdit(), QList()); +//} + +//TEST_F(test_cdateedit, updateCalendarWidget_001) +//{ +// mWidget->setCalendarPopup(true); +// mWidget->setLunarCalendarStatus(true); +// mWidget->updateCalendarWidget(); +//} + +//TEST_F(test_cdateedit, updateCalendarWidget_002) +//{ +// mWidget->setCalendarPopup(true); +// mWidget->setLunarCalendarStatus(false); +// mWidget->updateCalendarWidget(); +//} diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_cdateedit.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_cdateedit.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_cdateedit.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_cdateedit.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,49 +1,33 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: leilong -* -* Maintainer: leilong -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEXT_CDATEEDIT_H #define TEXT_CDATEEDIT_H -#include "cdateedit.h" -#include -#include -#include - -class test_cdateedit : public QObject, public::testing::Test -{ - Q_OBJECT -public: - explicit test_cdateedit(QObject *parent = nullptr); - - virtual void SetUp() - { - mWidget = new CDateEdit(); - } - - virtual void TearDown() - { - delete mWidget; - mWidget = nullptr; - } -protected: - CDateEdit *mWidget = nullptr; -}; +//#include "cdateedit.h" +//#include +//#include +//#include + +//class test_cdateedit : public QObject, public::testing::Test +//{ +// Q_OBJECT +//public: +// explicit test_cdateedit(QObject *parent = nullptr); + +// virtual void SetUp() +// { +// mWidget = new CDateEdit(); +// } + +// virtual void TearDown() +// { +// delete mWidget; +// mWidget = nullptr; +// } +//protected: +// CDateEdit *mWidget = nullptr; +//}; #endif // TEXT_CDATEEDIT_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_cdynamicicon.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_cdynamicicon.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_cdynamicicon.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_cdynamicicon.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "test_cdynamicicon.h" test_cdynamicicon::test_cdynamicicon() @@ -40,7 +24,9 @@ //void CDynamicIcon::setTitlebar(DTitlebar *titlebar) TEST_F(test_cdynamicicon, setTitlebar) { - DTitlebar *titlebar; + DTitlebar *titlebar = new DTitlebar(); mDynamicicon->setTitlebar(titlebar); + EXPECT_EQ(mDynamicicon->m_Titlebar, titlebar); + delete titlebar; } diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_cdynamicicon.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_cdynamicicon.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_cdynamicicon.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_cdynamicicon.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_CDYNAMICICON_H #define TEST_CDYNAMICICON_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_colorseletorwidget.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_colorseletorwidget.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_colorseletorwidget.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_colorseletorwidget.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,151 +1,119 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: leilong -* -* Maintainer: leilong -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "test_colorseletorwidget.h" -#include "../third-party_stub/stub.h" +#include "../dialog_stub.h" + +//test_colorseletorwidget::test_colorseletorwidget(QObject *parent) : QObject(parent) +//{ + +//} -static int colorseletorwidget_stub_true() -{ - return 1; -} - -test_colorseletorwidget::test_colorseletorwidget(QObject *parent) : QObject(parent) -{ - -} - -TEST_F(test_colorseletorwidget, reset_001) -{ - mWidget->reset(); - EXPECT_TRUE(mWidget->m_colorEntityMap.isEmpty()); -} - -TEST_F(test_colorseletorwidget, getSelectedColorInfo_001) -{ - JobTypeColorInfo info(0, "#123456", 1); - mWidget->m_colorInfo = info; - EXPECT_TRUE(mWidget->getSelectedColorInfo() == info); -} - -TEST_F(test_colorseletorwidget, setUserColor_001) -{ - JobTypeColorInfo info(0, "#123456", ColorSeletorWidget::TypeSystem); - mWidget->setUserColor(info); - EXPECT_TRUE(mWidget->m_userColorBtn == nullptr); -} - -TEST_F(test_colorseletorwidget, setUserColor_002) -{ - JobTypeColorInfo info(0, "#123456", ColorSeletorWidget::TypeUser); - mWidget->setUserColor(info); - EXPECT_TRUE(mWidget->m_userColorBtn != nullptr); -} - -TEST_F(test_colorseletorwidget, setSelectedColorByIndex_001) -{ - mWidget->reset(); - JobTypeColorInfo info(0, "#123456", ColorSeletorWidget::TypeUser); - mWidget->setUserColor(info); - mWidget->setSelectedColorByIndex(0); - EXPECT_TRUE(mWidget->m_userColorBtn->isChecked()); -} - -TEST_F(test_colorseletorwidget, setSelectedColorById_001) -{ - mWidget->reset(); - mWidget->addColor(JobTypeColorInfo(1, "#123456", ColorSeletorWidget::TypeSystem)); - mWidget->addColor(JobTypeColorInfo(2, "#111111", ColorSeletorWidget::TypeSystem)); - mWidget->addColor(JobTypeColorInfo(3, "#222222", ColorSeletorWidget::TypeSystem)); - mWidget->addColor(JobTypeColorInfo(4, "#333333", ColorSeletorWidget::TypeSystem)); - mWidget->addColor(JobTypeColorInfo(0, "#444444", ColorSeletorWidget::TypeUser)); - mWidget->setSelectedColorById(0); - EXPECT_TRUE(mWidget->m_userColorBtn->isChecked()) << "0"; - mWidget->setSelectedColorById(3); - EXPECT_FALSE(mWidget->m_userColorBtn->isChecked()) << "3"; -} - -TEST_F(test_colorseletorwidget, setSelectedColor_001) -{ - mWidget->reset(); - mWidget->addColor(JobTypeColorInfo(1, "#123456", ColorSeletorWidget::TypeSystem)); - mWidget->addColor(JobTypeColorInfo(2, "#111111", ColorSeletorWidget::TypeSystem)); - mWidget->addColor(JobTypeColorInfo(3, "#222222", ColorSeletorWidget::TypeSystem)); - mWidget->addColor(JobTypeColorInfo(4, "#333333", ColorSeletorWidget::TypeSystem)); - mWidget->addColor(JobTypeColorInfo(0, "#444444", ColorSeletorWidget::TypeUser)); - mWidget->setSelectedColor(JobTypeColorInfo(0, "#444444", ColorSeletorWidget::TypeUser)); - EXPECT_TRUE(mWidget->m_userColorBtn->isChecked()) << "1"; - mWidget->setSelectedColor((JobTypeColorInfo(4, "#333333", ColorSeletorWidget::TypeSystem))); - EXPECT_FALSE(mWidget->m_userColorBtn->isChecked()) << "2"; - mWidget->setSelectedColor((JobTypeColorInfo(4, "#555555", ColorSeletorWidget::TypeSystem))); - EXPECT_TRUE(mWidget->m_userColorBtn->isChecked()) << "3"; -} - -TEST_F(test_colorseletorwidget, initColorButton_001) -{ - mWidget->initColorButton(); -} - -TEST_F(test_colorseletorwidget, slotButtonClicked_001) -{ - mWidget->reset(); - mWidget->addColor(JobTypeColorInfo(1, "#123456", ColorSeletorWidget::TypeSystem)); - mWidget->addColor(JobTypeColorInfo(2, "#111111", ColorSeletorWidget::TypeSystem)); - mWidget->addColor(JobTypeColorInfo(3, "#222222", ColorSeletorWidget::TypeSystem)); - mWidget->addColor(JobTypeColorInfo(4, "#333333", ColorSeletorWidget::TypeSystem)); - mWidget->addColor(JobTypeColorInfo(0, "#444444", ColorSeletorWidget::TypeUser)); - mWidget->slotButtonClicked(1); - mWidget->slotButtonClicked(6); -} - -TEST_F(test_colorseletorwidget, slotAddColorButClicked_001) -{ - typedef int (*fptr)(); - fptr A_foo = (fptr)(&QDialog::exec); - Stub stub; - stub.set(A_foo, colorseletorwidget_stub_true); - - mWidget->slotAddColorButClicked(); - EXPECT_TRUE(mWidget->m_userColorBtn->isChecked()); -} - -TEST_F(test_colorseletorwidget, init_001) -{ - mWidget->init(); -} - -TEST_F(test_colorseletorwidget, initView_001) -{ - mWidget->initView(); -} - -TEST_F(test_colorseletorwidget, addColor_001) -{ - mWidget->reset(); - mWidget->addColor(JobTypeColorInfo(0, "", 1)); - EXPECT_EQ(mWidget->m_colorEntityMap.size(), 1); -} - -TEST_F(test_colorseletorwidget, addColor_002) -{ - mWidget->reset(); - mWidget->addColor(JobTypeColorInfo(0, "", ColorSeletorWidget::TypeUser)); - EXPECT_EQ(mWidget->m_colorEntityMap.size(), 1) << "eq"; - EXPECT_NE(mWidget->m_userColorBtn, nullptr) << "ne"; -} +//TEST_F(test_colorseletorwidget, reset_001) +//{ +// mWidget->reset(); +// EXPECT_TRUE(mWidget->m_colorEntityMap.isEmpty()); +//} + +//TEST_F(test_colorseletorwidget, getSelectedColorInfo_001) +//{ +// JobTypeColorInfo info(0, "#123456", 1); +// mWidget->m_colorInfo = info; +// EXPECT_TRUE(mWidget->getSelectedColorInfo() == info); +//} + +//TEST_F(test_colorseletorwidget, setUserColor_001) +//{ +// JobTypeColorInfo info(0, "#123456", ColorSeletorWidget::TypeSystem); +// mWidget->setUserColor(info); +// EXPECT_TRUE(mWidget->m_userColorBtn == nullptr); +//} + +//TEST_F(test_colorseletorwidget, setUserColor_002) +//{ +// JobTypeColorInfo info(0, "#123456", ColorSeletorWidget::TypeUser); +// mWidget->setUserColor(info); +// EXPECT_TRUE(mWidget->m_userColorBtn != nullptr); +//} + +//TEST_F(test_colorseletorwidget, setSelectedColorByIndex_001) +//{ +// mWidget->reset(); +// JobTypeColorInfo info(0, "#123456", ColorSeletorWidget::TypeUser); +// mWidget->setUserColor(info); +// mWidget->setSelectedColorByIndex(0); +// EXPECT_TRUE(mWidget->m_userColorBtn->isChecked()); +//} + +//TEST_F(test_colorseletorwidget, setSelectedColorById_001) +//{ +// mWidget->reset(); +// mWidget->addColor(JobTypeColorInfo(1, "#123456", ColorSeletorWidget::TypeSystem)); +// mWidget->addColor(JobTypeColorInfo(2, "#111111", ColorSeletorWidget::TypeSystem)); +// mWidget->addColor(JobTypeColorInfo(3, "#222222", ColorSeletorWidget::TypeSystem)); +// mWidget->addColor(JobTypeColorInfo(4, "#333333", ColorSeletorWidget::TypeSystem)); +// mWidget->addColor(JobTypeColorInfo(0, "#444444", ColorSeletorWidget::TypeUser)); +// mWidget->setSelectedColorById(0); +// EXPECT_TRUE(mWidget->m_userColorBtn->isChecked()) << "0"; +// mWidget->setSelectedColorById(3); +// EXPECT_FALSE(mWidget->m_userColorBtn->isChecked()) << "3"; +//} + +//TEST_F(test_colorseletorwidget, setSelectedColor_001) +//{ +// mWidget->reset(); +// mWidget->addColor(JobTypeColorInfo(1, "#123456", ColorSeletorWidget::TypeSystem)); +// mWidget->addColor(JobTypeColorInfo(2, "#111111", ColorSeletorWidget::TypeSystem)); +// mWidget->addColor(JobTypeColorInfo(3, "#222222", ColorSeletorWidget::TypeSystem)); +// mWidget->addColor(JobTypeColorInfo(4, "#333333", ColorSeletorWidget::TypeSystem)); +// mWidget->addColor(JobTypeColorInfo(0, "#444444", ColorSeletorWidget::TypeUser)); +// mWidget->setSelectedColor(JobTypeColorInfo(0, "#444444", ColorSeletorWidget::TypeUser)); +// EXPECT_TRUE(mWidget->m_userColorBtn->isChecked()) << "1"; +// mWidget->setSelectedColor((JobTypeColorInfo(4, "#333333", ColorSeletorWidget::TypeSystem))); +// EXPECT_FALSE(mWidget->m_userColorBtn->isChecked()) << "2"; +// mWidget->setSelectedColor((JobTypeColorInfo(4, "#555555", ColorSeletorWidget::TypeSystem))); +// EXPECT_TRUE(mWidget->m_userColorBtn->isChecked()) << "3"; +//} + +//TEST_F(test_colorseletorwidget, initColorButton_001) +//{ +// mWidget->initColorButton(); +//} + +//TEST_F(test_colorseletorwidget, slotButtonClicked_001) +//{ +// mWidget->reset(); +// mWidget->addColor(JobTypeColorInfo(1, "#123456", ColorSeletorWidget::TypeSystem)); +// mWidget->addColor(JobTypeColorInfo(2, "#111111", ColorSeletorWidget::TypeSystem)); +// mWidget->addColor(JobTypeColorInfo(3, "#222222", ColorSeletorWidget::TypeSystem)); +// mWidget->addColor(JobTypeColorInfo(4, "#333333", ColorSeletorWidget::TypeSystem)); +// mWidget->addColor(JobTypeColorInfo(0, "#444444", ColorSeletorWidget::TypeUser)); +// mWidget->slotButtonClicked(1); +// mWidget->slotButtonClicked(6); +//} + +//TEST_F(test_colorseletorwidget, slotAddColorButClicked_001) +//{ +// calendarDDialogExecReturn = 1; +// Stub stub; +// calendarDDialogExecStub(stub); + +// mWidget->slotAddColorButClicked(); +// EXPECT_TRUE(mWidget->m_userColorBtn->isChecked()); +//} + +//TEST_F(test_colorseletorwidget, addColor_001) +//{ +// mWidget->reset(); +// mWidget->addColor(JobTypeColorInfo(0, "", 1)); +// EXPECT_EQ(mWidget->m_colorEntityMap.size(), 1); +//} + +//TEST_F(test_colorseletorwidget, addColor_002) +//{ +// mWidget->reset(); +// mWidget->addColor(JobTypeColorInfo(0, "", ColorSeletorWidget::TypeUser)); +// EXPECT_EQ(mWidget->m_colorEntityMap.size(), 1) << "eq"; +// EXPECT_NE(mWidget->m_userColorBtn, nullptr) << "ne"; +//} diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_colorseletorwidget.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_colorseletorwidget.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_colorseletorwidget.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_colorseletorwidget.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,49 +1,33 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: leilong -* -* Maintainer: leilong -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_COLORSELETORWIDGET_H #define TEST_COLORSELETORWIDGET_H -#include -#include -#include -#include - -class test_colorseletorwidget : public QObject, public::testing::Test -{ - Q_OBJECT -public: - explicit test_colorseletorwidget(QObject *parent = nullptr); - - virtual void SetUp() - { - mWidget = new ColorSeletorWidget(); - } - - virtual void TearDown() - { - delete mWidget; - mWidget = nullptr; - } -protected: - ColorSeletorWidget *mWidget = nullptr; -}; +//#include +//#include +//#include +//#include + +//class test_colorseletorwidget : public QObject, public::testing::Test +//{ +// Q_OBJECT +//public: +// explicit test_colorseletorwidget(QObject *parent = nullptr); + +// virtual void SetUp() +// { +// mWidget = new ColorSeletorWidget(); +// } + +// virtual void TearDown() +// { +// delete mWidget; +// mWidget = nullptr; +// } +//protected: +// ColorSeletorWidget *mWidget = nullptr; +//}; #endif // TEST_COLORSELETORWIDGET_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_colorWidget/test_colorlabel.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_colorWidget/test_colorlabel.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_colorWidget/test_colorlabel.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_colorWidget/test_colorlabel.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,117 +1,101 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: leilong -* -* Maintainer: leilong -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ -#include "test_colorlabel.h" - -test_colorlabel::test_colorlabel(QObject *parent) : QObject(parent) -{ - -} - -TEST_F(test_colorlabel, getColor_001) -{ - ColorLabel *colorLabel = new ColorLabel(); - EXPECT_EQ(colorLabel->getColor(0, 0, 0).name(), "#000000"); - EXPECT_EQ(colorLabel->getColor(1, 0.5, 0.5).name(), "#3f7e7f");; - EXPECT_EQ(colorLabel->getColor(1, 0.2, 0.5).name(), "#667f7f"); - EXPECT_EQ(colorLabel->getColor(1, 0.1, 0.9).name(), "#cee5e5"); - EXPECT_EQ(colorLabel->getColor(1, 0.3, 0.4).name(), "#476566"); - EXPECT_EQ(colorLabel->getColor(2, 0.5, 0.5).name(), "#3f7d7f"); - EXPECT_EQ(colorLabel->getColor(0.5, 0.5, 0.5).name(), "#3f7e7f"); - EXPECT_EQ(colorLabel->getColor(5, 0.5, 0.5).name(), "#3f7a7f"); - EXPECT_EQ(colorLabel->getColor(1, 0.5, 0.5).name(), "#3f7e7f"); - EXPECT_EQ(colorLabel->getColor(10, 0, 0).name(), "#000000"); - EXPECT_EQ(colorLabel->getColor(60, 0, 0).name(), "#000000"); - EXPECT_EQ(colorLabel->getColor(120, 0, 0).name(), "#000000"); - EXPECT_EQ(colorLabel->getColor(180, 0, 0).name(), "#000000"); - EXPECT_EQ(colorLabel->getColor(241, 0, 0).name(), "#000000"); - EXPECT_EQ(colorLabel->getColor(305, 0, 0).name(), "#000000"); - EXPECT_EQ(colorLabel->getColor(360, 0, 0).name(), "#000000"); - delete colorLabel; -} - -TEST_F(test_colorlabel, setHue_001) -{ - ColorLabel *colorLabel = new ColorLabel(); - colorLabel->setHue(1); - EXPECT_EQ(1, colorLabel->m_hue); - colorLabel->setHue(5); - EXPECT_EQ(5, colorLabel->m_hue); - colorLabel->setHue(100); - EXPECT_EQ(100, colorLabel->m_hue); - delete colorLabel; -} - -TEST_F(test_colorlabel, pickColor) -{ - ColorLabel *colorLabel = new ColorLabel(); - colorLabel->pickColor(QPoint(), 0); - delete colorLabel; -} - -TEST_F(test_colorlabel, paintEvent_001) -{ - ColorLabel *colorLabel = new ColorLabel(); - QPaintEvent *e = new QPaintEvent(QRect()); - colorLabel->m_entered = true; - colorLabel->paintEvent(e); - colorLabel->m_entered = false; - colorLabel->paintEvent(e); - delete e; - delete colorLabel; -} - -TEST_F(test_colorlabel, mousePressEvent_001) -{ - ColorLabel *colorLabel = new ColorLabel(); - QMouseEvent *e = new QMouseEvent(QEvent::MouseMove, QPointF(), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); - colorLabel->mousePressEvent(e); - EXPECT_TRUE(colorLabel->m_pressed); - delete e; - delete colorLabel; -} - -TEST_F(test_colorlabel, mouseMoveEvent) -{ - ColorLabel *colorLabel = new ColorLabel(); - QMouseEvent *e = new QMouseEvent(QEvent::MouseMove, QPointF(), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); - colorLabel->mouseMoveEvent(e); - EXPECT_TRUE(colorLabel->m_entered); - delete e; - delete colorLabel; -} - -TEST_F(test_colorlabel, mouseReleaseEvent_001) -{ - ColorLabel *colorLabel = new ColorLabel(); - QMouseEvent *e = new QMouseEvent(QEvent::MouseMove, QPointF(), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); - colorLabel->mouseReleaseEvent(e); - EXPECT_FALSE(colorLabel->m_pressed); - delete e; - delete colorLabel; -} - -TEST_F(test_colorlabel, pickColorCursor_001) -{ - ColorLabel *colorLabel = new ColorLabel(); - QCursor cursor = colorLabel->pickColorCursor(); - EXPECT_NE(cursor, QCursor()); - delete colorLabel; -} +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +//#include "test_colorlabel.h" + +//test_colorlabel::test_colorlabel(QObject *parent) : QObject(parent) +//{ + +//} + +//TEST_F(test_colorlabel, getColor_001) +//{ +// ColorLabel *colorLabel = new ColorLabel(); +// EXPECT_EQ(colorLabel->getColor(0, 0, 0).name(), "#000000"); +// EXPECT_EQ(colorLabel->getColor(1, 0.5, 0.5).name(), "#3f7e7f");; +// EXPECT_EQ(colorLabel->getColor(1, 0.2, 0.5).name(), "#667f7f"); +// EXPECT_EQ(colorLabel->getColor(1, 0.1, 0.9).name(), "#cee5e5"); +// EXPECT_EQ(colorLabel->getColor(1, 0.3, 0.4).name(), "#476566"); +// EXPECT_EQ(colorLabel->getColor(2, 0.5, 0.5).name(), "#3f7d7f"); +// EXPECT_EQ(colorLabel->getColor(0.5, 0.5, 0.5).name(), "#3f7e7f"); +// EXPECT_EQ(colorLabel->getColor(5, 0.5, 0.5).name(), "#3f7a7f"); +// EXPECT_EQ(colorLabel->getColor(1, 0.5, 0.5).name(), "#3f7e7f"); +// EXPECT_EQ(colorLabel->getColor(10, 0, 0).name(), "#000000"); +// EXPECT_EQ(colorLabel->getColor(60, 0, 0).name(), "#000000"); +// EXPECT_EQ(colorLabel->getColor(120, 0, 0).name(), "#000000"); +// EXPECT_EQ(colorLabel->getColor(180, 0, 0).name(), "#000000"); +// EXPECT_EQ(colorLabel->getColor(241, 0, 0).name(), "#000000"); +// EXPECT_EQ(colorLabel->getColor(305, 0, 0).name(), "#000000"); +// EXPECT_EQ(colorLabel->getColor(360, 0, 0).name(), "#000000"); +// delete colorLabel; +//} + +//TEST_F(test_colorlabel, setHue_001) +//{ +// ColorLabel *colorLabel = new ColorLabel(); +// colorLabel->setHue(1); +// EXPECT_EQ(1, colorLabel->m_hue); +// colorLabel->setHue(5); +// EXPECT_EQ(5, colorLabel->m_hue); +// colorLabel->setHue(100); +// EXPECT_EQ(100, colorLabel->m_hue); +// delete colorLabel; +//} + +//TEST_F(test_colorlabel, pickColor) +//{ +// ColorLabel *colorLabel = new ColorLabel(); +// colorLabel->pickColor(QPoint(), 0); +// delete colorLabel; +//} + +//TEST_F(test_colorlabel, paintEvent_001) +//{ +// ColorLabel *colorLabel = new ColorLabel(); +// QPaintEvent *e = new QPaintEvent(QRect()); +// colorLabel->m_entered = true; +// colorLabel->paintEvent(e); +// colorLabel->m_entered = false; +// colorLabel->paintEvent(e); +// delete e; +// delete colorLabel; +//} + +//TEST_F(test_colorlabel, mousePressEvent_001) +//{ +// ColorLabel *colorLabel = new ColorLabel(); +// QMouseEvent *e = new QMouseEvent(QEvent::MouseMove, QPointF(), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); +// colorLabel->mousePressEvent(e); +// EXPECT_TRUE(colorLabel->m_pressed); +// delete e; +// delete colorLabel; +//} + +//TEST_F(test_colorlabel, mouseMoveEvent) +//{ +// ColorLabel *colorLabel = new ColorLabel(); +// QMouseEvent *e = new QMouseEvent(QEvent::MouseMove, QPointF(), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); +// colorLabel->mouseMoveEvent(e); +// EXPECT_TRUE(colorLabel->m_entered); +// delete e; +// delete colorLabel; +//} + +//TEST_F(test_colorlabel, mouseReleaseEvent_001) +//{ +// ColorLabel *colorLabel = new ColorLabel(); +// QMouseEvent *e = new QMouseEvent(QEvent::MouseMove, QPointF(), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); +// colorLabel->mouseReleaseEvent(e); +// EXPECT_FALSE(colorLabel->m_pressed); +// delete e; +// delete colorLabel; +//} + +//TEST_F(test_colorlabel, pickColorCursor_001) +//{ +// ColorLabel *colorLabel = new ColorLabel(); +// QCursor cursor = colorLabel->pickColorCursor(); +// EXPECT_NE(cursor, QCursor()); +// delete colorLabel; +//} diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_colorWidget/test_colorlabel.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_colorWidget/test_colorlabel.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_colorWidget/test_colorlabel.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_colorWidget/test_colorlabel.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,40 +1,24 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: leilong -* -* Maintainer: leilong -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_COLORLABEL_H #define TEST_COLORLABEL_H -#include -#include -#include -#include - -class test_colorlabel : public QObject, public::testing::Test -{ - Q_OBJECT -public: - explicit test_colorlabel(QObject *parent = nullptr); +//#include +//#include +//#include +//#include + +//class test_colorlabel : public QObject, public::testing::Test +//{ +// Q_OBJECT +//public: +// explicit test_colorlabel(QObject *parent = nullptr); -signals: +//signals: -public slots: -}; +//public slots: +//}; #endif // TEST_COLORLABEL_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_colorWidget/test_colorpickerwidget.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_colorWidget/test_colorpickerwidget.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_colorWidget/test_colorpickerwidget.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_colorWidget/test_colorpickerwidget.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,88 +1,64 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: leilong -* -* Maintainer: leilong -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ -#include "test_colorpickerwidget.h" - -test_colorpickerwidget::test_colorpickerwidget(QObject *parent) : QObject(parent) -{ - -} - -TEST_F(test_colorpickerwidget, getSelectedColor_001) -{ - mWidget->slotUpdateColor(QColor("#000000")); - EXPECT_EQ(mWidget->getSelectedColor(), "#000000") << "text: #000000"; - mWidget->slotUpdateColor(QColor("#123456")); - EXPECT_EQ(mWidget->getSelectedColor(), "#123456") << "text: #123456"; -} - -TEST_F(test_colorpickerwidget, initUI_001) -{ - mWidget->initUI(); - EXPECT_EQ(140, mWidget->m_cancelBtn->width()) << "m_cancelBtn->width()"; - EXPECT_EQ(36, mWidget->m_cancelBtn->height()) << "m_cancelBtn->height()"; - EXPECT_FALSE(mWidget->m_colHexLineEdit->isClearButtonEnabled()) << "m_colHexLineEdit->isClearButtonEnabled()"; -} - -TEST_F(test_colorpickerwidget, setColorHexLineEdit_001) -{ - mWidget->setColorHexLineEdit(); - EXPECT_TRUE(mWidget->m_colHexLineEdit->text().isEmpty()); -} - -TEST_F(test_colorpickerwidget, slotUpdateColor) -{ - mWidget->slotUpdateColor(QColor("#000000")); - EXPECT_EQ(mWidget->m_colHexLineEdit->text(), "000000") << "text: #000000"; - mWidget->slotUpdateColor(QColor("#123456")); - EXPECT_EQ(mWidget->m_colHexLineEdit->text(), "123456") << "text: #123456"; -} - -TEST_F(test_colorpickerwidget, slotHexLineEditChange_001) -{ - mWidget->slotHexLineEditChange(""); - EXPECT_FALSE(mWidget->m_enterBtn->isEnabled()); -} - -TEST_F(test_colorpickerwidget, slotHexLineEditChange_002) -{ - mWidget->slotHexLineEditChange("FFfF"); - EXPECT_EQ(mWidget->m_colHexLineEdit->text(), "ffff") << "eq"; - EXPECT_FALSE(mWidget->m_enterBtn->isEnabled()) << "false"; -} - -TEST_F(test_colorpickerwidget, slotHexLineEditChange_003) -{ - mWidget->slotHexLineEditChange("FFfFff"); - EXPECT_EQ(mWidget->m_colHexLineEdit->text(), "ffffff") << "eq"; - EXPECT_TRUE(mWidget->m_enterBtn->isEnabled()) << "true"; -} - -TEST_F(test_colorpickerwidget, slotCancelBtnClicked_001) -{ - mWidget->slotCancelBtnClicked(); -} - -TEST_F(test_colorpickerwidget, slotEnterBtnClicked_001) -{ - mWidget->slotEnterBtnClicked(); -} +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +//#include "test_colorpickerwidget.h" + +//test_colorpickerwidget::test_colorpickerwidget(QObject *parent) : QObject(parent) +//{ + +//} + +//TEST_F(test_colorpickerwidget, getSelectedColor_001) +//{ +// mWidget->slotUpdateColor(QColor("#000000")); +// EXPECT_EQ(mWidget->getSelectedColor(), "#000000") << "text: #000000"; +// mWidget->slotUpdateColor(QColor("#123456")); +// EXPECT_EQ(mWidget->getSelectedColor(), "#123456") << "text: #123456"; +//} + +//TEST_F(test_colorpickerwidget, setColorHexLineEdit_001) +//{ +// mWidget->setColorHexLineEdit(); +// EXPECT_TRUE(mWidget->m_colHexLineEdit->text().isEmpty()); +//} + +//TEST_F(test_colorpickerwidget, slotUpdateColor) +//{ +// mWidget->slotUpdateColor(QColor("#000000")); +// EXPECT_EQ(mWidget->m_colHexLineEdit->text(), "000000") << "text: #000000"; +// mWidget->slotUpdateColor(QColor("#123456")); +// EXPECT_EQ(mWidget->m_colHexLineEdit->text(), "123456") << "text: #123456"; +//} + +//TEST_F(test_colorpickerwidget, slotHexLineEditChange_001) +//{ +// mWidget->slotHexLineEditChange(""); +// EXPECT_FALSE(mWidget->m_enterBtn->isEnabled()); +//} + +//TEST_F(test_colorpickerwidget, slotHexLineEditChange_002) +//{ +// mWidget->slotHexLineEditChange("FFfF"); +// EXPECT_EQ(mWidget->m_colHexLineEdit->text(), "ffff") << "eq"; +// EXPECT_FALSE(mWidget->m_enterBtn->isEnabled()) << "false"; +//} + +//TEST_F(test_colorpickerwidget, slotHexLineEditChange_003) +//{ +// mWidget->slotHexLineEditChange("FFfFff"); +// EXPECT_EQ(mWidget->m_colHexLineEdit->text(), "ffffff") << "eq"; +// EXPECT_TRUE(mWidget->m_enterBtn->isEnabled()) << "true"; +//} + +//TEST_F(test_colorpickerwidget, slotCancelBtnClicked_001) +//{ +// mWidget->slotCancelBtnClicked(); +//} + +//TEST_F(test_colorpickerwidget, slotEnterBtnClicked_001) +//{ +// mWidget->slotEnterBtnClicked(); +//} diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_colorWidget/test_colorpickerwidget.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_colorWidget/test_colorpickerwidget.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_colorWidget/test_colorpickerwidget.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_colorWidget/test_colorpickerwidget.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,49 +1,33 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: leilong -* -* Maintainer: leilong -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_COLORPICKERWIDGET_H #define TEST_COLORPICKERWIDGET_H -#include -#include -#include -#include - -class test_colorpickerwidget : public QObject, public::testing::Test -{ - Q_OBJECT -public: - explicit test_colorpickerwidget(QObject *parent = nullptr); - - virtual void SetUp() - { - mWidget = new CColorPickerWidget(); - } - - virtual void TearDown() - { - delete mWidget; - mWidget = nullptr; - } -protected: - CColorPickerWidget *mWidget = nullptr; -}; +//#include +//#include +//#include +//#include + +//class test_colorpickerwidget : public QObject, public::testing::Test +//{ +// Q_OBJECT +//public: +// explicit test_colorpickerwidget(QObject *parent = nullptr); + +// virtual void SetUp() +// { +// mWidget = new CColorPickerWidget(); +// } + +// virtual void TearDown() +// { +// delete mWidget; +// mWidget = nullptr; +// } +//protected: +// CColorPickerWidget *mWidget = nullptr; +//}; #endif // TEST_COLORPICKERWIDGET_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_colorWidget/test_colorslider.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_colorWidget/test_colorslider.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_colorWidget/test_colorslider.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_colorWidget/test_colorslider.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,49 +1,33 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: leilong -* -* Maintainer: leilong -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ -#include "test_colorslider.h" +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later -test_colorslider::test_colorslider(QObject *parent) : QObject(parent) -{ +//#include "test_colorslider.h" -} +//test_colorslider::test_colorslider(QObject *parent) : QObject(parent) +//{ -TEST_F(test_colorslider, getColor_001) -{ - EXPECT_EQ(mWidget->getColor(0, 0, 0).name(), "#000000"); - EXPECT_EQ(mWidget->getColor(1, 0.5, 0.5).name(), "#3f7e7f");; - EXPECT_EQ(mWidget->getColor(1, 0.2, 0.5).name(), "#667f7f"); - EXPECT_EQ(mWidget->getColor(1, 0.1, 0.9).name(), "#cee5e5"); - EXPECT_EQ(mWidget->getColor(1, 0.3, 0.4).name(), "#476566"); - EXPECT_EQ(mWidget->getColor(2, 0.5, 0.5).name(), "#3f7d7f"); - EXPECT_EQ(mWidget->getColor(0.5, 0.5, 0.5).name(), "#3f7e7f"); - EXPECT_EQ(mWidget->getColor(5, 0.5, 0.5).name(), "#3f7a7f"); - EXPECT_EQ(mWidget->getColor(1, 0.5, 0.5).name(), "#3f7e7f"); - EXPECT_EQ(mWidget->getColor(10, 0, 0).name(), "#000000"); - EXPECT_EQ(mWidget->getColor(60, 0, 0).name(), "#000000"); - EXPECT_EQ(mWidget->getColor(71, 0, 0).name(), "#000000"); -} +//} -TEST_F(test_colorslider, paintEvent_001) -{ - QPaintEvent *e = new QPaintEvent(QRect()); - mWidget->paintEvent(e); - delete e; -} +//TEST_F(test_colorslider, getColor_001) +//{ +// EXPECT_EQ(mWidget->getColor(0, 0, 0).name(), "#000000"); +// EXPECT_EQ(mWidget->getColor(1, 0.5, 0.5).name(), "#3f7e7f");; +// EXPECT_EQ(mWidget->getColor(1, 0.2, 0.5).name(), "#667f7f"); +// EXPECT_EQ(mWidget->getColor(1, 0.1, 0.9).name(), "#cee5e5"); +// EXPECT_EQ(mWidget->getColor(1, 0.3, 0.4).name(), "#476566"); +// EXPECT_EQ(mWidget->getColor(2, 0.5, 0.5).name(), "#3f7d7f"); +// EXPECT_EQ(mWidget->getColor(0.5, 0.5, 0.5).name(), "#3f7e7f"); +// EXPECT_EQ(mWidget->getColor(5, 0.5, 0.5).name(), "#3f7a7f"); +// EXPECT_EQ(mWidget->getColor(1, 0.5, 0.5).name(), "#3f7e7f"); +// EXPECT_EQ(mWidget->getColor(10, 0, 0).name(), "#000000"); +// EXPECT_EQ(mWidget->getColor(60, 0, 0).name(), "#000000"); +// EXPECT_EQ(mWidget->getColor(71, 0, 0).name(), "#000000"); +//} + +//TEST_F(test_colorslider, paintEvent_001) +//{ +// QPaintEvent *e = new QPaintEvent(QRect()); +// mWidget->paintEvent(e); +// delete e; +//} diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_colorWidget/test_colorslider.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_colorWidget/test_colorslider.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_colorWidget/test_colorslider.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_colorWidget/test_colorslider.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,49 +1,33 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: leilong -* -* Maintainer: leilong -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEXT_COLORSLIDER_H #define TEXT_COLORSLIDER_H -#include -#include -#include -#include - -class test_colorslider : public QObject, public::testing::Test -{ - Q_OBJECT -public: - explicit test_colorslider(QObject *parent = nullptr); - - virtual void SetUp() - { - mWidget = new ColorSlider(); - } - - virtual void TearDown() - { - delete mWidget; - mWidget = nullptr; - } -protected: - ColorSlider *mWidget = nullptr; -}; +//#include +//#include +//#include +//#include + +//class test_colorslider : public QObject, public::testing::Test +//{ +// Q_OBJECT +//public: +// explicit test_colorslider(QObject *parent = nullptr); + +// virtual void SetUp() +// { +// mWidget = new ColorSlider(); +// } + +// virtual void TearDown() +// { +// delete mWidget; +// mWidget = nullptr; +// } +//protected: +// ColorSlider *mWidget = nullptr; +//}; #endif // TEXT_COLORSLIDER_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_cpushbutton.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_cpushbutton.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_cpushbutton.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_cpushbutton.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,82 +1,66 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: leilong -* -* Maintainer: leilong -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ -#include "test_cpushbutton.h" - -test_cpushbutton::test_cpushbutton(QObject *parent) : QObject(parent) -{ - -} - -TEST_F(test_cpushbutton, setHighlight_001) -{ - mWidget->setHighlight(true); - EXPECT_TRUE(mWidget->m_Highlighted); -} - -TEST_F(test_cpushbutton, setHighlight_002) -{ - mWidget->setHighlight(false); - EXPECT_FALSE(mWidget->m_Highlighted); -} - -TEST_F(test_cpushbutton, isHighlight_001) -{ - mWidget->setHighlight(true); - EXPECT_TRUE(mWidget->isHighlight()); -} - -TEST_F(test_cpushbutton, isHighlight_002) -{ - mWidget->setHighlight(false); - EXPECT_FALSE(mWidget->isHighlight()); -} - -TEST_F(test_cpushbutton, mousePressEvent_001) -{ - QMouseEvent *e = new QMouseEvent(QEvent::MouseMove, QPointF(), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); - mWidget->mousePressEvent(e); - EXPECT_TRUE(mWidget->m_pressed); - delete e; -} - -TEST_F(test_cpushbutton, mouseReleaseEvent_001) -{ - QMouseEvent *e = new QMouseEvent(QEvent::MouseMove, QPointF(), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); - mWidget->mouseReleaseEvent(e); - EXPECT_FALSE(mWidget->m_pressed); - delete e; -} - -TEST_F(test_cpushbutton, paintEvent_001) -{ - QPaintEvent *e = new QPaintEvent(QRect()); - mWidget->setHighlight(true); - mWidget->paintEvent(e); - delete e; -} - -TEST_F(test_cpushbutton, paintEvent_002) -{ - QPaintEvent *e = new QPaintEvent(QRect()); - mWidget->setHighlight(false); - mWidget->paintEvent(e); - delete e; -} +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +//#include "test_cpushbutton.h" + +//test_cpushbutton::test_cpushbutton(QObject *parent) : QObject(parent) +//{ + +//} + +//TEST_F(test_cpushbutton, setHighlight_001) +//{ +// mWidget->setHighlight(true); +// EXPECT_TRUE(mWidget->m_Highlighted); +//} + +//TEST_F(test_cpushbutton, setHighlight_002) +//{ +// mWidget->setHighlight(false); +// EXPECT_FALSE(mWidget->m_Highlighted); +//} + +//TEST_F(test_cpushbutton, isHighlight_001) +//{ +// mWidget->setHighlight(true); +// EXPECT_TRUE(mWidget->isHighlight()); +//} + +//TEST_F(test_cpushbutton, isHighlight_002) +//{ +// mWidget->setHighlight(false); +// EXPECT_FALSE(mWidget->isHighlight()); +//} + +//TEST_F(test_cpushbutton, mousePressEvent_001) +//{ +// QMouseEvent *e = new QMouseEvent(QEvent::MouseMove, QPointF(), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); +// mWidget->mousePressEvent(e); +// EXPECT_TRUE(mWidget->m_pressed); +// delete e; +//} + +//TEST_F(test_cpushbutton, mouseReleaseEvent_001) +//{ +// QMouseEvent *e = new QMouseEvent(QEvent::MouseMove, QPointF(), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); +// mWidget->mouseReleaseEvent(e); +// EXPECT_FALSE(mWidget->m_pressed); +// delete e; +//} + +//TEST_F(test_cpushbutton, paintEvent_001) +//{ +// QPaintEvent *e = new QPaintEvent(QRect()); +// mWidget->setHighlight(true); +// mWidget->paintEvent(e); +// delete e; +//} + +//TEST_F(test_cpushbutton, paintEvent_002) +//{ +// QPaintEvent *e = new QPaintEvent(QRect()); +// mWidget->setHighlight(false); +// mWidget->paintEvent(e); +// delete e; +//} diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_cpushbutton.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_cpushbutton.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_cpushbutton.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_cpushbutton.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,48 +1,32 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: leilong -* -* Maintainer: leilong -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_CPUSHBUTTON_H #define TEST_CPUSHBUTTON_H -#include "cpushbutton.h" -#include -#include -#include +//#include "cpushbutton.h" +//#include +//#include +//#include -class test_cpushbutton : public QObject, public::testing::Test -{ - Q_OBJECT -public: - explicit test_cpushbutton(QObject *parent = nullptr); - virtual void SetUp() - { - mWidget = new CPushButton(); - } +//class test_cpushbutton : public QObject, public::testing::Test +//{ +// Q_OBJECT +//public: +// explicit test_cpushbutton(QObject *parent = nullptr); +// virtual void SetUp() +// { +// mWidget = new CPushButton(); +// } - virtual void TearDown() - { - delete mWidget; - mWidget = nullptr; - } -protected: - CPushButton *mWidget = nullptr; -}; +// virtual void TearDown() +// { +// delete mWidget; +// mWidget = nullptr; +// } +//protected: +// CPushButton *mWidget = nullptr; +//}; #endif // TEST_CPUSHBUTTON_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_cradiobutton.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_cradiobutton.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_cradiobutton.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_cradiobutton.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,53 +1,37 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: leilong -* -* Maintainer: leilong -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ -#include "test_cradiobutton.h" - -test_cradiobutton::test_cradiobutton() -{ - -} - -TEST_F(test_cradiobutton, setColor_001) -{ - QColor color("#000000"); - mWidget->setColor(color); - EXPECT_EQ(mWidget->getColor(), color); -} - -TEST_F(test_cradiobutton, paintEvent_001) -{ - QColor color("#000000"); - mWidget->setColor(color); - mWidget->setChecked(true); - QPaintEvent *e = new QPaintEvent(QRect()); - mWidget->paintEvent(e); - delete e; -} - -TEST_F(test_cradiobutton, paintEvent_002) -{ - QColor color("#000000"); - mWidget->setColor(color); - mWidget->setChecked(false); - QPaintEvent *e = new QPaintEvent(QRect()); - mWidget->paintEvent(e); - delete e; -} +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +//#include "test_cradiobutton.h" + +//test_cradiobutton::test_cradiobutton() +//{ + +//} + +//TEST_F(test_cradiobutton, setColor_001) +//{ +// QColor color("#000000"); +// mWidget->setColor(color); +// EXPECT_EQ(mWidget->getColor(), color); +//} + +//TEST_F(test_cradiobutton, paintEvent_001) +//{ +// QColor color("#000000"); +// mWidget->setColor(color); +// mWidget->setChecked(true); +// QPaintEvent *e = new QPaintEvent(QRect()); +// mWidget->paintEvent(e); +// delete e; +//} + +//TEST_F(test_cradiobutton, paintEvent_002) +//{ +// QColor color("#000000"); +// mWidget->setColor(color); +// mWidget->setChecked(false); +// QPaintEvent *e = new QPaintEvent(QRect()); +// mWidget->paintEvent(e); +// delete e; +//} diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_cradiobutton.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_cradiobutton.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_cradiobutton.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_cradiobutton.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,48 +1,32 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: leilong -* -* Maintainer: leilong -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_CRADIOBUTTON_H #define TEST_CRADIOBUTTON_H -#include "cradiobutton.h" -#include -#include -#include - -class test_cradiobutton: public::testing::Test -{ -public: - test_cradiobutton(); - - virtual void SetUp() - { - mWidget = new CRadioButton(); - } - - virtual void TearDown() - { - delete mWidget; - mWidget = nullptr; - } -protected: - CRadioButton *mWidget = nullptr; -}; +//#include "cradiobutton.h" +//#include +//#include +//#include + +//class test_cradiobutton: public::testing::Test +//{ +//public: +// test_cradiobutton(); + +// virtual void SetUp() +// { +// mWidget = new CRadioButton(); +// } + +// virtual void TearDown() +// { +// delete mWidget; +// mWidget = nullptr; +// } +//protected: +// CRadioButton *mWidget = nullptr; +//}; #endif // TEST_CRADIOBUTTON_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_ctitlewidget.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_ctitlewidget.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_ctitlewidget.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_ctitlewidget.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,103 +1,87 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: leilong -* -* Maintainer: leilong -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ -#include "test_ctitlewidget.h" - -test_ctitlewidget::test_ctitlewidget() -{ - -} - -TEST_F(test_ctitlewidget, setShowState_001) -{ - mWidget->setShowState(CTitleWidget::Title_State_Mini); - EXPECT_EQ(mWidget->m_showState, CTitleWidget::Title_State_Mini); -} - -TEST_F(test_ctitlewidget, setShowState_002) -{ - mWidget->setShowState(CTitleWidget::Title_State_Normal); - EXPECT_EQ(mWidget->m_showState, CTitleWidget::Title_State_Normal); -} - -TEST_F(test_ctitlewidget, buttonBox_001) -{ - EXPECT_EQ(mWidget->buttonBox(), mWidget->m_buttonBox); -} - -TEST_F(test_ctitlewidget, searchEdit_001) -{ - EXPECT_EQ(mWidget->searchEdit(), mWidget->m_searchEdit); -} - -TEST_F(test_ctitlewidget, stateUpdate_001) -{ - mWidget->setShowState(CTitleWidget::Title_State_Mini); - mWidget->stateUpdate(); -} - -TEST_F(test_ctitlewidget, stateUpdate_002) -{ - mWidget->setShowState(CTitleWidget::Title_State_Normal); - mWidget->stateUpdate(); -} - -TEST_F(test_ctitlewidget, miniStateShowSearchEdit_001) -{ - mWidget->miniStateShowSearchEdit(); - EXPECT_EQ(mWidget->width(), mWidget->m_searchEdit->maximumWidth()); -} - -TEST_F(test_ctitlewidget, normalStateUpdateSearchEditWidth_001) -{ - mWidget->normalStateUpdateSearchEditWidth(); - EXPECT_NE(mWidget->width(), mWidget->m_searchEdit->maximumWidth()); -} - -TEST_F(test_ctitlewidget, eventFilter_001) -{ - DButtonBoxButton btn(""); - QKeyEvent e(QEvent::KeyPress, Qt::Key_Return, Qt::NoModifier); - mWidget->eventFilter(&btn, &e); - EXPECT_NE(mWidget->width(), mWidget->m_searchEdit->maximumWidth()); -} - -TEST_F(test_ctitlewidget, eventFilter_002) -{ - QFocusEvent e(QEvent::FocusOut, Qt::TabFocusReason); - mWidget->eventFilter(mWidget->m_searchEdit, &e); - EXPECT_NE(mWidget->width(), mWidget->m_searchEdit->maximumWidth()); -} - -TEST_F(test_ctitlewidget, slotShowSearchEdit_001) -{ - mWidget->slotShowSearchEdit(); -} - -TEST_F(test_ctitlewidget, slotSearchEditFocusChanged_001) -{ - mWidget->slotSearchEditFocusChanged(true); -} - -TEST_F(test_ctitlewidget, slotSearchEditFocusChanged_002) -{ - mWidget->setShowState(CTitleWidget::Title_State_Mini); - mWidget->slotSearchEditFocusChanged(false); -} +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +//#include "test_ctitlewidget.h" + +//test_ctitlewidget::test_ctitlewidget() +//{ + +//} + +//TEST_F(test_ctitlewidget, setShowState_001) +//{ +// mWidget->setShowState(CTitleWidget::Title_State_Mini); +// EXPECT_EQ(mWidget->m_showState, CTitleWidget::Title_State_Mini); +//} + +//TEST_F(test_ctitlewidget, setShowState_002) +//{ +// mWidget->setShowState(CTitleWidget::Title_State_Normal); +// EXPECT_EQ(mWidget->m_showState, CTitleWidget::Title_State_Normal); +//} + +//TEST_F(test_ctitlewidget, buttonBox_001) +//{ +// EXPECT_EQ(mWidget->buttonBox(), mWidget->m_buttonBox); +//} + +//TEST_F(test_ctitlewidget, searchEdit_001) +//{ +// EXPECT_EQ(mWidget->searchEdit(), mWidget->m_searchEdit); +//} + +//TEST_F(test_ctitlewidget, stateUpdate_001) +//{ +// mWidget->setShowState(CTitleWidget::Title_State_Mini); +// mWidget->stateUpdate(); +//} + +//TEST_F(test_ctitlewidget, stateUpdate_002) +//{ +// mWidget->setShowState(CTitleWidget::Title_State_Normal); +// mWidget->stateUpdate(); +//} + +//TEST_F(test_ctitlewidget, miniStateShowSearchEdit_001) +//{ +// mWidget->miniStateShowSearchEdit(); +// EXPECT_EQ(mWidget->width(), mWidget->m_searchEdit->maximumWidth()); +//} + +//TEST_F(test_ctitlewidget, normalStateUpdateSearchEditWidth_001) +//{ +// mWidget->normalStateUpdateSearchEditWidth(); +// EXPECT_NE(mWidget->width(), mWidget->m_searchEdit->maximumWidth()); +//} + +//TEST_F(test_ctitlewidget, eventFilter_001) +//{ +// DButtonBoxButton btn(""); +// QKeyEvent e(QEvent::KeyPress, Qt::Key_Return, Qt::NoModifier); +// mWidget->eventFilter(&btn, &e); +// EXPECT_NE(mWidget->width(), mWidget->m_searchEdit->maximumWidth()); +//} + +//TEST_F(test_ctitlewidget, eventFilter_002) +//{ +// QFocusEvent e(QEvent::FocusOut, Qt::TabFocusReason); +// mWidget->eventFilter(mWidget->m_searchEdit, &e); +// EXPECT_NE(mWidget->width(), mWidget->m_searchEdit->maximumWidth()); +//} + +//TEST_F(test_ctitlewidget, slotShowSearchEdit_001) +//{ +// mWidget->slotShowSearchEdit(); +//} + +//TEST_F(test_ctitlewidget, slotSearchEditFocusChanged_001) +//{ +// mWidget->slotSearchEditFocusChanged(true); +//} + +//TEST_F(test_ctitlewidget, slotSearchEditFocusChanged_002) +//{ +// mWidget->setShowState(CTitleWidget::Title_State_Mini); +// mWidget->slotSearchEditFocusChanged(false); +//} diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_ctitlewidget.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_ctitlewidget.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_ctitlewidget.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_ctitlewidget.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,49 +1,33 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: leilong -* -* Maintainer: leilong -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_CTITLEWIDGET_H #define TEST_CTITLEWIDGET_H -#include "ctitlewidget.h" -#include -#include -#include - -class test_ctitlewidget: public::testing::Test -{ -public: - test_ctitlewidget(); - - virtual void SetUp() - { - mWidget = new CTitleWidget(); - } - - virtual void TearDown() - { - delete mWidget; - mWidget = nullptr; - } -protected: - CTitleWidget *mWidget = nullptr; +//#include "ctitlewidget.h" +//#include +//#include +//#include + +//class test_ctitlewidget: public::testing::Test +//{ +//public: +// test_ctitlewidget(); + +// virtual void SetUp() +// { +// mWidget = new CTitleWidget(); +// } + +// virtual void TearDown() +// { +// delete mWidget; +// mWidget = nullptr; +// } +//protected: +// CTitleWidget *mWidget = nullptr; -}; +//}; #endif // TEST_CTITLEWIDGET_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_customframe.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_customframe.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_customframe.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_customframe.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "test_customframe.h" test_customframe::test_customframe() diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_customframe.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_customframe.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_customframe.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_customframe.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_CUSTOMFRAME_H #define TEST_CUSTOMFRAME_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_jobtypecombobox.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_jobtypecombobox.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_jobtypecombobox.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_jobtypecombobox.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,184 +1,212 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: leilong -* -* Maintainer: leilong -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ -#include "test_jobtypecombobox.h" -#include "../third-party_stub/stub.h" - -static QList jobtypecombobox_stub_JobTypeInfos1() -{ - QList infos; - infos.push_back(JobTypeInfo(1, "1", 0, "#000000")); - infos.push_back(JobTypeInfo(2)); - infos.push_back(JobTypeInfo(3, "3", 2, "#000000")); - - return infos; -} - -static QList jobtypecombobox_stub_JobTypeInfos2() -{ - QList infos; - infos.push_back(JobTypeInfo(1, "1", 0, "#000000")); - infos.push_back(JobTypeInfo(2, "2", 1, "#000000")); - infos.push_back(JobTypeInfo(3, "3", 2, "#000000")); - - return infos; -} - -static int jobtypecombobox_stub_flase() -{ - return 0; -} - -test_jobtypecombobox::test_jobtypecombobox() -{ - -} - -TEST_F(test_jobtypecombobox, updateJobType_001) -{ - Stub stub; - stub.set(ADDR(JobTypeInfoManager, getJobTypeList), jobtypecombobox_stub_JobTypeInfos2); - EXPECT_TRUE(mWidget->updateJobType()); -} - -TEST_F(test_jobtypecombobox, getCurrentJobTypeNo_001) -{ - Stub stub; - stub.set(ADDR(JobTypeInfoManager, getJobTypeList), jobtypecombobox_stub_JobTypeInfos1); - stub.set(ADDR(QComboBox, currentIndex), jobtypecombobox_stub_flase); - mWidget->updateJobType(); - mWidget->getCurrentJobTypeNo(); -} - -TEST_F(test_jobtypecombobox, setCurrentJobTypeNo_001) -{ - Stub stub; - stub.set(ADDR(JobTypeInfoManager, getJobTypeList), jobtypecombobox_stub_JobTypeInfos1); - mWidget->updateJobType(); - mWidget->setCurrentJobTypeNo(3); -} - -TEST_F(test_jobtypecombobox, slotBtnAddItemClicked_001) -{ - mWidget->slotBtnAddItemClicked(); - EXPECT_TRUE(mWidget->isEditable()); - EXPECT_TRUE(mWidget->currentText().isEmpty()); -} - -TEST_F(test_jobtypecombobox, showPopup_001) -{ - mWidget->showPopup(); - EXPECT_FALSE(mWidget->isEditable()); -} - -TEST_F(test_jobtypecombobox, eventFilter_001) -{ - QPointF point(1, 1); - QEnterEvent e(point, point, point); - mWidget->showPopup(); - mWidget->eventFilter(mWidget->m_addBtn, &e); -} - -TEST_F(test_jobtypecombobox, eventFilter_002) -{ - Stub stub; - stub.set(ADDR(JobTypeInfoManager, getJobTypeList), jobtypecombobox_stub_JobTypeInfos2); - mWidget->updateJobType(); - QPointF point(1, 1); - QFocusEvent e(QEvent::FocusIn); - mWidget->showPopup(); - mWidget->eventFilter(mWidget->m_addBtn, &e); -} - -TEST_F(test_jobtypecombobox, eventFilter_003) -{ - Stub stub; - stub.set(ADDR(JobTypeInfoManager, getJobTypeList), jobtypecombobox_stub_JobTypeInfos2); - mWidget->updateJobType(); - QPointF point(1, 1); - QKeyEvent e(QEvent::KeyPress, Qt::Key_Up, Qt::NoModifier); - mWidget->showPopup(); - mWidget->m_addBtn->setHighlight(true); - mWidget->eventFilter(mWidget->m_addBtn, &e); - EXPECT_TRUE(mWidget->m_addBtn->isHighlight()); -} - -TEST_F(test_jobtypecombobox, eventFilter_004) -{ - Stub stub; - stub.set(ADDR(JobTypeInfoManager, getJobTypeList), jobtypecombobox_stub_JobTypeInfos2); - mWidget->updateJobType(); - QPointF point(1, 1); - QKeyEvent e(QEvent::KeyPress, Qt::Key_Return, Qt::NoModifier); - mWidget->showPopup(); - mWidget->m_addBtn->setHighlight(true); - mWidget->eventFilter(mWidget->m_addBtn, &e); - EXPECT_TRUE(mWidget->m_addBtn->isHighlight()); -} - -TEST_F(test_jobtypecombobox, eventFilter_005) -{ - Stub stub; - stub.set(ADDR(JobTypeInfoManager, getJobTypeList), jobtypecombobox_stub_JobTypeInfos2); - mWidget->updateJobType(); - QPointF point(1, 1); - QKeyEvent e(QEvent::KeyPress, Qt::Key_Return, Qt::NoModifier); - mWidget->showPopup(); - mWidget->m_addBtn->setHighlight(true); - mWidget->eventFilter(mWidget->m_customWidget, &e); - EXPECT_TRUE(mWidget->m_addBtn->isHighlight()); -} - -TEST_F(test_jobtypecombobox, initUI_001) -{ - mWidget->initUI(); - EXPECT_FALSE(mWidget->isEditable()); -} - -TEST_F(test_jobtypecombobox, addJobTypeItem_001) -{ - mWidget->addJobTypeItem(1, "#000000", ""); -} - -TEST_F(test_jobtypecombobox, addCustomWidget_001) -{ - QFrame *viewContainer = mWidget->findChild(); - mWidget->addCustomWidget(viewContainer); - EXPECT_TRUE(mWidget->m_addBtn != nullptr); -} - -TEST_F(test_jobtypecombobox, setItemSelectable_001) -{ - Stub stub; - stub.set(ADDR(JobTypeInfoManager, getJobTypeList), jobtypecombobox_stub_JobTypeInfos2); - mWidget->updateJobType(); - mWidget->showPopup(); - mWidget->setItemSelectable(true); - EXPECT_FALSE(mWidget->m_addBtn->isHighlight()); -} - -TEST_F(test_jobtypecombobox, setItemSelectable_002) -{ - Stub stub; - stub.set(ADDR(JobTypeInfoManager, getJobTypeList), jobtypecombobox_stub_JobTypeInfos2); - mWidget->updateJobType(); - mWidget->showPopup(); - mWidget->setItemSelectable(false); -} +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +//#include "test_jobtypecombobox.h" +//#include "../third-party_stub/stub.h" + +//static QList jobtypecombobox_stub_JobTypeInfos1() +//{ +// QList infos; +// infos.push_back(JobTypeInfo(1, "1", 0, "#000000")); +// infos.push_back(JobTypeInfo(2)); +// infos.push_back(JobTypeInfo(3, "3", 2, "#000000")); + +// return infos; +//} + +//static QList jobtypecombobox_stub_JobTypeInfos2() +//{ +// QList infos; +// infos.push_back(JobTypeInfo(1, "1", 0, "#000000")); +// infos.push_back(JobTypeInfo(2, "2", 1, "#000000")); +// infos.push_back(JobTypeInfo(3, "3", 2, "#000000")); + +// return infos; +//} + +//static int jobtypecombobox_stub_flase() +//{ +// return 0; +//} + +//test_jobtypecombobox::test_jobtypecombobox() +//{ + +//} + +//TEST_F(test_jobtypecombobox, setAlert_001) +//{ +// mWidget->setAlert(true); +// EXPECT_TRUE(mWidget->m_control->isAlert()); +//} + +//TEST_F(test_jobtypecombobox, isAlert_001) +//{ +// mWidget->setAlert(true); +// EXPECT_TRUE(mWidget->isAlert()); +//} + +//TEST_F(test_jobtypecombobox, isAlert_002) +//{ +// mWidget->setAlert(false); +// EXPECT_FALSE(mWidget->isAlert()); +//} + +//TEST_F(test_jobtypecombobox, showAlertMessage_001) +//{ +// mWidget->showAlertMessage(""); +//} + +//TEST_F(test_jobtypecombobox, showAlertMessage_002) +//{ +// mWidget->showAlertMessage("", mWidget); +//} + +//TEST_F(test_jobtypecombobox, setAlertMessageAlignment_001) +//{ +// mWidget->setAlertMessageAlignment(Qt::AlignLeft); +// EXPECT_EQ(mWidget->m_control->messageAlignment(), Qt::AlignLeft); +//} + +//TEST_F(test_jobtypecombobox, hideAlertMessage_001) +//{ +// mWidget->hideAlertMessage(); +//} + +//TEST_F(test_jobtypecombobox, getCurrentEditPositione_001) +//{ +// EXPECT_EQ(mWidget->getCurrentEditPosition(), mWidget->m_newPos); +//} + +//TEST_F(test_jobtypecombobox, updateJobType_001) +//{ +// Stub stub; +// stub.set(ADDR(JobTypeInfoManager, getJobTypeList), jobtypecombobox_stub_JobTypeInfos2); +// EXPECT_TRUE(mWidget->updateJobType()); +//} + +//TEST_F(test_jobtypecombobox, getCurrentJobTypeNo_001) +//{ +// Stub stub; +// stub.set(ADDR(JobTypeInfoManager, getJobTypeList), jobtypecombobox_stub_JobTypeInfos1); +// stub.set(ADDR(QComboBox, currentIndex), jobtypecombobox_stub_flase); +// mWidget->updateJobType(); +// mWidget->getCurrentJobTypeNo(); +//} + +//TEST_F(test_jobtypecombobox, setCurrentJobTypeNo_001) +//{ +// Stub stub; +// stub.set(ADDR(JobTypeInfoManager, getJobTypeList), jobtypecombobox_stub_JobTypeInfos1); +// mWidget->updateJobType(); +// mWidget->setCurrentJobTypeNo(3); +//} + +//TEST_F(test_jobtypecombobox, slotBtnAddItemClicked_001) +//{ +// mWidget->slotBtnAddItemClicked(); +// EXPECT_TRUE(mWidget->isEditable()); +// EXPECT_TRUE(mWidget->currentText().isEmpty()); +//} + +//TEST_F(test_jobtypecombobox, showPopup_001) +//{ +// mWidget->showPopup(); +// EXPECT_FALSE(mWidget->isEditable()); +//} + +//TEST_F(test_jobtypecombobox, eventFilter_001) +//{ +// QPointF point(1, 1); +// QEnterEvent e(point, point, point); +// mWidget->showPopup(); +// mWidget->eventFilter(mWidget->m_addBtn, &e); +//} + +//TEST_F(test_jobtypecombobox, eventFilter_002) +//{ +// Stub stub; +// stub.set(ADDR(JobTypeInfoManager, getJobTypeList), jobtypecombobox_stub_JobTypeInfos2); +// mWidget->updateJobType(); +// QPointF point(1, 1); +// QFocusEvent e(QEvent::FocusIn); +// mWidget->showPopup(); +// mWidget->eventFilter(mWidget->m_addBtn, &e); +//} + +//TEST_F(test_jobtypecombobox, eventFilter_003) +//{ +// Stub stub; +// stub.set(ADDR(JobTypeInfoManager, getJobTypeList), jobtypecombobox_stub_JobTypeInfos2); +// mWidget->updateJobType(); +// QPointF point(1, 1); +// QKeyEvent e(QEvent::KeyPress, Qt::Key_Up, Qt::NoModifier); +// mWidget->showPopup(); +// mWidget->m_addBtn->setHighlight(true); +// mWidget->eventFilter(mWidget->m_addBtn, &e); +// EXPECT_TRUE(mWidget->m_addBtn->isHighlight()); +//} + +//TEST_F(test_jobtypecombobox, eventFilter_004) +//{ +// Stub stub; +// stub.set(ADDR(JobTypeInfoManager, getJobTypeList), jobtypecombobox_stub_JobTypeInfos2); +// mWidget->updateJobType(); +// QPointF point(1, 1); +// QKeyEvent e(QEvent::KeyPress, Qt::Key_Return, Qt::NoModifier); +// mWidget->showPopup(); +// mWidget->m_addBtn->setHighlight(true); +// mWidget->eventFilter(mWidget->m_addBtn, &e); +// EXPECT_TRUE(mWidget->m_addBtn->isHighlight()); +//} + +//TEST_F(test_jobtypecombobox, eventFilter_005) +//{ +// Stub stub; +// stub.set(ADDR(JobTypeInfoManager, getJobTypeList), jobtypecombobox_stub_JobTypeInfos2); +// mWidget->updateJobType(); +// QPointF point(1, 1); +// QKeyEvent e(QEvent::KeyPress, Qt::Key_Return, Qt::NoModifier); +// mWidget->showPopup(); +// mWidget->m_addBtn->setHighlight(true); +// mWidget->eventFilter(mWidget->m_customWidget, &e); +// EXPECT_TRUE(mWidget->m_addBtn->isHighlight()); +//} + +//TEST_F(test_jobtypecombobox, initUI_001) +//{ +// mWidget->initUI(); +// EXPECT_FALSE(mWidget->isEditable()); +//} + +//TEST_F(test_jobtypecombobox, addJobTypeItem_001) +//{ +// mWidget->addJobTypeItem(1, "#000000", ""); +//} + +//TEST_F(test_jobtypecombobox, addCustomWidget_001) +//{ +// QFrame *viewContainer = mWidget->findChild(); +// mWidget->addCustomWidget(viewContainer); +// EXPECT_TRUE(mWidget->m_addBtn != nullptr); +//} + +//TEST_F(test_jobtypecombobox, setItemSelectable_001) +//{ +// Stub stub; +// stub.set(ADDR(JobTypeInfoManager, getJobTypeList), jobtypecombobox_stub_JobTypeInfos2); +// mWidget->updateJobType(); +// mWidget->showPopup(); +// mWidget->setItemSelectable(true); +// EXPECT_FALSE(mWidget->m_addBtn->isHighlight()); +//} + +//TEST_F(test_jobtypecombobox, setItemSelectable_002) +//{ +// Stub stub; +// stub.set(ADDR(JobTypeInfoManager, getJobTypeList), jobtypecombobox_stub_JobTypeInfos2); +// mWidget->updateJobType(); +// mWidget->showPopup(); +// mWidget->setItemSelectable(false); +//} diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_jobtypecombobox.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_jobtypecombobox.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_jobtypecombobox.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_jobtypecombobox.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,48 +1,33 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: leilong -* -* Maintainer: leilong -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_JOBTYPECOMBOBOX_H #define TEST_JOBTYPECOMBOBOX_H -#include "jobtypecombobox.h" -#include -#include -#include - -class test_jobtypecombobox: public::testing::Test -{ -public: - test_jobtypecombobox(); - - virtual void SetUp() - { - mWidget = new JobTypeComboBox(); - } - - virtual void TearDown() - { - delete mWidget; - mWidget = nullptr; - } -protected: - JobTypeComboBox *mWidget = nullptr; -}; +//#include "jobtypecombobox.h" +//#include +//#include +//#include + +//class test_jobtypecombobox: public::testing::Test +//{ +//public: +// test_jobtypecombobox(); + +// virtual void SetUp() +// { +// mWidget = new JobTypeComboBox(); +// mWidget->slotBtnAddItemClicked(); +// } + +// virtual void TearDown() +// { +// delete mWidget; +// mWidget = nullptr; +// } +//protected: +// JobTypeComboBox *mWidget = nullptr; +//}; #endif // TEST_JOBTYPECOMBOBOX_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_jobtypelistview.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_jobtypelistview.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_jobtypelistview.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_jobtypelistview.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,102 +1,86 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: leilong -* -* Maintainer: leilong -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ -#include "test_jobtypelistview.h" -#include "cscheduleoperation.h" -#include "../dialog_stub.h" - -static int jobtypelistview_stub_true(int) -{ - return 1; -} - -test_jobtypelistview::test_jobtypelistview() -{ - -} - -TEST_F(test_jobtypelistview, canAdd_001) -{ - EXPECT_TRUE(mWidget->canAdd()); -} - -TEST_F(test_jobtypelistview, viewportEvent_001) -{ - QHoverEvent e(QEvent::HoverLeave, QPointF(0, 0), QPointF(0, 0)); - mWidget->viewportEvent(&e); -} - -TEST_F(test_jobtypelistview, viewportEvent_002) -{ - QHoverEvent e(QEvent::HoverLeave, QPointF(0, 0), QPointF(0, 0)); - mWidget->m_iIndexCurrentHover = 0; - mWidget->viewportEvent(&e); -} - -TEST_F(test_jobtypelistview, viewportEvent_003) -{ - QHoverEvent e(QEvent::HoverMove, QPointF(1, 1), QPointF(1, 1)); - mWidget->m_iIndexCurrentHover = 1; - mWidget->viewportEvent(&e); -} - -TEST_F(test_jobtypelistview, initUI_001) -{ - mWidget->initUI(); -} - -TEST_F(test_jobtypelistview, addJobTypeItem_001) -{ - mWidget->addJobTypeItem(JobTypeInfo()); -} - -TEST_F(test_jobtypelistview, slotUpdateJobType_001) -{ - Stub stub; - calendarDDialogExecStub(stub); - mWidget->slotUpdateJobType(); -} - -TEST_F(test_jobtypelistview, slotDeleteJobType_001) -{ - mWidget->slotDeleteJobType(); -} - -TEST_F(test_jobtypelistview, slotDeleteJobType_002) -{ - mWidget->m_iIndexCurrentHover = 1; - mWidget->slotDeleteJobType(); -} - -TEST_F(test_jobtypelistview, slotDeleteJobType_003) -{ - Stub stub; - calendarDDialogExecStub(stub); - stub.set(ADDR(CScheduleOperation, isJobTypeUsed), jobtypelistview_stub_true); - mWidget->m_iIndexCurrentHover = 1; - mWidget->slotDeleteJobType(); -} - -TEST_F(test_jobtypelistview, updateJobType_003) -{ - mWidget->m_iIndexCurrentHover = 1; - mWidget->updateJobType(); - EXPECT_EQ(mWidget->m_iIndexCurrentHover, -1); -} +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +//#include "test_jobtypelistview.h" +//#include "cscheduleoperation.h" +//#include "../dialog_stub.h" + +//static int jobtypelistview_stub_true(int) +//{ +// return 1; +//} + +//test_jobtypelistview::test_jobtypelistview() +//{ + +//} + +//TEST_F(test_jobtypelistview, canAdd_001) +//{ +// mWidget->canAdd(); +//} + +//TEST_F(test_jobtypelistview, viewportEvent_001) +//{ +// QHoverEvent e(QEvent::HoverLeave, QPointF(0, 0), QPointF(0, 0)); +// mWidget->viewportEvent(&e); +//} + +//TEST_F(test_jobtypelistview, viewportEvent_002) +//{ +// QHoverEvent e(QEvent::HoverLeave, QPointF(0, 0), QPointF(0, 0)); +// mWidget->m_iIndexCurrentHover = 0; +// mWidget->viewportEvent(&e); +//} + +//TEST_F(test_jobtypelistview, viewportEvent_003) +//{ +// QHoverEvent e(QEvent::HoverMove, QPointF(1, 1), QPointF(1, 1)); +// mWidget->m_iIndexCurrentHover = 1; +// mWidget->viewportEvent(&e); +//} + +//TEST_F(test_jobtypelistview, initUI_001) +//{ +// mWidget->initUI(); +//} + +//TEST_F(test_jobtypelistview, addJobTypeItem_001) +//{ +// mWidget->addJobTypeItem(JobTypeInfo()); +//} + +//TEST_F(test_jobtypelistview, slotUpdateJobType_001) +//{ +// Stub stub; +// calendarDDialogExecStub(stub); +// mWidget->slotUpdateJobType(); +//} + +//TEST_F(test_jobtypelistview, slotDeleteJobType_001) +//{ +// mWidget->slotDeleteJobType(); +//} + +//TEST_F(test_jobtypelistview, slotDeleteJobType_002) +//{ +// mWidget->m_iIndexCurrentHover = 1; +// mWidget->slotDeleteJobType(); +//} + +//TEST_F(test_jobtypelistview, slotDeleteJobType_003) +//{ +// Stub stub; +// calendarDDialogExecStub(stub); +// stub.set(ADDR(CScheduleOperation, isJobTypeUsed), jobtypelistview_stub_true); +// mWidget->m_iIndexCurrentHover = 1; +// mWidget->slotDeleteJobType(); +//} + +//TEST_F(test_jobtypelistview, updateJobType_003) +//{ +// mWidget->m_iIndexCurrentHover = 1; +// mWidget->updateJobType(); +// EXPECT_EQ(mWidget->m_iIndexCurrentHover, -1); +//} diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_jobtypelistview.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_jobtypelistview.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_jobtypelistview.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_jobtypelistview.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,62 +1,46 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: leilong -* -* Maintainer: leilong -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_JOBTYPELISTVIEW_H #define TEST_JOBTYPELISTVIEW_H -#include "jobtypelistview.h" -#include "../third-party_stub/stub.h" -#include -#include -#include - -static QList jobtypelistview_stub_JobTypeInfos() -{ - QList infos; - infos.push_back(JobTypeInfo(1, "1", 0, "#000000")); - infos.push_back(JobTypeInfo(2, "2", 1, "#000000")); - infos.push_back(JobTypeInfo(3, "3", 2, "#000000")); - - return infos; -} - - -class test_jobtypelistview: public::testing::Test -{ -public: - test_jobtypelistview(); - - void SetUp() - { - Stub stub; - stub.set(ADDR(JobTypeInfoManager, getJobTypeList), jobtypelistview_stub_JobTypeInfos); - mWidget = new JobTypeListView(); - } - - void TearDown() - { - delete mWidget; - mWidget = nullptr; - } -protected: - JobTypeListView *mWidget = nullptr; -}; +//#include "jobtypelistview.h" +//#include "../third-party_stub/stub.h" +//#include +//#include +//#include + +//static QList jobtypelistview_stub_JobTypeInfos() +//{ +// QList infos; +// infos.push_back(JobTypeInfo(1, "1", 0, "#000000")); +// infos.push_back(JobTypeInfo(2, "2", 1, "#000000")); +// infos.push_back(JobTypeInfo(3, "3", 2, "#000000")); + +// return infos; +//} + + +//class test_jobtypelistview: public::testing::Test +//{ +//public: +// test_jobtypelistview(); + +// void SetUp() +// { +// Stub stub; +// stub.set(ADDR(JobTypeInfoManager, getJobTypeList), jobtypelistview_stub_JobTypeInfos); +// mWidget = new JobTypeListView(); +// } + +// void TearDown() +// { +// delete mWidget; +// mWidget = nullptr; +// } +//protected: +// JobTypeListView *mWidget = nullptr; +//}; #endif // TEST_JOBTYPELISTVIEW_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_labelwidget.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_labelwidget.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_labelwidget.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_labelwidget.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,38 +1,17 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: leilong -* -* Maintainer: leilong -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ -#include "test_labelwidget.h" -#include "../third-party_stub/stub.h" +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later -static int labelwidget_stub_true() -{ - return 1; -} +//#include "test_labelwidget.h" +//#include "../third-party_stub/stub.h" -test_labelwidget::test_labelwidget() -{ +//test_labelwidget::test_labelwidget() +//{ -} +//} -TEST_F(test_labelwidget, paintEvent_001) -{ - QPaintEvent e(QRect(0, 0, 0, 0)); - mWidget->paintEvent(&e); -} +//TEST_F(test_labelwidget, paintEvent_001) +//{ +// QPaintEvent e(QRect(0, 0, 0, 0)); +// mWidget->paintEvent(&e); +//} diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_labelwidget.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_labelwidget.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_labelwidget.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_labelwidget.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,48 +1,32 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: leilong -* -* Maintainer: leilong -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_LABELWIDGET_H #define TEST_LABELWIDGET_H -#include "labelwidget.h" -#include -#include -#include - -class test_labelwidget: public::testing::Test -{ -public: - test_labelwidget(); - - virtual void SetUp() - { - mWidget = new LabelWidget(); - } - - virtual void TearDown() - { - delete mWidget; - mWidget = nullptr; - } -protected: - LabelWidget *mWidget = nullptr; -}; +//#include "labelwidget.h" +//#include +//#include +//#include + +//class test_labelwidget: public::testing::Test +//{ +//public: +// test_labelwidget(); + +// virtual void SetUp() +// { +// mWidget = new LabelWidget(); +// } + +// virtual void TearDown() +// { +// delete mWidget; +// mWidget = nullptr; +// } +//protected: +// LabelWidget *mWidget = nullptr; +//}; #endif // TEST_LABELWIDGET_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_lunarcalendarwidget.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_lunarcalendarwidget.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_lunarcalendarwidget.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_lunarcalendarwidget.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,37 +1,21 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: leilong -* -* Maintainer: leilong -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ -#include "test_lunarcalendarwidget.h" +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later -test_lunarcalendarwidget::test_lunarcalendarwidget() -{ +//#include "test_lunarcalendarwidget.h" -} +//test_lunarcalendarwidget::test_lunarcalendarwidget() +//{ -TEST_F(test_lunarcalendarwidget, setLunarYearText_001) -{ - mWidget->setLunarYearText("2023"); - EXPECT_EQ(mWidget->lunarYearText(), "2023"); -} +//} -TEST_F(test_lunarcalendarwidget, minimumSizeHint_001) -{ - mWidget->minimumSizeHint(); -} +//TEST_F(test_lunarcalendarwidget, setLunarYearText_001) +//{ +// mWidget->setLunarYearText("2023"); +// EXPECT_EQ(mWidget->lunarYearText(), "2023"); +//} + +//TEST_F(test_lunarcalendarwidget, minimumSizeHint_001) +//{ +// mWidget->minimumSizeHint(); +//} diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_lunarcalendarwidget.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_lunarcalendarwidget.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_lunarcalendarwidget.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_lunarcalendarwidget.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,48 +1,32 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: leilong -* -* Maintainer: leilong -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_LUNARCALENDARWIDGET_H #define TEST_LUNARCALENDARWIDGET_H -#include "lunarcalendarwidget.h" -#include -#include -#include - -class test_lunarcalendarwidget: public::testing::Test -{ -public: - test_lunarcalendarwidget(); - - virtual void SetUp() - { - mWidget = new LunarCalendarWidget(); - } - - virtual void TearDown() - { - delete mWidget; - mWidget = nullptr; - } -protected: - LunarCalendarWidget *mWidget = nullptr; -}; +//#include "lunarcalendarwidget.h" +//#include +//#include +//#include + +//class test_lunarcalendarwidget: public::testing::Test +//{ +//public: +// test_lunarcalendarwidget(); + +// virtual void SetUp() +// { +// mWidget = new LunarCalendarWidget(); +// } + +// virtual void TearDown() +// { +// delete mWidget; +// mWidget = nullptr; +// } +//protected: +// LunarCalendarWidget *mWidget = nullptr; +//}; #endif // TEST_LUNARCALENDARWIDGET_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_monthbrefwidget.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_monthbrefwidget.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_monthbrefwidget.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_monthbrefwidget.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "test_monthbrefwidget.h" #include diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_monthbrefwidget.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_monthbrefwidget.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_monthbrefwidget.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_monthbrefwidget.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_MONTHBREFWIDGET_H #define TEST_MONTHBREFWIDGET_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_scheduleremindwidget.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_scheduleremindwidget.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_scheduleremindwidget.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_scheduleremindwidget.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "test_scheduleremindwidget.h" test_scheduleremindwidget::test_scheduleremindwidget() diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_scheduleremindwidget.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_scheduleremindwidget.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_scheduleremindwidget.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_scheduleremindwidget.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_SCHEDULEREMINDWIDGET_H #define TEST_SCHEDULEREMINDWIDGET_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_scheduleview.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_scheduleview.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_scheduleview.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_scheduleview.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,24 +1,26 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "test_scheduleview.h" +#include "../third-party_stub/stub.h" + +static QLocale::Language scheduleview_stub_language() +{ + return QLocale::English; +} + +static bool scheduleview_stub_event() +{ + return true; +} + +static touchGestureOperation::TouchState scheduleview_getTouchState = touchGestureOperation::T_STATE_NONE; + +static touchGestureOperation::TouchState scheduleview_stub_getTouchState() +{ + return scheduleview_getTouchState; +} test_scheduleview::test_scheduleview() { @@ -225,3 +227,87 @@ QPixmap pixmap(mScheduleView->size()); mScheduleView->render(&pixmap); } + +TEST_F(test_scheduleview, paintEvent_01) +{ + QPaintEvent e(QRect(0, 0, 100, 100)); + mScheduleView->paintEvent(&e); +} + +TEST_F(test_scheduleview, paintEvent_02) +{ + mScheduleView->m_currentTimeType = 1; + QPaintEvent e(QRect(0, 0, 100, 100)); + mScheduleView->paintEvent(&e); +} + +TEST_F(test_scheduleview, paintEvent_03) +{ + Stub stub; + stub.set(ADDR(QLocale, language), scheduleview_stub_language); + + QPaintEvent e(QRect(0, 0, 100, 100)); + CScheduleView view; + view.paintEvent(&e); +} + +TEST_F(test_scheduleview, paintEvent_04) +{ + Stub stub; + stub.set(ADDR(QLocale, language), scheduleview_stub_language); + + QPaintEvent e(QRect(0, 0, 100, 100)); + CScheduleView view; + view.m_currentTimeType = 1; + view.paintEvent(&e); +} + +TEST_F(test_scheduleview, event_01) +{ + Stub stub; + stub.set(ADDR(touchGestureOperation, event), scheduleview_stub_event); + stub.set(ADDR(touchGestureOperation, getTouchState), scheduleview_stub_getTouchState); + QPaintEvent e(QRect(0, 0, 100, 100)); + scheduleview_getTouchState = touchGestureOperation::T_STATE_NONE; + CScheduleView view; + view.event(&e); +} + +TEST_F(test_scheduleview, event_02) +{ + Stub stub; + stub.set(ADDR(touchGestureOperation, event), scheduleview_stub_event); + stub.set(ADDR(touchGestureOperation, getTouchState), scheduleview_stub_getTouchState); + QPaintEvent e(QRect(0, 0, 100, 100)); + scheduleview_getTouchState = touchGestureOperation::T_SINGLE_CLICK; + CScheduleView view; + view.event(&e); +} + +TEST_F(test_scheduleview, event_03) +{ + Stub stub; + stub.set(ADDR(touchGestureOperation, event), scheduleview_stub_event); + stub.set(ADDR(touchGestureOperation, getTouchState), scheduleview_stub_getTouchState); + QPaintEvent e(QRect(0, 0, 100, 100)); + scheduleview_getTouchState = touchGestureOperation::T_SLIDE; + CScheduleView view; + view.m_touchGesture.setUpdate(true); + view.m_touchGesture.m_movingDir = touchGestureOperation::T_LEFT; + + view.event(&e); +} + +TEST_F(test_scheduleview, event_04) +{ + Stub stub; + stub.set(ADDR(touchGestureOperation, event), scheduleview_stub_event); + stub.set(ADDR(touchGestureOperation, getTouchState), scheduleview_stub_getTouchState); + QPaintEvent e(QRect(0, 0, 100, 100)); + scheduleview_getTouchState = touchGestureOperation::T_SLIDE; + CScheduleView view; + view.m_touchGesture.setUpdate(true); + view.m_touchGesture.m_movingDir = touchGestureOperation::T_RIGHT; + + view.event(&e); +} diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_scheduleview.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_scheduleview.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_scheduleview.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_scheduleview.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_SCHEDULEVIEW_H #define TEST_SCHEDULEVIEW_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_timeedit.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_timeedit.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_timeedit.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_timeedit.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "test_timeedit.h" #include @@ -74,3 +58,28 @@ QFocusEvent focusEvent_in( QEvent::FocusIn,Qt::FocusReason::TabFocusReason); QApplication::sendEvent(mTimeEdit,&focusEvent_in); } + +TEST_F(test_timeedit, slotActivated_01) +{ + mTimeEdit->slotActivated(""); +} + +TEST_F(test_timeedit, slotEditingFinished_01) +{ + mTimeEdit->slotEditingFinished(); +} + +TEST_F(test_timeedit, initUI_01) +{ + mTimeEdit->initUI(); +} + +TEST_F(test_timeedit, initConnection_01) +{ + mTimeEdit->initConnection(); +} + +TEST_F(test_timeedit, showPopup_01) +{ + mTimeEdit->showPopup(); +} diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_timeedit.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_timeedit.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_timeedit.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_timeedit.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_TIMEEDIT_H #define TEST_TIMEEDIT_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_titlewidget.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_titlewidget.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_titlewidget.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_titlewidget.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "test_titlewidget.h" #include diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_titlewidget.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_titlewidget.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_titlewidget.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_titlewidget.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_TITLEWIDGET_H #define TEST_TITLEWIDGET_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_todaybutton.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_todaybutton.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_todaybutton.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_todaybutton.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "test_todaybutton.h" #include diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_todaybutton.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_todaybutton.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_customWidget/test_todaybutton.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_customWidget/test_todaybutton.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_TODAYBUTTON_H #define TEST_TODAYBUTTON_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_dataManage/test_calendardatedatamanage.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_dataManage/test_calendardatedatamanage.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_dataManage/test_calendardatedatamanage.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_dataManage/test_calendardatedatamanage.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,156 +1,132 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: hejinghai -* -* Maintainer: hejinghai -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ -#include "test_calendardatedatamanage.h" -#include - -test_calendardatedatamanage::test_calendardatedatamanage() -{ -} - -void test_calendardatedatamanage::SetUp() -{ - calendarDateDataManager = new CalendarDateDataManager(); -} - -void test_calendardatedatamanage::TearDown() -{ - delete calendarDateDataManager; - calendarDateDataManager = nullptr; -} - -/** - *本类是为获取当前日期的类,所拿到的数据会根据当前时间不断变化,因此暂时不做返回值判断 - */ - -//void CalendarDateDataManager::setSelectDate(const QDate &selectDate, const bool isSwitchYear) -TEST_F(test_calendardatedatamanage, setSelectDate) -{ - QDate selectDate(2020, 12, 25); - bool isSwitchYear = true; - calendarDateDataManager->setSelectDate(selectDate, isSwitchYear); - - isSwitchYear = false; - calendarDateDataManager->setSelectDate(selectDate, isSwitchYear); -} - -//QDate CalendarDateDataManager::getSelectDate() const -TEST_F(test_calendardatedatamanage, getSelectDate) -{ - QDate selectDate; - selectDate = calendarDateDataManager->getSelectDate(); - //qInfo() << selectDate; -} - -//void CalendarDateDataManager::setCurrentDateTime(const QDateTime ¤tDateTime) -TEST_F(test_calendardatedatamanage, setCurrentDateTime) -{ - QDate date(2020, 12, 25); - QDateTime currentDateTime(date); - calendarDateDataManager->setCurrentDateTime(currentDateTime); -} - -//QDateTime CalendarDateDataManager::getCurrentDate() const -TEST_F(test_calendardatedatamanage, getCurrentDate) -{ - QDateTime currentDateTime; - currentDateTime = calendarDateDataManager->getCurrentDate(); -} - -//QMap > CalendarDateDataManager::getYearDate() -TEST_F(test_calendardatedatamanage, getYearDate) -{ - QMap > dateTime; - dateTime = calendarDateDataManager->getYearDate(); -} - -//QVector CalendarDateDataManager::getWeekDate(const QDate &date) -TEST_F(test_calendardatedatamanage, getWeekDate) -{ - QDate selectDate(2020, 12, 25); - QVector dateV = calendarDateDataManager->getWeekDate(selectDate); -} - -//void CalendarDateDataManager::setWeekFirstDay(const Qt::DayOfWeek &firstDay) -TEST_F(test_calendardatedatamanage, setWeekFirstDay) -{ - Qt::DayOfWeek firstDay(Qt::Sunday); - calendarDateDataManager->setWeekFirstDay(firstDay); -} - -// Qt::DayOfWeek CalendarDateDataManager::getWeekFirstDay() -TEST_F(test_calendardatedatamanage, getWeekFirstDay) -{ - Qt::DayOfWeek firstDay(Qt::Sunday); - - Qt::DayOfWeek getfirstDay; - getfirstDay = calendarDateDataManager->getWeekFirstDay(); - //qInfo() << getfirstDay; - assert(firstDay == getfirstDay); -} - -//void CalendarDateDataManager::setWeekDayFormatByID(const int &weekDayFormatID) -TEST_F(test_calendardatedatamanage, setWeekDayFormatByID) -{ - int setWeekDayFormatByID = 0; - calendarDateDataManager->setWeekDayFormatByID(setWeekDayFormatByID); - - setWeekDayFormatByID = 1; - calendarDateDataManager->setWeekDayFormatByID(setWeekDayFormatByID); -} - -//QString CalendarDateDataManager::getWeekDayFormat() const -TEST_F(test_calendardatedatamanage, getWeekDayFormat) -{ - QString getWEKfomat; - calendarDateDataManager->getWeekDayFormat(); -} - -//ShowDateRange CalendarDateDataManager::getShowDateRange() const -TEST_F(test_calendardatedatamanage, getShowDateRange) -{ - ShowDateRange showDateR; - showDateR = calendarDateDataManager->getShowDateRange(); -} - -//int CalendarDateDataManager::getWeekNumOfYear(const QDate &date) -TEST_F(test_calendardatedatamanage, getWeekNumOfYear) -{ - //2020-12-25 为第52周 - const int weeknum = 52; - QDate date(2020, 12, 25); - int weekNum = 0; - weekNum = calendarDateDataManager->getWeekNumOfYear(date); - assert(weeknum == weekNum); -} - -TEST_F(test_calendardatedatamanage, setDateFormatChanged) -{ - for (int i = 0; i < 10; ++i) { - calendarDateDataManager->setDateFormatChanged(i); - } -} - -//setTimeFormatChanged -TEST_F(test_calendardatedatamanage, setTimeFormatChanged) -{ - calendarDateDataManager->setTimeFormatChanged(0); - calendarDateDataManager->setTimeFormatChanged(1); -} +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +//#include "test_calendardatedatamanage.h" +//#include + +//test_calendardatedatamanage::test_calendardatedatamanage() +//{ +//} + +//void test_calendardatedatamanage::SetUp() +//{ +// calendarDateDataManager = new CalendarDateDataManager(); +//} + +//void test_calendardatedatamanage::TearDown() +//{ +// delete calendarDateDataManager; +// calendarDateDataManager = nullptr; +//} + +///** +// *本类是为获取当前日期的类,所拿到的数据会根据当前时间不断变化,因此暂时不做返回值判断 +// */ + +////void CalendarDateDataManager::setSelectDate(const QDate &selectDate, const bool isSwitchYear) +//TEST_F(test_calendardatedatamanage, setSelectDate) +//{ +// QDate selectDate(2020, 12, 25); +// bool isSwitchYear = true; +// calendarDateDataManager->setSelectDate(selectDate, isSwitchYear); + +// isSwitchYear = false; +// calendarDateDataManager->setSelectDate(selectDate, isSwitchYear); +//} + +////QDate CalendarDateDataManager::getSelectDate() const +//TEST_F(test_calendardatedatamanage, getSelectDate) +//{ +// QDate selectDate; +// selectDate = calendarDateDataManager->getSelectDate(); +// //qInfo() << selectDate; +//} + +////void CalendarDateDataManager::setCurrentDateTime(const QDateTime ¤tDateTime) +//TEST_F(test_calendardatedatamanage, setCurrentDateTime) +//{ +// QDate date(2020, 12, 25); +// QDateTime currentDateTime(date); +// calendarDateDataManager->setCurrentDateTime(currentDateTime); +//} + +////QDateTime CalendarDateDataManager::getCurrentDate() const +//TEST_F(test_calendardatedatamanage, getCurrentDate) +//{ +// QDateTime currentDateTime; +// currentDateTime = calendarDateDataManager->getCurrentDate(); +//} + +////QMap > CalendarDateDataManager::getYearDate() +//TEST_F(test_calendardatedatamanage, getYearDate) +//{ +// QMap > dateTime; +// dateTime = calendarDateDataManager->getYearDate(); +//} + +////QVector CalendarDateDataManager::getWeekDate(const QDate &date) +//TEST_F(test_calendardatedatamanage, getWeekDate) +//{ +// QDate selectDate(2020, 12, 25); +// QVector dateV = calendarDateDataManager->getWeekDate(selectDate); +//} + +////void CalendarDateDataManager::setWeekFirstDay(const Qt::DayOfWeek &firstDay) +//TEST_F(test_calendardatedatamanage, setWeekFirstDay) +//{ +// Qt::DayOfWeek firstDay(Qt::Sunday); +// calendarDateDataManager->setWeekFirstDay(firstDay); +//} + +//// Qt::DayOfWeek CalendarDateDataManager::getWeekFirstDay() +//TEST_F(test_calendardatedatamanage, getWeekFirstDay) +//{ +// assert(Qt::Sunday == calendarDateDataManager->getWeekFirstDay()); +//} + +////void CalendarDateDataManager::setWeekDayFormatByID(const int &weekDayFormatID) +//TEST_F(test_calendardatedatamanage, setWeekDayFormatByID) +//{ +// int setWeekDayFormatByID = 0; +// calendarDateDataManager->setWeekDayFormatByID(setWeekDayFormatByID); + +// setWeekDayFormatByID = 1; +// calendarDateDataManager->setWeekDayFormatByID(setWeekDayFormatByID); +//} + +////QString CalendarDateDataManager::getWeekDayFormat() const +//TEST_F(test_calendardatedatamanage, getWeekDayFormat) +//{ +// QString getWEKfomat; +// calendarDateDataManager->getWeekDayFormat(); +//} + +////ShowDateRange CalendarDateDataManager::getShowDateRange() const +//TEST_F(test_calendardatedatamanage, getShowDateRange) +//{ +// ShowDateRange showDateR; +// showDateR = calendarDateDataManager->getShowDateRange(); +//} + +////int CalendarDateDataManager::getWeekNumOfYear(const QDate &date) +//TEST_F(test_calendardatedatamanage, getWeekNumOfYear) +//{ +// //2020-12-25 为第52周 +// QDate date(2020, 12, 25); +// assert(52 == calendarDateDataManager->getWeekNumOfYear(date)); +//} + +//TEST_F(test_calendardatedatamanage, setDateFormatChanged) +//{ +// for (int i = 0; i < 10; ++i) { +// calendarDateDataManager->setDateFormatChanged(i); +// } +//} + +////setTimeFormatChanged +//TEST_F(test_calendardatedatamanage, setTimeFormatChanged) +//{ +// calendarDateDataManager->setTimeFormatChanged(0); +// calendarDateDataManager->setTimeFormatChanged(1); +//} diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_dataManage/test_calendardatedatamanage.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_dataManage/test_calendardatedatamanage.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_dataManage/test_calendardatedatamanage.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_dataManage/test_calendardatedatamanage.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,39 +1,23 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: hejinghai -* -* Maintainer: hejinghai -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_CALENDARDATEDATAMANAGE_H #define TEST_CALENDARDATEDATAMANAGE_H -#include "calendardatedatamanage.h" -#include "gtest/gtest.h" -#include +//#include "calendardatedatamanage.h" +//#include "gtest/gtest.h" +//#include -class test_calendardatedatamanage : public QObject, public::testing::Test -{ -public: - test_calendardatedatamanage(); - void SetUp() override; - void TearDown() override; +//class test_calendardatedatamanage : public QObject, public::testing::Test +//{ +//public: +// test_calendardatedatamanage(); +// void SetUp() override; +// void TearDown() override; -protected: - CalendarDateDataManager *calendarDateDataManager = nullptr; -}; +//protected: +// CalendarDateDataManager *calendarDateDataManager = nullptr; +//}; #endif // TEST_CALENDARDATEDATAMANAGE_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_dataManage/test_schedulecoormanage.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_dataManage/test_schedulecoormanage.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_dataManage/test_schedulecoormanage.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_dataManage/test_schedulecoormanage.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,175 +1,155 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: hejinghai -* -* Maintainer: hejinghai -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ -#include "test_schedulecoormanage.h" -#include - -test_schedulecoormanage::test_schedulecoormanage() -{ - cScheduleCoorManage = new CScheduleCoorManage(); -} - -test_schedulecoormanage::~test_schedulecoormanage() -{ - delete cScheduleCoorManage; -} - -//void CScheduleCoorManage::setRange(int w, int h, QDate begindate, QDate enddate, int rightmagin) -TEST_F(test_schedulecoormanage, setRange) -{ - int w = 100; - int h = 100; - QDate begindate(2020, 12, 01); - QDate enddate(2020, 12, 31); - int rightmagin = 1; - cScheduleCoorManage->setRange(w, h, begindate, enddate, rightmagin); -} - -//void CScheduleCoorManage::setDateRange(QDate begindate, QDate enddate) -TEST_F(test_schedulecoormanage, setDateRange) -{ - QDate begindate(2020, 12, 01); - QDate enddate(2020, 12, 21); - cScheduleCoorManage->setDateRange(begindate, enddate); - - cScheduleCoorManage->setDateRange(enddate, begindate); - - int w = 100; - int h = 100; - QDate m_begindate(2020, 12, 11); - QDate m_enddate(2020, 12, 31); - int rightmagin = 1; - cScheduleCoorManage->setRange(w, h, m_begindate, m_enddate, rightmagin); - cScheduleCoorManage->setDateRange(begindate, enddate); -} - -/** - * @brief test_schedulecoormanage, getDrawRegion - * (QDateTime begintime, QDateTime endtime) - * (QDateTime begintime, QDateTime endtime, int index, int coount) - * (QDate date, QDateTime begintime, QDateTime endtime, int index, int coount, int maxnum, int type) - */ -TEST_F(test_schedulecoormanage, getDrawRegion) -{ - QString begin = "2020-12-01 12:24:36"; - QDateTime begindate = QDateTime::fromString(begin, "yyyy-MM-dd hh:mm:ss"); - QString end = "2020-12-21 12:24:36"; - QDateTime enddate = QDateTime::fromString(end, "yyyy-MM-dd hh:mm:ss"); - - cScheduleCoorManage->getDrawRegion(begindate, enddate); - cScheduleCoorManage->getDrawRegion(enddate, begindate); - - int index = 2; - int coount = 1; - cScheduleCoorManage->getDrawRegion(begindate, enddate, index, coount); - cScheduleCoorManage->getDrawRegion(enddate, begindate, index, coount); - - QDate date(2020, 12, 31); - int maxnum = 3; - int type = 0; - cScheduleCoorManage->getDrawRegion(date, begindate, enddate, index, coount, maxnum, type); - cScheduleCoorManage->getDrawRegion(date, enddate, begindate, index, coount, maxnum, type); - int w = 100; - int h = 100; - QDate m_begindate(2020, 11, 11); - QDate m_enddate(2020, 12, 31); - int rightmagin = 1; - cScheduleCoorManage->setRange(w, h, m_begindate, m_enddate, rightmagin); - cScheduleCoorManage->getDrawRegion(begindate, enddate); - cScheduleCoorManage->getDrawRegion(begindate, enddate, index, coount); - - coount = 5; - cScheduleCoorManage->getDrawRegion(date, begindate, enddate, index, coount, maxnum, type); - - index = 5; - cScheduleCoorManage->getDrawRegion(date, begindate, enddate, index, coount, maxnum, type); -} - -//QRectF CScheduleCoorManage::getDrawRegionF(QDateTime begintime, QDateTime endtime) -TEST_F(test_schedulecoormanage, getDrawRegionF) -{ - QString begin = "2020-12-01 12:24:36"; - QDateTime begindate = QDateTime::fromString(begin, "yyyy-MM-dd hh:mm:ss"); - QString end = "2020-12-21 12:24:36"; - QDateTime enddate = QDateTime::fromString(end, "yyyy-MM-dd hh:mm:ss"); - - cScheduleCoorManage->getDrawRegionF(begindate, enddate); - cScheduleCoorManage->getDrawRegionF(enddate, begindate); - - int w = 100; - int h = 100; - QDate m_begindate(2020, 11, 11); - QDate m_enddate(2020, 12, 31); - int rightmagin = 1; - cScheduleCoorManage->setRange(w, h, m_begindate, m_enddate, rightmagin); - cScheduleCoorManage->getDrawRegionF(begindate, enddate); -} - -//QRectF CScheduleCoorManage::getAllDayDrawRegion(QDate begin, QDate end) -TEST_F(test_schedulecoormanage, getAllDayDrawRegion) -{ - QDate begindate(2020, 12, 01); - QDate enddate(2020, 12, 31); - cScheduleCoorManage->getAllDayDrawRegion(begindate, enddate); - cScheduleCoorManage->getAllDayDrawRegion(enddate, begindate); -} - -//QDateTime CScheduleCoorManage::getDate(QPointF pos) -TEST_F(test_schedulecoormanage, getDate) -{ - QPointF pos(0, 0); - QDateTime dateTime = cScheduleCoorManage->getDate(pos); - qInfo() << dateTime; - QPointF pos1(-1, 0); - QDateTime dateTime1 = cScheduleCoorManage->getDate(pos1); -} - -//QDate CScheduleCoorManage::getsDate(QPointF pos) -TEST_F(test_schedulecoormanage, getsDate) -{ - QPointF pos(0, 0); - QDate date = cScheduleCoorManage->getsDate(pos); - qInfo() << date; - QPointF pos1(-1, 0); - cScheduleCoorManage->getsDate(pos1); -} - -//float CScheduleCoorManage::getHeight(const QTime &time) -TEST_F(test_schedulecoormanage, getHeight) -{ - const float Height = 0; - QTime time(18, 8, 9, 30); - float height = cScheduleCoorManage->getHeight(time); - qInfo() << height; - assert(Height <= height); -} - -//QDate getBegindate() -TEST_F(test_schedulecoormanage, getBegindate) -{ - int w = 100; - int h = 100; - QDate m_begindate(2020, 11, 11); - QDate m_enddate(2020, 12, 31); - int rightmagin = 1; - cScheduleCoorManage->setRange(w, h, m_begindate, m_enddate, rightmagin); - QDate getbegindate = cScheduleCoorManage->getBegindate(); - assert(m_begindate == getbegindate); -} +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +//#include "test_schedulecoormanage.h" +//#include + +//test_schedulecoormanage::test_schedulecoormanage() +//{ +// cScheduleCoorManage = new CScheduleCoorManage(); +//} + +//test_schedulecoormanage::~test_schedulecoormanage() +//{ +// delete cScheduleCoorManage; +//} + +////void CScheduleCoorManage::setRange(int w, int h, QDate begindate, QDate enddate, int rightmagin) +//TEST_F(test_schedulecoormanage, setRange) +//{ +// int w = 100; +// int h = 100; +// QDate begindate(2020, 12, 01); +// QDate enddate(2020, 12, 31); +// int rightmagin = 1; +// cScheduleCoorManage->setRange(w, h, begindate, enddate, rightmagin); +//} + +////void CScheduleCoorManage::setDateRange(QDate begindate, QDate enddate) +//TEST_F(test_schedulecoormanage, setDateRange) +//{ +// QDate begindate(2020, 12, 01); +// QDate enddate(2020, 12, 21); +// cScheduleCoorManage->setDateRange(begindate, enddate); + +// cScheduleCoorManage->setDateRange(enddate, begindate); + +// int w = 100; +// int h = 100; +// QDate m_begindate(2020, 12, 11); +// QDate m_enddate(2020, 12, 31); +// int rightmagin = 1; +// cScheduleCoorManage->setRange(w, h, m_begindate, m_enddate, rightmagin); +// cScheduleCoorManage->setDateRange(begindate, enddate); +//} + +///** +// * @brief test_schedulecoormanage, getDrawRegion +// * (QDateTime begintime, QDateTime endtime) +// * (QDateTime begintime, QDateTime endtime, int index, int coount) +// * (QDate date, QDateTime begintime, QDateTime endtime, int index, int coount, int maxnum, int type) +// */ +//TEST_F(test_schedulecoormanage, getDrawRegion) +//{ +// QString begin = "2020-12-01 12:24:36"; +// QDateTime begindate = QDateTime::fromString(begin, "yyyy-MM-dd hh:mm:ss"); +// QString end = "2020-12-21 12:24:36"; +// QDateTime enddate = QDateTime::fromString(end, "yyyy-MM-dd hh:mm:ss"); + +// cScheduleCoorManage->getDrawRegion(begindate, enddate); +// cScheduleCoorManage->getDrawRegion(enddate, begindate); + +// int index = 2; +// int coount = 1; +// cScheduleCoorManage->getDrawRegion(begindate, enddate, index, coount); +// cScheduleCoorManage->getDrawRegion(enddate, begindate, index, coount); + +// QDate date(2020, 12, 31); +// int maxnum = 3; +// int type = 0; +// cScheduleCoorManage->getDrawRegion(date, begindate, enddate, index, coount, maxnum, type); +// cScheduleCoorManage->getDrawRegion(date, enddate, begindate, index, coount, maxnum, type); +// int w = 100; +// int h = 100; +// QDate m_begindate(2020, 11, 11); +// QDate m_enddate(2020, 12, 31); +// int rightmagin = 1; +// cScheduleCoorManage->setRange(w, h, m_begindate, m_enddate, rightmagin); +// cScheduleCoorManage->getDrawRegion(begindate, enddate); +// cScheduleCoorManage->getDrawRegion(begindate, enddate, index, coount); + +// coount = 5; +// cScheduleCoorManage->getDrawRegion(date, begindate, enddate, index, coount, maxnum, type); + +// index = 5; +// cScheduleCoorManage->getDrawRegion(date, begindate, enddate, index, coount, maxnum, type); +//} + +////QRectF CScheduleCoorManage::getDrawRegionF(QDateTime begintime, QDateTime endtime) +//TEST_F(test_schedulecoormanage, getDrawRegionF) +//{ +// QString begin = "2020-12-01 12:24:36"; +// QDateTime begindate = QDateTime::fromString(begin, "yyyy-MM-dd hh:mm:ss"); +// QString end = "2020-12-21 12:24:36"; +// QDateTime enddate = QDateTime::fromString(end, "yyyy-MM-dd hh:mm:ss"); + +// cScheduleCoorManage->getDrawRegionF(begindate, enddate); +// cScheduleCoorManage->getDrawRegionF(enddate, begindate); + +// int w = 100; +// int h = 100; +// QDate m_begindate(2020, 11, 11); +// QDate m_enddate(2020, 12, 31); +// int rightmagin = 1; +// cScheduleCoorManage->setRange(w, h, m_begindate, m_enddate, rightmagin); +// cScheduleCoorManage->getDrawRegionF(begindate, enddate); +//} + +////QRectF CScheduleCoorManage::getAllDayDrawRegion(QDate begin, QDate end) +//TEST_F(test_schedulecoormanage, getAllDayDrawRegion) +//{ +// QDate begindate(2020, 12, 01); +// QDate enddate(2020, 12, 31); +// cScheduleCoorManage->getAllDayDrawRegion(begindate, enddate); +// cScheduleCoorManage->getAllDayDrawRegion(enddate, begindate); +//} + +////QDateTime CScheduleCoorManage::getDate(QPointF pos) +//TEST_F(test_schedulecoormanage, getDate) +//{ +// QPointF pos(0, 0); +// QDateTime dateTime = cScheduleCoorManage->getDate(pos); +// qInfo() << dateTime; +// QPointF pos1(-1, 0); +// QDateTime dateTime1 = cScheduleCoorManage->getDate(pos1); +//} + +////QDate CScheduleCoorManage::getsDate(QPointF pos) +//TEST_F(test_schedulecoormanage, getsDate) +//{ +// QPointF pos(0, 0); +// QDate date = cScheduleCoorManage->getsDate(pos); +// qInfo() << date; +// QPointF pos1(-1, 0); +// cScheduleCoorManage->getsDate(pos1); +//} + +////float CScheduleCoorManage::getHeight(const QTime &time) +//TEST_F(test_schedulecoormanage, getHeight) +//{ +// QTime time(18, 8, 9, 30); +// assert(0 <= cScheduleCoorManage->getHeight(time)); +//} + +////QDate getBegindate() +//TEST_F(test_schedulecoormanage, getBegindate) +//{ +// int w = 100; +// int h = 100; +// QDate m_begindate(2020, 11, 11); +// QDate m_enddate(2020, 12, 31); +// int rightmagin = 1; +// cScheduleCoorManage->setRange(w, h, m_begindate, m_enddate, rightmagin); +// assert(m_begindate == cScheduleCoorManage->getBegindate()); +//} diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_dataManage/test_schedulecoormanage.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_dataManage/test_schedulecoormanage.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_dataManage/test_schedulecoormanage.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_dataManage/test_schedulecoormanage.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,37 +1,21 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: hejinghai -* -* Maintainer: hejinghai -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_SCHEDULECOORMANAGE_H #define TEST_SCHEDULECOORMANAGE_H -#include "schedulecoormanage.h" -#include "gtest/gtest.h" -#include +//#include "schedulecoormanage.h" +//#include "gtest/gtest.h" +//#include -class test_schedulecoormanage : public QObject, public::testing::Test -{ -public: - test_schedulecoormanage(); - ~test_schedulecoormanage(); -protected: - CScheduleCoorManage *cScheduleCoorManage = nullptr; -}; +//class test_schedulecoormanage : public QObject, public::testing::Test +//{ +//public: +// test_schedulecoormanage(); +// ~test_schedulecoormanage(); +//protected: +// CScheduleCoorManage *cScheduleCoorManage = nullptr; +//}; #endif // TEST_SCHEDULECOORMANAGE_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_dataManage/test_scheduledatamanage.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_dataManage/test_scheduledatamanage.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_dataManage/test_scheduledatamanage.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_dataManage/test_scheduledatamanage.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,59 +1,41 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: hejinghai -* -* Maintainer: hejinghai -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ -#include "test_scheduledatamanage.h" - -test_scheduledatamanage::test_scheduledatamanage() -{ - datamanage = new CScheduleDataManage(); -} - -test_scheduledatamanage::~test_scheduledatamanage() -{ - delete datamanage; -} - - -//bool CScheduleDataManage::getSearchResult(QDate date) -TEST_F(test_scheduledatamanage, getSearchResult) -{ - //QDate date(2020, 12, 01); - //datamanage->getSearchResult(date); -} - -//CScheduleDataManage *CScheduleDataManage::getScheduleDataManage() -TEST_F(test_scheduledatamanage, getScheduleDataManage) -{ - datamanage->getScheduleDataManage(); -} - -//QColor CScheduleDataManage::getSystemActiveColor() -TEST_F(test_scheduledatamanage, getSystemActiveColor) -{ - datamanage->getSystemActiveColor(); -} - -//int getTheme() -TEST_F(test_scheduledatamanage, getTheme) -{ - datamanage->m_theme = 1; - int theme = datamanage->getTheme(); - assert(1 == theme); -} +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +//#include "test_scheduledatamanage.h" + +//test_scheduledatamanage::test_scheduledatamanage() +//{ +// datamanage = new CScheduleDataManage(); +//} + +//test_scheduledatamanage::~test_scheduledatamanage() +//{ +// delete datamanage; +//} + + +////bool CScheduleDataManage::getSearchResult(QDate date) +//TEST_F(test_scheduledatamanage, getSearchResult) +//{ +// //QDate date(2020, 12, 01); +// //datamanage->getSearchResult(date); +//} + +////CScheduleDataManage *CScheduleDataManage::getScheduleDataManage() +//TEST_F(test_scheduledatamanage, getScheduleDataManage) +//{ +// datamanage->getScheduleDataManage(); +//} + +////QColor CScheduleDataManage::getSystemActiveColor() +//TEST_F(test_scheduledatamanage, getSystemActiveColor) +//{ +// datamanage->getSystemActiveColor(); +//} + +////int getTheme() +//TEST_F(test_scheduledatamanage, getTheme) +//{ +// datamanage->getTheme(); +//} diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_dataManage/test_scheduledatamanage.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_dataManage/test_scheduledatamanage.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_dataManage/test_scheduledatamanage.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_dataManage/test_scheduledatamanage.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,37 +1,21 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: hejinghai -* -* Maintainer: hejinghai -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_SCHEDULEDATAMANAGE_H #define TEST_SCHEDULEDATAMANAGE_H -#include "scheduledatamanage.h" -#include "gtest/gtest.h" -#include +//#include "scheduledatamanage.h" +//#include "gtest/gtest.h" +//#include -class test_scheduledatamanage : public QObject, public::testing::Test -{ -public: - test_scheduledatamanage(); - ~test_scheduledatamanage(); -protected: - CScheduleDataManage *datamanage = nullptr; -}; +//class test_scheduledatamanage : public QObject, public::testing::Test +//{ +//public: +// test_scheduledatamanage(); +// ~test_scheduledatamanage(); +//protected: +// CScheduleDataManage *datamanage = nullptr; +//}; #endif // TEST_SCHEDULEDATAMANAGE_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_dialog/test_myscheduleview.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_dialog/test_myscheduleview.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_dialog/test_myscheduleview.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_dialog/test_myscheduleview.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,108 +1,92 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -#include "test_myscheduleview.h" - -#include "../dialog_stub.h" - -#include -#include - -QVector getScheduleViewData() -{ - ScheduleDataInfo schedule1, schedule2; - - QDateTime currentDateTime = QDateTime::currentDateTime(); - schedule1.setID(1); - schedule1.setBeginDateTime(currentDateTime); - schedule1.setEndDateTime(currentDateTime.addDays(1)); - schedule1.setTitleName("scheduleOne"); - schedule1.setAllDay(true); - schedule1.setType(1); - schedule1.setRecurID(0); - - schedule2.setID(2); - schedule2.setBeginDateTime(currentDateTime.addDays(1)); - schedule2.setEndDateTime(currentDateTime.addDays(1).addSecs(60 * 60)); - schedule2.setTitleName("scheduleTwo"); - schedule2.setAllDay(true); - schedule2.setType(2); - schedule2.setRecurID(0); - - QVector scheduleList{}; - scheduleList.append(schedule1); - scheduleList.append(schedule2); - return scheduleList; -} - -test_myscheduleview::test_myscheduleview() -{ - ScheduleDataInfo scheduleinfo = getScheduleViewData().first(); - mScheduleView = new CMyScheduleView(scheduleinfo); -} - -test_myscheduleview::~test_myscheduleview() -{ - delete mScheduleView; - mScheduleView = nullptr; -} - -//void CMyScheduleView::setLabelTextColor(const int type) -TEST_F(test_myscheduleview, setLabelTextColor) -{ - mScheduleView->setLabelTextColor(1); - mScheduleView->setLabelTextColor(2); -} - +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. // -TEST_F(test_myscheduleview, CMyScheduleView) -{ - ScheduleDataInfo scheduleinfo; - QDateTime currentDateTime = QDateTime::currentDateTime(); - scheduleinfo.setID(1); - scheduleinfo.setBeginDateTime(currentDateTime); - scheduleinfo.setEndDateTime(currentDateTime.addDays(1)); - scheduleinfo.setTitleName("测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试" - "测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试" - "测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试" - "测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试" - "测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试" - "测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试" - "测试测试测试测试测试测试测试测试测试测试测试测试测试测试"); - scheduleinfo.setAllDay(true); - scheduleinfo.setType(4); - scheduleinfo.setRecurID(0); - CMyScheduleView scheduleView(scheduleinfo); -} - -//FontChange -TEST_F(test_myscheduleview, FontChange) -{ - QEvent event(QEvent::FontChange); - QApplication::sendEvent(mScheduleView, &event); -} - -//slotBtClick -TEST_F(test_myscheduleview, slotBtClick) -{ - Stub stub; - calendarDDialogExecStub(stub); - mScheduleView->slotBtClick(1, "tt"); -} +// SPDX-License-Identifier: LGPL-3.0-or-later + +//#include "test_myscheduleview.h" + +//#include "../dialog_stub.h" + +//#include +//#include + +//QVector getScheduleViewData() +//{ +// ScheduleDataInfo schedule1, schedule2; + +// QDateTime currentDateTime = QDateTime::currentDateTime(); +// schedule1.setID(1); +// schedule1.setBeginDateTime(currentDateTime); +// schedule1.setEndDateTime(currentDateTime.addDays(1)); +// schedule1.setTitleName("scheduleOne"); +// schedule1.setAllDay(true); +// schedule1.setType(1); +// schedule1.setRecurID(0); + +// schedule2.setID(2); +// schedule2.setBeginDateTime(currentDateTime.addDays(1)); +// schedule2.setEndDateTime(currentDateTime.addDays(1).addSecs(60 * 60)); +// schedule2.setTitleName("scheduleTwo"); +// schedule2.setAllDay(true); +// schedule2.setType(2); +// schedule2.setRecurID(0); + +// QVector scheduleList{}; +// scheduleList.append(schedule1); +// scheduleList.append(schedule2); +// return scheduleList; +//} + +//test_myscheduleview::test_myscheduleview() +//{ +// ScheduleDataInfo scheduleinfo = getScheduleViewData().first(); +// mScheduleView = new CMyScheduleView(scheduleinfo); +//} + +//test_myscheduleview::~test_myscheduleview() +//{ +// delete mScheduleView; +// mScheduleView = nullptr; +//} + +////void CMyScheduleView::setLabelTextColor(const int type) +//TEST_F(test_myscheduleview, setLabelTextColor) +//{ +// mScheduleView->setLabelTextColor(1); +// mScheduleView->setLabelTextColor(2); +//} + +//// +//TEST_F(test_myscheduleview, CMyScheduleView) +//{ +// ScheduleDataInfo scheduleinfo; +// QDateTime currentDateTime = QDateTime::currentDateTime(); +// scheduleinfo.setID(1); +// scheduleinfo.setBeginDateTime(currentDateTime); +// scheduleinfo.setEndDateTime(currentDateTime.addDays(1)); +// scheduleinfo.setTitleName("测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试" +// "测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试" +// "测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试" +// "测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试" +// "测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试" +// "测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试" +// "测试测试测试测试测试测试测试测试测试测试测试测试测试测试"); +// scheduleinfo.setAllDay(true); +// scheduleinfo.setType(4); +// scheduleinfo.setRecurID(0); +// CMyScheduleView scheduleView(scheduleinfo); +//} + +////FontChange +//TEST_F(test_myscheduleview, FontChange) +//{ +// QEvent event(QEvent::FontChange); +// QApplication::sendEvent(mScheduleView, &event); +//} + +////slotBtClick +//TEST_F(test_myscheduleview, slotBtClick) +//{ +// Stub stub; +// calendarDDialogExecStub(stub); +// mScheduleView->slotBtClick(1, "tt"); +//} diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_dialog/test_myscheduleview.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_dialog/test_myscheduleview.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_dialog/test_myscheduleview.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_dialog/test_myscheduleview.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_MYSCHEDULEVIEW_H #define TEST_MYSCHEDULEVIEW_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_dialog/test_schedulectrldlg.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_dialog/test_schedulectrldlg.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_dialog/test_schedulectrldlg.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_dialog/test_schedulectrldlg.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "test_schedulectrldlg.h" #include diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_dialog/test_schedulectrldlg.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_dialog/test_schedulectrldlg.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_dialog/test_schedulectrldlg.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_dialog/test_schedulectrldlg.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_SCHEDULECTRLDLG_H #define TEST_SCHEDULECTRLDLG_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_dialog/test_scheduledlg.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_dialog/test_scheduledlg.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_dialog/test_scheduledlg.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_dialog/test_scheduledlg.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "test_scheduledlg.h" #include "../cscheduledbusstub.h" diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_dialog/test_scheduledlg.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_dialog/test_scheduledlg.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_dialog/test_scheduledlg.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_dialog/test_scheduledlg.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. - * - * Author: chenhaifeng - * - * Maintainer: chenhaifeng - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_SCHEDULEDLG_H #define TEST_SCHEDULEDLG_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_dialog/test_scheduletypeeditdlg.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_dialog/test_scheduletypeeditdlg.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_dialog/test_scheduletypeeditdlg.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_dialog/test_scheduletypeeditdlg.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,78 +1,47 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: leilong -* -* Maintainer: leilong -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ -#include "test_scheduletypeeditdlg.h" - -test_scheduletypeeditdlg::test_scheduletypeeditdlg() -{ - -} - -TEST_F(test_scheduletypeeditdlg, slotEditTextChanged_001) -{ - mWidget->m_typeText = "123"; - mWidget->slotEditTextChanged("21212312312315456489512315489456123165489456123135485"); - EXPECT_EQ(mWidget->m_lineEdit->text(), "123"); -} - -TEST_F(test_scheduletypeeditdlg, slotEditTextChanged_002) -{ - mWidget->m_typeText = "123"; - mWidget->slotEditTextChanged(""); - EXPECT_FALSE(mWidget->getButton(1)->isEnabled()); -} - -TEST_F(test_scheduletypeeditdlg, slotEditTextChanged_003) -{ - mWidget->m_typeText = "123"; - mWidget->slotEditTextChanged(" "); - EXPECT_FALSE(mWidget->getButton(1)->isEnabled()); -} - -TEST_F(test_scheduletypeeditdlg, slotFocusChanged_001) -{ - mWidget->m_lineEdit->setText(""); - mWidget->slotFocusChanged(false); -} - -TEST_F(test_scheduletypeeditdlg, slotBtnCancel_001) -{ - mWidget->slotBtnCancel(); -} - -TEST_F(test_scheduletypeeditdlg, slotBtnNext_001) -{ - mWidget->slotBtnNext(); -} - -TEST_F(test_scheduletypeeditdlg, init_001) -{ - mWidget->init(); -} - -TEST_F(test_scheduletypeeditdlg, initView_001) -{ - mWidget->initView(); -} - -TEST_F(test_scheduletypeeditdlg, initData_001) -{ - mWidget->initData(); -} +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +//#include "test_scheduletypeeditdlg.h" + +//test_scheduletypeeditdlg::test_scheduletypeeditdlg() +//{ + +//} + +//TEST_F(test_scheduletypeeditdlg, slotEditTextChanged_001) +//{ +// mWidget->m_typeText = "123"; +// mWidget->slotEditTextChanged("21212312312315456489512315489456123165489456123135485"); +// EXPECT_EQ(mWidget->m_lineEdit->text(), "123"); +//} + +//TEST_F(test_scheduletypeeditdlg, slotEditTextChanged_002) +//{ +// mWidget->m_typeText = "123"; +// mWidget->slotEditTextChanged(""); +// EXPECT_FALSE(mWidget->getButton(1)->isEnabled()); +//} + +//TEST_F(test_scheduletypeeditdlg, slotEditTextChanged_003) +//{ +// mWidget->m_typeText = "123"; +// mWidget->slotEditTextChanged(" "); +// EXPECT_FALSE(mWidget->getButton(1)->isEnabled()); +//} + +//TEST_F(test_scheduletypeeditdlg, slotFocusChanged_001) +//{ +// mWidget->m_lineEdit->setText(""); +// mWidget->slotFocusChanged(false); +//} + +//TEST_F(test_scheduletypeeditdlg, slotBtnCancel_001) +//{ +// mWidget->slotBtnCancel(); +//} + +//TEST_F(test_scheduletypeeditdlg, slotBtnNext_001) +//{ +// mWidget->slotBtnNext(); +//} diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_dialog/test_scheduletypeeditdlg.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_dialog/test_scheduletypeeditdlg.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_dialog/test_scheduletypeeditdlg.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_dialog/test_scheduletypeeditdlg.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,48 +1,32 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: leilong -* -* Maintainer: leilong -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_SCHEDULETYPEEDITDLG_H #define TEST_SCHEDULETYPEEDITDLG_H -#include "scheduletypeeditdlg.h" -#include -#include -#include - -class test_scheduletypeeditdlg: public::testing::Test -{ -public: - test_scheduletypeeditdlg(); - - virtual void SetUp() - { - mWidget = new ScheduleTypeEditDlg(); - } - - virtual void TearDown() - { - delete mWidget; - mWidget = nullptr; - } -protected: - ScheduleTypeEditDlg *mWidget = nullptr; -}; +//#include "scheduletypeeditdlg.h" +//#include +//#include +//#include + +//class test_scheduletypeeditdlg: public::testing::Test +//{ +//public: +// test_scheduletypeeditdlg(); + +// virtual void SetUp() +// { +// mWidget = new ScheduleTypeEditDlg(); +// } + +// virtual void TearDown() +// { +// delete mWidget; +// mWidget = nullptr; +// } +//protected: +// ScheduleTypeEditDlg *mWidget = nullptr; +//}; #endif // TEST_SCHEDULETYPEEDITDLG_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_keypress/keypressstub.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_keypress/keypressstub.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_keypress/keypressstub.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_keypress/keypressstub.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "keypressstub.h" #include "view/graphicsItem/cweekdaybackgrounditem.h" diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_keypress/keypressstub.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_keypress/keypressstub.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_keypress/keypressstub.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_keypress/keypressstub.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef KEYPRESSSTUB_H #define KEYPRESSSTUB_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_keypress/test_calldaykeyleftdeal.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_keypress/test_calldaykeyleftdeal.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_keypress/test_calldaykeyleftdeal.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_keypress/test_calldaykeyleftdeal.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "test_calldaykeyleftdeal.h" #include "../third-party_stub/stub.h" diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_keypress/test_calldaykeyleftdeal.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_keypress/test_calldaykeyleftdeal.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_keypress/test_calldaykeyleftdeal.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_keypress/test_calldaykeyleftdeal.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_CALLDAYKEYLEFTDEAL_H #define TEST_CALLDAYKEYLEFTDEAL_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_keypress/test_calldaykeyrightdeal.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_keypress/test_calldaykeyrightdeal.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_keypress/test_calldaykeyrightdeal.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_keypress/test_calldaykeyrightdeal.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "test_calldaykeyrightdeal.h" #include "../third-party_stub/stub.h" diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_keypress/test_calldaykeyrightdeal.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_keypress/test_calldaykeyrightdeal.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_keypress/test_calldaykeyrightdeal.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_keypress/test_calldaykeyrightdeal.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_CALLDAYKEYRIGHTDEAL_H #define TEST_CALLDAYKEYRIGHTDEAL_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_keypress/test_ckeydowndeal.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_keypress/test_ckeydowndeal.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_keypress/test_ckeydowndeal.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_keypress/test_ckeydowndeal.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "test_ckeydowndeal.h" #include "../third-party_stub/stub.h" diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_keypress/test_ckeydowndeal.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_keypress/test_ckeydowndeal.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_keypress/test_ckeydowndeal.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_keypress/test_ckeydowndeal.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_CKEYDOWNDEAL_H #define TEST_CKEYDOWNDEAL_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_keypress/test_ckeyenabledeal.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_keypress/test_ckeyenabledeal.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_keypress/test_ckeyenabledeal.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_keypress/test_ckeyenabledeal.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "test_ckeyenabledeal.h" #include "../third-party_stub/stub.h" diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_keypress/test_ckeyenabledeal.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_keypress/test_ckeyenabledeal.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_keypress/test_ckeyenabledeal.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_keypress/test_ckeyenabledeal.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_CKEYENABLEDEAL_H #define TEST_CKEYENABLEDEAL_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_keypress/test_ckeyleftdeal.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_keypress/test_ckeyleftdeal.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_keypress/test_ckeyleftdeal.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_keypress/test_ckeyleftdeal.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "test_ckeyleftdeal.h" #include "../third-party_stub/stub.h" diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_keypress/test_ckeyleftdeal.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_keypress/test_ckeyleftdeal.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_keypress/test_ckeyleftdeal.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_keypress/test_ckeyleftdeal.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_CKEYLEFTDEAL_H #define TEST_CKEYLEFTDEAL_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_keypress/test_ckeypressprxy.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_keypress/test_ckeypressprxy.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_keypress/test_ckeypressprxy.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_keypress/test_ckeypressprxy.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,46 +1,30 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ -#include "test_ckeypressprxy.h" -#include "ckeyleftdeal.h" +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later -test_CKeyPressPrxy::test_CKeyPressPrxy() -{ - keyPressPrxy = QSharedPointer(new CKeyPressPrxy); -} +//#include "test_ckeypressprxy.h" +//#include "ckeyleftdeal.h" -TEST_F(test_CKeyPressPrxy, keyPressDeal_NoEvent) -{ - ASSERT_FALSE(keyPressPrxy->keyPressDeal(Qt::Key_Tab)); -} +//test_CKeyPressPrxy::test_CKeyPressPrxy() +//{ +// keyPressPrxy = QSharedPointer(new CKeyPressPrxy); +//} -TEST_F(test_CKeyPressPrxy, keyPressDeal) -{ - keyPressPrxy->addkeyPressDeal(new CKeyLeftDeal()); - ASSERT_FALSE(keyPressPrxy->keyPressDeal(Qt::Key_Left)); -} +//TEST_F(test_CKeyPressPrxy, keyPressDeal_NoEvent) +//{ +// ASSERT_FALSE(keyPressPrxy->keyPressDeal(Qt::Key_Tab)); +//} -TEST_F(test_CKeyPressPrxy, removeDeal) -{ - CKeyLeftDeal *leftDeal = new CKeyLeftDeal(); - keyPressPrxy->addkeyPressDeal(leftDeal); - keyPressPrxy->removeDeal(leftDeal); - ASSERT_FALSE(keyPressPrxy->keyPressDeal(Qt::Key_Left)); -} +//TEST_F(test_CKeyPressPrxy, keyPressDeal) +//{ +// keyPressPrxy->addkeyPressDeal(new CKeyLeftDeal()); +// ASSERT_FALSE(keyPressPrxy->keyPressDeal(Qt::Key_Left)); +//} + +//TEST_F(test_CKeyPressPrxy, removeDeal) +//{ +// CKeyLeftDeal *leftDeal = new CKeyLeftDeal(); +// keyPressPrxy->addkeyPressDeal(leftDeal); +// keyPressPrxy->removeDeal(leftDeal); +// ASSERT_FALSE(keyPressPrxy->keyPressDeal(Qt::Key_Left)); +//} diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_keypress/test_ckeypressprxy.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_keypress/test_ckeypressprxy.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_keypress/test_ckeypressprxy.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_keypress/test_ckeypressprxy.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,46 +1,30 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_CKEYPRESSPRXY_H #define TEST_CKEYPRESSPRXY_H -#include "configsettings.h" -#include "gtest/gtest.h" -#include "ckeypressprxy.h" - -#include -#include - -class test_CKeyPressPrxy : public QObject - , public ::testing::Test -{ - Q_OBJECT -public: - test_CKeyPressPrxy(); - -signals: - -public slots: - -public: - QSharedPointer keyPressPrxy; -}; +//#include "configsettings.h" +//#include "gtest/gtest.h" +//#include "ckeypressprxy.h" + +//#include +//#include + +//class test_CKeyPressPrxy : public QObject +// , public ::testing::Test +//{ +// Q_OBJECT +//public: +// test_CKeyPressPrxy(); + +//signals: + +//public slots: + +//public: +// QSharedPointer keyPressPrxy; +//}; #endif // TEST_CKEYPRESSPRXY_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_keypress/test_ckeyrightdeal.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_keypress/test_ckeyrightdeal.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_keypress/test_ckeyrightdeal.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_keypress/test_ckeyrightdeal.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "test_ckeyrightdeal.h" #include "../third-party_stub/stub.h" diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_keypress/test_ckeyrightdeal.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_keypress/test_ckeyrightdeal.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_keypress/test_ckeyrightdeal.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_keypress/test_ckeyrightdeal.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_CKEYRIGHTDEAL_H #define TEST_CKEYRIGHTDEAL_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_keypress/test_ckeyupdeal.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_keypress/test_ckeyupdeal.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_keypress/test_ckeyupdeal.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_keypress/test_ckeyupdeal.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "test_ckeyupdeal.h" #include "../third-party_stub/stub.h" diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_keypress/test_ckeyupdeal.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_keypress/test_ckeyupdeal.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_keypress/test_ckeyupdeal.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_keypress/test_ckeyupdeal.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_CKEYUPDEAL_H #define TEST_CKEYUPDEAL_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_keypress/test_cscenetabkeydeal.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_keypress/test_cscenetabkeydeal.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_keypress/test_cscenetabkeydeal.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_keypress/test_cscenetabkeydeal.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "test_cscenetabkeydeal.h" #include "../third-party_stub/stub.h" diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_keypress/test_cscenetabkeydeal.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_keypress/test_cscenetabkeydeal.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_keypress/test_cscenetabkeydeal.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_keypress/test_cscenetabkeydeal.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_CSCENETABKEYDEAL_H #define TEST_CSCENETABKEYDEAL_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_keypress/test_cweekdayscenetabkeydeal.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_keypress/test_cweekdayscenetabkeydeal.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_keypress/test_cweekdayscenetabkeydeal.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_keypress/test_cweekdayscenetabkeydeal.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "test_cweekdayscenetabkeydeal.h" #include "../third-party_stub/stub.h" diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_keypress/test_cweekdayscenetabkeydeal.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_keypress/test_cweekdayscenetabkeydeal.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_keypress/test_cweekdayscenetabkeydeal.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_keypress/test_cweekdayscenetabkeydeal.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_CWEEKDAYSCENETABKEYDEAL_H #define TEST_CWEEKDAYSCENETABKEYDEAL_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/testmainwindowgui.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/testmainwindowgui.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/testmainwindowgui.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/testmainwindowgui.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,241 +1,307 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ -#include "testmainwindowgui.h" -#include "configsettings.h" -#include "view/monthgraphiview.h" -#include "yearWidget/yearwindow.h" -#include "monthWidget/monthwindow.h" -#include "dialog_stub.h" -#include "testscheduledata.h" - -#include - -testMainWindowGUI::testMainWindowGUI() -{ -} - -QVariant getSetView(const QString &str) -{ - QVariant variant; - if (str == "base.geometry") { - QByteArray byteArray("\x01\xD9\xD0\xCB\x00\x02\x00\x00\x00\x00\x02\x12\x00\x00\x00\xF3\x00\x00\x05m\x00\x00\x03l\x00\x00\x02\x12\x00\x00\x00\xF3\x00\x00\x05m\x00\x00\x03l\x00\x00\x00\x00\x00\x00\x00\x00\x07\x80"); - variant.setValue(byteArray); - } else if (str == "base.state") { - variant.setValue(1); - - } else if (str == "base.view") { - variant.setValue(2); - } - return variant; -} - -void testMainWindowGUI::SetUp() -{ - Stub stub; - stub.set(ADDR(CConfigSettings, value), getSetView); -} - -void testMainWindowGUI::TearDown() -{ -} - -TEST_F(testMainWindowGUI, yearGUITest) -{ - Calendarmainwindow mainWindow(0); - - CYearWindow *myYearWindow = mainWindow.findChild("yearwindow"); - if (myYearWindow != nullptr) { - DIconButton *m_prevButton = myYearWindow->findChild("PrevButton"); - DIconButton *m_nextButton = myYearWindow->findChild("NextButton"); - LabelWidget *m_today = myYearWindow->findChild("yearToDay"); - - if (m_prevButton != nullptr) { - QTest::mouseClick(m_prevButton, Qt::LeftButton); - } - - if (m_today != nullptr) { - QTest::mouseClick(m_today, Qt::LeftButton); - } - - if (m_nextButton != nullptr) { - QTest::mouseClick(m_nextButton, Qt::LeftButton); - } - //获取QStackedWidget - QStackedWidget *stackedWidget = myYearWindow->findChild(); - if (stackedWidget) { - QWidget *currentWidget = stackedWidget->currentWidget(); - if (currentWidget) { - currentWidget->setFocus(); - QTest::keyPress(currentWidget, Qt::Key_Up); - } - currentWidget = stackedWidget->currentWidget(); - if (currentWidget) { - currentWidget->setFocus(); - QTest::keyPress(currentWidget, Qt::Key_Down); - } - } - //year_resizeEvent - myYearWindow->setSearchWFlag(true); - mainWindow.resize(1000, 400); - myYearWindow->setSearchWFlag(false); - mainWindow.resize(700, 400); - } -} - -TEST_F(testMainWindowGUI, monthGUITest) -{ - Calendarmainwindow mainWindow(1); - CMonthWindow *mymonthWindow = mainWindow.findChild("monthWindow"); - if (mymonthWindow != nullptr) { - } -} -TEST_F(testMainWindowGUI, weekGUIKeyTest) -{ - Calendarmainwindow mainWindow(2); -} - -TEST_F(testMainWindowGUI, dayGUIKeyTest) -{ - Calendarmainwindow mainWindow(3); -} - -TEST_F(testMainWindowGUI, slotCurrentDateUpdate) -{ - Calendarmainwindow mainWindow(1); - mainWindow.slotCurrentDateUpdate(); -} - -//slotSetSearchFocus -TEST_F(testMainWindowGUI, slotSetSearchFocus) -{ - Calendarmainwindow mainWindow(1); - mainWindow.slotSetSearchFocus(); -} - -//viewWindow -TEST_F(testMainWindowGUI, viewWindow) -{ - Calendarmainwindow mainWindow(1); - mainWindow.viewWindow(3, false); - mainWindow.viewWindow(0, true); -} - -//setSearchWidth -TEST_F(testMainWindowGUI, setSearchWidth) -{ - Calendarmainwindow mainWindow(1); - mainWindow.setSearchWidth(500); -} - -//slotTheme -TEST_F(testMainWindowGUI, slotTheme) -{ - Calendarmainwindow mainWindow(1); - mainWindow.slotTheme(0); - mainWindow.slotTheme(1); - mainWindow.slotTheme(2); -} - -//slotOpenSchedule -TEST_F(testMainWindowGUI, slotOpenSchedule) -{ - Stub stub; - calendarDDialogExecStub(stub); - Calendarmainwindow mainWindow(1); - QString job = ScheduleDataInfo::ScheduleToJsonStr(TestDataInfo::getScheduleItemDInfo().first()); - mainWindow.slotOpenSchedule(job); -} - -//slotWUpdateSchedule -TEST_F(testMainWindowGUI, slotWUpdateSchedule) -{ - Calendarmainwindow mainWindow(1); - mainWindow.slotWUpdateSchedule(); -} - -//slotStextChanged -TEST_F(testMainWindowGUI, slotStextChanged) -{ - Calendarmainwindow mainWindow(1); - mainWindow.slotStextChanged(); -} - -//slotStextfocusChanged -TEST_F(testMainWindowGUI, slotStextfocusChanged) -{ - Calendarmainwindow mainWindow(1); - mainWindow.slotStextfocusChanged(true); -} - -//slotDeleteitem -TEST_F(testMainWindowGUI, slotDeleteitem) -{ - Stub stub; - calendarDDialogExecStub(stub); - Calendarmainwindow mainWindow(1); - mainWindow.slotDeleteitem(); -} - -//slotNewSchedule -TEST_F(testMainWindowGUI, slotNewSchedule) -{ - Stub stub; - calendarDDialogExecStub(stub); - Calendarmainwindow mainWindow(1); - mainWindow.slotNewSchedule(); -} - -//slotSwitchView -TEST_F(testMainWindowGUI, slotSwitchView) -{ - Stub stub; - calendarDDialogExecStub(stub); - Calendarmainwindow mainWindow(1); - mainWindow.slotSwitchView(0); - mainWindow.slotSwitchView(1); - mainWindow.slotSwitchView(2); - mainWindow.slotSwitchView(3); -} - -//slotViewtransparentFrame -TEST_F(testMainWindowGUI, slotViewtransparentFrame) -{ - Calendarmainwindow mainWindow(1); - mainWindow.slotViewtransparentFrame(true); - mainWindow.slotViewtransparentFrame(false); -} - -bool stub_startDetached(const QString &program, const QStringList &arguments) -{ - Q_UNUSED(program) - Q_UNUSED(arguments) - return true; -} - -//slotViewShortcut -TEST_F(testMainWindowGUI, slotViewShortcut) -{ - Stub stub; - stub.set((bool (*)(const QString &, const QStringList &))ADDR(QProcess, startDetached), - stub_startDetached); - Calendarmainwindow mainWindow(1); - mainWindow.slotViewShortcut(); -} +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +//#include "testmainwindowgui.h" +//#include "configsettings.h" +//#include "view/monthgraphiview.h" +//#include "yearWidget/yearwindow.h" +//#include "monthWidget/monthwindow.h" +//#include "dialog_stub.h" +//#include "testscheduledata.h" + +//#include + +//testMainWindowGUI::testMainWindowGUI() +//{ +//} + +//QVariant getSetView(const QString &str) +//{ +// QVariant variant; +// if (str == "base.geometry") { +// QByteArray byteArray("\x01\xD9\xD0\xCB\x00\x02\x00\x00\x00\x00\x02\x12\x00\x00\x00\xF3\x00\x00\x05m\x00\x00\x03l\x00\x00\x02\x12\x00\x00\x00\xF3\x00\x00\x05m\x00\x00\x03l\x00\x00\x00\x00\x00\x00\x00\x00\x07\x80"); +// variant.setValue(byteArray); +// } else if (str == "base.state") { +// variant.setValue(1); + +// } else if (str == "base.view") { +// variant.setValue(2); +// } +// return variant; +//} + +//void testMainWindowGUI::SetUp() +//{ +// Stub stub; +// stub.set(ADDR(CConfigSettings, value), getSetView); +//} + +//void testMainWindowGUI::TearDown() +//{ +//} + +//TEST_F(testMainWindowGUI, yearGUITest) +//{ +// Calendarmainwindow mainWindow(0); + +// CYearWindow *myYearWindow = mainWindow.findChild("yearwindow"); +// if (myYearWindow != nullptr) { +// DIconButton *m_prevButton = myYearWindow->findChild("PrevButton"); +// DIconButton *m_nextButton = myYearWindow->findChild("NextButton"); +// LabelWidget *m_today = myYearWindow->findChild("yearToDay"); + +// if (m_prevButton != nullptr) { +// QTest::mouseClick(m_prevButton, Qt::LeftButton); +// } + +// if (m_today != nullptr) { +// QTest::mouseClick(m_today, Qt::LeftButton); +// } + +// if (m_nextButton != nullptr) { +// QTest::mouseClick(m_nextButton, Qt::LeftButton); +// } +// //获取QStackedWidget +// QStackedWidget *stackedWidget = myYearWindow->findChild(); +// if (stackedWidget) { +// QWidget *currentWidget = stackedWidget->currentWidget(); +// if (currentWidget) { +// currentWidget->setFocus(); +// QTest::keyPress(currentWidget, Qt::Key_Up); +// } +// currentWidget = stackedWidget->currentWidget(); +// if (currentWidget) { +// currentWidget->setFocus(); +// QTest::keyPress(currentWidget, Qt::Key_Down); +// } +// } +// //year_resizeEvent +// myYearWindow->setSearchWFlag(true); +// mainWindow.resize(1000, 400); +// myYearWindow->setSearchWFlag(false); +// mainWindow.resize(700, 400); +// } +//} + +//TEST_F(testMainWindowGUI, monthGUITest) +//{ +// Calendarmainwindow mainWindow(1); +// CMonthWindow *mymonthWindow = mainWindow.findChild("monthWindow"); +// if (mymonthWindow != nullptr) { +// } +//} +//TEST_F(testMainWindowGUI, weekGUIKeyTest) +//{ +// Calendarmainwindow mainWindow(2); +//} + +//TEST_F(testMainWindowGUI, dayGUIKeyTest) +//{ +// Calendarmainwindow mainWindow(3); +//} + +//TEST_F(testMainWindowGUI, slotCurrentDateUpdate) +//{ +// Calendarmainwindow mainWindow(1); +// mainWindow.slotCurrentDateUpdate(); +//} + +////slotSetSearchFocus +//TEST_F(testMainWindowGUI, slotSetSearchFocus) +//{ +// Calendarmainwindow mainWindow(1); +// mainWindow.slotSetSearchFocus(); +//} + +////viewWindow +//TEST_F(testMainWindowGUI, viewWindow) +//{ +// Calendarmainwindow mainWindow(1); +// mainWindow.viewWindow(3, false); +// mainWindow.viewWindow(0, true); +//} + +////setSearchWidth +//TEST_F(testMainWindowGUI, setSearchWidth) +//{ +// Calendarmainwindow mainWindow(1); +// mainWindow.setSearchWidth(500); +//} + +////slotTheme +//TEST_F(testMainWindowGUI, slotTheme) +//{ +// Calendarmainwindow mainWindow(1); +// mainWindow.slotTheme(0); +// mainWindow.slotTheme(1); +// mainWindow.slotTheme(2); +//} + +////slotOpenSchedule +//TEST_F(testMainWindowGUI, slotOpenSchedule) +//{ +// Stub stub; +// calendarDDialogExecStub(stub); +// Calendarmainwindow mainWindow(1); +// QString job = ScheduleDataInfo::ScheduleToJsonStr(TestDataInfo::getScheduleItemDInfo().first()); +// mainWindow.slotOpenSchedule(job); +//} + +////slotWUpdateSchedule +//TEST_F(testMainWindowGUI, slotWUpdateSchedule) +//{ +// Calendarmainwindow mainWindow(1); +// mainWindow.slotWUpdateSchedule(); +//} + +////slotStextChanged +//TEST_F(testMainWindowGUI, slotStextChanged) +//{ +// Calendarmainwindow mainWindow(1); +// mainWindow.slotStextChanged(); +//} + +////slotStextfocusChanged +//TEST_F(testMainWindowGUI, slotStextfocusChanged) +//{ +// Calendarmainwindow mainWindow(1); +// mainWindow.slotStextfocusChanged(true); +//} + +////slotDeleteitem +//TEST_F(testMainWindowGUI, slotDeleteitem) +//{ +// Stub stub; +// calendarDDialogExecStub(stub); +// Calendarmainwindow mainWindow(1); +// mainWindow.slotDeleteitem(); +//} + +////slotNewSchedule +//TEST_F(testMainWindowGUI, slotNewSchedule) +//{ +// Stub stub; +// calendarDDialogExecStub(stub); +// Calendarmainwindow mainWindow(1); +// mainWindow.slotNewSchedule(); +//} + +////slotSwitchView +//TEST_F(testMainWindowGUI, slotSwitchView) +//{ +// Stub stub; +// calendarDDialogExecStub(stub); +// Calendarmainwindow mainWindow(1); +// mainWindow.slotSwitchView(0); +// mainWindow.slotSwitchView(1); +// mainWindow.slotSwitchView(2); +// mainWindow.slotSwitchView(3); +//} + +////slotViewtransparentFrame +//TEST_F(testMainWindowGUI, slotViewtransparentFrame) +//{ +// Calendarmainwindow mainWindow(1); +// mainWindow.slotViewtransparentFrame(true); +// mainWindow.slotViewtransparentFrame(false); +//} + +//bool stub_startDetached(const QString &program, const QStringList &arguments) +//{ +// Q_UNUSED(program) +// Q_UNUSED(arguments) +// return true; +//} + +////slotViewShortcut +//TEST_F(testMainWindowGUI, slotViewShortcut) +//{ +// Stub stub; +// stub.set((bool (*)(const QString &, const QStringList &))ADDR(QProcess, startDetached), +// stub_startDetached); +// Calendarmainwindow mainWindow(1); +// mainWindow.slotViewShortcut(); +//} + +//TEST_F(testMainWindowGUI, resizeEvent_01) +//{ +// QResizeEvent event(QSize(10, 10), QSize(100, 100)); +// Calendarmainwindow mainWindow(1); +// mainWindow.resizeEvent(&event); +//} + +//TEST_F(testMainWindowGUI, resizeEvent_02) +//{ +// QResizeEvent event(QSize(10, 10), QSize(1000, 1000)); +// Calendarmainwindow mainWindow(1); +// mainWindow.resize(1000, 1000); +// mainWindow.resizeEvent(&event); +//} + +//TEST_F(testMainWindowGUI, slotstackWClicked_01) +//{ +// Calendarmainwindow mainWindow(1); +// QPushButton btn; +// mainWindow.m_buttonBox->setId(&btn, 0); +// mainWindow.slotstackWClicked(&btn); +//} + +//TEST_F(testMainWindowGUI, slotWUpdateSchedule_01) +//{ +// Calendarmainwindow mainWindow(1); +// mainWindow.m_opensearchflag = true; +// mainWindow.m_searchEdit->setText("123"); +// mainWindow.slotWUpdateSchedule(); +//} + +//TEST_F(testMainWindowGUI, slotSreturnPressed_01) +//{ +// Calendarmainwindow mainWindow(1); +// mainWindow.m_opensearchflag = true; +// mainWindow.m_searchEdit->setText("123"); +// mainWindow.slotSreturnPressed(); +//} + +//TEST_F(testMainWindowGUI, slotStextChanged_01) +//{ +// Calendarmainwindow mainWindow(1); +// mainWindow.m_searchEdit->setText("123"); +// mainWindow.slotStextChanged(); +//} + +//TEST_F(testMainWindowGUI, slotStextChanged_02) +//{ +// Calendarmainwindow mainWindow(1); +// mainWindow.m_searchEdit->setText(""); +// mainWindow.slotStextChanged(); +//} + +//TEST_F(testMainWindowGUI, slotSearchSelectSchedule_02) +//{ +// Calendarmainwindow mainWindow(1); +// ScheduleDataInfo info; +// mainWindow.slotSearchSelectSchedule(info); +//} + +//TEST_F(testMainWindowGUI, mouseMoveEvent_01) +//{ +// Calendarmainwindow mainWindow(1); +// QMouseEvent event(QMouseEvent::MouseMove, QPointF(), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); +// mainWindow.mouseMoveEvent(&event); +//} + +//TEST_F(testMainWindowGUI, changeEvent_01) +//{ +// Calendarmainwindow mainWindow(1); +// QEvent event(QEvent::ActivationChange); +// mainWindow.changeEvent(&event); +//} + +//TEST_F(testMainWindowGUI, slotOpenSettingDialog_01) +//{ +// Stub stub; +// calendarDDialogExecStub(stub); +// Calendarmainwindow mainWindow(1); +// mainWindow.slotOpenSettingDialog(); +//} diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/testmainwindowgui.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/testmainwindowgui.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/testmainwindowgui.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/testmainwindowgui.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,43 +1,27 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TESTMAINWINDOWGUI_H #define TESTMAINWINDOWGUI_H -#include "calendarmainwindow.h" -#include "gtest/gtest.h" -#include "../third-party_stub/stub.h" - -#include -#include - -class testMainWindowGUI : public QObject - , public ::testing::Test -{ -public: - testMainWindowGUI(); - void SetUp() override; - void TearDown() override; - -public: - Stub stub; -}; +//#include "calendarmainwindow.h" +//#include "gtest/gtest.h" +//#include "../third-party_stub/stub.h" + +//#include +//#include + +//class testMainWindowGUI : public QObject +// , public ::testing::Test +//{ +//public: +// testMainWindowGUI(); +// void SetUp() override; +// void TearDown() override; + +//public: +// Stub stub; +//}; #endif // TESTMAINWINDOWGUI_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/testscheduledata.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/testscheduledata.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/testscheduledata.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/testscheduledata.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "testscheduledata.h" TestScheduleData::TestScheduleData() diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/testscheduledata.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/testscheduledata.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/testscheduledata.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/testscheduledata.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,38 +1,22 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TESTSCHEDULEDATA_H #define TESTSCHEDULEDATA_H -#include "src/scheduledatainfo.h" +//#include "src/scheduledatainfo.h" + +//#include -#include +//class TestScheduleData +//{ +//public: +// TestScheduleData(); +//}; -class TestScheduleData -{ -public: - TestScheduleData(); -}; - -namespace TestDataInfo { -QVector getScheduleItemDInfo(); -} +//namespace TestDataInfo { +//QVector getScheduleItemDInfo(); +//} #endif // TESTSCHEDULEDATA_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_shortcut.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_shortcut.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_shortcut.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_shortcut.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "test_shortcut.h" #include "shortcut.h" diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_shortcut.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_shortcut.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_shortcut.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_shortcut.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_SHORTCUT_H #define TEST_SHORTCUT_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_tabletconfig.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_tabletconfig.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_tabletconfig.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_tabletconfig.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "test_tabletconfig.h" test_TabletConfig::test_TabletConfig() diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_tabletconfig.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_tabletconfig.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_tabletconfig.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_tabletconfig.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_TABLETCONFIG_H #define TEST_TABLETCONFIG_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_view/test_alldayeventview.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_view/test_alldayeventview.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_view/test_alldayeventview.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_view/test_alldayeventview.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,391 +1,373 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: hejinghai -* -* Maintainer: hejinghai -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ -#include "test_alldayeventview.h" -#include "../dialog_stub.h" - -#include -#include -#include - -test_alldayeventview::test_alldayeventview() -{ -} - -void test_alldayeventview::SetUp() -{ - cAllDayEventWeekView = new CAllDayEventWeekView(); - cAllDayEventWeekView->setFixedSize(QSize(800, 300)); -} - -void test_alldayeventview::TearDown() -{ - delete cAllDayEventWeekView; - cAllDayEventWeekView = nullptr; -} - -//void CAllDayEventWeekView::setTheMe(int type) -TEST_F(test_alldayeventview, setTheMe) -{ - int type = 1; - cAllDayEventWeekView->setTheMe(); - cAllDayEventWeekView->setTheMe(type); -} - -//bool CAllDayEventWeekView::MeetCreationConditions(const QDateTime &date) -TEST_F(test_alldayeventview, MeetCreationConditions) -{ - QString begin = "2020-12-01 12:24:36"; - QDateTime date = QDateTime::fromString(begin, "yyyy-MM-dd hh:mm:ss"); - cAllDayEventWeekView->MeetCreationConditions(date); -} - -//bool CAllDayEventWeekView::IsEqualtime(const QDateTime &timeFirst, const QDateTime &timeSecond) -TEST_F(test_alldayeventview, IsEqualtime) -{ - QString begin = "2020-12-01 12:24:36"; - QDateTime begindate = QDateTime::fromString(begin, "yyyy-MM-dd hh:mm:ss"); - QString end = "2020-12-21 12:24:36"; - QDateTime enddate = QDateTime::fromString(end, "yyyy-MM-dd hh:mm:ss"); - - bool getBool = cAllDayEventWeekView->IsEqualtime(begindate, enddate); - assert(false == getBool); - - enddate = QDateTime::fromString(begin, "yyyy-MM-dd hh:mm:ss"); - getBool = cAllDayEventWeekView->IsEqualtime(begindate, enddate); - assert(true == getBool); -} - -//void CAllDayEventWeekView::setRange(int w, int h, QDate begindate, QDate enddate, int rightmagin) -TEST_F(test_alldayeventview, setRange) -{ - int w = 3; - int h = 2; - QDate begindate(2020, 12, 01); - QDate enddate(2020, 12, 21); - int rightmagin = 2; - cAllDayEventWeekView->setRange(w, h, begindate, enddate, rightmagin); -} - -QVector getTestScheduleDataInfo() -{ - ScheduleDataInfo info1; - info1.setID(1); - info1.setType(2); - info1.setAllDay(true); - info1.setRecurID(2); - info1.setTitleName("测试1"); - QString strDate = "2020-12-02 12:24:36"; - QDateTime ignoreDate = QDateTime::fromString(strDate, "yyyy-MM-dd hh:mm:ss"); - QVector ignoreDateList; - ignoreDateList.append(ignoreDate); - info1.setIgnoreTime(ignoreDateList); - QString begin = "2020-12-01 12:24:36"; - QDateTime begindate = QDateTime::fromString(begin, "yyyy-MM-dd hh:mm:ss"); - QString end = "2020-12-03 12:24:36"; - QDateTime enddate = QDateTime::fromString(end, "yyyy-MM-dd hh:mm:ss"); - info1.setBeginDateTime(begindate); - info1.setEndDateTime(enddate); - - ScheduleDataInfo info2; - info2.setID(1); - info2.setType(2); - info2.setAllDay(true); - info2.setRecurID(2); - info2.setTitleName("测试2"); - QString strDate2 = "2020-12-12 12:24:36"; - QDateTime ignoreDate2 = QDateTime::fromString(strDate2, "yyyy-MM-dd hh:mm:ss"); - QVector ignoreDateList2; - ignoreDateList2.append(ignoreDate2); - info2.setIgnoreTime(ignoreDateList2); - QString begin2 = "2020-12-11 12:24:36"; - QDateTime begindate2 = QDateTime::fromString(begin2, "yyyy-MM-dd hh:mm:ss"); - QString end2 = "2020-12-13 12:24:36"; - QDateTime enddate2 = QDateTime::fromString(end2, "yyyy-MM-dd hh:mm:ss"); - info2.setBeginDateTime(begindate2); - info2.setEndDateTime(enddate2); - - ScheduleDataInfo info3; - info3.setID(1); - info3.setType(2); - info3.setAllDay(true); - info3.setRecurID(2); - info3.setTitleName("测试3"); - QString strDate3 = "2020-12-22 12:24:36"; - QDateTime ignoreDate3 = QDateTime::fromString(strDate3, "yyyy-MM-dd hh:mm:ss"); - QVector ignoreDateList3; - ignoreDateList3.append(ignoreDate3); - info3.setIgnoreTime(ignoreDateList3); - QString begin3 = "2020-12-21 12:24:36"; - QDateTime begindate3 = QDateTime::fromString(begin3, "yyyy-MM-dd hh:mm:ss"); - QString end3 = "2020-12-23 12:24:36"; - QDateTime enddate3 = QDateTime::fromString(end3, "yyyy-MM-dd hh:mm:ss"); - info3.setBeginDateTime(begindate3); - info3.setEndDateTime(enddate3); - - QVector infoList; - infoList.append(info1); - infoList.append(info2); - infoList.append(info3); - - return infoList; -} - -//void CAllDayEventWeekView::setDayData(const QVector> &vlistData) -TEST_F(test_alldayeventview, setDayData) -{ - QVector> vlistData; - - QVector infoList1; - infoList1.append(getTestScheduleDataInfo().at(0)); - infoList1.append(getTestScheduleDataInfo().at(1)); - - QVector infoList2; - infoList2.append(getTestScheduleDataInfo().at(2)); - - vlistData.append(infoList1); - vlistData.append(infoList2); - - cAllDayEventWeekView->setDayData(vlistData); -} - - -//void CAllDayEventWeekView::setInfo(const QVector &info) -TEST_F(test_alldayeventview, setInfo) -{ - cAllDayEventWeekView->setInfo(getTestScheduleDataInfo()); -} - -//void CAllDayEventWeekView::slotDoubleEvent() -TEST_F(test_alldayeventview, slotDoubleEvent) -{ - cAllDayEventWeekView->slotDoubleEvent(); -} - -//void CAllDayEventWeekView::createItemWidget(int index, bool average) -TEST_F(test_alldayeventview, createItemWidget) -{ - QVector> vlistData; - - QVector infoList1; - infoList1.append(getTestScheduleDataInfo().at(0)); - infoList1.append(getTestScheduleDataInfo().at(1)); - - QVector infoList2; - infoList2.append(getTestScheduleDataInfo().at(2)); - - vlistData.append(infoList1); - vlistData.append(infoList2); - - cAllDayEventWeekView->setDayData(vlistData); - - int w = 1000; - int h = 900; - QDate begindate(2020, 12, 01); - QDate enddate(2020, 12, 21); - int rightmagin = 2; - cAllDayEventWeekView->setRange(w, h, begindate, enddate, rightmagin); - - int index = 0; - bool average = true; - cAllDayEventWeekView->createItemWidget(index, average); - cAllDayEventWeekView->updateHeight(); - //setSelectSearchSchedule - cAllDayEventWeekView->setSelectSearchSchedule(getTestScheduleDataInfo().at(1)); -} - -//void CAllDayEventWeekView::updateItemHeightByFontSize() -TEST_F(test_alldayeventview, updateItemHeightByFontSize) -{ - cAllDayEventWeekView->updateItemHeightByFontSize(); -} - - -//void CAllDayEventWeekView::upDateInfoShow(const DragStatus &status, const ScheduleDataInfo &info) -TEST_F(test_alldayeventview, upDateInfoShow) -{ - cAllDayEventWeekView->setInfo(getTestScheduleDataInfo()); - cAllDayEventWeekView->upDateInfoShow(DragInfoGraphicsView::DragStatus::ChangeEnd, getTestScheduleDataInfo().at(1)); - cAllDayEventWeekView->upDateInfoShow(DragInfoGraphicsView::DragStatus::ChangeBegin, getTestScheduleDataInfo().at(1)); - cAllDayEventWeekView->upDateInfoShow(DragInfoGraphicsView::DragStatus::ChangeWhole, getTestScheduleDataInfo().at(1)); - cAllDayEventWeekView->upDateInfoShow(DragInfoGraphicsView::DragStatus::IsCreate, getTestScheduleDataInfo().at(1)); -} - +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. // -TEST_F(test_alldayeventview, getPixmap) -{ - cAllDayEventWeekView->setFixedSize(500, 800); - QPixmap pixmap(cAllDayEventWeekView->size()); - pixmap = cAllDayEventWeekView->grab(); -} +// SPDX-License-Identifier: LGPL-3.0-or-later -// -TEST_F(test_alldayeventview, eventTest) -{ - QTest::keyEvent(QTest::Press, cAllDayEventWeekView, Qt::Key::Key_Enter); - cAllDayEventWeekView->setFixedSize(500, 100); - QTest::mouseDClick(cAllDayEventWeekView, Qt::LeftButton, Qt::NoModifier, QPoint(200, 50)); -} - -//slotCreate -TEST_F(test_alldayeventview, slotCreate) -{ - calendarDDialogExecReturn = 1; - Stub stub; - calendarDDialogExecStub(stub); - cAllDayEventWeekView->slotCreate(QDateTime::currentDateTime()); -} - -//getDragScheduleInfoBeginTime -TEST_F(test_alldayeventview, getDragScheduleInfoBeginTime) -{ - cAllDayEventWeekView->getDragScheduleInfoBeginTime(QDateTime::currentDateTime()); -} - -//changeEvent -TEST_F(test_alldayeventview, changeEvent) -{ - QEvent event(QEvent::FontChange); - QApplication::sendEvent(cAllDayEventWeekView, &event); -} - -//mousePressEvent -TEST_F(test_alldayeventview, mousePressEvent) -{ - QMouseEvent event(QEvent::MouseButtonPress, QPointF(32, 13), QPointF(646, 438), QPointF(646, 438), - Qt::LeftButton, Qt::LeftButton, Qt::NoModifier, Qt::MouseEventSynthesizedByQt); - QApplication::sendEvent(cAllDayEventWeekView->viewport(), &event); -} - -TEST_F(test_alldayeventview, JudgeIsCreate) -{ - QPointF point(32, 13); - cAllDayEventWeekView->JudgeIsCreate(point); -} - -QAction *stub_exec(const QPoint &pos, QAction *at = nullptr) -{ - Q_UNUSED(pos) - Q_UNUSED(at) - return nullptr; -} - -//RightClickToCreate -TEST_F(test_alldayeventview, RightClickToCreate) -{ - Stub stub; - stub.set((QAction * (QMenu::*)(const QPoint &, QAction *)) ADDR(QMenu, exec), stub_exec); - cAllDayEventWeekView->RightClickToCreate(nullptr, QPoint(30, 50)); -} - -//MoveInfoProcess -TEST_F(test_alldayeventview, MoveInfoProcess) -{ - ScheduleDataInfo info; - QDateTime currentTime = QDateTime::currentDateTime(); - info.setBeginDateTime(currentTime); - info.setEndDateTime(currentTime.addDays(1)); - info.setAllDay(true); - cAllDayEventWeekView->MoveInfoProcess(info, QPointF(0, 0)); - info.setAllDay(false); - cAllDayEventWeekView->MoveInfoProcess(info, QPointF(0, 0)); -} - -//getDragScheduleInfoEndTime -TEST_F(test_alldayeventview, getDragScheduleInfoEndTime) -{ - cAllDayEventWeekView->getDragScheduleInfoEndTime(QDateTime::currentDateTime()); -} - -//slotUpdateScene -TEST_F(test_alldayeventview, slotUpdateScene) -{ - cAllDayEventWeekView->slotUpdateScene(); -} - -TEST_F(test_alldayeventview, updateInfo) -{ - cAllDayEventWeekView->updateInfo(); - cAllDayEventWeekView->m_DragStatus = DragInfoGraphicsView::IsCreate; - cAllDayEventWeekView->updateInfo(); -} - -//mouseDoubleClickEvent -TEST_F(test_alldayeventview, mouseDoubleClickEvent) -{ - Stub stub; - calendarDDialogExecStub(stub); - QTest::mouseDClick(cAllDayEventWeekView->viewport(), Qt::LeftButton); -} +//#include "test_alldayeventview.h" +//#include "../dialog_stub.h" -// -TEST_F(test_alldayeventview, setSceneRect) -{ - cAllDayEventWeekView->setSceneRect(20, 20, 1000, 1500); - cAllDayEventWeekView->updateBackgroundShowItem(); -} - -//slotPosOnView -TEST_F(test_alldayeventview, slotPosOnView) -{ - cAllDayEventWeekView->slotPosOnView(1); -} - -//mouseReleaseEvent -TEST_F(test_alldayeventview, mouseReleaseEvent) -{ - QMouseEvent event(QEvent::MouseButtonRelease, QPointF(32, 13), QPointF(646, 438), QPointF(646, 438), - Qt::RightButton, Qt::RightButton, Qt::NoModifier, Qt::MouseEventSynthesizedByQt); - QApplication::sendEvent(cAllDayEventWeekView->viewport(), &event); -} - -//mouseReleaseEvent -TEST_F(test_alldayeventview, mouseReleaseEvent1) -{ - cAllDayEventWeekView->m_TouchBeginTime = QDateTime::currentDateTime().toMSecsSinceEpoch() - 10; - QMouseEvent event(QEvent::MouseButtonRelease, QPointF(32, 13), QPointF(646, 438), QPointF(646, 438), - Qt::LeftButton, Qt::LeftButton, Qt::NoModifier, Qt::MouseEventSynthesizedByQt); - QApplication::sendEvent(cAllDayEventWeekView->viewport(), &event); -} - -//mouseMoveEvent -TEST_F(test_alldayeventview, mouseMoveEvent) -{ - cAllDayEventWeekView->m_touchState = DragInfoGraphicsView::TS_PRESS; - QTest::mouseMove(cAllDayEventWeekView->viewport()); -} - -//wheelEvent -TEST_F(test_alldayeventview, wheelEvent) -{ - QEvent event(QEvent::Wheel); - QApplication::sendEvent(cAllDayEventWeekView->viewport(), &event); -} - -//contextMenuEvent -TEST_F(test_alldayeventview, contextMenuEvent) -{ - // QEvent event(QEvent::ContextMenu); - QContextMenuEvent event(QContextMenuEvent::Mouse, QPoint(20, 20), QPoint(120, 120), Qt::NoModifier); - Stub stub; - stub.set((QAction * (QMenu::*)(const QPoint &, QAction *)) ADDR(QMenu, exec), stub_exec); - calendarDDialogExecStub(stub); - QApplication::sendEvent(cAllDayEventWeekView->viewport(), &event); -} +//#include +//#include +//#include + +//test_alldayeventview::test_alldayeventview() +//{ +//} + +//void test_alldayeventview::SetUp() +//{ +// cAllDayEventWeekView = new CAllDayEventWeekView(); +// cAllDayEventWeekView->setFixedSize(QSize(800, 300)); +//} + +//void test_alldayeventview::TearDown() +//{ +// delete cAllDayEventWeekView; +// cAllDayEventWeekView = nullptr; +//} + +////void CAllDayEventWeekView::setTheMe(int type) +//TEST_F(test_alldayeventview, setTheMe) +//{ +// int type = 1; +// cAllDayEventWeekView->setTheMe(); +// cAllDayEventWeekView->setTheMe(type); +//} + +////bool CAllDayEventWeekView::MeetCreationConditions(const QDateTime &date) +//TEST_F(test_alldayeventview, MeetCreationConditions) +//{ +// QString begin = "2020-12-01 12:24:36"; +// QDateTime date = QDateTime::fromString(begin, "yyyy-MM-dd hh:mm:ss"); +// cAllDayEventWeekView->MeetCreationConditions(date); +//} + +////bool CAllDayEventWeekView::IsEqualtime(const QDateTime &timeFirst, const QDateTime &timeSecond) +//TEST_F(test_alldayeventview, IsEqualtime) +//{ +// QString begin = "2020-12-01 12:24:36"; +// QDateTime begindate = QDateTime::fromString(begin, "yyyy-MM-dd hh:mm:ss"); +// QString end = "2020-12-21 12:24:36"; +// QDateTime enddate = QDateTime::fromString(end, "yyyy-MM-dd hh:mm:ss"); + +// assert(false == cAllDayEventWeekView->IsEqualtime(begindate, enddate)); + +// enddate = QDateTime::fromString(begin, "yyyy-MM-dd hh:mm:ss"); +// assert(true == cAllDayEventWeekView->IsEqualtime(begindate, enddate)); +//} + +////void CAllDayEventWeekView::setRange(int w, int h, QDate begindate, QDate enddate, int rightmagin) +//TEST_F(test_alldayeventview, setRange) +//{ +// int w = 3; +// int h = 2; +// QDate begindate(2020, 12, 01); +// QDate enddate(2020, 12, 21); +// int rightmagin = 2; +// cAllDayEventWeekView->setRange(w, h, begindate, enddate, rightmagin); +//} + +//QVector getTestScheduleDataInfo() +//{ +// ScheduleDataInfo info1; +// info1.setID(1); +// info1.setType(2); +// info1.setAllDay(true); +// info1.setRecurID(2); +// info1.setTitleName("测试1"); +// QString strDate = "2020-12-02 12:24:36"; +// QDateTime ignoreDate = QDateTime::fromString(strDate, "yyyy-MM-dd hh:mm:ss"); +// QVector ignoreDateList; +// ignoreDateList.append(ignoreDate); +// info1.setIgnoreTime(ignoreDateList); +// QString begin = "2020-12-01 12:24:36"; +// QDateTime begindate = QDateTime::fromString(begin, "yyyy-MM-dd hh:mm:ss"); +// QString end = "2020-12-03 12:24:36"; +// QDateTime enddate = QDateTime::fromString(end, "yyyy-MM-dd hh:mm:ss"); +// info1.setBeginDateTime(begindate); +// info1.setEndDateTime(enddate); + +// ScheduleDataInfo info2; +// info2.setID(1); +// info2.setType(2); +// info2.setAllDay(true); +// info2.setRecurID(2); +// info2.setTitleName("测试2"); +// QString strDate2 = "2020-12-12 12:24:36"; +// QDateTime ignoreDate2 = QDateTime::fromString(strDate2, "yyyy-MM-dd hh:mm:ss"); +// QVector ignoreDateList2; +// ignoreDateList2.append(ignoreDate2); +// info2.setIgnoreTime(ignoreDateList2); +// QString begin2 = "2020-12-11 12:24:36"; +// QDateTime begindate2 = QDateTime::fromString(begin2, "yyyy-MM-dd hh:mm:ss"); +// QString end2 = "2020-12-13 12:24:36"; +// QDateTime enddate2 = QDateTime::fromString(end2, "yyyy-MM-dd hh:mm:ss"); +// info2.setBeginDateTime(begindate2); +// info2.setEndDateTime(enddate2); + +// ScheduleDataInfo info3; +// info3.setID(1); +// info3.setType(2); +// info3.setAllDay(true); +// info3.setRecurID(2); +// info3.setTitleName("测试3"); +// QString strDate3 = "2020-12-22 12:24:36"; +// QDateTime ignoreDate3 = QDateTime::fromString(strDate3, "yyyy-MM-dd hh:mm:ss"); +// QVector ignoreDateList3; +// ignoreDateList3.append(ignoreDate3); +// info3.setIgnoreTime(ignoreDateList3); +// QString begin3 = "2020-12-21 12:24:36"; +// QDateTime begindate3 = QDateTime::fromString(begin3, "yyyy-MM-dd hh:mm:ss"); +// QString end3 = "2020-12-23 12:24:36"; +// QDateTime enddate3 = QDateTime::fromString(end3, "yyyy-MM-dd hh:mm:ss"); +// info3.setBeginDateTime(begindate3); +// info3.setEndDateTime(enddate3); + +// QVector infoList; +// infoList.append(info1); +// infoList.append(info2); +// infoList.append(info3); + +// return infoList; +//} + +////void CAllDayEventWeekView::setDayData(const QVector> &vlistData) +//TEST_F(test_alldayeventview, setDayData) +//{ +// QVector> vlistData; + +// QVector infoList1; +// infoList1.append(getTestScheduleDataInfo().at(0)); +// infoList1.append(getTestScheduleDataInfo().at(1)); + +// QVector infoList2; +// infoList2.append(getTestScheduleDataInfo().at(2)); + +// vlistData.append(infoList1); +// vlistData.append(infoList2); + +// cAllDayEventWeekView->setDayData(vlistData); +//} + + +////void CAllDayEventWeekView::setInfo(const QVector &info) +//TEST_F(test_alldayeventview, setInfo) +//{ +// cAllDayEventWeekView->setInfo(getTestScheduleDataInfo()); +//} + +////void CAllDayEventWeekView::slotDoubleEvent() +//TEST_F(test_alldayeventview, slotDoubleEvent) +//{ +// cAllDayEventWeekView->slotDoubleEvent(); +//} + +////void CAllDayEventWeekView::createItemWidget(int index, bool average) +//TEST_F(test_alldayeventview, createItemWidget) +//{ +// QVector> vlistData; + +// QVector infoList1; +// infoList1.append(getTestScheduleDataInfo().at(0)); +// infoList1.append(getTestScheduleDataInfo().at(1)); + +// QVector infoList2; +// infoList2.append(getTestScheduleDataInfo().at(2)); + +// vlistData.append(infoList1); +// vlistData.append(infoList2); + +// cAllDayEventWeekView->setDayData(vlistData); + +// int w = 1000; +// int h = 900; +// QDate begindate(2020, 12, 01); +// QDate enddate(2020, 12, 21); +// int rightmagin = 2; +// cAllDayEventWeekView->setRange(w, h, begindate, enddate, rightmagin); + +// int index = 0; +// bool average = true; +// cAllDayEventWeekView->createItemWidget(index, average); +// cAllDayEventWeekView->updateHeight(); +// //setSelectSearchSchedule +// cAllDayEventWeekView->setSelectSearchSchedule(getTestScheduleDataInfo().at(1)); +//} + +////void CAllDayEventWeekView::updateItemHeightByFontSize() +//TEST_F(test_alldayeventview, updateItemHeightByFontSize) +//{ +// cAllDayEventWeekView->updateItemHeightByFontSize(); +//} + + +////void CAllDayEventWeekView::upDateInfoShow(const DragStatus &status, const ScheduleDataInfo &info) +//TEST_F(test_alldayeventview, upDateInfoShow) +//{ +// cAllDayEventWeekView->setInfo(getTestScheduleDataInfo()); +// cAllDayEventWeekView->upDateInfoShow(DragInfoGraphicsView::DragStatus::ChangeEnd, getTestScheduleDataInfo().at(1)); +// cAllDayEventWeekView->upDateInfoShow(DragInfoGraphicsView::DragStatus::ChangeBegin, getTestScheduleDataInfo().at(1)); +// cAllDayEventWeekView->upDateInfoShow(DragInfoGraphicsView::DragStatus::ChangeWhole, getTestScheduleDataInfo().at(1)); +// cAllDayEventWeekView->upDateInfoShow(DragInfoGraphicsView::DragStatus::IsCreate, getTestScheduleDataInfo().at(1)); +//} + +//// +//TEST_F(test_alldayeventview, getPixmap) +//{ +// cAllDayEventWeekView->setFixedSize(500, 800); +// QPixmap pixmap(cAllDayEventWeekView->size()); +// pixmap = cAllDayEventWeekView->grab(); +//} + +//// +//TEST_F(test_alldayeventview, eventTest) +//{ +// QTest::keyEvent(QTest::Press, cAllDayEventWeekView, Qt::Key::Key_Enter); +// cAllDayEventWeekView->setFixedSize(500, 100); +// QTest::mouseDClick(cAllDayEventWeekView, Qt::LeftButton, Qt::NoModifier, QPoint(200, 50)); +//} + +////slotCreate +//TEST_F(test_alldayeventview, slotCreate) +//{ +// calendarDDialogExecReturn = 1; +// Stub stub; +// calendarDDialogExecStub(stub); +// cAllDayEventWeekView->slotCreate(QDateTime::currentDateTime()); +//} + +////getDragScheduleInfoBeginTime +//TEST_F(test_alldayeventview, getDragScheduleInfoBeginTime) +//{ +// cAllDayEventWeekView->getDragScheduleInfoBeginTime(QDateTime::currentDateTime()); +//} + +////changeEvent +//TEST_F(test_alldayeventview, changeEvent) +//{ +// QEvent event(QEvent::FontChange); +// QApplication::sendEvent(cAllDayEventWeekView, &event); +//} + +////mousePressEvent +//TEST_F(test_alldayeventview, mousePressEvent) +//{ +// QMouseEvent event(QEvent::MouseButtonPress, QPointF(32, 13), QPointF(646, 438), QPointF(646, 438), +// Qt::LeftButton, Qt::LeftButton, Qt::NoModifier, Qt::MouseEventSynthesizedByQt); +// QApplication::sendEvent(cAllDayEventWeekView->viewport(), &event); +//} + +//TEST_F(test_alldayeventview, JudgeIsCreate) +//{ +// QPointF point(32, 13); +// cAllDayEventWeekView->JudgeIsCreate(point); +//} + +//QAction *stub_exec(const QPoint &pos, QAction *at = nullptr) +//{ +// Q_UNUSED(pos) +// Q_UNUSED(at) +// return nullptr; +//} + +////RightClickToCreate +//TEST_F(test_alldayeventview, RightClickToCreate) +//{ +// Stub stub; +// stub.set((QAction * (QMenu::*)(const QPoint &, QAction *)) ADDR(QMenu, exec), stub_exec); +// cAllDayEventWeekView->RightClickToCreate(nullptr, QPoint(30, 50)); +//} + +////MoveInfoProcess +//TEST_F(test_alldayeventview, MoveInfoProcess) +//{ +// ScheduleDataInfo info; +// QDateTime currentTime = QDateTime::currentDateTime(); +// info.setBeginDateTime(currentTime); +// info.setEndDateTime(currentTime.addDays(1)); +// info.setAllDay(true); +// cAllDayEventWeekView->MoveInfoProcess(info, QPointF(0, 0)); +// info.setAllDay(false); +// cAllDayEventWeekView->MoveInfoProcess(info, QPointF(0, 0)); +//} + +////getDragScheduleInfoEndTime +//TEST_F(test_alldayeventview, getDragScheduleInfoEndTime) +//{ +// cAllDayEventWeekView->getDragScheduleInfoEndTime(QDateTime::currentDateTime()); +//} + +////slotUpdateScene +//TEST_F(test_alldayeventview, slotUpdateScene) +//{ +// cAllDayEventWeekView->slotUpdateScene(); +//} + +//TEST_F(test_alldayeventview, updateInfo) +//{ +// cAllDayEventWeekView->updateInfo(); +// cAllDayEventWeekView->m_DragStatus = DragInfoGraphicsView::IsCreate; +// cAllDayEventWeekView->updateInfo(); +//} + +////mouseDoubleClickEvent +//TEST_F(test_alldayeventview, mouseDoubleClickEvent) +//{ +// Stub stub; +// calendarDDialogExecStub(stub); +// QTest::mouseDClick(cAllDayEventWeekView->viewport(), Qt::LeftButton); +//} + +//// +//TEST_F(test_alldayeventview, setSceneRect) +//{ +// cAllDayEventWeekView->setSceneRect(20, 20, 1000, 1500); +// cAllDayEventWeekView->updateBackgroundShowItem(); +//} + +////slotPosOnView +//TEST_F(test_alldayeventview, slotPosOnView) +//{ +// cAllDayEventWeekView->slotPosOnView(1); +//} + +////mouseReleaseEvent +//TEST_F(test_alldayeventview, mouseReleaseEvent) +//{ +// QMouseEvent event(QEvent::MouseButtonRelease, QPointF(32, 13), QPointF(646, 438), QPointF(646, 438), +// Qt::RightButton, Qt::RightButton, Qt::NoModifier, Qt::MouseEventSynthesizedByQt); +// QApplication::sendEvent(cAllDayEventWeekView->viewport(), &event); +//} + +////mouseReleaseEvent +//TEST_F(test_alldayeventview, mouseReleaseEvent1) +//{ +// cAllDayEventWeekView->m_TouchBeginTime = QDateTime::currentDateTime().toMSecsSinceEpoch() - 10; +// QMouseEvent event(QEvent::MouseButtonRelease, QPointF(32, 13), QPointF(646, 438), QPointF(646, 438), +// Qt::LeftButton, Qt::LeftButton, Qt::NoModifier, Qt::MouseEventSynthesizedByQt); +// QApplication::sendEvent(cAllDayEventWeekView->viewport(), &event); +//} + +////mouseMoveEvent +//TEST_F(test_alldayeventview, mouseMoveEvent) +//{ +// cAllDayEventWeekView->m_touchState = DragInfoGraphicsView::TS_PRESS; +// QTest::mouseMove(cAllDayEventWeekView->viewport()); +//} + +////wheelEvent +//TEST_F(test_alldayeventview, wheelEvent) +//{ +// QEvent event(QEvent::Wheel); +// QApplication::sendEvent(cAllDayEventWeekView->viewport(), &event); +//} + +////contextMenuEvent +//TEST_F(test_alldayeventview, contextMenuEvent) +//{ +// // QEvent event(QEvent::ContextMenu); +// QContextMenuEvent event(QContextMenuEvent::Mouse, QPoint(20, 20), QPoint(120, 120), Qt::NoModifier); +// Stub stub; +// stub.set((QAction * (QMenu::*)(const QPoint &, QAction *)) ADDR(QMenu, exec), stub_exec); +// calendarDDialogExecStub(stub); +// QApplication::sendEvent(cAllDayEventWeekView->viewport(), &event); +//} diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_view/test_alldayeventview.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_view/test_alldayeventview.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_view/test_alldayeventview.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_view/test_alldayeventview.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,40 +1,24 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: hejinghai -* -* Maintainer: hejinghai -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_ALLDAYEVENTVIEW_H #define TEST_ALLDAYEVENTVIEW_H -#include "alldayeventview.h" -#include "gtest/gtest.h" -#include - -class test_alldayeventview : public QObject, public::testing::Test -{ -public: - test_alldayeventview(); - - void SetUp() override; - void TearDown() override; - -protected: - CAllDayEventWeekView *cAllDayEventWeekView = nullptr; -}; +//#include "alldayeventview.h" +//#include "gtest/gtest.h" +//#include + +//class test_alldayeventview : public QObject, public::testing::Test +//{ +//public: +// test_alldayeventview(); + +// void SetUp() override; +// void TearDown() override; + +//protected: +// CAllDayEventWeekView *cAllDayEventWeekView = nullptr; +//}; #endif // TEST_ALLDAYEVENTVIEW_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_view/test_calldayscheduleitem.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_view/test_calldayscheduleitem.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_view/test_calldayscheduleitem.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_view/test_calldayscheduleitem.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,65 +1,49 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "test_calldayscheduleitem.h" #include "../testscheduledata.h" #include -test_CAlldayscheduleitem::test_CAlldayscheduleitem() -{ -} - -void test_CAlldayscheduleitem::SetUp() -{ - m_rectF.setRect(0, 0, 200, 50); - m_allItem = new CAllDayScheduleItem(m_rectF); -} - -void test_CAlldayscheduleitem::TearDown() -{ - delete m_allItem; - m_allItem = nullptr; -} - -//paintBackground -TEST_F(test_CAlldayscheduleitem, paintBackground) -{ - m_allItem->setData(TestDataInfo::getScheduleItemDInfo().first()); - QPixmap pixmap(m_rectF.toRect().size()); - pixmap.fill(Qt::transparent); - QPainter painter(&pixmap); - m_allItem->setPressSchedule(TestDataInfo::getScheduleItemDInfo().first()); - m_allItem->m_vSelectflag = true; - m_allItem->paintBackground(&painter, pixmap.rect(), true); - m_allItem->m_vHoverflag = true; - m_allItem->m_vSelectflag = false; - m_allItem->paintBackground(&painter, pixmap.rect(), true); -} - -//hasSelectSchedule -TEST_F(test_CAlldayscheduleitem, hasSelectSchedule) -{ - m_allItem->setData(TestDataInfo::getScheduleItemDInfo().first()); - - bool hasSelectInfo = m_allItem->hasSelectSchedule(TestDataInfo::getScheduleItemDInfo().first()); - ASSERT_TRUE(hasSelectInfo); -} +//test_CAlldayscheduleitem::test_CAlldayscheduleitem() +//{ +//} + +//void test_CAlldayscheduleitem::SetUp() +//{ +// m_rectF.setRect(0, 0, 200, 50); +// m_allItem = new CAllDayScheduleItem(m_rectF); +//} + +//void test_CAlldayscheduleitem::TearDown() +//{ +// delete m_allItem; +// m_allItem = nullptr; +//} + +////paintBackground +//TEST_F(test_CAlldayscheduleitem, paintBackground) +//{ +// m_allItem->setData(TestDataInfo::getScheduleItemDInfo().first()); +// QPixmap pixmap(m_rectF.toRect().size()); +// pixmap.fill(Qt::transparent); +// QPainter painter(&pixmap); +// m_allItem->setPressSchedule(TestDataInfo::getScheduleItemDInfo().first()); +// m_allItem->m_vSelectflag = true; +// m_allItem->paintBackground(&painter, pixmap.rect(), true); +// m_allItem->m_vHoverflag = true; +// m_allItem->m_vSelectflag = false; +// m_allItem->paintBackground(&painter, pixmap.rect(), true); +//} + +////hasSelectSchedule +//TEST_F(test_CAlldayscheduleitem, hasSelectSchedule) +//{ +// m_allItem->setData(TestDataInfo::getScheduleItemDInfo().first()); + +// bool hasSelectInfo = m_allItem->hasSelectSchedule(TestDataInfo::getScheduleItemDInfo().first()); +// ASSERT_TRUE(hasSelectInfo); +//} diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_view/test_calldayscheduleitem.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_view/test_calldayscheduleitem.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_view/test_calldayscheduleitem.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_view/test_calldayscheduleitem.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,45 +1,29 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_CALLDAYSCHEDULEITEM_H #define TEST_CALLDAYSCHEDULEITEM_H -#include "gtest/gtest.h" -#include "graphicsItem/calldayscheduleitem.h" +//#include "gtest/gtest.h" +//#include "graphicsItem/calldayscheduleitem.h" + +//#include -#include +//class test_CAlldayscheduleitem : public QObject +// , public ::testing::Test +//{ +// Q_OBJECT +//public: +// test_CAlldayscheduleitem(); +// void SetUp() override; +// void TearDown() override; +//signals: -class test_CAlldayscheduleitem : public QObject - , public ::testing::Test -{ - Q_OBJECT -public: - test_CAlldayscheduleitem(); - void SetUp() override; - void TearDown() override; -signals: - -public slots: -public: - CAllDayScheduleItem *m_allItem; - QRectF m_rectF; -}; +//public slots: +//public: +// CAllDayScheduleItem *m_allItem; +// QRectF m_rectF; +//}; #endif // TEST_CALLDAYSCHEDULEITEM_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_view/test_cweekdaybackgrounditem.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_view/test_cweekdaybackgrounditem.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_view/test_cweekdaybackgrounditem.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_view/test_cweekdaybackgrounditem.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,68 +1,52 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ -#include "test_cweekdaybackgrounditem.h" - -test_CWeekDayBackgroundItem::test_CWeekDayBackgroundItem() -{ -} - -void test_CWeekDayBackgroundItem::SetUp() -{ - m_weekItem = new CWeekDayBackgroundItem(); -} - -void test_CWeekDayBackgroundItem::TearDown() -{ - delete m_weekItem; - m_weekItem = nullptr; -} - -//showFocus -TEST_F(test_CWeekDayBackgroundItem, showFocus) -{ - m_weekItem->setShowFocus(true); - ASSERT_TRUE(m_weekItem->showFocus()); - m_weekItem->setShowFocus(false); - ASSERT_FALSE(m_weekItem->showFocus()); -} - -//setItemFocus -TEST_F(test_CWeekDayBackgroundItem, setItemFocus) -{ - m_weekItem->setItemFocus(true); -} - -//hasNextSubItem -TEST_F(test_CWeekDayBackgroundItem, hasNextSubItem) -{ - bool hasNextSub; - hasNextSub = m_weekItem->hasNextSubItem(); - ASSERT_FALSE(hasNextSub); -} - -//drawDividingLine -TEST_F(test_CWeekDayBackgroundItem, drawDividingLine) -{ - m_weekItem->setDrawDividingLine(false); - ASSERT_FALSE(m_weekItem->drawDividingLine()); - m_weekItem->setDrawDividingLine(true); - ASSERT_TRUE(m_weekItem->drawDividingLine()); -} +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +//#include "test_cweekdaybackgrounditem.h" + +//test_CWeekDayBackgroundItem::test_CWeekDayBackgroundItem() +//{ +//} + +//void test_CWeekDayBackgroundItem::SetUp() +//{ +// m_weekItem = new CWeekDayBackgroundItem(); +//} + +//void test_CWeekDayBackgroundItem::TearDown() +//{ +// delete m_weekItem; +// m_weekItem = nullptr; +//} + +////showFocus +//TEST_F(test_CWeekDayBackgroundItem, showFocus) +//{ +// m_weekItem->setShowFocus(true); +// ASSERT_TRUE(m_weekItem->showFocus()); +// m_weekItem->setShowFocus(false); +// ASSERT_FALSE(m_weekItem->showFocus()); +//} + +////setItemFocus +//TEST_F(test_CWeekDayBackgroundItem, setItemFocus) +//{ +// m_weekItem->setItemFocus(true); +//} + +////hasNextSubItem +//TEST_F(test_CWeekDayBackgroundItem, hasNextSubItem) +//{ +// bool hasNextSub; +// hasNextSub = m_weekItem->hasNextSubItem(); +// ASSERT_FALSE(hasNextSub); +//} + +////drawDividingLine +//TEST_F(test_CWeekDayBackgroundItem, drawDividingLine) +//{ +// m_weekItem->setDrawDividingLine(false); +// ASSERT_FALSE(m_weekItem->drawDividingLine()); +// m_weekItem->setDrawDividingLine(true); +// ASSERT_TRUE(m_weekItem->drawDividingLine()); +//} diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_view/test_cweekdaybackgrounditem.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_view/test_cweekdaybackgrounditem.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_view/test_cweekdaybackgrounditem.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_view/test_cweekdaybackgrounditem.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,49 +1,33 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_CWEEKDAYBACKGROUNDITEM_H #define TEST_CWEEKDAYBACKGROUNDITEM_H -#include "graphicsItem/cweekdaybackgrounditem.h" -#include "gtest/gtest.h" +//#include "graphicsItem/cweekdaybackgrounditem.h" +//#include "gtest/gtest.h" -#include +//#include -class test_CWeekDayBackgroundItem : public QObject - , public testing::Test -{ - Q_OBJECT -public: - test_CWeekDayBackgroundItem(); - // Sets up the test fixture. - void SetUp() override; - - // Tears down the test fixture. - void TearDown() override; - -signals: - -public slots: - -public: - CWeekDayBackgroundItem *m_weekItem; -}; +//class test_CWeekDayBackgroundItem : public QObject +// , public testing::Test +//{ +// Q_OBJECT +//public: +// test_CWeekDayBackgroundItem(); +// // Sets up the test fixture. +// void SetUp() override; + +// // Tears down the test fixture. +// void TearDown() override; + +//signals: + +//public slots: + +//public: +// CWeekDayBackgroundItem *m_weekItem; +//}; #endif // TEST_CWEEKDAYBACKGROUNDITEM_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_view/test_graphicsItem/test_cmonthdayitem.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_view/test_graphicsItem/test_cmonthdayitem.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_view/test_graphicsItem/test_cmonthdayitem.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_view/test_graphicsItem/test_cmonthdayitem.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,48 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "test_cmonthdayitem.h" +#include +#include + +//test_cmonthdayitem::test_cmonthdayitem() +//{ + +//} + +//TEST_F(test_cmonthdayitem, paint_01) +//{ +// mItem->m_isFocus = true; +// QPainter painter; +// QStyleOptionGraphicsItem item; +// mItem->paint(&painter, &item); +//} + +//TEST_F(test_cmonthdayitem, paint_02) +//{ +// CMonthDayItem::m_LunarVisible = true; +// QPainter painter; +// QStyleOptionGraphicsItem item; +// mItem->paint(&painter, &item); +//} + +//TEST_F(test_cmonthdayitem, paint_03) +//{ +// CMonthDayItem::m_LunarVisible = true; +// QPainter painter; +// QStyleOptionGraphicsItem item; +// mItem->setStatus(CMonthDayItem::H_REST); +// EXPECT_EQ(mItem->m_DayStatus, CMonthDayItem::H_REST); +// mItem->paint(&painter, &item); +//} + +//TEST_F(test_cmonthdayitem, paint_04) +//{ +// CMonthDayItem::m_LunarVisible = true; +// QPainter painter; +// QStyleOptionGraphicsItem item; +// mItem->setStatus(CMonthDayItem::H_WORK); +// EXPECT_EQ(mItem->m_DayStatus, CMonthDayItem::H_WORK); +// mItem->paint(&painter, &item); +//} diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_view/test_graphicsItem/test_cmonthdayitem.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_view/test_graphicsItem/test_cmonthdayitem.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_view/test_graphicsItem/test_cmonthdayitem.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_view/test_graphicsItem/test_cmonthdayitem.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,31 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef TEST_CMONTHDAYITEM_H +#define TEST_CMONTHDAYITEM_H + +//#include "graphicsItem/cmonthdayitem.h" +//#include +//#include + +//class test_cmonthdayitem: public::testing::Test +//{ +//public: +// test_cmonthdayitem(); + +// virtual void SetUp() +// { +// mItem = new CMonthDayItem(); +// } + +// virtual void TearDown() +// { +// delete mItem; +// mItem = nullptr; +// } +//protected: +// CMonthDayItem *mItem = nullptr; +//}; + +#endif // TEST_CMONTHDAYITEM_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_view/test_graphicsItem/test_cmonthschedulenumitem.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_view/test_graphicsItem/test_cmonthschedulenumitem.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_view/test_graphicsItem/test_cmonthschedulenumitem.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_view/test_graphicsItem/test_cmonthschedulenumitem.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,50 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "test_cmonthschedulenumitem.h" +#include +#include + +//test_cmonthschedulenumItem::test_cmonthschedulenumItem() +//{ + +//} + +//TEST_F(test_cmonthschedulenumItem, setColor_01) +//{ +// QColor color1("#000000"); +// QColor color2("#111111"); +// mItem->setColor(color1, color2); +// EXPECT_EQ(mItem->m_color1, color1); +// EXPECT_EQ(mItem->m_color2, color2); +//} + +//TEST_F(test_cmonthschedulenumItem, setText_01) +//{ +// QColor color("#000000"); +// mItem->setText(color, QFont()); +// EXPECT_EQ(mItem->m_textcolor, color); +//} + +//TEST_F(test_cmonthschedulenumItem, setSizeType_01) +//{ +// QColor color("#000000"); +// mItem->setSizeType(DFontSizeManager::T5); +// EXPECT_EQ(mItem->m_SizeType, DFontSizeManager::T5); +//} + +//TEST_F(test_cmonthschedulenumItem, setData_01) +//{ +// QColor color("#000000"); +// mItem->setData(4); +// EXPECT_EQ(mItem->m_num, 4); +//} + +//TEST_F(test_cmonthschedulenumItem, paint_01) +//{ +// mItem->m_isFocus = true; +// QPainter painter; +// QStyleOptionGraphicsItem item; +// mItem->paint(&painter, &item); +//} diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_view/test_graphicsItem/test_cmonthschedulenumitem.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_view/test_graphicsItem/test_cmonthschedulenumitem.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_view/test_graphicsItem/test_cmonthschedulenumitem.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_view/test_graphicsItem/test_cmonthschedulenumitem.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,31 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef TEST_CMONTHSCHEDULENUMITEM_H +#define TEST_CMONTHSCHEDULENUMITEM_H + +//#include "graphicsItem/cmonthschedulenumitem.h" +//#include +//#include + +//class test_cmonthschedulenumItem: public::testing::Test +//{ +//public: +// test_cmonthschedulenumItem(); + +// virtual void SetUp() +// { +// mItem = new CMonthScheduleNumItem(); +// } + +// virtual void TearDown() +// { +// delete mItem; +// mItem = nullptr; +// } +//protected: +// CMonthScheduleNumItem *mItem = nullptr; +//}; + +#endif // TEST_CMONTHSCHEDULENUMITEM_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_view/test_graphicsItem/test_cscenebackgrounditem.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_view/test_graphicsItem/test_cscenebackgrounditem.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_view/test_graphicsItem/test_cscenebackgrounditem.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_view/test_graphicsItem/test_cscenebackgrounditem.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,53 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "test_cscenebackgrounditem.h" + +//test_cscenebackgrounditem::test_cscenebackgrounditem() +//{ + +//} + +//TEST_F(test_cscenebackgrounditem, setNextItemFocusAndGetNextItem_01) +//{ +// mItem->m_showItemIndex = 0; +// mItem->setNextItemFocusAndGetNextItem(); +//} + +//TEST_F(test_cscenebackgrounditem, setNextItemFocusAndGetNextItem_02) +//{ +// mItem->m_showItemIndex = 1; +// mItem->setNextItemFocusAndGetNextItem(); +//} + +//TEST_F(test_cscenebackgrounditem, setNextItemFocusAndGetNextItem_03) +//{ +// mItem->m_showItemIndex = -1; +// mItem->m_isFocus = true; +// mItem->setNextItemFocusAndGetNextItem(); +//} + +//TEST_F(test_cscenebackgrounditem, setItemFocus_01) +//{ +// mItem->m_showItemIndex = -1; +// mItem->setItemFocus(true); +//} + +//TEST_F(test_cscenebackgrounditem, setItemFocus_02) +//{ +// mItem->m_showItemIndex = 1; +// mItem->setItemFocus(true); +//} + +//TEST_F(test_cscenebackgrounditem, initState_01) +//{ +// mItem->m_showItemIndex = 1; +// mItem->initState(); +//} + +//TEST_F(test_cscenebackgrounditem, updateCurrentItemShow_01) +//{ +// mItem->m_showItemIndex = 1; +// mItem->updateCurrentItemShow(); +//} diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_view/test_graphicsItem/test_cscenebackgrounditem.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_view/test_graphicsItem/test_cscenebackgrounditem.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_view/test_graphicsItem/test_cscenebackgrounditem.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_view/test_graphicsItem/test_cscenebackgrounditem.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,43 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef TEST_CSCENEBACKGROUNDITEM_H +#define TEST_CSCENEBACKGROUNDITEM_H + +//#include "graphicsItem/cscenebackgrounditem.h" +//#include +//#include <../third-party_stub/stub.h> +//#include +//#include + +//class test_cscenebackgrounditem: public::testing::Test +//{ +//public: +// test_cscenebackgrounditem(); + +// virtual void SetUp() +// { +// mItem = new CSceneBackgroundItem(CSceneBackgroundItem::OnMonthView); +// mFocusItem = new CFocusItem(); +// mScene = new QGraphicsScene(); +// mScene->addItem(mItem); +// mScene->addItem(mFocusItem); +// mItem->m_item.append(mFocusItem); +// mItem->m_item.append(mFocusItem); +// } + +// virtual void TearDown() +// { +// delete mItem; +// mItem = nullptr; +// delete mFocusItem; +// delete mScene; +// } +//protected: +// CSceneBackgroundItem *mItem = nullptr; +// CFocusItem *mFocusItem = nullptr; +// QGraphicsScene *mScene = nullptr; +//}; + +#endif // TEST_CSCENEBACKGROUNDITEM_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_view/test_graphicsItem/test_cscheduleitem.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_view/test_graphicsItem/test_cscheduleitem.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_view/test_graphicsItem/test_cscheduleitem.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_view/test_graphicsItem/test_cscheduleitem.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,51 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "test_cscheduleitem.h" +#include + +//test_cscheduleitem::test_cscheduleitem() +//{ + +//} + +//TEST_F(test_cscheduleitem, setData_01) +//{ +// mItem->setData(ScheduleDataInfo(), QDate(), 2); +// EXPECT_EQ(mItem->m_totalNum, 2); +//} + +//TEST_F(test_cscheduleitem, hasSelectSchedule_01) +//{ +// ScheduleDataInfo info; +// mItem->setData(info, QDate(), 2); +// EXPECT_TRUE(mItem->hasSelectSchedule(info)); +//} + +//TEST_F(test_cscheduleitem, splitTexte_01) +//{ +// QFont font; +// QStringList strList; +// QFontMetrics metrics(font); +// ScheduleDataInfo info; +// mItem->splitText(font, 20, 10, "123", strList, metrics); +//} + +//TEST_F(test_cscheduleitem, paintBackground_01) +//{ +// QPainter painter; +// QRectF rect; +// mItem->m_vHoverflag = true; +// mItem->m_vSelectflag = false; +// mItem->paintBackground(&painter, rect); +//} + +//TEST_F(test_cscheduleitem, paintBackground_02) +//{ +// QPainter painter; +// QRectF rect; +// mItem->m_vHoverflag = true; +// mItem->m_vSelectflag = true; +// mItem->paintBackground(&painter, rect); +//} diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_view/test_graphicsItem/test_cscheduleitem.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_view/test_graphicsItem/test_cscheduleitem.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_view/test_graphicsItem/test_cscheduleitem.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_view/test_graphicsItem/test_cscheduleitem.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,34 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef TEST_DRAGINFOITEM_H +#define TEST_DRAGINFOITEM_H + +//#include "graphicsItem/scheduleitem.h" +//#include +//#include <../third-party_stub/stub.h> +//#include +//#include + +//class test_cscheduleitem: public::testing::Test +//{ +//public: +// test_cscheduleitem(); + +// virtual void SetUp() +// { +// QRectF rect(0, 0, 100, 100); +// mItem = new CScheduleItem(rect); +// } + +// virtual void TearDown() +// { +// delete mItem; +// mItem = nullptr; +// } +//protected: +// CScheduleItem *mItem = nullptr; +//}; + +#endif // TEST_DRAGINFOITEM_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_view/test_graphicsscene.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_view/test_graphicsscene.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_view/test_graphicsscene.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_view/test_graphicsscene.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "test_graphicsscene.h" #include @@ -26,91 +10,91 @@ #include #include "view/graphicsItem/cfocusitem.h" -test_graphicsscene::test_graphicsscene() -{ -} - -void test_graphicsscene::SetUp() -{ - m_Scene = new CGraphicsScene(); -} - -void test_graphicsscene::TearDown() -{ - delete m_Scene; - m_Scene = nullptr; -} - -TEST_F(test_graphicsscene, getCurrentFocusItem) -{ - QGraphicsItem *item = m_Scene->getCurrentFocusItem(); - Q_UNUSED(item) -} - -//setPrePage -TEST_F(test_graphicsscene, setPrePage) -{ - m_Scene->setPrePage(QDate::currentDate(), false); -} - -//focusInDeal -TEST_F(test_graphicsscene, focusInDeal) -{ - m_Scene->setIsShowCurrentItem(true); - QFocusEvent event(QEvent::FocusIn, Qt::TabFocusReason); - QApplication::sendEvent(m_Scene, &event); -} - -TEST_F(test_graphicsscene, focusInDeal1) -{ - CFocusItem *item = new CFocusItem(); - m_Scene->setCurrentFocusItem(item); - m_Scene->addItem(item); - QFocusEvent event(QEvent::FocusIn, Qt::ActiveWindowFocusReason); - QApplication::sendEvent(m_Scene, &event); - m_Scene->clear(); -} - -//focusOutDeal -TEST_F(test_graphicsscene, focusOutDeal) -{ - QFocusEvent event(QEvent::FocusOut, Qt::TabFocusReason); - m_Scene->setActiveSwitching(true); - QApplication::sendEvent(m_Scene, &event); -} - -//focusOutDeal -TEST_F(test_graphicsscene, focusOutDeal1) -{ - QFocusEvent event(QEvent::FocusOut, Qt::TabFocusReason); - m_Scene->setActiveSwitching(false); - QApplication::sendEvent(m_Scene, &event); -} - -TEST_F(test_graphicsscene, event) -{ - QFocusEvent event(QEvent::FocusOut); - m_Scene->event(&event); -} - -//setIsContextMenu -TEST_F(test_graphicsscene, setIsContextMenu) -{ - m_Scene->setIsShowCurrentItem(false); -} - -//currentItemInit -TEST_F(test_graphicsscene, currentItemInit) -{ - CFocusItem *item = new CFocusItem(); - m_Scene->setCurrentFocusItem(item); - m_Scene->addItem(item); - m_Scene->currentItemInit(); - m_Scene->clear(); -} - -//getActiveSwitching -TEST_F(test_graphicsscene, getActiveSwitching) -{ - m_Scene->getActiveSwitching(); -} +//test_graphicsscene::test_graphicsscene() +//{ +//} + +//void test_graphicsscene::SetUp() +//{ +// m_Scene = new CGraphicsScene(); +//} + +//void test_graphicsscene::TearDown() +//{ +// delete m_Scene; +// m_Scene = nullptr; +//} + +//TEST_F(test_graphicsscene, getCurrentFocusItem) +//{ +// QGraphicsItem *item = m_Scene->getCurrentFocusItem(); +// Q_UNUSED(item) +//} + +////setPrePage +//TEST_F(test_graphicsscene, setPrePage) +//{ +// m_Scene->setPrePage(QDate::currentDate(), false); +//} + +////focusInDeal +//TEST_F(test_graphicsscene, focusInDeal) +//{ +// m_Scene->setIsShowCurrentItem(true); +// QFocusEvent event(QEvent::FocusIn, Qt::TabFocusReason); +// QApplication::sendEvent(m_Scene, &event); +//} + +//TEST_F(test_graphicsscene, focusInDeal1) +//{ +// CFocusItem *item = new CFocusItem(); +// m_Scene->setCurrentFocusItem(item); +// m_Scene->addItem(item); +// QFocusEvent event(QEvent::FocusIn, Qt::ActiveWindowFocusReason); +// QApplication::sendEvent(m_Scene, &event); +// m_Scene->clear(); +//} + +////focusOutDeal +//TEST_F(test_graphicsscene, focusOutDeal) +//{ +// QFocusEvent event(QEvent::FocusOut, Qt::TabFocusReason); +// m_Scene->setActiveSwitching(true); +// QApplication::sendEvent(m_Scene, &event); +//} + +////focusOutDeal +//TEST_F(test_graphicsscene, focusOutDeal1) +//{ +// QFocusEvent event(QEvent::FocusOut, Qt::TabFocusReason); +// m_Scene->setActiveSwitching(false); +// QApplication::sendEvent(m_Scene, &event); +//} + +//TEST_F(test_graphicsscene, event) +//{ +// QFocusEvent event(QEvent::FocusOut); +// m_Scene->event(&event); +//} + +////setIsContextMenu +//TEST_F(test_graphicsscene, setIsContextMenu) +//{ +// m_Scene->setIsShowCurrentItem(false); +//} + +////currentItemInit +//TEST_F(test_graphicsscene, currentItemInit) +//{ +// CFocusItem *item = new CFocusItem(); +// m_Scene->setCurrentFocusItem(item); +// m_Scene->addItem(item); +// m_Scene->currentItemInit(); +// m_Scene->clear(); +//} + +////getActiveSwitching +//TEST_F(test_graphicsscene, getActiveSwitching) +//{ +// m_Scene->getActiveSwitching(); +//} diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_view/test_graphicsscene.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_view/test_graphicsscene.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_view/test_graphicsscene.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_view/test_graphicsscene.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,45 +1,29 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_GRAPHICSSCENE_H #define TEST_GRAPHICSSCENE_H -#include "gtest/gtest.h" -#include "cgraphicsscene.h" +//#include "gtest/gtest.h" +//#include "cgraphicsscene.h" -#include +//#include -class test_graphicsscene : public QObject - , public ::testing::Test -{ - Q_OBJECT -public: - test_graphicsscene(); - - void SetUp() override; - void TearDown() override; -signals: - -public slots: -public: - CGraphicsScene *m_Scene = nullptr; -}; +//class test_graphicsscene : public QObject +// , public ::testing::Test +//{ +// Q_OBJECT +//public: +// test_graphicsscene(); + +// void SetUp() override; +// void TearDown() override; +//signals: + +//public slots: +//public: +// CGraphicsScene *m_Scene = nullptr; +//}; #endif // TEST_GRAPHICSSCENE_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_view/test_graphicsview.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_view/test_graphicsview.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_view/test_graphicsview.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_view/test_graphicsview.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,318 +1,302 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: hejinghai -* -* Maintainer: hejinghai -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ -#include "test_graphicsview.h" -#include "graphicsItem/scheduleitem.h" -#include "../third-party_stub/stub.h" -#include "../dialog_stub.h" -#include - -test_graphicsview::test_graphicsview() -{ - cGraphicsView = new CGraphicsView(nullptr, CGraphicsView::WeekPos); -} - -test_graphicsview::~test_graphicsview() -{ - delete cGraphicsView; -} - -//void CGraphicsView::setMargins(int left, int top, int right, int bottom) -TEST_F(test_graphicsview, setMargins) -{ - int left = 50; - int top = 50; - int right = 50; - int bottom = 50; - cGraphicsView->setMargins(left, top, right, bottom); - assert(cGraphicsView->m_margins.left() == 50); -} - -//void CGraphicsView::setTheMe(int type) -TEST_F(test_graphicsview, setTheMe) -{ - int type = 0; - cGraphicsView->setTheMe(type); - - type = 2; - cGraphicsView->setTheMe(type); -} - -//bool CGraphicsView::MeetCreationConditions(const QDateTime &date) -TEST_F(test_graphicsview, MeetCreationConditions) -{ - QString strDate = "2020-12-28 12:24:36"; - QDateTime date = QDateTime::fromString(strDate, "yyyy-MM-dd hh:mm:ss"); - - cGraphicsView->MeetCreationConditions(date); -} - -TEST_F(test_graphicsview, updateHeight_01) -{ - cGraphicsView->updateHeight(); -} - -//void CGraphicsView::setRange(int w, int h, QDate begindate, QDate enddate, int rightMargin) -TEST_F(test_graphicsview, setRange) -{ - int w = 20; - int h = 20; - QDate begindate(2020, 11, 11); - QDate enddate(2020, 11, 31); - int rightMargin = 10; - - cGraphicsView->setRange(w, h, begindate, enddate, rightMargin); - cGraphicsView->setRange(begindate, enddate); -} - -//void CGraphicsView::setCurrentDate(const QDateTime ¤tDate) -TEST_F(test_graphicsview, setCurrentDate) -{ - QDateTime date = QDateTime::currentDateTime(); - cGraphicsView->setCurrentDate(date); -} - -//void CGraphicsView::setInfo(const QVector &info) -TEST_F(test_graphicsview, setInfo) -{ - QVector infos = QVector {}; - cGraphicsView->setInfo(infos); -} - -bool MScheduleTimeThan(const ScheduleDataInfo &s1, const ScheduleDataInfo &s2); -TEST_F(test_graphicsview, MScheduleTimeThan) -{ - ScheduleDataInfo info1 = ScheduleDataInfo{}; - ScheduleDataInfo info2 = ScheduleDataInfo{}; - MScheduleTimeThan(info1, info2); -} - -//void CGraphicsView::upDateInfoShow(const CGraphicsView::DragStatus &status, const ScheduleDataInfo &info) -TEST_F(test_graphicsview, upDateInfoShow) -{ - ScheduleDataInfo info = ScheduleDataInfo{}; - cGraphicsView->upDateInfoShow(CGraphicsView::DragStatus::IsCreate, info); - cGraphicsView->upDateInfoShow(CGraphicsView::DragStatus::ChangeEnd, info); - cGraphicsView->upDateInfoShow(CGraphicsView::DragStatus::ChangeBegin, info); - cGraphicsView->upDateInfoShow(CGraphicsView::DragStatus::ChangeWhole, info); - cGraphicsView->upDateInfoShow(CGraphicsView::DragStatus::NONE, info); -} - -//QDateTime CGraphicsView::getPosDate(const QPoint &p) -TEST_F(test_graphicsview, getPosDate) -{ - QDateTime dateTime; - QPoint point(50, 40); - dateTime = cGraphicsView->getPosDate(point); -} +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +//#include "test_graphicsview.h" +//#include "graphicsItem/scheduleitem.h" +//#include "../third-party_stub/stub.h" +//#include "../dialog_stub.h" +//#include -//void CGraphicsView::ShowSchedule(DragInfoItem *infoitem) -//TEST_F(test_graphicsview, ShowSchedule) +//test_graphicsview::test_graphicsview() //{ +// cGraphicsView = new CGraphicsView(nullptr, CGraphicsView::WeekPos); +//} + +//test_graphicsview::~test_graphicsview() +//{ +// delete cGraphicsView; +//} + +////void CGraphicsView::setMargins(int left, int top, int right, int bottom) +//TEST_F(test_graphicsview, setMargins) +//{ +// int left = 50; +// int top = 50; +// int right = 50; +// int bottom = 50; +// cGraphicsView->setMargins(left, top, right, bottom); +// assert(cGraphicsView->m_margins.left() == 50); +//} + +////void CGraphicsView::setTheMe(int type) +//TEST_F(test_graphicsview, setTheMe) +//{ +// int type = 0; +// cGraphicsView->setTheMe(type); + +// type = 2; +// cGraphicsView->setTheMe(type); +//} + +////bool CGraphicsView::MeetCreationConditions(const QDateTime &date) +//TEST_F(test_graphicsview, MeetCreationConditions) +//{ +// QString strDate = "2020-12-28 12:24:36"; +// QDateTime date = QDateTime::fromString(strDate, "yyyy-MM-dd hh:mm:ss"); + +// cGraphicsView->MeetCreationConditions(date); +//} + +//TEST_F(test_graphicsview, updateHeight_01) +//{ +// cGraphicsView->updateHeight(); +//} + +////void CGraphicsView::setRange(int w, int h, QDate begindate, QDate enddate, int rightMargin) +//TEST_F(test_graphicsview, setRange) +//{ +// int w = 20; +// int h = 20; +// QDate begindate(2020, 11, 11); +// QDate enddate(2020, 11, 31); +// int rightMargin = 10; + +// cGraphicsView->setRange(w, h, begindate, enddate, rightMargin); +// cGraphicsView->setRange(begindate, enddate); +//} + +////void CGraphicsView::setCurrentDate(const QDateTime ¤tDate) +//TEST_F(test_graphicsview, setCurrentDate) +//{ +// QDateTime date = QDateTime::currentDateTime(); +// cGraphicsView->setCurrentDate(date); +//} + +////void CGraphicsView::setInfo(const QVector &info) +//TEST_F(test_graphicsview, setInfo) +//{ +// QVector infos = QVector {}; +// cGraphicsView->setInfo(infos); +//} + +//bool MScheduleTimeThan(const ScheduleDataInfo &s1, const ScheduleDataInfo &s2); +//TEST_F(test_graphicsview, MScheduleTimeThan) +//{ +// ScheduleDataInfo info1 = ScheduleDataInfo{}; +// ScheduleDataInfo info2 = ScheduleDataInfo{}; +// MScheduleTimeThan(info1, info2); +//} + +////void CGraphicsView::upDateInfoShow(const CGraphicsView::DragStatus &status, const ScheduleDataInfo &info) +//TEST_F(test_graphicsview, upDateInfoShow) +//{ +// ScheduleDataInfo info = ScheduleDataInfo{}; +// cGraphicsView->upDateInfoShow(CGraphicsView::DragStatus::IsCreate, info); +// cGraphicsView->upDateInfoShow(CGraphicsView::DragStatus::ChangeEnd, info); +// cGraphicsView->upDateInfoShow(CGraphicsView::DragStatus::ChangeBegin, info); +// cGraphicsView->upDateInfoShow(CGraphicsView::DragStatus::ChangeWhole, info); +// cGraphicsView->upDateInfoShow(CGraphicsView::DragStatus::NONE, info); +//} + +////QDateTime CGraphicsView::getPosDate(const QPoint &p) +//TEST_F(test_graphicsview, getPosDate) +//{ +// QDateTime dateTime; // QPoint point(50, 40); -// QGraphicsItem *listItem = itemAt(point); -// DragInfoItem *infoitem = dynamic_cast(listItem); -// CScheduleItem *scheduleitem = dynamic_cast(infoitem); -// qInfo() << scheduleitem->getType(); -// cGraphicsView->ShowSchedule(infoitem); -//} - -TEST_F(test_graphicsview, MoveInfoProcess_01) -{ - ScheduleDataInfo info = ScheduleDataInfo{}; - QPointF pos(1, 1); - info.setAllDay(true); - cGraphicsView->MoveInfoProcess(info, pos); - EXPECT_FALSE(info.getAllDay()); -} - -TEST_F(test_graphicsview, MoveInfoProcess_02) -{ - ScheduleDataInfo info = ScheduleDataInfo{}; - QPointF pos(1, 1); - info.setAllDay(false); - cGraphicsView->MoveInfoProcess(info, pos); - EXPECT_FALSE(info.getAllDay()); -} - -//void CGraphicsView::addScheduleItem(const ScheduleDataInfo &info, QDate date, int index, int totalNum, int type, int viewtype, int maxnum) -TEST_F(test_graphicsview, addScheduleItem_01) -{ - ScheduleDataInfo info = ScheduleDataInfo{}; - QDate date(2020, 12, 28); - int index = 1; - int totalNum = 2; - int type = 1; - int viewtype = 1; - int maxnum = 3; - cGraphicsView->addScheduleItem(info, date, index, totalNum, type, viewtype, maxnum); -} - -TEST_F(test_graphicsview, clearSchedule_01) -{ - cGraphicsView->clearSchedule(); - - EXPECT_TRUE(cGraphicsView->m_updateDflag); - EXPECT_TRUE(cGraphicsView->m_vScheduleItem.isEmpty()); -} - -//void CGraphicsView::scheduleClassificationType(QVector &scheduleInfolist, QList &info) -TEST_F(test_graphicsview, schedusleClassificationType) -{ - QVector scheduleInfolist = QVector {}; - QList info = QList {}; - cGraphicsView->scheduleClassificationType(scheduleInfolist, info); -} - -//void CGraphicsView::slotDoubleEvent(int type) -TEST_F(test_graphicsview, slotDoubleEvent) -{ - int type = 1; - cGraphicsView->slotDoubleEvent(type); -} - -//void CGraphicsView::slotScrollBar() -TEST_F(test_graphicsview, slotScrollBar) -{ - cGraphicsView->slotScrollBar(); -} - -//void CGraphicsView::slotUpdateScene() -TEST_F(test_graphicsview, slotUpdateScene) -{ - cGraphicsView->slotUpdateScene(); -} - -//void CGraphicsView::scrollBarValueChangedSlot() -TEST_F(test_graphicsview, scrollBarValueChangedSlot_01) -{ - cGraphicsView->scrollBarValueChangedSlot(); -} - -//ScheduleDataInfo CGraphicsView::getScheduleInfo(const QDateTime &beginDate, const QDateTime &endDate) -TEST_F(test_graphicsview, getScheduleInfo_01) -{ - QString begin = "2020-12-01 12:24:36"; - QDateTime begindate = QDateTime::fromString(begin, "yyyy-MM-dd hh:mm:ss"); - QString end = "2020-12-21 12:24:36"; - QDateTime enddate = QDateTime::fromString(end, "yyyy-MM-dd hh:mm:ss"); - - cGraphicsView->getScheduleInfo(begindate, enddate); -} - -TEST_F(test_graphicsview, getScheduleInfo_02) -{ - QString begin = "2020-12-01 12:24:36"; - QDateTime begindate = QDateTime::fromString(begin, "yyyy-MM-dd hh:mm:ss"); - QString end = "2020-12-21 12:24:36"; - QDateTime enddate = QDateTime::fromString(end, "yyyy-MM-dd hh:mm:ss"); - - cGraphicsView->getScheduleInfo(enddate, begindate); -} - -//bool CGraphicsView::IsEqualtime(const QDateTime &timeFirst, const QDateTime &timeSecond) -TEST_F(test_graphicsview, IsEqualtime) -{ - QString begin = "2020-12-01 12:24:36"; - QDateTime begindate = QDateTime::fromString(begin, "yyyy-MM-dd hh:mm:ss"); - QString end = "2020-12-21 12:24:36"; - QDateTime enddate = QDateTime::fromString(end, "yyyy-MM-dd hh:mm:ss"); - - cGraphicsView->IsEqualtime(begindate, enddate); -} - -//bool CGraphicsView::JudgeIsCreate(const QPointF &pos) -TEST_F(test_graphicsview, JudgeIsCreate) -{ - QPointF pos(20, 20); - bool getBool = cGraphicsView->JudgeIsCreate(pos); -} - -//void CGraphicsView::RightClickToCreate(QGraphicsItem *listItem, const QPoint &pos) -TEST_F(test_graphicsview, RightClickToCreate) -{ -// QGraphicsItem *listItem = nullptr; -// QPoint pos(20, 20); - //cGraphicsView->RightClickToCreate(listItem, pos); -} - -//QDateTime CGraphicsView::getDragScheduleInfoBeginTime(const QDateTime &moveDateTime) -TEST_F(test_graphicsview, getDragScheduleInfoBeginTime) -{ - QString begin = "2020-12-01 12:24:36"; - QDateTime begindate = QDateTime::fromString(begin, "yyyy-MM-dd hh:mm:ss"); - - cGraphicsView->getDragScheduleInfoBeginTime(begindate); -} - -//QDateTime CGraphicsView::getDragScheduleInfoEndTime(const QDateTime &moveDateTime) -TEST_F(test_graphicsview, getDragScheduleInfoEndTime) -{ - QString end = "2020-12-21 12:24:36"; - QDateTime enddate = QDateTime::fromString(end, "yyyy-MM-dd hh:mm:ss"); - - cGraphicsView->getDragScheduleInfoEndTime(enddate); -} - -//void CGraphicsView::keepCenterOnScene() -TEST_F(test_graphicsview, keepCenterOnScene) -{ - cGraphicsView->keepCenterOnScene(); -} - -//void CGraphicsView::setTime(QTime time) -TEST_F(test_graphicsview, setTime) -{ - QTime time(7, 30, 5, 100); - - cGraphicsView->setTime(time); -} - -//void CGraphicsView::updateInfo() -TEST_F(test_graphicsview, updateInfo) -{ - cGraphicsView->updateInfo(); -} - -TEST_F(test_graphicsview, mouseDoubleClickEvent_01) -{ - Stub stub; - calendarDDialogExecStub(stub); - QMouseEvent event(QEvent::MouseButtonDblClick, QPointF(1, 1), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); - cGraphicsView->mouseDoubleClickEvent(&event); -} - -TEST_F(test_graphicsview, mousePressEvent_01) -{ - QMouseEvent event(QEvent::MouseButtonPress, QPointF(1, 1), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); - cGraphicsView->mousePressEvent(&event); -} - -TEST_F(test_graphicsview, mouseMoveEvent_01) -{ - QMouseEvent event(QEvent::MouseButtonPress, QPointF(1, 1), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); - cGraphicsView->mouseMoveEvent(&event); -} - -TEST_F(test_graphicsview, resizeEvent_01) -{ - QResizeEvent event(QSize(50, 50), QSize(100, 100)); - cGraphicsView->resizeEvent(&event); -} +// dateTime = cGraphicsView->getPosDate(point); +//} + +////void CGraphicsView::ShowSchedule(DragInfoItem *infoitem) +////TEST_F(test_graphicsview, ShowSchedule) +////{ +//// QPoint point(50, 40); +//// QGraphicsItem *listItem = itemAt(point); +//// DragInfoItem *infoitem = dynamic_cast(listItem); +//// CScheduleItem *scheduleitem = dynamic_cast(infoitem); +//// qInfo() << scheduleitem->getType(); +//// cGraphicsView->ShowSchedule(infoitem); +////} + +//TEST_F(test_graphicsview, MoveInfoProcess_01) +//{ +// ScheduleDataInfo info = ScheduleDataInfo{}; +// QPointF pos(1, 1); +// info.setAllDay(true); +// cGraphicsView->MoveInfoProcess(info, pos); +// EXPECT_FALSE(info.getAllDay()); +//} + +//TEST_F(test_graphicsview, MoveInfoProcess_02) +//{ +// ScheduleDataInfo info = ScheduleDataInfo{}; +// QPointF pos(1, 1); +// info.setAllDay(false); +// cGraphicsView->MoveInfoProcess(info, pos); +// EXPECT_FALSE(info.getAllDay()); +//} + +////void CGraphicsView::addScheduleItem(const ScheduleDataInfo &info, QDate date, int index, int totalNum, int type, int viewtype, int maxnum) +//TEST_F(test_graphicsview, addScheduleItem_01) +//{ +// ScheduleDataInfo info = ScheduleDataInfo{}; +// QDate date(2020, 12, 28); +// int index = 1; +// int totalNum = 2; +// int type = 1; +// int viewtype = 1; +// int maxnum = 3; +// cGraphicsView->addScheduleItem(info, date, index, totalNum, type, viewtype, maxnum); +//} + +//TEST_F(test_graphicsview, clearSchedule_01) +//{ +// cGraphicsView->clearSchedule(); + +// EXPECT_TRUE(cGraphicsView->m_updateDflag); +// EXPECT_TRUE(cGraphicsView->m_vScheduleItem.isEmpty()); +//} + +////void CGraphicsView::scheduleClassificationType(QVector &scheduleInfolist, QList &info) +//TEST_F(test_graphicsview, schedusleClassificationType) +//{ +// QVector scheduleInfolist = QVector {}; +// QList info = QList {}; +// cGraphicsView->scheduleClassificationType(scheduleInfolist, info); +//} + +////void CGraphicsView::slotDoubleEvent(int type) +//TEST_F(test_graphicsview, slotDoubleEvent) +//{ +// int type = 1; +// cGraphicsView->slotDoubleEvent(type); +//} + +////void CGraphicsView::slotScrollBar() +//TEST_F(test_graphicsview, slotScrollBar) +//{ +// cGraphicsView->slotScrollBar(); +//} + +////void CGraphicsView::slotUpdateScene() +//TEST_F(test_graphicsview, slotUpdateScene) +//{ +// cGraphicsView->slotUpdateScene(); +//} + +////void CGraphicsView::scrollBarValueChangedSlot() +//TEST_F(test_graphicsview, scrollBarValueChangedSlot_01) +//{ +// cGraphicsView->scrollBarValueChangedSlot(); +//} + +////ScheduleDataInfo CGraphicsView::getScheduleInfo(const QDateTime &beginDate, const QDateTime &endDate) +//TEST_F(test_graphicsview, getScheduleInfo_01) +//{ +// QString begin = "2020-12-01 12:24:36"; +// QDateTime begindate = QDateTime::fromString(begin, "yyyy-MM-dd hh:mm:ss"); +// QString end = "2020-12-21 12:24:36"; +// QDateTime enddate = QDateTime::fromString(end, "yyyy-MM-dd hh:mm:ss"); + +// cGraphicsView->getScheduleInfo(begindate, enddate); +//} + +//TEST_F(test_graphicsview, getScheduleInfo_02) +//{ +// QString begin = "2020-12-01 12:24:36"; +// QDateTime begindate = QDateTime::fromString(begin, "yyyy-MM-dd hh:mm:ss"); +// QString end = "2020-12-21 12:24:36"; +// QDateTime enddate = QDateTime::fromString(end, "yyyy-MM-dd hh:mm:ss"); + +// cGraphicsView->getScheduleInfo(enddate, begindate); +//} + +////bool CGraphicsView::IsEqualtime(const QDateTime &timeFirst, const QDateTime &timeSecond) +//TEST_F(test_graphicsview, IsEqualtime) +//{ +// QString begin = "2020-12-01 12:24:36"; +// QDateTime begindate = QDateTime::fromString(begin, "yyyy-MM-dd hh:mm:ss"); +// QString end = "2020-12-21 12:24:36"; +// QDateTime enddate = QDateTime::fromString(end, "yyyy-MM-dd hh:mm:ss"); + +// cGraphicsView->IsEqualtime(begindate, enddate); +//} + +////bool CGraphicsView::JudgeIsCreate(const QPointF &pos) +//TEST_F(test_graphicsview, JudgeIsCreate) +//{ +// QPointF pos(20, 20); +// cGraphicsView->JudgeIsCreate(pos); +//} + +////void CGraphicsView::RightClickToCreate(QGraphicsItem *listItem, const QPoint &pos) +//TEST_F(test_graphicsview, RightClickToCreate) +//{ +//// QGraphicsItem *listItem = nullptr; +//// QPoint pos(20, 20); +// //cGraphicsView->RightClickToCreate(listItem, pos); +//} + +////QDateTime CGraphicsView::getDragScheduleInfoBeginTime(const QDateTime &moveDateTime) +//TEST_F(test_graphicsview, getDragScheduleInfoBeginTime) +//{ +// QString begin = "2020-12-01 12:24:36"; +// QDateTime begindate = QDateTime::fromString(begin, "yyyy-MM-dd hh:mm:ss"); + +// cGraphicsView->getDragScheduleInfoBeginTime(begindate); +//} + +////QDateTime CGraphicsView::getDragScheduleInfoEndTime(const QDateTime &moveDateTime) +//TEST_F(test_graphicsview, getDragScheduleInfoEndTime) +//{ +// QString end = "2020-12-21 12:24:36"; +// QDateTime enddate = QDateTime::fromString(end, "yyyy-MM-dd hh:mm:ss"); + +// cGraphicsView->getDragScheduleInfoEndTime(enddate); +//} + +////void CGraphicsView::keepCenterOnScene() +//TEST_F(test_graphicsview, keepCenterOnScene) +//{ +// cGraphicsView->keepCenterOnScene(); +//} + +////void CGraphicsView::setTime(QTime time) +//TEST_F(test_graphicsview, setTime) +//{ +// QTime time(7, 30, 5, 100); + +// cGraphicsView->setTime(time); +//} + +////void CGraphicsView::updateInfo() +//TEST_F(test_graphicsview, updateInfo) +//{ +// cGraphicsView->updateInfo(); +//} + +//TEST_F(test_graphicsview, mouseDoubleClickEvent_01) +//{ +// Stub stub; +// calendarDDialogExecStub(stub); +// QMouseEvent event(QEvent::MouseButtonDblClick, QPointF(1, 1), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); +// cGraphicsView->mouseDoubleClickEvent(&event); +//} + +//TEST_F(test_graphicsview, mousePressEvent_01) +//{ +// QMouseEvent event(QEvent::MouseButtonPress, QPointF(1, 1), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); +// cGraphicsView->mousePressEvent(&event); +//} + +//TEST_F(test_graphicsview, mouseMoveEvent_01) +//{ +// QMouseEvent event(QEvent::MouseButtonPress, QPointF(1, 1), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); +// cGraphicsView->mouseMoveEvent(&event); +//} + +//TEST_F(test_graphicsview, resizeEvent_01) +//{ +// QResizeEvent event(QSize(50, 50), QSize(100, 100)); +// cGraphicsView->resizeEvent(&event); +//} diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_view/test_graphicsview.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_view/test_graphicsview.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_view/test_graphicsview.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_view/test_graphicsview.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,37 +1,21 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: hejinghai -* -* Maintainer: hejinghai -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_GRAPHICSVIEW_H #define TEST_GRAPHICSVIEW_H -#include "graphicsview.h" -#include "gtest/gtest.h" -#include +//#include "graphicsview.h" +//#include "gtest/gtest.h" +//#include -class test_graphicsview : public QObject, public::testing::Test -{ -public: - test_graphicsview(); - ~test_graphicsview(); -protected: - CGraphicsView *cGraphicsView = nullptr; -}; +//class test_graphicsview : public QObject, public::testing::Test +//{ +//public: +// test_graphicsview(); +// ~test_graphicsview(); +//protected: +// CGraphicsView *cGraphicsView = nullptr; +//}; #endif // TEST_GRAPHICSVIEW_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_view/test_monthgraphiview.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_view/test_monthgraphiview.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_view/test_monthgraphiview.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_view/test_monthgraphiview.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: hejinghai -* -* Maintainer: hejinghai -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "test_monthgraphiview.h" #include "../third-party_stub/stub.h" #include "../dialog_stub.h" @@ -27,11 +11,6 @@ { } -static int monthgraphiview_stub_true() -{ - return 1; -} - test_monthgraphiview::test_monthgraphiview() { cMonthGraphiview = new CMonthGraphicsview(); diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_view/test_monthgraphiview.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_view/test_monthgraphiview.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_view/test_monthgraphiview.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_view/test_monthgraphiview.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,37 +1,21 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: hejinghai -* -* Maintainer: hejinghai -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_MONTHGRAPHVIEW_H #define TEST_MONTHGRAPHVIEW_H -#include "monthgraphiview.h" -#include "gtest/gtest.h" -#include +//#include "monthgraphiview.h" +//#include "gtest/gtest.h" +//#include -class test_monthgraphiview : public QObject, public::testing::Test -{ -public: - test_monthgraphiview(); - ~test_monthgraphiview(); -protected: - CMonthGraphicsview *cMonthGraphiview = nullptr; -}; +//class test_monthgraphiview : public QObject, public::testing::Test +//{ +//public: +// test_monthgraphiview(); +// ~test_monthgraphiview(); +//protected: +// CMonthGraphicsview *cMonthGraphiview = nullptr; +//}; #endif // TEST_MONTHGRAPHVIEW_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_view/test_scheduleitem.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_view/test_scheduleitem.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_view/test_scheduleitem.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_view/test_scheduleitem.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,153 +1,137 @@ -/* -* Copyright (C) 2019 ~ 2021 Uniontech Software Technology Co.,Ltd. -* -* Author: zhengxiaokang -* -* Maintainer: zhengxiaokang -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "test_scheduleitem.h" #include "../third-party_stub/stub.h" #include -test_scheduleitem::test_scheduleitem() -{ - QRectF rectf; - mScheduleItem = new CScheduleItem(rectf); -} - -test_scheduleitem::~test_scheduleitem() -{ - delete mScheduleItem; - mScheduleItem = nullptr; -} - -QVector getScheduleItemDInfo() -{ - QVector scheduleDate {}; - ScheduleDataInfo schedule1, schedule2, schedule3, schedule4, schedule5, scheduleFes; - QDateTime currentDateTime = QDateTime::currentDateTime(); - - schedule1.setID(1); - schedule1.setBeginDateTime(currentDateTime); - schedule1.setEndDateTime(currentDateTime.addDays(1)); - schedule1.setTitleName("scheduleOne"); - schedule1.setAllDay(true); - schedule1.setType(1); - schedule1.setRecurID(0); - - schedule2.setID(2); - schedule2.setBeginDateTime(currentDateTime.addDays(1)); - schedule2.setEndDateTime(currentDateTime.addDays(1).addSecs(60 * 60)); - schedule2.setTitleName("scheduleTwo"); - schedule2.setAllDay(true); - schedule2.setType(2); - schedule2.setRecurID(0); - - schedule3.setID(3); - schedule3.setBeginDateTime(currentDateTime.addDays(2)); - schedule3.setEndDateTime(currentDateTime.addDays(2).addSecs(60 * 60)); - schedule3.setTitleName("scheduleThree"); - schedule3.setAllDay(false); - schedule3.setType(3); - schedule3.setRecurID(0); - - schedule4.setID(4); - schedule4.setBeginDateTime(currentDateTime.addDays(3)); - schedule4.setEndDateTime(currentDateTime.addDays(3).addSecs(60 * 60)); - schedule4.setTitleName("scheduleFour"); - schedule4.setAllDay(false); - schedule4.setType(1); - schedule4.setRecurID(0); - - schedule5.setID(5); - schedule5.setBeginDateTime(currentDateTime.addDays(4)); - schedule5.setEndDateTime(currentDateTime.addDays(4).addSecs(60 * 60)); - schedule5.setTitleName("scheduleFive"); - schedule5.setAllDay(false); - schedule5.setType(2); - schedule5.setRecurID(0); - - scheduleFes.setID(6); - scheduleFes.setBeginDateTime(currentDateTime.addDays(5)); - scheduleFes.setEndDateTime(currentDateTime.addDays(5).addSecs(60 * 60)); - scheduleFes.setTitleName("scheduleFestival"); - scheduleFes.setAllDay(true); - scheduleFes.setType(4); - scheduleFes.setRecurID(0); - - scheduleDate.append(schedule1); - scheduleDate.append(schedule2); - scheduleDate.append(schedule3); - scheduleDate.append(schedule4); - scheduleDate.append(schedule5); - scheduleDate.append(scheduleFes); - return scheduleDate; -} - -//void CScheduleItem::setData(const ScheduleDataInfo &info, QDate date, int totalNum) -TEST_F(test_scheduleitem, setData) -{ - ScheduleDataInfo scheduleinof = getScheduleItemDInfo().first(); - mScheduleItem->setData(scheduleinof, QDate::currentDate(), 4); -} - -//bool CScheduleItem::hasSelectSchedule(const ScheduleDataInfo &info) -TEST_F(test_scheduleitem, hasSelectSchedule) -{ - ScheduleDataInfo scheduleinfo1 = getScheduleItemDInfo().first(); - ScheduleDataInfo scheduleinfo2 = getScheduleItemDInfo().at(1); - mScheduleItem->setData(scheduleinfo1, QDate::currentDate(), 4); - bool res = mScheduleItem->hasSelectSchedule(scheduleinfo1); - EXPECT_TRUE(res); - res = mScheduleItem->hasSelectSchedule(scheduleinfo2); - EXPECT_FALSE(res); -} - -//void CScheduleItem::splitText(QFont font, int w, int h, QString str, QStringList &liststr, QFontMetrics &fontm) -TEST_F(test_scheduleitem, splitText) -{ - QFont font; - QString str = "helo"; - QStringList strlist("hello,word!"); - QFontMetrics fontmetrics(font); - mScheduleItem->splitText(font, 10, 12, str, strlist, fontmetrics); - mScheduleItem->splitText(font, 40, 40, str, strlist, fontmetrics); -} - -bool getItemFocus_Stub() -{ - return true; -} - -//paintBackground -TEST_F(test_scheduleitem, paintBackground) -{ - QRectF rectf(0, 0, 100, 100); - mScheduleItem->setRect(rectf); - mScheduleItem->setData(getScheduleItemDInfo().first(), QDate::currentDate(), 4); - QPixmap pixmap(rectf.toRect().size()); - pixmap.fill(Qt::transparent); - QPainter painter(&pixmap); - mScheduleItem->m_vHighflag = true; - mScheduleItem->m_vSelectflag = false; - mScheduleItem->paintBackground(&painter, pixmap.rect(), true); - Stub stub; - stub.set(ADDR(CFocusItem, getItemFocus), getItemFocus_Stub); - mScheduleItem->m_vSelectflag = true; - mScheduleItem->paintBackground(&painter, pixmap.rect(), true); -} +//test_scheduleitem::test_scheduleitem() +//{ +// QRectF rectf; +// mScheduleItem = new CScheduleItem(rectf); +//} + +//test_scheduleitem::~test_scheduleitem() +//{ +// delete mScheduleItem; +// mScheduleItem = nullptr; +//} + +//QVector getScheduleItemDInfo() +//{ +// QVector scheduleDate {}; +// ScheduleDataInfo schedule1, schedule2, schedule3, schedule4, schedule5, scheduleFes; +// QDateTime currentDateTime = QDateTime::currentDateTime(); + +// schedule1.setID(1); +// schedule1.setBeginDateTime(currentDateTime); +// schedule1.setEndDateTime(currentDateTime.addDays(1)); +// schedule1.setTitleName("scheduleOne"); +// schedule1.setAllDay(true); +// schedule1.setType(1); +// schedule1.setRecurID(0); + +// schedule2.setID(2); +// schedule2.setBeginDateTime(currentDateTime.addDays(1)); +// schedule2.setEndDateTime(currentDateTime.addDays(1).addSecs(60 * 60)); +// schedule2.setTitleName("scheduleTwo"); +// schedule2.setAllDay(true); +// schedule2.setType(2); +// schedule2.setRecurID(0); + +// schedule3.setID(3); +// schedule3.setBeginDateTime(currentDateTime.addDays(2)); +// schedule3.setEndDateTime(currentDateTime.addDays(2).addSecs(60 * 60)); +// schedule3.setTitleName("scheduleThree"); +// schedule3.setAllDay(false); +// schedule3.setType(3); +// schedule3.setRecurID(0); + +// schedule4.setID(4); +// schedule4.setBeginDateTime(currentDateTime.addDays(3)); +// schedule4.setEndDateTime(currentDateTime.addDays(3).addSecs(60 * 60)); +// schedule4.setTitleName("scheduleFour"); +// schedule4.setAllDay(false); +// schedule4.setType(1); +// schedule4.setRecurID(0); + +// schedule5.setID(5); +// schedule5.setBeginDateTime(currentDateTime.addDays(4)); +// schedule5.setEndDateTime(currentDateTime.addDays(4).addSecs(60 * 60)); +// schedule5.setTitleName("scheduleFive"); +// schedule5.setAllDay(false); +// schedule5.setType(2); +// schedule5.setRecurID(0); + +// scheduleFes.setID(6); +// scheduleFes.setBeginDateTime(currentDateTime.addDays(5)); +// scheduleFes.setEndDateTime(currentDateTime.addDays(5).addSecs(60 * 60)); +// scheduleFes.setTitleName("scheduleFestival"); +// scheduleFes.setAllDay(true); +// scheduleFes.setType(4); +// scheduleFes.setRecurID(0); + +// scheduleDate.append(schedule1); +// scheduleDate.append(schedule2); +// scheduleDate.append(schedule3); +// scheduleDate.append(schedule4); +// scheduleDate.append(schedule5); +// scheduleDate.append(scheduleFes); +// return scheduleDate; +//} + +////void CScheduleItem::setData(const ScheduleDataInfo &info, QDate date, int totalNum) +//TEST_F(test_scheduleitem, setData) +//{ +// ScheduleDataInfo scheduleinof = getScheduleItemDInfo().first(); +// mScheduleItem->setData(scheduleinof, QDate::currentDate(), 4); +//} + +////bool CScheduleItem::hasSelectSchedule(const ScheduleDataInfo &info) +//TEST_F(test_scheduleitem, hasSelectSchedule) +//{ +// ScheduleDataInfo scheduleinfo1 = getScheduleItemDInfo().first(); +// ScheduleDataInfo scheduleinfo2 = getScheduleItemDInfo().at(1); +// mScheduleItem->setData(scheduleinfo1, QDate::currentDate(), 4); +// bool res = mScheduleItem->hasSelectSchedule(scheduleinfo1); +// EXPECT_TRUE(res); +// res = mScheduleItem->hasSelectSchedule(scheduleinfo2); +// EXPECT_FALSE(res); +//} + +////void CScheduleItem::splitText(QFont font, int w, int h, QString str, QStringList &liststr, QFontMetrics &fontm) +//TEST_F(test_scheduleitem, splitText) +//{ +// QFont font; +// QString str = "helo"; +// QStringList strlist("hello,word!"); +// QFontMetrics fontmetrics(font); +// mScheduleItem->splitText(font, 10, 12, str, strlist, fontmetrics); +// mScheduleItem->splitText(font, 40, 40, str, strlist, fontmetrics); +//} + +//bool getItemFocus_Stub() +//{ +// return true; +//} + +////paintBackground +//TEST_F(test_scheduleitem, paintBackground) +//{ +// QRectF rectf(0, 0, 100, 100); +// mScheduleItem->setRect(rectf); +// mScheduleItem->setData(getScheduleItemDInfo().first(), QDate::currentDate(), 4); +// QPixmap pixmap(rectf.toRect().size()); +// pixmap.fill(Qt::transparent); +// QPainter painter(&pixmap); +// mScheduleItem->m_vHighflag = true; +// mScheduleItem->m_vSelectflag = false; +// mScheduleItem->paintBackground(&painter, pixmap.rect(), true); +// Stub stub; +// stub.set(ADDR(CFocusItem, getItemFocus), getItemFocus_Stub); +// mScheduleItem->m_vSelectflag = true; +// mScheduleItem->paintBackground(&painter, pixmap.rect(), true); +//} diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_view/test_scheduleitem.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_view/test_scheduleitem.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_view/test_scheduleitem.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_view/test_scheduleitem.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,39 +1,23 @@ -/* -* Copyright (C) 2019 ~ 2021 Uniontech Software Technology Co.,Ltd. -* -* Author: zhengxiaokang -* -* Maintainer: zhengxiaokang -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_SCHEDULEITEM_H #define TEST_SCHEDULEITEM_H -#include -#include -#include "graphicsItem/scheduleitem.h" +//#include +//#include +//#include "graphicsItem/scheduleitem.h" -class test_scheduleitem : public ::QObject - , public ::testing::Test -{ -public: - test_scheduleitem(); - ~test_scheduleitem(); +//class test_scheduleitem : public ::QObject +// , public ::testing::Test +//{ +//public: +// test_scheduleitem(); +// ~test_scheduleitem(); -protected: - CScheduleItem *mScheduleItem = nullptr; -}; +//protected: +// CScheduleItem *mScheduleItem = nullptr; +//}; #endif // TEST_SCHEDULEITEM_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_widget/test_dayWidget/test_dayhuangliview.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_widget/test_dayWidget/test_dayhuangliview.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_widget/test_dayWidget/test_dayhuangliview.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_widget/test_dayWidget/test_dayhuangliview.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,63 +1,47 @@ -/* -* Copyright (C) 2019 ~ 2021 Uniontech Software Technology Co.,Ltd. -* -* Author: zhengxiaokang -* -* Maintainer: zhengxiaokang -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "test_dayhuangliview.h" -test_dayhuangliview::test_dayhuangliview() -{ - mDayHuangLiLabel = new CDayHuangLiLabel(); -} - -test_dayhuangliview::~test_dayhuangliview() -{ - delete mDayHuangLiLabel; - mDayHuangLiLabel = nullptr; -} - -//void CDayHuangLiLabel::setbackgroundColor(QColor backgroundColor) -TEST_F(test_dayhuangliview, setbackgroundColor) -{ - mDayHuangLiLabel->setbackgroundColor(QColor(100, 100, 255)); -} - -//void CDayHuangLiLabel::setTextInfo(QColor tcolor, QFont font) -TEST_F(test_dayhuangliview, setTextInfo) -{ - mDayHuangLiLabel->setTextInfo(QColor(100, 100, 255), QFont()); -} - -//void CDayHuangLiLabel::setHuangLiText(QStringList vhuangli, int type) -TEST_F(test_dayhuangliview, setHuangLiText) -{ - QStringList strlist("嫁娶 入土"); - mDayHuangLiLabel->setHuangLiText(strlist, 1); - QStringList strlist1(""); - mDayHuangLiLabel->setHuangLiText(strlist1, 2); -} - -TEST_F(test_dayhuangliview, getPixmap) -{ - QStringList strlist("嫁娶 入土"); - mDayHuangLiLabel->setHuangLiText(strlist, 1); - mDayHuangLiLabel->setbackgroundColor(QColor(100, 100, 255)); - mDayHuangLiLabel->setFixedSize(200, 50); - QPixmap pixmap(mDayHuangLiLabel->size()); - mDayHuangLiLabel->render(&pixmap); -} +//test_dayhuangliview::test_dayhuangliview() +//{ +// mDayHuangLiLabel = new CDayHuangLiLabel(); +//} + +//test_dayhuangliview::~test_dayhuangliview() +//{ +// delete mDayHuangLiLabel; +// mDayHuangLiLabel = nullptr; +//} + +////void CDayHuangLiLabel::setbackgroundColor(QColor backgroundColor) +//TEST_F(test_dayhuangliview, setbackgroundColor) +//{ +// mDayHuangLiLabel->setbackgroundColor(QColor(100, 100, 255)); +//} + +////void CDayHuangLiLabel::setTextInfo(QColor tcolor, QFont font) +//TEST_F(test_dayhuangliview, setTextInfo) +//{ +// mDayHuangLiLabel->setTextInfo(QColor(100, 100, 255), QFont()); +//} + +////void CDayHuangLiLabel::setHuangLiText(QStringList vhuangli, int type) +//TEST_F(test_dayhuangliview, setHuangLiText) +//{ +// QStringList strlist("嫁娶 入土"); +// mDayHuangLiLabel->setHuangLiText(strlist, 1); +// QStringList strlist1(""); +// mDayHuangLiLabel->setHuangLiText(strlist1, 2); +//} + +//TEST_F(test_dayhuangliview, getPixmap) +//{ +// QStringList strlist("嫁娶 入土"); +// mDayHuangLiLabel->setHuangLiText(strlist, 1); +// mDayHuangLiLabel->setbackgroundColor(QColor(100, 100, 255)); +// mDayHuangLiLabel->setFixedSize(200, 50); +// QPixmap pixmap(mDayHuangLiLabel->size()); +// mDayHuangLiLabel->render(&pixmap); +//} diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_widget/test_dayWidget/test_dayhuangliview.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_widget/test_dayWidget/test_dayhuangliview.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_widget/test_dayWidget/test_dayhuangliview.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_widget/test_dayWidget/test_dayhuangliview.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,39 +1,23 @@ -/* -* Copyright (C) 2019 ~ 2021 Uniontech Software Technology Co.,Ltd. -* -* Author: zhengxiaokang -* -* Maintainer: zhengxiaokang -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_DAYHUANGLIVIEW_H #define TEST_DAYHUANGLIVIEW_H -#include -#include -#include +//#include +//#include +//#include -class test_dayhuangliview : public QObject - , public ::testing::Test -{ -public: - test_dayhuangliview(); - ~test_dayhuangliview(); +//class test_dayhuangliview : public QObject +// , public ::testing::Test +//{ +//public: +// test_dayhuangliview(); +// ~test_dayhuangliview(); -protected: - CDayHuangLiLabel *mDayHuangLiLabel = nullptr; -}; +//protected: +// CDayHuangLiLabel *mDayHuangLiLabel = nullptr; +//}; #endif // TEST_DAYHUANGLIVIEW_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_widget/test_dayWidget/test_daymonthview.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_widget/test_dayWidget/test_daymonthview.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_widget/test_dayWidget/test_daymonthview.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_widget/test_dayWidget/test_daymonthview.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,143 +1,127 @@ -/* -* Copyright (C) 2019 ~ 2021 Uniontech Software Technology Co.,Ltd. -* -* Author: zhengxiaokang -* -* Maintainer: zhengxiaokang -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "test_daymonthview.h" -test_daymonthview::test_daymonthview() -{ - mDayMonthView = new CDayMonthView(); -} - -test_daymonthview::~test_daymonthview() -{ - delete mDayMonthView; - mDayMonthView = nullptr; -} - -QVector dayMonthviewGetDayList() -{ - QVector dateList {}; - QDate currentDate = QDate::currentDate(); - for (int i = 0; i < 42; i++) { - dateList.append(currentDate.addDays(i)); - } - - return dateList; -} - -QMap dayMonthViewGetHuangLiDayInfo() -{ - QMap huangLiDayInfo {}; - CaHuangLiDayInfo huangLiInfo1 {}; - huangLiInfo1.mGanZhiYear = "辛丑牛年"; //年干支 - huangLiInfo1.mGanZhiMonth = "庚寅月"; //月干支 - huangLiInfo1.mGanZhiDay = "辛卯日"; //日干支 - huangLiInfo1.mLunarMonthName = "正月"; //农历月名称 - huangLiInfo1.mLunarDayName = "初一"; //农历日名称 - huangLiInfo1.mLunarLeapMonth = 4; //闰月 - huangLiInfo1.mZodiac = "牛"; //生肖 - huangLiInfo1.mTerm = ""; //农历节气 - huangLiInfo1.mSolarFestival = "国庆节"; //阳历节日 - huangLiInfo1.mLunarFestival = "除夕"; //农历节日 - huangLiInfo1.mSuit = "嫁娶"; //黄历宜 - huangLiInfo1.mAvoid = "入土"; //黄历忌 - - huangLiDayInfo.insert(QDate::currentDate(), huangLiInfo1); - return huangLiDayInfo; -} - -QVector dayMonthViewGetLineFlag() -{ - QVector flags {}; - for (int i = 0; i < 42; i++) { - flags.append(true); - } - return flags; -} - -//void CDayMonthView::setShowDate(const QVector &showDate, const QDate &selectDate, const QDate ¤tDate) -TEST_F(test_daymonthview, setShowDate) -{ - mDayMonthView->setShowDate(dayMonthviewGetDayList(), QDate::currentDate(), QDate::currentDate()); -} - -//void CDayMonthView::setLunarVisible(bool visible) -TEST_F(test_daymonthview, setLunarVisible) -{ - mDayMonthView->setLunarVisible(true); -} - -//void CDayMonthView::setTheMe(int type) -TEST_F(test_daymonthview, setTheMe) -{ - mDayMonthView->setTheMe(1); - mDayMonthView->setTheMe(2); -} - -//void CDayMonthView::setSearchFlag(bool flag) -TEST_F(test_daymonthview, setSearchFlag) -{ - mDayMonthView->setSearchFlag(true); -} - -//void CDayMonthView::setHuangLiInfo(const CaHuangLiDayInfo &huangLiInfo) -TEST_F(test_daymonthview, setHuangLiInfo) -{ - mDayMonthView->setHuangLiInfo(dayMonthViewGetHuangLiDayInfo().value(QDate::currentDate())); -} - -//void CDayMonthView::setHasScheduleFlag(const QVector &hasScheduleFlag) -TEST_F(test_daymonthview, setHasScheduleFlag) -{ - mDayMonthView->setHasScheduleFlag(dayMonthViewGetLineFlag()); -} - -//void CDayMonthView::updateDateLunarDay() -TEST_F(test_daymonthview, updateDateLunarDay) -{ - mDayMonthView->updateDateLunarDay(); -} - -//void CDayMonthView::changeSelectDate(const QDate &date) -TEST_F(test_daymonthview, changeSelectDate) -{ - mDayMonthView->changeSelectDate(QDate::currentDate()); -} - -//void CDayMonthView::slotprev() -TEST_F(test_daymonthview, slotprev) -{ - mDayMonthView->setShowDate(dayMonthviewGetDayList(), QDate::currentDate().addDays(1), QDate::currentDate().addDays(1)); - mDayMonthView->slotprev(); -} - -//void CDayMonthView::slotnext() -TEST_F(test_daymonthview, slotnext) -{ - mDayMonthView->setShowDate(dayMonthviewGetDayList(), QDate::currentDate().addDays(1), QDate::currentDate().addDays(1)); - mDayMonthView->slotnext(); -} - -//void CDayMonthView::slottoday() -TEST_F(test_daymonthview, slottoday) -{ - mDayMonthView->setShowDate(dayMonthviewGetDayList(), QDate::currentDate().addDays(1), QDate::currentDate().addDays(1)); - mDayMonthView->slottoday(); -} +//test_daymonthview::test_daymonthview() +//{ +// mDayMonthView = new CDayMonthView(); +//} + +//test_daymonthview::~test_daymonthview() +//{ +// delete mDayMonthView; +// mDayMonthView = nullptr; +//} + +//QVector dayMonthviewGetDayList() +//{ +// QVector dateList {}; +// QDate currentDate = QDate::currentDate(); +// for (int i = 0; i < 42; i++) { +// dateList.append(currentDate.addDays(i)); +// } + +// return dateList; +//} + +//QMap dayMonthViewGetHuangLiDayInfo() +//{ +// QMap huangLiDayInfo {}; +// CaHuangLiDayInfo huangLiInfo1 {}; +// huangLiInfo1.mGanZhiYear = "辛丑牛年"; //年干支 +// huangLiInfo1.mGanZhiMonth = "庚寅月"; //月干支 +// huangLiInfo1.mGanZhiDay = "辛卯日"; //日干支 +// huangLiInfo1.mLunarMonthName = "正月"; //农历月名称 +// huangLiInfo1.mLunarDayName = "初一"; //农历日名称 +// huangLiInfo1.mLunarLeapMonth = 4; //闰月 +// huangLiInfo1.mZodiac = "牛"; //生肖 +// huangLiInfo1.mTerm = ""; //农历节气 +// huangLiInfo1.mSolarFestival = "国庆节"; //阳历节日 +// huangLiInfo1.mLunarFestival = "除夕"; //农历节日 +// huangLiInfo1.mSuit = "嫁娶"; //黄历宜 +// huangLiInfo1.mAvoid = "入土"; //黄历忌 + +// huangLiDayInfo.insert(QDate::currentDate(), huangLiInfo1); +// return huangLiDayInfo; +//} + +//QVector dayMonthViewGetLineFlag() +//{ +// QVector flags {}; +// for (int i = 0; i < 42; i++) { +// flags.append(true); +// } +// return flags; +//} + +////void CDayMonthView::setShowDate(const QVector &showDate, const QDate &selectDate, const QDate ¤tDate) +//TEST_F(test_daymonthview, setShowDate) +//{ +// mDayMonthView->setShowDate(dayMonthviewGetDayList(), QDate::currentDate(), QDate::currentDate()); +//} + +////void CDayMonthView::setLunarVisible(bool visible) +//TEST_F(test_daymonthview, setLunarVisible) +//{ +// mDayMonthView->setLunarVisible(true); +//} + +////void CDayMonthView::setTheMe(int type) +//TEST_F(test_daymonthview, setTheMe) +//{ +// mDayMonthView->setTheMe(1); +// mDayMonthView->setTheMe(2); +//} + +////void CDayMonthView::setSearchFlag(bool flag) +//TEST_F(test_daymonthview, setSearchFlag) +//{ +// mDayMonthView->setSearchFlag(true); +//} + +////void CDayMonthView::setHuangLiInfo(const CaHuangLiDayInfo &huangLiInfo) +//TEST_F(test_daymonthview, setHuangLiInfo) +//{ +// mDayMonthView->setHuangLiInfo(dayMonthViewGetHuangLiDayInfo().value(QDate::currentDate())); +//} + +////void CDayMonthView::setHasScheduleFlag(const QVector &hasScheduleFlag) +//TEST_F(test_daymonthview, setHasScheduleFlag) +//{ +// mDayMonthView->setHasScheduleFlag(dayMonthViewGetLineFlag()); +//} + +////void CDayMonthView::updateDateLunarDay() +//TEST_F(test_daymonthview, updateDateLunarDay) +//{ +// mDayMonthView->updateDateLunarDay(); +//} + +////void CDayMonthView::changeSelectDate(const QDate &date) +//TEST_F(test_daymonthview, changeSelectDate) +//{ +// mDayMonthView->changeSelectDate(QDate::currentDate()); +//} + +////void CDayMonthView::slotprev() +//TEST_F(test_daymonthview, slotprev) +//{ +// mDayMonthView->setShowDate(dayMonthviewGetDayList(), QDate::currentDate().addDays(1), QDate::currentDate().addDays(1)); +// mDayMonthView->slotprev(); +//} + +////void CDayMonthView::slotnext() +//TEST_F(test_daymonthview, slotnext) +//{ +// mDayMonthView->setShowDate(dayMonthviewGetDayList(), QDate::currentDate().addDays(1), QDate::currentDate().addDays(1)); +// mDayMonthView->slotnext(); +//} + +////void CDayMonthView::slottoday() +//TEST_F(test_daymonthview, slottoday) +//{ +// mDayMonthView->setShowDate(dayMonthviewGetDayList(), QDate::currentDate().addDays(1), QDate::currentDate().addDays(1)); +// mDayMonthView->slottoday(); +//} diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_widget/test_dayWidget/test_daymonthview.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_widget/test_dayWidget/test_daymonthview.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_widget/test_dayWidget/test_daymonthview.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_widget/test_dayWidget/test_daymonthview.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,39 +1,23 @@ -/* -* Copyright (C) 2019 ~ 2021 Uniontech Software Technology Co.,Ltd. -* -* Author: zhengxiaokang -* -* Maintainer: zhengxiaokang -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_DAYMONTHVIEW_H #define TEST_DAYMONTHVIEW_H -#include -#include -#include +//#include +//#include +//#include -class test_daymonthview : public QObject - , public ::testing::Test -{ -public: - test_daymonthview(); - ~test_daymonthview(); +//class test_daymonthview : public QObject +// , public ::testing::Test +//{ +//public: +// test_daymonthview(); +// ~test_daymonthview(); -protected: - CDayMonthView *mDayMonthView = nullptr; -}; +//protected: +// CDayMonthView *mDayMonthView = nullptr; +//}; #endif // TEST_DAYMONTHVIEW_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_widget/test_dayWidget/test_daywindow.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_widget/test_dayWidget/test_daywindow.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_widget/test_dayWidget/test_daywindow.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_widget/test_dayWidget/test_daywindow.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,79 +1,63 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "test_daywindow.h" -test_dayWindow::test_dayWindow() -{ -} - -void test_dayWindow::SetUp() -{ - QDateTime currentTime = QDateTime::currentDateTime(); - m_dayWindow = new CDayWindow(); - m_dayWindow->setCurrentDateTime(currentTime); - m_dayWindow->setSelectDate(currentTime.date()); -} - -void test_dayWindow::TearDown() -{ - delete m_dayWindow; - m_dayWindow = nullptr; -} - -//测试paintevent -TEST_F(test_dayWindow, getPixmap) -{ - m_dayWindow->setFixedSize(800, 600); - QPixmap pixmap(m_dayWindow->size()); - m_dayWindow->render(&pixmap); -} - -//setTheme -TEST_F(test_dayWindow, setTheme) -{ - m_dayWindow->setTheMe(0); - m_dayWindow->setTheMe(1); - m_dayWindow->setTheMe(2); -} - -//setSearchWFlag -TEST_F(test_dayWindow, setSearchWFlag) -{ - m_dayWindow->setSearchWFlag(false); -} - -//slotChangeSelectDate -TEST_F(test_dayWindow, slotChangeSelectDate) -{ - m_dayWindow->slotChangeSelectDate(m_dayWindow->getSelectDate()); -} - -//slotSwitchPrePage -TEST_F(test_dayWindow, slotSwitchPrePage) -{ - m_dayWindow->slotSwitchPrePage(); -} - -//slotSwitchNextPage -TEST_F(test_dayWindow, slotSwitchNextPage) -{ - m_dayWindow->slotSwitchNextPage(); -} +//test_dayWindow::test_dayWindow() +//{ +//} + +//void test_dayWindow::SetUp() +//{ +// QDateTime currentTime = QDateTime::currentDateTime(); +// m_dayWindow = new CDayWindow(); +// m_dayWindow->setCurrentDateTime(currentTime); +// m_dayWindow->setSelectDate(currentTime.date()); +//} + +//void test_dayWindow::TearDown() +//{ +// delete m_dayWindow; +// m_dayWindow = nullptr; +//} + +////测试paintevent +//TEST_F(test_dayWindow, getPixmap) +//{ +// m_dayWindow->setFixedSize(800, 600); +// QPixmap pixmap(m_dayWindow->size()); +// m_dayWindow->render(&pixmap); +//} + +////setTheme +//TEST_F(test_dayWindow, setTheme) +//{ +// m_dayWindow->setTheMe(0); +// m_dayWindow->setTheMe(1); +// m_dayWindow->setTheMe(2); +//} + +////setSearchWFlag +//TEST_F(test_dayWindow, setSearchWFlag) +//{ +// m_dayWindow->setSearchWFlag(false); +//} + +////slotChangeSelectDate +//TEST_F(test_dayWindow, slotChangeSelectDate) +//{ +// m_dayWindow->slotChangeSelectDate(m_dayWindow->getSelectDate()); +//} + +////slotSwitchPrePage +//TEST_F(test_dayWindow, slotSwitchPrePage) +//{ +// m_dayWindow->slotSwitchPrePage(); +//} + +////slotSwitchNextPage +//TEST_F(test_dayWindow, slotSwitchNextPage) +//{ +// m_dayWindow->slotSwitchNextPage(); +//} diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_widget/test_dayWidget/test_daywindow.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_widget/test_dayWidget/test_daywindow.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_widget/test_dayWidget/test_daywindow.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_widget/test_dayWidget/test_daywindow.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,44 +1,28 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_DAYWINDOW_H #define TEST_DAYWINDOW_H -#include "gtest/gtest.h" -#include "dayWidget/daywindow.h" +//#include "gtest/gtest.h" +//#include "dayWidget/daywindow.h" + +//#include -#include +//class test_dayWindow : public QObject +// , public ::testing::Test +//{ +// Q_OBJECT +//public: +// test_dayWindow(); +// void SetUp() override; +// void TearDown() override; +//signals: -class test_dayWindow : public QObject - , public ::testing::Test -{ - Q_OBJECT -public: - test_dayWindow(); - void SetUp() override; - void TearDown() override; -signals: - -public slots: -public: - CDayWindow *m_dayWindow; -}; +//public slots: +//public: +// CDayWindow *m_dayWindow; +//}; #endif // TEST_DAYWINDOW_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_widget/test_monthWidget/test_monthdayview.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_widget/test_monthWidget/test_monthdayview.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_widget/test_monthWidget/test_monthdayview.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_widget/test_monthWidget/test_monthdayview.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,231 +1,212 @@ -/* -* Copyright (C) 2019 ~ 2021 Uniontech Software Technology Co.,Ltd. -* -* Author: zhengxiaokang -* -* Maintainer: zhengxiaokang -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ -#include "test_monthdayview.h" -#include "touchgestureoperation.h" -#include "../third-party_stub/stub.h" - -#include -#include - -static int monthdayview_int = 0; - -static int monthdayview_stub_int() -{ - return monthdayview_int; -} - -static bool monthdayview_stub_event(QEvent *) -{ - return true; -} - -test_monthdayview::test_monthdayview() -{ - mMonthDayView = new CMonthDayView(); - mMonthWidget = new CMonthWidget(); - mMonthRect = new CMonthRect(); -} - -test_monthdayview::~test_monthdayview() -{ - delete mMonthDayView; - mMonthDayView = nullptr; - delete mMonthWidget; - mMonthWidget = nullptr; - delete mMonthRect; - mMonthRect = nullptr; -} - -//void CMonthDayView::setSelectDate(const QDate &date) -TEST_F(test_monthdayview, setSelectdate) -{ - mMonthDayView->setSelectDate(QDate::currentDate()); -} - -//void CMonthDayView::setTheMe(int type) -TEST_F(test_monthdayview, setTheMe) -{ - mMonthDayView->setTheMe(1); - mMonthDayView->setTheMe(2); -} - -//void CMonthDayView::setSearchflag(bool flag) -TEST_F(test_monthdayview, setSearchflag) -{ - mMonthDayView->setSearchflag(false); -} - -TEST_F(test_monthdayview, event_01) -{ - Stub stub; - stub.set(ADDR(touchGestureOperation, getTouchState), monthdayview_stub_int); - QMouseEvent e(QEvent::MouseButtonPress, QPointF(1, 1), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); - mMonthDayView->event(&e); -} - -//void CMonthWidget::setDate(const QDate date[12]) -TEST_F(test_monthdayview, setDate) -{ - QDate m_days[12]; - QDate currentDate = QDate::currentDate(); - for (int i = 0; i < 12; i++) { - m_days[i] = currentDate.addDays(i); - } - mMonthWidget->setDate(m_days); -} - -//void CMonthWidget::updateSize() -TEST_F(test_monthdayview, updateSize) -{ - mMonthWidget->updateSize(); -} - -//void CMonthRect::setDate(const QDate &date) -TEST_F(test_monthdayview, setRectDate) -{ - mMonthRect->setDate(QDate::currentDate()); - mMonthRect->getDate(); -} - -//void CMonthRect::setRect(const QRectF &rect) -TEST_F(test_monthdayview, setRect) -{ - mMonthRect->setRect(QRectF()); - mMonthRect->rect(); -} - -//void CMonthRect::setDevicePixelRatio(const qreal pixel) -TEST_F(test_monthdayview, setDevicePixelRatio) -{ - mMonthRect->setDevicePixelRatio(1.2); -} - -//void CMonthRect::setTheMe(int type) -TEST_F(test_monthdayview, setRTheMe) -{ - mMonthRect->setTheMe(1); - mMonthRect->setTheMe(2); -} - -TEST_F(test_monthdayview, paintEvent_01) -{ - QPaintEvent paint(QRect(0, 0, 1, 1)); - mMonthWidget->paintEvent(&paint); -} - -TEST_F(test_monthdayview, mouseReleaseEvent_01) -{ - QMouseEvent e(QEvent::MouseButtonPress, QPointF(1, 1), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); - mMonthWidget->mouseReleaseEvent(&e); -} - -TEST_F(test_monthdayview, keyPressEvent_01) -{ - QKeyEvent e(QEvent::KeyPress, Qt::Key_Left, Qt::NoModifier); - mMonthWidget->keyPressEvent(&e); -} - -TEST_F(test_monthdayview, keyPressEvent_02) -{ - QKeyEvent e(QEvent::KeyPress, Qt::Key_Right, Qt::NoModifier); - mMonthWidget->keyPressEvent(&e); -} - -TEST_F(test_monthdayview, keyPressEvent_03) -{ - QKeyEvent e(QEvent::KeyPress, Qt::Key_Up, Qt::NoModifier); - mMonthWidget->keyPressEvent(&e); -} - -TEST_F(test_monthdayview, focusInEvent_01) -{ - QFocusEvent e(QEvent::FocusIn, Qt::TabFocusReason); - mMonthWidget->focusInEvent(&e); - EXPECT_TRUE(mMonthWidget->m_isFocus); -} - -TEST_F(test_monthdayview, focusInEvent_02) -{ - QFocusEvent e(QEvent::FocusIn, Qt::OtherFocusReason); - mMonthWidget->focusInEvent(&e); - EXPECT_FALSE(mMonthWidget->m_isFocus); -} - -TEST_F(test_monthdayview, focusOutEvent_01) -{ - QFocusEvent e(QEvent::FocusIn, Qt::OtherFocusReason); - mMonthWidget->focusOutEvent(&e); - EXPECT_FALSE(mMonthWidget->m_isFocus); -} - -TEST_F(test_monthdayview, mousePress_01) -{ - mMonthWidget->mousePress(QPoint(0, 0)); - EXPECT_FALSE(mMonthWidget->m_isFocus); -} - -TEST_F(test_monthdayview, updateSize_01) -{ - mMonthWidget->updateSize(); -} - -TEST_F(test_monthdayview, getMousePosItem_01) -{ - mMonthWidget->getMousePosItem(QPointF()); -} - -TEST_F(test_monthdayview, updateShowDate_01) -{ - mMonthWidget->updateShowDate(QDate()); -} - -TEST_F(test_monthdayview, paintItem_01) -{ - mMonthRect->m_Date = QDate(2022, 4, 22); - QPainter pa(mMonthWidget); - mMonthRect->paintItem(&pa, QRect(), true); -} - -TEST_F(test_monthdayview, paintItem_02) -{ - mMonthRect->m_Date = QDate(2022, 4, 22); - mMonthRect->m_SelectRect = mMonthRect; - QPainter pa(mMonthWidget); - mMonthRect->paintItem(&pa, QRect(), true); -} - -TEST_F(test_monthdayview, setDevicePixelRatio_01) -{ - mMonthRect->setDevicePixelRatio(10); - EXPECT_EQ(mMonthRect->m_DevicePixelRatio, 10); -} - -TEST_F(test_monthdayview, setTheMe_01) -{ - mMonthRect->setTheMe(0); - EXPECT_EQ(mMonthRect->m_defaultTextColor, Qt::black); -} - -TEST_F(test_monthdayview, setTheMe_02) -{ - mMonthRect->setTheMe(2); - EXPECT_EQ(mMonthRect->m_defaultTextColor, QColor("#C0C6D4")); -} +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +//#include "test_monthdayview.h" +//#include "touchgestureoperation.h" +//#include "../third-party_stub/stub.h" + +//#include +//#include + +//static int monthdayview_int = 0; + +//static int monthdayview_stub_int() +//{ +// return monthdayview_int; +//} + +//test_monthdayview::test_monthdayview() +//{ +// mMonthDayView = new CMonthDayView(); +// mMonthWidget = new CMonthWidget(); +// mMonthRect = new CMonthRect(); +// mMonthRect->setDate(QDate()); +// CMonthRect::setSelectRect(mMonthRect); +//} + +//test_monthdayview::~test_monthdayview() +//{ +// delete mMonthDayView; +// mMonthDayView = nullptr; +// delete mMonthWidget; +// mMonthWidget = nullptr; +// delete mMonthRect; +// mMonthRect = nullptr; +//} + +////void CMonthDayView::setSelectDate(const QDate &date) +//TEST_F(test_monthdayview, setSelectdate) +//{ +// mMonthDayView->setSelectDate(QDate::currentDate()); +//} + +////void CMonthDayView::setTheMe(int type) +//TEST_F(test_monthdayview, setTheMe) +//{ +// mMonthDayView->setTheMe(1); +// mMonthDayView->setTheMe(2); +//} + +////void CMonthDayView::setSearchflag(bool flag) +//TEST_F(test_monthdayview, setSearchflag) +//{ +// mMonthDayView->setSearchflag(false); +//} + +//TEST_F(test_monthdayview, event_01) +//{ +// Stub stub; +// stub.set(ADDR(touchGestureOperation, getTouchState), monthdayview_stub_int); +// QMouseEvent e(QEvent::MouseButtonPress, QPointF(1, 1), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); +// mMonthDayView->event(&e); +//} + +////void CMonthWidget::setDate(const QDate date[12]) +//TEST_F(test_monthdayview, setDate) +//{ +// QDate m_days[12]; +// QDate currentDate = QDate::currentDate(); +// for (int i = 0; i < 12; i++) { +// m_days[i] = currentDate.addDays(i); +// } +// mMonthWidget->setDate(m_days); +//} + +////void CMonthWidget::updateSize() +//TEST_F(test_monthdayview, updateSize) +//{ +// mMonthWidget->updateSize(); +//} + +////void CMonthRect::setDate(const QDate &date) +//TEST_F(test_monthdayview, setRectDate) +//{ +// mMonthRect->setDate(QDate::currentDate()); +// mMonthRect->getDate(); +//} + +////void CMonthRect::setRect(const QRectF &rect) +//TEST_F(test_monthdayview, setRect) +//{ +// mMonthRect->setRect(QRectF()); +// mMonthRect->rect(); +//} + +////void CMonthRect::setDevicePixelRatio(const qreal pixel) +//TEST_F(test_monthdayview, setDevicePixelRatio) +//{ +// mMonthRect->setDevicePixelRatio(1.2); +//} + +////void CMonthRect::setTheMe(int type) +//TEST_F(test_monthdayview, setRTheMe) +//{ +// mMonthRect->setTheMe(1); +// mMonthRect->setTheMe(2); +//} + +//TEST_F(test_monthdayview, paintEvent_01) +//{ +// QPaintEvent paint(QRect(0, 0, 1, 1)); +// mMonthWidget->paintEvent(&paint); +//} + +//TEST_F(test_monthdayview, mouseReleaseEvent_01) +//{ +// QMouseEvent e(QEvent::MouseButtonPress, QPointF(1, 1), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); +// mMonthWidget->mouseReleaseEvent(&e); +//} + +//TEST_F(test_monthdayview, keyPressEvent_01) +//{ +// QKeyEvent e(QEvent::KeyPress, Qt::Key_Left, Qt::NoModifier); +// mMonthWidget->keyPressEvent(&e); +//} + +//TEST_F(test_monthdayview, keyPressEvent_02) +//{ +// QKeyEvent e(QEvent::KeyPress, Qt::Key_Right, Qt::NoModifier); +// mMonthWidget->keyPressEvent(&e); +//} + +//TEST_F(test_monthdayview, keyPressEvent_03) +//{ +// QKeyEvent e(QEvent::KeyPress, Qt::Key_Up, Qt::NoModifier); +// mMonthWidget->keyPressEvent(&e); +//} + +//TEST_F(test_monthdayview, focusInEvent_01) +//{ +// QFocusEvent e(QEvent::FocusIn, Qt::TabFocusReason); +// mMonthWidget->focusInEvent(&e); +// EXPECT_TRUE(mMonthWidget->m_isFocus); +//} + +//TEST_F(test_monthdayview, focusInEvent_02) +//{ +// QFocusEvent e(QEvent::FocusIn, Qt::OtherFocusReason); +// mMonthWidget->focusInEvent(&e); +// EXPECT_FALSE(mMonthWidget->m_isFocus); +//} + +//TEST_F(test_monthdayview, focusOutEvent_01) +//{ +// QFocusEvent e(QEvent::FocusIn, Qt::OtherFocusReason); +// mMonthWidget->focusOutEvent(&e); +// EXPECT_FALSE(mMonthWidget->m_isFocus); +//} + +//TEST_F(test_monthdayview, mousePress_01) +//{ +// mMonthWidget->mousePress(QPoint(0, 0)); +// EXPECT_FALSE(mMonthWidget->m_isFocus); +//} + +//TEST_F(test_monthdayview, updateSize_01) +//{ +// mMonthWidget->updateSize(); +//} + +//TEST_F(test_monthdayview, getMousePosItem_01) +//{ +// mMonthWidget->getMousePosItem(QPointF()); +//} + +//TEST_F(test_monthdayview, updateShowDate_01) +//{ +// mMonthWidget->updateShowDate(QDate()); +//} + +//TEST_F(test_monthdayview, paintItem_01) +//{ +// mMonthRect->m_Date = QDate(2022, 4, 22); +// QPainter pa(mMonthWidget); +// mMonthRect->paintItem(&pa, QRect(), true); +//} + +//TEST_F(test_monthdayview, paintItem_02) +//{ +// mMonthRect->m_Date = QDate(2022, 4, 22); +// mMonthRect->m_SelectRect = mMonthRect; +// QPainter pa(mMonthWidget); +// mMonthRect->paintItem(&pa, QRect(), true); +//} + +//TEST_F(test_monthdayview, setDevicePixelRatio_01) +//{ +// mMonthRect->setDevicePixelRatio(10); +// EXPECT_EQ(mMonthRect->m_DevicePixelRatio, 10); +//} + +//TEST_F(test_monthdayview, setTheMe_01) +//{ +// mMonthRect->setTheMe(0); +// EXPECT_EQ(mMonthRect->m_defaultTextColor, Qt::black); +//} + +//TEST_F(test_monthdayview, setTheMe_02) +//{ +// mMonthRect->setTheMe(2); +// EXPECT_EQ(mMonthRect->m_defaultTextColor, QColor("#C0C6D4")); +//} diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_widget/test_monthWidget/test_monthdayview.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_widget/test_monthWidget/test_monthdayview.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_widget/test_monthWidget/test_monthdayview.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_widget/test_monthWidget/test_monthdayview.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,41 +1,25 @@ -/* -* Copyright (C) 2019 ~ 2021 Uniontech Software Technology Co.,Ltd. -* -* Author: zhengxiaokang -* -* Maintainer: zhengxiaokang -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_MONTHDAYVIEW_H #define TEST_MONTHDAYVIEW_H #include -#include "monthWidget/monthdayview.h" -#include "gtest/gtest.h" +//#include "monthWidget/monthdayview.h" +//#include "gtest/gtest.h" -class test_monthdayview : public QObject - , public ::testing::Test -{ -public: - test_monthdayview(); - ~test_monthdayview(); +//class test_monthdayview : public QObject +// , public ::testing::Test +//{ +//public: +// test_monthdayview(); +// ~test_monthdayview(); -protected: - CMonthDayView *mMonthDayView = nullptr; - CMonthWidget *mMonthWidget = nullptr; - CMonthRect *mMonthRect = nullptr; -}; +//protected: +// CMonthDayView *mMonthDayView = nullptr; +// CMonthWidget *mMonthWidget = nullptr; +// CMonthRect *mMonthRect = nullptr; +//}; #endif // TEST_MONTHDAYVIEW_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_widget/test_monthWidget/test_monthscheduleview.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_widget/test_monthWidget/test_monthscheduleview.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_widget/test_monthWidget/test_monthscheduleview.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_widget/test_monthWidget/test_monthscheduleview.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,378 +1,362 @@ -/* -* Copyright (C) 2019 ~ 2021 Uniontech Software Technology Co.,Ltd. -* -* Author: zhengxiaokang -* -* Maintainer: zhengxiaokang -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "test_monthscheduleview.h" #include "dataManage/scheduledaterangeinfo.h" -test_monthscheduleview::test_monthscheduleview() -{ - QRect rect; - m_scene = new QGraphicsScene(); - mMonthScheduleView = new CMonthScheduleView(nullptr, m_scene); - mMonthScheduleWidgetItem = new CMonthScheduleItem(rect); - mWeekScheduleView = new CWeekScheduleView(); - mMonthScheduleNumButton = new CMonthScheduleNumItem(); -} - -test_monthscheduleview::~test_monthscheduleview() -{ - delete mMonthScheduleView; - mMonthScheduleView = nullptr; - delete m_scene; - m_scene = nullptr; - delete mWeekScheduleView; - mWeekScheduleView = nullptr; - delete mMonthScheduleNumButton; - mMonthScheduleNumButton = nullptr; - delete mMonthScheduleWidgetItem; - mMonthScheduleWidgetItem = nullptr; -} - -QVector getMonthScheduleDInfo() -{ - QVector scheduleDate {}; - ScheduleDataInfo schedule1, schedule2, schedule3, schedule4, schedule5, scheduleFes; - QDateTime currentDateTime = QDateTime::currentDateTime(); - - schedule1.setID(1); - schedule1.setBeginDateTime(currentDateTime); - schedule1.setEndDateTime(currentDateTime.addDays(1)); - schedule1.setTitleName("scheduleOne"); - schedule1.setAllDay(true); - schedule1.setType(1); - schedule1.setRecurID(0); - - schedule2.setID(2); - schedule2.setBeginDateTime(currentDateTime.addDays(1)); - schedule2.setEndDateTime(currentDateTime.addDays(1).addSecs(60 * 60)); - schedule2.setTitleName("scheduleTwo"); - schedule2.setAllDay(true); - schedule2.setType(2); - schedule2.setRecurID(0); - - schedule3.setID(3); - schedule3.setBeginDateTime(currentDateTime.addDays(2)); - schedule3.setEndDateTime(currentDateTime.addDays(2).addSecs(60 * 60)); - schedule3.setTitleName("scheduleThree"); - schedule3.setAllDay(false); - schedule3.setType(3); - schedule3.setRecurID(0); - - schedule4.setID(4); - schedule4.setBeginDateTime(currentDateTime.addDays(3)); - schedule4.setEndDateTime(currentDateTime.addDays(3).addSecs(60 * 60)); - schedule4.setTitleName("scheduleFour"); - schedule4.setAllDay(false); - schedule4.setType(1); - schedule4.setRecurID(0); - - schedule5.setID(5); - schedule5.setBeginDateTime(currentDateTime.addDays(4)); - schedule5.setEndDateTime(currentDateTime.addDays(4).addSecs(60 * 60)); - schedule5.setTitleName("scheduleFive"); - schedule5.setAllDay(false); - schedule5.setType(2); - schedule5.setRecurID(0); - - scheduleFes.setID(6); - scheduleFes.setBeginDateTime(currentDateTime.addDays(5)); - scheduleFes.setEndDateTime(currentDateTime.addDays(5).addSecs(60 * 60)); - scheduleFes.setTitleName("scheduleFestival"); - scheduleFes.setAllDay(true); - scheduleFes.setType(4); - scheduleFes.setRecurID(0); - - scheduleDate.append(schedule1); - scheduleDate.append(schedule2); - scheduleDate.append(schedule3); - scheduleDate.append(schedule4); - scheduleDate.append(schedule5); - scheduleDate.append(scheduleFes); - return scheduleDate; -} - -QMap> getMonthMapScheduleDInfo(int getDays) -{ - QDate currentDate = QDate::currentDate(); - QVector scheduleInfo {}; - QMap> scheduleDateInfo {}; - switch (getDays) { - case 0: { - scheduleInfo.append(getMonthScheduleDInfo().at(0)); - scheduleDateInfo[currentDate] = scheduleInfo; - } break; - case 1: { - scheduleInfo.append(getMonthScheduleDInfo().at(1)); - scheduleDateInfo[currentDate.addDays(1)] = scheduleInfo; - } break; - case 2: { - scheduleInfo.append(getMonthScheduleDInfo().at(2)); - scheduleDateInfo[currentDate.addDays(2)] = scheduleInfo; - } break; - default: { - scheduleInfo.append(getMonthScheduleDInfo().at(3)); - scheduleDateInfo[currentDate.addDays(3)] = scheduleInfo; - scheduleInfo.append(getMonthScheduleDInfo().at(4)); - scheduleDateInfo[currentDate.addDays(4)] = scheduleInfo; - scheduleInfo.append(getMonthScheduleDInfo().at(5)); - scheduleDateInfo[currentDate.addDays(5)] = scheduleInfo; - } break; - } - return scheduleDateInfo; -} - -QVector getScheduleDateRangeInfo() -{ - QVector scheduleDateRangeInfo {}; - MScheduleDateRangeInfo scheduledaterangeinfo1; - scheduledaterangeinfo1.num = 4; - scheduledaterangeinfo1.bdate = QDate::currentDate(); - scheduledaterangeinfo1.edate = QDate::currentDate().addDays(1); - scheduledaterangeinfo1.state = true; - scheduledaterangeinfo1.tData = getMonthScheduleDInfo().first(); - - // MScheduleDateRangeInfo scheduledaterangeinfo2; - // scheduledaterangeinfo2.num = 2; - // scheduledaterangeinfo2.bDate = QDate(2021, 1, 23); - // scheduledaterangeinfo2.eDate = QDate(2021, 1, 24); - // scheduledaterangeinfo2.state = false; - // scheduledaterangeinfo2.tData = getMonthScheduleDInfo().at(1); - - // MScheduleDateRangeInfo scheduledaterangeinfo3; - // scheduledaterangeinfo3.num = 2; - // scheduledaterangeinfo3.bDate = QDate(2021, 1, 25); - // scheduledaterangeinfo3.eDate = QDate(2021, 1, 26); - // scheduledaterangeinfo3.state = false; - // scheduledaterangeinfo3.tData = getMonthScheduleDInfo().at(2); - - // MScheduleDateRangeInfo scheduledaterangeinfo4; - // scheduledaterangeinfo4.num = 2; - // scheduledaterangeinfo4.bDate = QDate(2021, 1, 27); - // scheduledaterangeinfo4.eDate = QDate(2021, 1, 28); - // scheduledaterangeinfo4.state = false; - // scheduledaterangeinfo4.tData = getMonthScheduleDInfo().at(3); - - scheduleDateRangeInfo.append(scheduledaterangeinfo1); - // scheduleDateRangeInfo.append(scheduledaterangeinfo2); - // scheduleDateRangeInfo.append(scheduledaterangeinfo3); - // scheduleDateRangeInfo.append(scheduledaterangeinfo4); - - return scheduleDateRangeInfo; -} - -//void CMonthScheduleView::setallsize(int w, int h, int left, int top, int buttom, int itemHeight) -TEST_F(test_monthscheduleview, setallsize) -{ - mMonthScheduleView->setallsize(1, 1, 1, 1, 1, 1); -} - -//void CMonthScheduleView::setData(QMap > &data, int currentMonth) -TEST_F(test_monthscheduleview, setData) -{ - QMap> mapScheduleInfo = getMonthMapScheduleDInfo(4); - mMonthScheduleView->setData(mapScheduleInfo, 1); -} - -//void CMonthScheduleView::slotFontChange() -TEST_F(test_monthscheduleview, slotFontChange) -{ - mMonthScheduleView->slotFontChange(); -} - -//void CMonthScheduleView::updateData() -TEST_F(test_monthscheduleview, updateDate) -{ - mMonthScheduleView->updateData(); -} - -//void CMonthScheduleView::updateHeight() -TEST_F(test_monthscheduleview, updateHeight) -{ - mMonthScheduleView->updateHeight(); -} - -//QVector CMonthScheduleView::getScheduleShowItem() const -TEST_F(test_monthscheduleview, getScheduleShowItem) -{ - mMonthScheduleView->getScheduleShowItem(); -} - -//void CMonthScheduleView::updateDate(const ScheduleDataInfo &info) -TEST_F(test_monthscheduleview, updateData) -{ - mMonthScheduleView->updateDate(getMonthScheduleDInfo().first()); -} - -//void CMonthScheduleView::changeDate(const ScheduleDataInfo &info) -TEST_F(test_monthscheduleview, changeDate) -{ - mMonthScheduleView->changeDate(getMonthScheduleDInfo().first()); -} - -//void CMonthScheduleView::updateDate(const int row, const ScheduleDataInfo &info) -TEST_F(test_monthscheduleview, updatedate) -{ - mMonthScheduleView->updateDate(2, getMonthScheduleDInfo().first()); -} - -//void CMonthScheduleView::updateDateShow(QVector> &vCMDaySchedule, QVector &scheduleShowItem) -TEST_F(test_monthscheduleview, updateDateShow) -{ - QVector scheduleinfo = getScheduleDateRangeInfo(); - QVector> m_scheduledaterangeinfo {}; - QVector m_scheduleshowinfo {}; - m_scheduledaterangeinfo.append(scheduleinfo); - m_scheduleshowinfo.append(mMonthScheduleWidgetItem); - - mMonthScheduleView->updateDateShow(m_scheduledaterangeinfo, m_scheduleshowinfo); -} - -//void CMonthScheduleView::createScheduleItemWidget(MScheduleDateRangeInfo info, int cNum, QVector &scheduleShowItem) -TEST_F(test_monthscheduleview, createScheduleItemWidget) -{ - QVector scheduledaterangeinfo = getScheduleDateRangeInfo(); - QVector m_scheduleshowinfo {}; - m_scheduleshowinfo.append(mMonthScheduleWidgetItem); - mMonthScheduleView->createScheduleItemWidget(scheduledaterangeinfo.first(), 1, m_scheduleshowinfo); -} - -//void CMonthScheduleView::createScheduleNumWidget(MScheduleDateRangeInfo info, int cNum, QVector &scheduleShowItem) -TEST_F(test_monthscheduleview, createScheduleNumWidget) -{ - MScheduleDateRangeInfo scheduledaterangeinfo = getScheduleDateRangeInfo().first(); - QVector m_scheduleshowinfo {}; - QMap> mapScheduleInfo = getMonthMapScheduleDInfo(4); - mMonthScheduleView->setData(mapScheduleInfo, 3); - mMonthScheduleView->createScheduleNumWidget(scheduledaterangeinfo, 2, m_scheduleshowinfo); -} - -//void CMonthScheduleView::computePos(int cnum, QDate bgeindate, QDate enddate, QPoint &pos, int &fw, int &fh) -TEST_F(test_monthscheduleview, computePos) -{ - QDate bDate = QDate(2020, 1, 20); - QDate eDate = QDate(2021, 1, 23); - QPoint pos = QPoint(4, 4); - int fw = 8; - int fh = 8; - mMonthScheduleView->computePos(2, bDate, eDate, pos, fw, fh); -} - -//void CWeekScheduleView::setData(QMap > &data, const QDate &startDate, const QDate &stopDate) -TEST_F(test_monthscheduleview, setweekData) -{ - QMap> mapScheduleInfo = getMonthMapScheduleDInfo(4); - QDate startDate = QDate(2021, 1, 21); - QDate stopData = QDate(2021, 1, 27); - mWeekScheduleView->setData(mapScheduleInfo, startDate, stopData); -} - -//bool CWeekScheduleView::addData(const ScheduleDataInfo &info) -TEST_F(test_monthscheduleview, addData) -{ - QMap> mapScheduleInfo = getMonthMapScheduleDInfo(4); - QDate startDate = QDate::currentDate(); - QDate stopData = startDate.addDays(6); - mWeekScheduleView->setData(mapScheduleInfo, startDate, stopData); - bool re = mWeekScheduleView->addData(getMonthScheduleDInfo().first()); - EXPECT_TRUE(re); - - startDate = QDate::currentDate().addDays(-7); - stopData = QDate::currentDate().addDays(-1); - mWeekScheduleView->setData(mapScheduleInfo, startDate, stopData); - re = mWeekScheduleView->addData(getMonthScheduleDInfo().first()); - EXPECT_FALSE(re); -} - -//void CWeekScheduleView::changeDate(const ScheduleDataInfo &info) -TEST_F(test_monthscheduleview, changedate) -{ - mWeekScheduleView->changeDate(getMonthScheduleDInfo().first()); -} - -//void CWeekScheduleView::setHeight(const int ScheduleHeight, const int DayHeigth) -TEST_F(test_monthscheduleview, setHeight) -{ - mWeekScheduleView->setHeight(10, 10); -} - -//void CWeekScheduleView::updateSchedule(const bool isNormalDisplay, const ScheduleDataInfo &info) -TEST_F(test_monthscheduleview, updateSchedule) -{ - mWeekScheduleView->updateSchedule(true, getMonthScheduleDInfo().first()); - mWeekScheduleView->updateSchedule(false, getMonthScheduleDInfo().first()); -} - -//void CWeekScheduleView::clearItem() -TEST_F(test_monthscheduleview, clearItem) -{ - mWeekScheduleView->clearItem(); -} - -//void CWeekScheduleView::setMaxNum() -TEST_F(test_monthscheduleview, setMacNum) -{ - mWeekScheduleView->setMaxNum(); -} - -//void CWeekScheduleView::mScheduleClear() -TEST_F(test_monthscheduleview, mScheduleClear) -{ - mWeekScheduleView->mScheduleClear(); -} - -//void CWeekScheduleView::sortAndFilter(QVector &vMDaySchedule) -TEST_F(test_monthscheduleview, sortAndFileter) -{ - QVector scheduleinfo = getScheduleDateRangeInfo(); - mWeekScheduleView->setHeight(4, 20); - QMap> mapScheduleInfo = getMonthMapScheduleDInfo(4); - QDate startDate = QDate::currentDate(); - QDate stopData = startDate.addDays(6); - mWeekScheduleView->setData(mapScheduleInfo, startDate, stopData); - mWeekScheduleView->sortAndFilter(scheduleinfo); -} - -//void CMonthScheduleNumButton::setColor(QColor color1, QColor color2, bool GradientFlag) -TEST_F(test_monthscheduleview, setColor) -{ - QColor color1(100, 100, 255); - QColor color2(200, 200, 255); - mMonthScheduleNumButton->setColor(color1, color2); -} - -//void CMonthScheduleNumButton::setText(QColor tcolor, QFont font, QPoint pos) -TEST_F(test_monthscheduleview, setText) -{ - QColor color(100, 100, 255); - QFont font; - mMonthScheduleNumButton->setText(color, font); -} - -//void CMonthScheduleNumButton::setSizeType(DFontSizeManager::SizeType sizeType) -TEST_F(test_monthscheduleview, setSizeType) -{ - mMonthScheduleNumButton->setSizeType(DFontSizeManager::SizeType::T1); -} - -//QPixmap CMonthScheduleWidgetItem::getPixmap() -TEST_F(test_monthscheduleview, getPixmap) -{ - mMonthScheduleWidgetItem->getPixmap(); -} +//test_monthscheduleview::test_monthscheduleview() +//{ +// QRect rect; +// m_scene = new QGraphicsScene(); +// mMonthScheduleView = new CMonthScheduleView(nullptr, m_scene); +// mMonthScheduleWidgetItem = new CMonthScheduleItem(rect); +// mWeekScheduleView = new CWeekScheduleView(); +// mMonthScheduleNumButton = new CMonthScheduleNumItem(); +//} + +//test_monthscheduleview::~test_monthscheduleview() +//{ +// delete mMonthScheduleView; +// mMonthScheduleView = nullptr; +// delete m_scene; +// m_scene = nullptr; +// delete mWeekScheduleView; +// mWeekScheduleView = nullptr; +// delete mMonthScheduleNumButton; +// mMonthScheduleNumButton = nullptr; +// delete mMonthScheduleWidgetItem; +// mMonthScheduleWidgetItem = nullptr; +//} + +//QVector getMonthScheduleDInfo() +//{ +// QVector scheduleDate {}; +// ScheduleDataInfo schedule1, schedule2, schedule3, schedule4, schedule5, scheduleFes; +// QDateTime currentDateTime = QDateTime::currentDateTime(); + +// schedule1.setID(1); +// schedule1.setBeginDateTime(currentDateTime); +// schedule1.setEndDateTime(currentDateTime.addDays(1)); +// schedule1.setTitleName("scheduleOne"); +// schedule1.setAllDay(true); +// schedule1.setType(1); +// schedule1.setRecurID(0); + +// schedule2.setID(2); +// schedule2.setBeginDateTime(currentDateTime.addDays(1)); +// schedule2.setEndDateTime(currentDateTime.addDays(1).addSecs(60 * 60)); +// schedule2.setTitleName("scheduleTwo"); +// schedule2.setAllDay(true); +// schedule2.setType(2); +// schedule2.setRecurID(0); + +// schedule3.setID(3); +// schedule3.setBeginDateTime(currentDateTime.addDays(2)); +// schedule3.setEndDateTime(currentDateTime.addDays(2).addSecs(60 * 60)); +// schedule3.setTitleName("scheduleThree"); +// schedule3.setAllDay(false); +// schedule3.setType(3); +// schedule3.setRecurID(0); + +// schedule4.setID(4); +// schedule4.setBeginDateTime(currentDateTime.addDays(3)); +// schedule4.setEndDateTime(currentDateTime.addDays(3).addSecs(60 * 60)); +// schedule4.setTitleName("scheduleFour"); +// schedule4.setAllDay(false); +// schedule4.setType(1); +// schedule4.setRecurID(0); + +// schedule5.setID(5); +// schedule5.setBeginDateTime(currentDateTime.addDays(4)); +// schedule5.setEndDateTime(currentDateTime.addDays(4).addSecs(60 * 60)); +// schedule5.setTitleName("scheduleFive"); +// schedule5.setAllDay(false); +// schedule5.setType(2); +// schedule5.setRecurID(0); + +// scheduleFes.setID(6); +// scheduleFes.setBeginDateTime(currentDateTime.addDays(5)); +// scheduleFes.setEndDateTime(currentDateTime.addDays(5).addSecs(60 * 60)); +// scheduleFes.setTitleName("scheduleFestival"); +// scheduleFes.setAllDay(true); +// scheduleFes.setType(4); +// scheduleFes.setRecurID(0); + +// scheduleDate.append(schedule1); +// scheduleDate.append(schedule2); +// scheduleDate.append(schedule3); +// scheduleDate.append(schedule4); +// scheduleDate.append(schedule5); +// scheduleDate.append(scheduleFes); +// return scheduleDate; +//} + +//QMap> getMonthMapScheduleDInfo(int getDays) +//{ +// QDate currentDate = QDate::currentDate(); +// QVector scheduleInfo {}; +// QMap> scheduleDateInfo {}; +// switch (getDays) { +// case 0: { +// scheduleInfo.append(getMonthScheduleDInfo().at(0)); +// scheduleDateInfo[currentDate] = scheduleInfo; +// } break; +// case 1: { +// scheduleInfo.append(getMonthScheduleDInfo().at(1)); +// scheduleDateInfo[currentDate.addDays(1)] = scheduleInfo; +// } break; +// case 2: { +// scheduleInfo.append(getMonthScheduleDInfo().at(2)); +// scheduleDateInfo[currentDate.addDays(2)] = scheduleInfo; +// } break; +// default: { +// scheduleInfo.append(getMonthScheduleDInfo().at(3)); +// scheduleDateInfo[currentDate.addDays(3)] = scheduleInfo; +// scheduleInfo.append(getMonthScheduleDInfo().at(4)); +// scheduleDateInfo[currentDate.addDays(4)] = scheduleInfo; +// scheduleInfo.append(getMonthScheduleDInfo().at(5)); +// scheduleDateInfo[currentDate.addDays(5)] = scheduleInfo; +// } break; +// } +// return scheduleDateInfo; +//} + +//QVector getScheduleDateRangeInfo() +//{ +// QVector scheduleDateRangeInfo {}; +// MScheduleDateRangeInfo scheduledaterangeinfo1; +// scheduledaterangeinfo1.num = 4; +// scheduledaterangeinfo1.bdate = QDate::currentDate(); +// scheduledaterangeinfo1.edate = QDate::currentDate().addDays(1); +// scheduledaterangeinfo1.state = true; +// scheduledaterangeinfo1.tData = getMonthScheduleDInfo().first(); + +// // MScheduleDateRangeInfo scheduledaterangeinfo2; +// // scheduledaterangeinfo2.num = 2; +// // scheduledaterangeinfo2.bDate = QDate(2021, 1, 23); +// // scheduledaterangeinfo2.eDate = QDate(2021, 1, 24); +// // scheduledaterangeinfo2.state = false; +// // scheduledaterangeinfo2.tData = getMonthScheduleDInfo().at(1); + +// // MScheduleDateRangeInfo scheduledaterangeinfo3; +// // scheduledaterangeinfo3.num = 2; +// // scheduledaterangeinfo3.bDate = QDate(2021, 1, 25); +// // scheduledaterangeinfo3.eDate = QDate(2021, 1, 26); +// // scheduledaterangeinfo3.state = false; +// // scheduledaterangeinfo3.tData = getMonthScheduleDInfo().at(2); + +// // MScheduleDateRangeInfo scheduledaterangeinfo4; +// // scheduledaterangeinfo4.num = 2; +// // scheduledaterangeinfo4.bDate = QDate(2021, 1, 27); +// // scheduledaterangeinfo4.eDate = QDate(2021, 1, 28); +// // scheduledaterangeinfo4.state = false; +// // scheduledaterangeinfo4.tData = getMonthScheduleDInfo().at(3); + +// scheduleDateRangeInfo.append(scheduledaterangeinfo1); +// // scheduleDateRangeInfo.append(scheduledaterangeinfo2); +// // scheduleDateRangeInfo.append(scheduledaterangeinfo3); +// // scheduleDateRangeInfo.append(scheduledaterangeinfo4); + +// return scheduleDateRangeInfo; +//} + +////void CMonthScheduleView::setallsize(int w, int h, int left, int top, int buttom, int itemHeight) +//TEST_F(test_monthscheduleview, setallsize) +//{ +// mMonthScheduleView->setallsize(1, 1, 1, 1, 1, 1); +//} + +////void CMonthScheduleView::setData(QMap > &data, int currentMonth) +//TEST_F(test_monthscheduleview, setData) +//{ +// QMap> mapScheduleInfo = getMonthMapScheduleDInfo(4); +// mMonthScheduleView->setData(mapScheduleInfo, 1); +//} + +////void CMonthScheduleView::slotFontChange() +//TEST_F(test_monthscheduleview, slotFontChange) +//{ +// mMonthScheduleView->slotFontChange(); +//} + +////void CMonthScheduleView::updateData() +//TEST_F(test_monthscheduleview, updateDate) +//{ +// mMonthScheduleView->updateData(); +//} + +////void CMonthScheduleView::updateHeight() +//TEST_F(test_monthscheduleview, updateHeight) +//{ +// mMonthScheduleView->updateHeight(); +//} + +////QVector CMonthScheduleView::getScheduleShowItem() const +//TEST_F(test_monthscheduleview, getScheduleShowItem) +//{ +// mMonthScheduleView->getScheduleShowItem(); +//} + +////void CMonthScheduleView::updateDate(const ScheduleDataInfo &info) +//TEST_F(test_monthscheduleview, updateData) +//{ +// mMonthScheduleView->updateDate(getMonthScheduleDInfo().first()); +//} + +////void CMonthScheduleView::changeDate(const ScheduleDataInfo &info) +//TEST_F(test_monthscheduleview, changeDate) +//{ +// mMonthScheduleView->changeDate(getMonthScheduleDInfo().first()); +//} + +////void CMonthScheduleView::updateDate(const int row, const ScheduleDataInfo &info) +//TEST_F(test_monthscheduleview, updatedate) +//{ +// mMonthScheduleView->updateDate(2, getMonthScheduleDInfo().first()); +//} + +////void CMonthScheduleView::updateDateShow(QVector> &vCMDaySchedule, QVector &scheduleShowItem) +//TEST_F(test_monthscheduleview, updateDateShow) +//{ +// QVector scheduleinfo = getScheduleDateRangeInfo(); +// QVector> m_scheduledaterangeinfo {}; +// QVector m_scheduleshowinfo {}; +// m_scheduledaterangeinfo.append(scheduleinfo); +// m_scheduleshowinfo.append(mMonthScheduleWidgetItem); + +// mMonthScheduleView->updateDateShow(m_scheduledaterangeinfo, m_scheduleshowinfo); +//} + +////void CMonthScheduleView::createScheduleItemWidget(MScheduleDateRangeInfo info, int cNum, QVector &scheduleShowItem) +//TEST_F(test_monthscheduleview, createScheduleItemWidget) +//{ +// QVector scheduledaterangeinfo = getScheduleDateRangeInfo(); +// QVector m_scheduleshowinfo {}; +// m_scheduleshowinfo.append(mMonthScheduleWidgetItem); +// mMonthScheduleView->createScheduleItemWidget(scheduledaterangeinfo.first(), 1, m_scheduleshowinfo); +//} + +////void CMonthScheduleView::createScheduleNumWidget(MScheduleDateRangeInfo info, int cNum, QVector &scheduleShowItem) +//TEST_F(test_monthscheduleview, createScheduleNumWidget) +//{ +// MScheduleDateRangeInfo scheduledaterangeinfo = getScheduleDateRangeInfo().first(); +// QVector m_scheduleshowinfo {}; +// QMap> mapScheduleInfo = getMonthMapScheduleDInfo(4); +// mMonthScheduleView->setData(mapScheduleInfo, 3); +// mMonthScheduleView->createScheduleNumWidget(scheduledaterangeinfo, 2, m_scheduleshowinfo); +//} + +////void CMonthScheduleView::computePos(int cnum, QDate bgeindate, QDate enddate, QPoint &pos, int &fw, int &fh) +//TEST_F(test_monthscheduleview, computePos) +//{ +// QDate bDate = QDate(2020, 1, 20); +// QDate eDate = QDate(2021, 1, 23); +// QPoint pos = QPoint(4, 4); +// int fw = 8; +// int fh = 8; +// mMonthScheduleView->computePos(2, bDate, eDate, pos, fw, fh); +//} + +////void CWeekScheduleView::setData(QMap > &data, const QDate &startDate, const QDate &stopDate) +//TEST_F(test_monthscheduleview, setweekData) +//{ +// QMap> mapScheduleInfo = getMonthMapScheduleDInfo(4); +// QDate startDate = QDate(2021, 1, 21); +// QDate stopData = QDate(2021, 1, 27); +// mWeekScheduleView->setData(mapScheduleInfo, startDate, stopData); +//} + +////bool CWeekScheduleView::addData(const ScheduleDataInfo &info) +//TEST_F(test_monthscheduleview, addData) +//{ +// QMap> mapScheduleInfo = getMonthMapScheduleDInfo(4); +// QDate startDate = QDate::currentDate(); +// QDate stopData = startDate.addDays(6); +// mWeekScheduleView->setData(mapScheduleInfo, startDate, stopData); +// bool re = mWeekScheduleView->addData(getMonthScheduleDInfo().first()); +// EXPECT_TRUE(re); + +// startDate = QDate::currentDate().addDays(-7); +// stopData = QDate::currentDate().addDays(-1); +// mWeekScheduleView->setData(mapScheduleInfo, startDate, stopData); +// re = mWeekScheduleView->addData(getMonthScheduleDInfo().first()); +// EXPECT_FALSE(re); +//} + +////void CWeekScheduleView::changeDate(const ScheduleDataInfo &info) +//TEST_F(test_monthscheduleview, changedate) +//{ +// mWeekScheduleView->changeDate(getMonthScheduleDInfo().first()); +//} + +////void CWeekScheduleView::setHeight(const int ScheduleHeight, const int DayHeigth) +//TEST_F(test_monthscheduleview, setHeight) +//{ +// mWeekScheduleView->setHeight(10, 10); +//} + +////void CWeekScheduleView::updateSchedule(const bool isNormalDisplay, const ScheduleDataInfo &info) +//TEST_F(test_monthscheduleview, updateSchedule) +//{ +// mWeekScheduleView->updateSchedule(true, getMonthScheduleDInfo().first()); +// mWeekScheduleView->updateSchedule(false, getMonthScheduleDInfo().first()); +//} + +////void CWeekScheduleView::clearItem() +//TEST_F(test_monthscheduleview, clearItem) +//{ +// mWeekScheduleView->clearItem(); +//} + +////void CWeekScheduleView::setMaxNum() +//TEST_F(test_monthscheduleview, setMacNum) +//{ +// mWeekScheduleView->setMaxNum(); +//} + +////void CWeekScheduleView::mScheduleClear() +//TEST_F(test_monthscheduleview, mScheduleClear) +//{ +// mWeekScheduleView->mScheduleClear(); +//} + +////void CWeekScheduleView::sortAndFilter(QVector &vMDaySchedule) +//TEST_F(test_monthscheduleview, sortAndFileter) +//{ +// QVector scheduleinfo = getScheduleDateRangeInfo(); +// mWeekScheduleView->setHeight(4, 20); +// QMap> mapScheduleInfo = getMonthMapScheduleDInfo(4); +// QDate startDate = QDate::currentDate(); +// QDate stopData = startDate.addDays(6); +// mWeekScheduleView->setData(mapScheduleInfo, startDate, stopData); +// mWeekScheduleView->sortAndFilter(scheduleinfo); +//} + +////void CMonthScheduleNumButton::setColor(QColor color1, QColor color2, bool GradientFlag) +//TEST_F(test_monthscheduleview, setColor) +//{ +// QColor color1(100, 100, 255); +// QColor color2(200, 200, 255); +// mMonthScheduleNumButton->setColor(color1, color2); +//} + +////void CMonthScheduleNumButton::setText(QColor tcolor, QFont font, QPoint pos) +//TEST_F(test_monthscheduleview, setText) +//{ +// QColor color(100, 100, 255); +// QFont font; +// mMonthScheduleNumButton->setText(color, font); +//} + +////void CMonthScheduleNumButton::setSizeType(DFontSizeManager::SizeType sizeType) +//TEST_F(test_monthscheduleview, setSizeType) +//{ +// mMonthScheduleNumButton->setSizeType(DFontSizeManager::SizeType::T1); +//} + +////QPixmap CMonthScheduleWidgetItem::getPixmap() +//TEST_F(test_monthscheduleview, getPixmap) +//{ +// mMonthScheduleWidgetItem->getPixmap(); +//} diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_widget/test_monthWidget/test_monthscheduleview.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_widget/test_monthWidget/test_monthscheduleview.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_widget/test_monthWidget/test_monthscheduleview.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_widget/test_monthWidget/test_monthscheduleview.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,45 +1,29 @@ -/* -* Copyright (C) 2019 ~ 2021 Uniontech Software Technology Co.,Ltd. -* -* Author: zhengxiaokang -* -* Maintainer: zhengxiaokang -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_MONTHSCHEDULEVIEW_H #define TEST_MONTHSCHEDULEVIEW_H #include -#include "monthWidget/monthscheduleview.h" -#include "graphicsItem/cmonthscheduleitem.h" -#include "graphicsItem/cmonthschedulenumitem.h" -#include "gtest/gtest.h" +//#include "monthWidget/monthscheduleview.h" +//#include "graphicsItem/cmonthscheduleitem.h" +//#include "graphicsItem/cmonthschedulenumitem.h" +//#include "gtest/gtest.h" -class test_monthscheduleview : public QObject - , public ::testing::Test -{ -public: - test_monthscheduleview(); - ~test_monthscheduleview(); +//class test_monthscheduleview : public QObject +// , public ::testing::Test +//{ +//public: +// test_monthscheduleview(); +// ~test_monthscheduleview(); -protected: - CMonthScheduleView *mMonthScheduleView = nullptr; - CMonthScheduleItem *mMonthScheduleWidgetItem = nullptr; - CWeekScheduleView *mWeekScheduleView = nullptr; - CMonthScheduleNumItem *mMonthScheduleNumButton = nullptr; - QGraphicsScene *m_scene = nullptr; -}; +//protected: +// CMonthScheduleView *mMonthScheduleView = nullptr; +// CMonthScheduleItem *mMonthScheduleWidgetItem = nullptr; +// CWeekScheduleView *mWeekScheduleView = nullptr; +// CMonthScheduleNumItem *mMonthScheduleNumButton = nullptr; +// QGraphicsScene *m_scene = nullptr; +//}; #endif // TEST_MONTHSCHEDULEVIEW_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_widget/test_monthWidget/test_monthview.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_widget/test_monthWidget/test_monthview.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_widget/test_monthWidget/test_monthview.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_widget/test_monthWidget/test_monthview.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,210 +1,194 @@ -/* -* Copyright (C) 2019 ~ 2021 Uniontech Software Technology Co.,Ltd. -* -* Author: zhengxiaokang -* -* Maintainer: zhengxiaokang -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "test_monthview.h" -test_monthview::test_monthview() -{ - mMonthView = new CMonthView(); -} - -test_monthview::~test_monthview() -{ - delete mMonthView; - mMonthView = nullptr; -} - -QVector getMonthViewScheduleDInfo() -{ - QVector scheduleDate {}; - ScheduleDataInfo schedule1, schedule2, schedule3, schedule4, schedule5, scheduleFes; - QDateTime currentDateTime = QDateTime::currentDateTime(); - - schedule1.setID(1); - schedule1.setBeginDateTime(currentDateTime); - schedule1.setEndDateTime(currentDateTime.addDays(1)); - schedule1.setTitleName("scheduleOne"); - schedule1.setAllDay(true); - schedule1.setType(1); - schedule1.setRecurID(0); - - schedule2.setID(2); - schedule2.setBeginDateTime(currentDateTime.addDays(1)); - schedule2.setEndDateTime(currentDateTime.addDays(1).addSecs(60 * 60)); - schedule2.setTitleName("scheduleTwo"); - schedule2.setAllDay(true); - schedule2.setType(2); - schedule2.setRecurID(0); - - schedule3.setID(3); - schedule3.setBeginDateTime(currentDateTime.addDays(2)); - schedule3.setEndDateTime(currentDateTime.addDays(2).addSecs(60 * 60)); - schedule3.setTitleName("scheduleThree"); - schedule3.setAllDay(false); - schedule3.setType(3); - schedule3.setRecurID(0); - - schedule4.setID(4); - schedule4.setBeginDateTime(currentDateTime.addDays(3)); - schedule4.setEndDateTime(currentDateTime.addDays(3).addSecs(60 * 60)); - schedule4.setTitleName("scheduleFour"); - schedule4.setAllDay(false); - schedule4.setType(1); - schedule4.setRecurID(0); - - schedule5.setID(5); - schedule5.setBeginDateTime(currentDateTime.addDays(4)); - schedule5.setEndDateTime(currentDateTime.addDays(4).addSecs(60 * 60)); - schedule5.setTitleName("scheduleFive"); - schedule5.setAllDay(false); - schedule5.setType(2); - schedule5.setRecurID(0); - - scheduleFes.setID(6); - scheduleFes.setBeginDateTime(currentDateTime.addDays(5)); - scheduleFes.setEndDateTime(currentDateTime.addDays(5).addSecs(60 * 60)); - scheduleFes.setTitleName("scheduleFestival"); - scheduleFes.setAllDay(true); - scheduleFes.setType(4); - scheduleFes.setRecurID(0); - - scheduleDate.append(schedule1); - scheduleDate.append(schedule2); - scheduleDate.append(schedule3); - scheduleDate.append(schedule4); - scheduleDate.append(schedule5); - scheduleDate.append(scheduleFes); - return scheduleDate; -} - -QVector MonthviewGetDayList() -{ - QVector dateList {}; - QDate currentDate = QDate::currentDate(); - for (int i = 0; i < 42; i++) { - dateList.append(currentDate.addDays(i)); - } - - return dateList; -} - -QMap MonthViewGetHuangLiDayInfo() -{ - QMap huangLiDayinfo {}; - CaHuangLiDayInfo huangLiInfo1 {}; - huangLiInfo1.mGanZhiYear = "辛丑牛年"; //年干支 - huangLiInfo1.mGanZhiMonth = "庚寅月"; //月干支 - huangLiInfo1.mGanZhiDay = "辛卯日"; //日干支 - huangLiInfo1.mLunarMonthName = "正月"; //农历月名称 - huangLiInfo1.mLunarDayName = "初一"; //农历日名称 - huangLiInfo1.mLunarLeapMonth = 4; //闰月 - huangLiInfo1.mZodiac = "牛"; //生肖 - huangLiInfo1.mTerm = ""; //农历节气 - huangLiInfo1.mSolarFestival = "国庆节"; //阳历节日 - huangLiInfo1.mLunarFestival = "除夕"; //农历节日 - huangLiInfo1.mSuit = "嫁娶"; //黄历宜 - huangLiInfo1.mAvoid = "入土"; //黄历忌 - - huangLiDayinfo.insert(QDate::currentDate(), huangLiInfo1); - return huangLiDayinfo; -} - -//void CMonthView::setTheMe(int type) -TEST_F(test_monthview, setTheMe) -{ - mMonthView->setTheMe(1); - mMonthView->setTheMe(2); -} - -//void CMonthView::setSelectSchedule(const ScheduleDataInfo &scheduleInfo) -TEST_F(test_monthview, setSelectSchedule) -{ - ScheduleDataInfo scheduleinfo = getMonthViewScheduleDInfo().first(); - mMonthView->setSelectSchedule(scheduleinfo); -} - -//void CMonthView::slotScheduleRemindWidget(const bool isShow, const ScheduleDataInfo &out) -TEST_F(test_monthview, slotScheduleRemindWidget) -{ - ScheduleDataInfo scheduleinfo = getMonthViewScheduleDInfo().first(); - mMonthView->slotScheduleRemindWidget(false, scheduleinfo); - mMonthView->slotScheduleRemindWidget(true, scheduleinfo); -} - -//void CMonthView::setFirstWeekday(Qt::DayOfWeek weekday) -TEST_F(test_monthview, setFirstWeekday) -{ - mMonthView->setFirstWeekday(Qt::Sunday); -} - -//void CMonthView::setShowDate(const QVector &showDate) -TEST_F(test_monthview, setShowDate) -{ - mMonthView->setShowDate(MonthviewGetDayList()); -} - -//void CMonthView::setHuangLiInfo(const QMap &huangLiInfo) -TEST_F(test_monthview, setHuangLiInfo) -{ - mMonthView->setHuangLiInfo(MonthViewGetHuangLiDayInfo()); -} - -//void CMonthView::setFestival(const QMap &festivalInfo) -TEST_F(test_monthview, setFestival) -{ - QMap festivalInfo {}; - festivalInfo.insert(QDate::currentDate(), 1); - festivalInfo.insert(QDate::currentDate().addDays(1), 2); - mMonthView->setFestival(festivalInfo); -} - -//void CMonthView::setScheduleInfo(const QMap > &scheduleInfo) -TEST_F(test_monthview, setScheduleInfo) -{ - QMap> scheduleinfo {}; - scheduleinfo.insert(QDate::currentDate(), getMonthViewScheduleDInfo()); - mMonthView->setScheduleInfo(scheduleinfo); -} - -//void CMonthView::setSearchScheduleInfo(const QVector &searchScheduleInfo) -TEST_F(test_monthview, setSearchScheduleInfo) -{ - mMonthView->setSearchScheduleInfo(getMonthViewScheduleDInfo()); -} - -//void CMonthView::setCurrentDate(const QDate ¤tDate) -TEST_F(test_monthview, setCurrentDate) -{ - mMonthView->setCurrentDate(QDate::currentDate()); -} - -//ScheduleDataInfo CMonthView::getScheduleInfo(const QDate &beginDate, const QDate &endDate) -TEST_F(test_monthview, getScheduleInfo) -{ - QDate currentDate = QDate::currentDate(); - QDate currentDate1 = QDate::currentDate().addDays(1); - mMonthView->getScheduleInfo(currentDate, currentDate1); - mMonthView->getScheduleInfo(currentDate1, currentDate); -} - -TEST_F(test_monthview, isDragging) -{ - mMonthView->isDragging(); -} +//test_monthview::test_monthview() +//{ +// mMonthView = new CMonthView(); +//} + +//test_monthview::~test_monthview() +//{ +// delete mMonthView; +// mMonthView = nullptr; +//} + +//QVector getMonthViewScheduleDInfo() +//{ +// QVector scheduleDate {}; +// ScheduleDataInfo schedule1, schedule2, schedule3, schedule4, schedule5, scheduleFes; +// QDateTime currentDateTime = QDateTime::currentDateTime(); + +// schedule1.setID(1); +// schedule1.setBeginDateTime(currentDateTime); +// schedule1.setEndDateTime(currentDateTime.addDays(1)); +// schedule1.setTitleName("scheduleOne"); +// schedule1.setAllDay(true); +// schedule1.setType(1); +// schedule1.setRecurID(0); + +// schedule2.setID(2); +// schedule2.setBeginDateTime(currentDateTime.addDays(1)); +// schedule2.setEndDateTime(currentDateTime.addDays(1).addSecs(60 * 60)); +// schedule2.setTitleName("scheduleTwo"); +// schedule2.setAllDay(true); +// schedule2.setType(2); +// schedule2.setRecurID(0); + +// schedule3.setID(3); +// schedule3.setBeginDateTime(currentDateTime.addDays(2)); +// schedule3.setEndDateTime(currentDateTime.addDays(2).addSecs(60 * 60)); +// schedule3.setTitleName("scheduleThree"); +// schedule3.setAllDay(false); +// schedule3.setType(3); +// schedule3.setRecurID(0); + +// schedule4.setID(4); +// schedule4.setBeginDateTime(currentDateTime.addDays(3)); +// schedule4.setEndDateTime(currentDateTime.addDays(3).addSecs(60 * 60)); +// schedule4.setTitleName("scheduleFour"); +// schedule4.setAllDay(false); +// schedule4.setType(1); +// schedule4.setRecurID(0); + +// schedule5.setID(5); +// schedule5.setBeginDateTime(currentDateTime.addDays(4)); +// schedule5.setEndDateTime(currentDateTime.addDays(4).addSecs(60 * 60)); +// schedule5.setTitleName("scheduleFive"); +// schedule5.setAllDay(false); +// schedule5.setType(2); +// schedule5.setRecurID(0); + +// scheduleFes.setID(6); +// scheduleFes.setBeginDateTime(currentDateTime.addDays(5)); +// scheduleFes.setEndDateTime(currentDateTime.addDays(5).addSecs(60 * 60)); +// scheduleFes.setTitleName("scheduleFestival"); +// scheduleFes.setAllDay(true); +// scheduleFes.setType(4); +// scheduleFes.setRecurID(0); + +// scheduleDate.append(schedule1); +// scheduleDate.append(schedule2); +// scheduleDate.append(schedule3); +// scheduleDate.append(schedule4); +// scheduleDate.append(schedule5); +// scheduleDate.append(scheduleFes); +// return scheduleDate; +//} + +//QVector MonthviewGetDayList() +//{ +// QVector dateList {}; +// QDate currentDate = QDate::currentDate(); +// for (int i = 0; i < 42; i++) { +// dateList.append(currentDate.addDays(i)); +// } + +// return dateList; +//} + +//QMap MonthViewGetHuangLiDayInfo() +//{ +// QMap huangLiDayinfo {}; +// CaHuangLiDayInfo huangLiInfo1 {}; +// huangLiInfo1.mGanZhiYear = "辛丑牛年"; //年干支 +// huangLiInfo1.mGanZhiMonth = "庚寅月"; //月干支 +// huangLiInfo1.mGanZhiDay = "辛卯日"; //日干支 +// huangLiInfo1.mLunarMonthName = "正月"; //农历月名称 +// huangLiInfo1.mLunarDayName = "初一"; //农历日名称 +// huangLiInfo1.mLunarLeapMonth = 4; //闰月 +// huangLiInfo1.mZodiac = "牛"; //生肖 +// huangLiInfo1.mTerm = ""; //农历节气 +// huangLiInfo1.mSolarFestival = "国庆节"; //阳历节日 +// huangLiInfo1.mLunarFestival = "除夕"; //农历节日 +// huangLiInfo1.mSuit = "嫁娶"; //黄历宜 +// huangLiInfo1.mAvoid = "入土"; //黄历忌 + +// huangLiDayinfo.insert(QDate::currentDate(), huangLiInfo1); +// return huangLiDayinfo; +//} + +////void CMonthView::setTheMe(int type) +//TEST_F(test_monthview, setTheMe) +//{ +// mMonthView->setTheMe(1); +// mMonthView->setTheMe(2); +//} + +////void CMonthView::setSelectSchedule(const ScheduleDataInfo &scheduleInfo) +//TEST_F(test_monthview, setSelectSchedule) +//{ +// ScheduleDataInfo scheduleinfo = getMonthViewScheduleDInfo().first(); +// mMonthView->setSelectSchedule(scheduleinfo); +//} + +////void CMonthView::slotScheduleRemindWidget(const bool isShow, const ScheduleDataInfo &out) +//TEST_F(test_monthview, slotScheduleRemindWidget) +//{ +// ScheduleDataInfo scheduleinfo = getMonthViewScheduleDInfo().first(); +// mMonthView->slotScheduleRemindWidget(false, scheduleinfo); +// mMonthView->slotScheduleRemindWidget(true, scheduleinfo); +//} + +////void CMonthView::setFirstWeekday(Qt::DayOfWeek weekday) +//TEST_F(test_monthview, setFirstWeekday) +//{ +// mMonthView->setFirstWeekday(Qt::Sunday); +//} + +////void CMonthView::setShowDate(const QVector &showDate) +//TEST_F(test_monthview, setShowDate) +//{ +// mMonthView->setShowDate(MonthviewGetDayList()); +//} + +////void CMonthView::setHuangLiInfo(const QMap &huangLiInfo) +//TEST_F(test_monthview, setHuangLiInfo) +//{ +// mMonthView->setHuangLiInfo(MonthViewGetHuangLiDayInfo()); +//} + +////void CMonthView::setFestival(const QMap &festivalInfo) +//TEST_F(test_monthview, setFestival) +//{ +// QMap festivalInfo {}; +// festivalInfo.insert(QDate::currentDate(), 1); +// festivalInfo.insert(QDate::currentDate().addDays(1), 2); +// mMonthView->setFestival(festivalInfo); +//} + +////void CMonthView::setScheduleInfo(const QMap > &scheduleInfo) +//TEST_F(test_monthview, setScheduleInfo) +//{ +// QMap> scheduleinfo {}; +// scheduleinfo.insert(QDate::currentDate(), getMonthViewScheduleDInfo()); +// mMonthView->setScheduleInfo(scheduleinfo); +//} + +////void CMonthView::setSearchScheduleInfo(const QVector &searchScheduleInfo) +//TEST_F(test_monthview, setSearchScheduleInfo) +//{ +// mMonthView->setSearchScheduleInfo(getMonthViewScheduleDInfo()); +//} + +////void CMonthView::setCurrentDate(const QDate ¤tDate) +//TEST_F(test_monthview, setCurrentDate) +//{ +// mMonthView->setCurrentDate(QDate::currentDate()); +//} + +////ScheduleDataInfo CMonthView::getScheduleInfo(const QDate &beginDate, const QDate &endDate) +//TEST_F(test_monthview, getScheduleInfo) +//{ +// QDate currentDate = QDate::currentDate(); +// QDate currentDate1 = QDate::currentDate().addDays(1); +// mMonthView->getScheduleInfo(currentDate, currentDate1); +// mMonthView->getScheduleInfo(currentDate1, currentDate); +//} + +//TEST_F(test_monthview, isDragging) +//{ +// mMonthView->isDragging(); +//} diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_widget/test_monthWidget/test_monthview.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_widget/test_monthWidget/test_monthview.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_widget/test_monthWidget/test_monthview.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_widget/test_monthWidget/test_monthview.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,39 +1,23 @@ -/* -* Copyright (C) 2019 ~ 2021 Uniontech Software Technology Co.,Ltd. -* -* Author: zhengxiaokang -* -* Maintainer: zhengxiaokang -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_MONTHVIEW_H #define TEST_MONTHVIEW_H #include #include "gtest/gtest.h" -#include "monthWidget/monthview.h" +//#include "monthWidget/monthview.h" -class test_monthview : public QObject - , public ::testing::Test -{ -public: - test_monthview(); - ~test_monthview(); +//class test_monthview : public QObject +// , public ::testing::Test +//{ +//public: +// test_monthview(); +// ~test_monthview(); -protected: - CMonthView *mMonthView = nullptr; -}; +//protected: +// CMonthView *mMonthView = nullptr; +//}; #endif // TEST_MONTHVIEW_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_widget/test_monthWidget/test_monthweekview.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_widget/test_monthWidget/test_monthweekview.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_widget/test_monthWidget/test_monthweekview.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_widget/test_monthWidget/test_monthweekview.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,89 +1,73 @@ -/* -* Copyright (C) 2019 ~ 2021 Uniontech Software Technology Co.,Ltd. -* -* Author: zhengxiaokang -* -* Maintainer: zhengxiaokang -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "test_monthweekview.h" #include #include -test_monthweekview::test_monthweekview() -{ - mMonthWeekView = new CMonthWeekView(); - mWeekRect = new WeekRect(); -} - -test_monthweekview::~test_monthweekview() -{ - delete mMonthWeekView; - mMonthWeekView = nullptr; - delete mWeekRect; - mWeekRect = nullptr; -} - -//void CMonthWeekView::setFirstDay(const Qt::DayOfWeek weekday) -TEST_F(test_monthweekview, setFirstDay) -{ - mMonthWeekView->setFirstDay(static_cast(QDate::currentDate().dayOfWeek())); - mMonthWeekView->setFirstDay(static_cast(QDate::currentDate().addDays(1).dayOfWeek())); -} - -//void CMonthWeekView::setTheMe(int type) -TEST_F(test_monthweekview, setTheMe) -{ - mMonthWeekView->setTheMe(1); - mMonthWeekView->setTheMe(2); -} - -//void CMonthWeekView::setCurrentDate(const QDate ¤tDate) -TEST_F(test_monthweekview, setCurrentDate) -{ - mMonthWeekView->setCurrentDate(QDate::currentDate()); -} - -TEST_F(test_monthweekview, paintEvent_01) -{ - QPaintEvent e(QRect(0, 0, 1, 1)); - mMonthWeekView->paintEvent(&e); -} - -//void WeekRect::setWeek(const Qt::DayOfWeek &showWeek, const bool &showLine) -TEST_F(test_monthweekview, setWeek) -{ - mWeekRect->setWeek(Qt::Sunday, false); -} - -//void WeekRect::setRect(const QRectF &rectF) -TEST_F(test_monthweekview, setRect) -{ - mWeekRect->setRect(QRectF()); -} - -//void WeekRect::setTheMe(int type) -TEST_F(test_monthweekview, setRectTheMe_01) -{ - mWeekRect->setTheMe(1); - EXPECT_EQ(mWeekRect->m_testColor, QColor("#6F6F6F")); -} - -//void WeekRect::setTheMe(int type) -TEST_F(test_monthweekview, setRectTheMe_02) -{ - mWeekRect->setTheMe(3); - EXPECT_EQ(mWeekRect->m_testColor, QColor("#C0C6D4")); -} +//test_monthweekview::test_monthweekview() +//{ +// mMonthWeekView = new CMonthWeekView(); +// mWeekRect = new WeekRect(); +//} + +//test_monthweekview::~test_monthweekview() +//{ +// delete mMonthWeekView; +// mMonthWeekView = nullptr; +// delete mWeekRect; +// mWeekRect = nullptr; +//} + +////void CMonthWeekView::setFirstDay(const Qt::DayOfWeek weekday) +//TEST_F(test_monthweekview, setFirstDay) +//{ +// mMonthWeekView->setFirstDay(static_cast(QDate::currentDate().dayOfWeek())); +// mMonthWeekView->setFirstDay(static_cast(QDate::currentDate().addDays(1).dayOfWeek())); +//} + +////void CMonthWeekView::setTheMe(int type) +//TEST_F(test_monthweekview, setTheMe) +//{ +// mMonthWeekView->setTheMe(1); +// mMonthWeekView->setTheMe(2); +//} + +////void CMonthWeekView::setCurrentDate(const QDate ¤tDate) +//TEST_F(test_monthweekview, setCurrentDate) +//{ +// mMonthWeekView->setCurrentDate(QDate::currentDate()); +//} + +//TEST_F(test_monthweekview, paintEvent_01) +//{ +// QPaintEvent e(QRect(0, 0, 1, 1)); +// mMonthWeekView->paintEvent(&e); +//} + +////void WeekRect::setWeek(const Qt::DayOfWeek &showWeek, const bool &showLine) +//TEST_F(test_monthweekview, setWeek) +//{ +// mWeekRect->setWeek(Qt::Sunday, false); +//} + +////void WeekRect::setRect(const QRectF &rectF) +//TEST_F(test_monthweekview, setRect) +//{ +// mWeekRect->setRect(QRectF()); +//} + +////void WeekRect::setTheMe(int type) +//TEST_F(test_monthweekview, setRectTheMe_01) +//{ +// mWeekRect->setTheMe(1); +// EXPECT_EQ(mWeekRect->m_testColor, QColor("#6F6F6F")); +//} + +////void WeekRect::setTheMe(int type) +//TEST_F(test_monthweekview, setRectTheMe_02) +//{ +// mWeekRect->setTheMe(3); +// EXPECT_EQ(mWeekRect->m_testColor, QColor("#C0C6D4")); +//} diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_widget/test_monthWidget/test_monthweekview.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_widget/test_monthWidget/test_monthweekview.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_widget/test_monthWidget/test_monthweekview.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_widget/test_monthWidget/test_monthweekview.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,40 +1,24 @@ -/* -* Copyright (C) 2019 ~ 2021 Uniontech Software Technology Co.,Ltd. -* -* Author: zhengxiaokang -* -* Maintainer: zhengxiaokang -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_MONTHWEEKVIEW_H #define TEST_MONTHWEEKVIEW_H #include -#include "monthWidget/monthweekview.h" -#include "gtest/gtest.h" +//#include "monthWidget/monthweekview.h" +//#include "gtest/gtest.h" -class test_monthweekview : public QObject - , public ::testing::Test -{ -public: - test_monthweekview(); - ~test_monthweekview(); +//class test_monthweekview : public QObject +// , public ::testing::Test +//{ +//public: +// test_monthweekview(); +// ~test_monthweekview(); -protected: - CMonthWeekView *mMonthWeekView = nullptr; - WeekRect *mWeekRect = nullptr; -}; +//protected: +// CMonthWeekView *mMonthWeekView = nullptr; +// WeekRect *mWeekRect = nullptr; +//}; #endif // TEST_MONTHWEEKVIEW_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_widget/test_monthWidget/test_monthwindow.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_widget/test_monthWidget/test_monthwindow.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_widget/test_monthWidget/test_monthwindow.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_widget/test_monthWidget/test_monthwindow.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,93 +1,77 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ -#include "test_monthwindow.h" - -#include "../third-party_stub/stub.h" -#include "monthWidget/monthview.h" - -test_monthWindow::test_monthWindow() -{ -} - -void test_monthWindow::SetUp() -{ - m_monthWindow = new CMonthWindow(nullptr); -} - -void test_monthWindow::TearDown() -{ - delete m_monthWindow; - m_monthWindow = nullptr; -} - -TEST_F(test_monthWindow, setTheMe) -{ - m_monthWindow->setTheMe(0); - m_monthWindow->setTheMe(1); - m_monthWindow->setTheMe(2); -} - -namespace MonthWindow { -void deleteselectschedule_Stub(void *obj) -{ - Q_UNUSED(obj) -} -} // namespace MonthWindow - -TEST_F(test_monthWindow, deleteselectSchedule) -{ - Stub stub; - stub.set(ADDR(CMonthView, deleteSelectSchedule), MonthWindow::deleteselectschedule_Stub); - m_monthWindow->deleteselectSchedule(); -} - -TEST_F(test_monthWindow, previousMonth) -{ - QDate currentDate = QDate::currentDate(); - m_monthWindow->setSelectDate(currentDate); - m_monthWindow->previousMonth(); - ASSERT_EQ(m_monthWindow->getSelectDate(), currentDate.addMonths(1)); -} - -TEST_F(test_monthWindow, nextMonth) -{ - QDate currentDate = QDate::currentDate(); - m_monthWindow->setSelectDate(currentDate); - m_monthWindow->nextMonth(); - ASSERT_EQ(m_monthWindow->getSelectDate(), currentDate.addMonths(-1)); -} - -TEST_F(test_monthWindow, slotViewSelectDate) -{ - QDate currentDate = QDate::currentDate(); - m_monthWindow->slotViewSelectDate(currentDate); -} - -TEST_F(test_monthWindow, resizeEvent) -{ - m_monthWindow->setFixedSize(500, 300); - m_monthWindow->setFixedSize(600, 400); -} - -TEST_F(test_monthWindow, slottoday) -{ - m_monthWindow->slottoday(); -} +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +//#include "test_monthwindow.h" + +//#include "../third-party_stub/stub.h" +//#include "monthWidget/monthview.h" + +//test_monthWindow::test_monthWindow() +//{ +//} + +//void test_monthWindow::SetUp() +//{ +// m_monthWindow = new CMonthWindow(nullptr); +//} + +//void test_monthWindow::TearDown() +//{ +// delete m_monthWindow; +// m_monthWindow = nullptr; +//} + +//TEST_F(test_monthWindow, setTheMe) +//{ +// m_monthWindow->setTheMe(0); +// m_monthWindow->setTheMe(1); +// m_monthWindow->setTheMe(2); +//} + +//namespace MonthWindow { +//void deleteselectschedule_Stub(void *obj) +//{ +// Q_UNUSED(obj) +//} +//} // namespace MonthWindow + +//TEST_F(test_monthWindow, deleteselectSchedule) +//{ +// Stub stub; +// stub.set(ADDR(CMonthView, deleteSelectSchedule), MonthWindow::deleteselectschedule_Stub); +// m_monthWindow->deleteselectSchedule(); +//} + +//TEST_F(test_monthWindow, previousMonth) +//{ +// QDate currentDate = QDate::currentDate(); +// m_monthWindow->setSelectDate(currentDate); +// m_monthWindow->previousMonth(); +// ASSERT_EQ(m_monthWindow->getSelectDate(), currentDate.addMonths(1)); +//} + +//TEST_F(test_monthWindow, nextMonth) +//{ +// QDate currentDate = QDate::currentDate(); +// m_monthWindow->setSelectDate(currentDate); +// m_monthWindow->nextMonth(); +// ASSERT_EQ(m_monthWindow->getSelectDate(), currentDate.addMonths(-1)); +//} + +//TEST_F(test_monthWindow, slotViewSelectDate) +//{ +// QDate currentDate = QDate::currentDate(); +// m_monthWindow->slotViewSelectDate(currentDate); +//} + +//TEST_F(test_monthWindow, resizeEvent) +//{ +// m_monthWindow->setFixedSize(500, 300); +// m_monthWindow->setFixedSize(600, 400); +//} + +//TEST_F(test_monthWindow, slottoday) +//{ +// m_monthWindow->slottoday(); +//} diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_widget/test_monthWidget/test_monthwindow.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_widget/test_monthWidget/test_monthwindow.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_widget/test_monthWidget/test_monthwindow.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_widget/test_monthWidget/test_monthwindow.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,42 +1,26 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_MONTHWINDOW_H #define TEST_MONTHWINDOW_H #include "gtest/gtest.h" -#include "monthWidget/monthwindow.h" +//#include "monthWidget/monthwindow.h" + +//#include -#include +//class test_monthWindow : public QObject +// , public ::testing::Test +//{ +// Q_OBJECT +//public: +// explicit test_monthWindow(); +// void SetUp() override; +// void TearDown() override; -class test_monthWindow : public QObject - , public ::testing::Test -{ - Q_OBJECT -public: - explicit test_monthWindow(); - void SetUp() override; - void TearDown() override; - -public: - CMonthWindow *m_monthWindow {nullptr}; -}; +//public: +// CMonthWindow *m_monthWindow {nullptr}; +//}; #endif // TEST_MONTHWINDOW_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_widget/test_schedulesearchview.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_widget/test_schedulesearchview.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_widget/test_schedulesearchview.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_widget/test_schedulesearchview.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2021 Uniontech Software Technology Co.,Ltd. -* -* Author: zhengxiaokang -* -* Maintainer: zhengxiaokang -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "test_schedulesearchview.h" #include "../third-party_stub/stub.h" #include "../calendar-basicstruct/src/utils.h" @@ -26,6 +10,8 @@ #include "scheduleTask/scheduletask.h" #include "constants.h" #include "../testscheduledata.h" +#include "../dialog_stub.h" +#include QVector getScheduleDInfo() { @@ -142,6 +128,11 @@ return true; } +static QAction* schedulesearchview_stub_QMenu_exec() +{ + return nullptr; +} + test_schedulesearchview::test_schedulesearchview() { } @@ -306,19 +297,119 @@ } //void CScheduleSearchItem::slotEdit() -TEST_F(test_schedulesearchview, slotEdit) +TEST_F(test_schedulesearchview, slotEdit_01) { - // ScheduleDataInfo scheduleinfo = getScheduleDInfo().first(); - // mScheduleSearchItem->setData(scheduleinfo, QDate::currentDate()); - // mScheduleSearchItem->slotEdit(); + Stub stub; + calendarDDialogExecStub(stub); + ScheduleDataInfo scheduleinfo = getScheduleDInfo().first(); + CScheduleSearchItem item; + item.setData(scheduleinfo, QDate::currentDate()); + item.slotEdit(); } //void CScheduleSearchItem::slotDelete() -TEST_F(test_schedulesearchview, slotDelete) +TEST_F(test_schedulesearchview, slotDelete_01) +{ + Stub stub; + calendarDDialogExecStub(stub); + ScheduleDataInfo scheduleinfo = getScheduleDInfo().first(); + CScheduleSearchItem item; + item.setData(scheduleinfo, QDate::currentDate()); + item.slotDelete(); +} + +TEST_F(test_schedulesearchview, slotTimeFormatChanged_01) +{ + mScheduleSearchItem->slotTimeFormatChanged(1); + EXPECT_EQ(mScheduleSearchItem->m_timeFormat, "hh:mm"); +} + +TEST_F(test_schedulesearchview, slotTimeFormatChanged_02) +{ + mScheduleSearchItem->slotTimeFormatChanged(0); + EXPECT_EQ(mScheduleSearchItem->m_timeFormat, "h:mm"); +} + +TEST_F(test_schedulesearchview, slotSchotCutClicked_01) +{ + Stub stub; + stub.set((QAction*(QMenu::*)(const QPoint &, QAction *))ADDR(QMenu, exec), schedulesearchview_stub_QMenu_exec); + CScheduleSearchItem item; + item.slotSchotCutClicked(); +} + +TEST_F(test_schedulesearchview, contextMenuEvent_01) +{ + Stub stub; + stub.set((QAction*(QMenu::*)(const QPoint &, QAction *))ADDR(QMenu, exec), schedulesearchview_stub_QMenu_exec); + CScheduleSearchItem item; + + QContextMenuEvent event(QContextMenuEvent::Mouse, QPoint()); + item.contextMenuEvent(&event); +} + +TEST_F(test_schedulesearchview, mouseDoubleClickEvent_01) +{ + Stub stub; + calendarDDialogExecStub(stub); + CScheduleSearchItem item; + + QMouseEvent event(QEvent::MouseButtonDblClick, QPointF(), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); + item.mouseDoubleClickEvent(&event); +} + +TEST_F(test_schedulesearchview, mousePressEvent_01) +{ + CScheduleSearchItem item; + QMouseEvent event(QEvent::MouseButtonDblClick, QPointF(), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); + item.mousePressEvent(&event); + EXPECT_FALSE(item.m_tabFocus); +} + +TEST_F(test_schedulesearchview, mouseReleaseEvent_01) +{ + CScheduleSearchItem item; + QMouseEvent event(QEvent::MouseButtonDblClick, QPointF(), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); + item.mouseReleaseEvent(&event); + EXPECT_EQ(item.m_mouseStatus, CScheduleSearchItem::M_HOVER); +} + +TEST_F(test_schedulesearchview, enterEvent_01) +{ + CScheduleSearchItem item; + QEvent event(QEvent::Enter); + item.enterEvent(&event); + EXPECT_EQ(item.m_mouseStatus, CScheduleSearchItem::M_HOVER); +} + +TEST_F(test_schedulesearchview, focusOutEvent_01) +{ + CScheduleSearchItem item; + QFocusEvent event(QEvent::FocusOut, Qt::TabFocusReason); + item.focusOutEvent(&event); +} + +TEST_F(test_schedulesearchview, focusInEvent_01) +{ + CScheduleSearchItem item; + QFocusEvent event(QEvent::FocusIn, Qt::TabFocusReason); + item.focusInEvent(&event); +} + +TEST_F(test_schedulesearchview, keyPressEvent_01) +{ + Stub stub; + calendarDDialogExecStub(stub); + CScheduleSearchItem item; + QKeyEvent event(QEvent::KeyPress, Qt::Key_Return, Qt::NoModifier); + item.keyPressEvent(&event); +} + +TEST_F(test_schedulesearchview, keyPressEvent_02) { - // ScheduleDataInfo scheduleinfo = getScheduleDInfo().first(); - // mScheduleSearchItem->setData(scheduleinfo, QDate::currentDate()); - // mScheduleSearchItem->slotDelete(); + CScheduleSearchItem item; + QKeyEvent event(QEvent::KeyPress, Qt::Key_M, Qt::AltModifier); + item.keyPressEvent(&event); } //const ScheduleDataInfo &getData() const diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_widget/test_schedulesearchview.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_widget/test_schedulesearchview.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_widget/test_schedulesearchview.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_widget/test_schedulesearchview.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2021 Uniontech Software Technology Co.,Ltd. -* -* Author: zhengxiaokang -* -* Maintainer: zhengxiaokang -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_SCHEDULESEARCHVIEW_H #define TEST_SCHEDULESEARCHVIEW_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_widget/test_touchgestureoperation.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_widget/test_touchgestureoperation.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_widget/test_touchgestureoperation.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_widget/test_touchgestureoperation.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2021 Uniontech Software Technology Co.,Ltd. -* -* Author: zhengxiaokang -* -* Maintainer: zhengxiaokang -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "test_touchgestureoperation.h" test_touchgestureoperation::test_touchgestureoperation() diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_widget/test_touchgestureoperation.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_widget/test_touchgestureoperation.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_widget/test_touchgestureoperation.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_widget/test_touchgestureoperation.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2021 Uniontech Software Technology Co.,Ltd. -* -* Author: zhengxiaokang -* -* Maintainer: zhengxiaokang -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_TOUCHGESTUREOPERATION_H #define TEST_TOUCHGESTUREOPERATION_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_widget/test_weekWidget/test_weekheadview.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_widget/test_weekWidget/test_weekheadview.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_widget/test_weekWidget/test_weekheadview.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_widget/test_weekWidget/test_weekheadview.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,121 +1,105 @@ -/* -* Copyright (C) 2019 ~ 2021 Uniontech Software Technology Co.,Ltd. -* -* Author: zhengxiaokang -* -* Maintainer: zhengxiaokang -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "test_weekheadview.h" #include "../third-party_stub/stub.h" -test_weekheadview::test_weekheadview() -{ - mWeekHeadView = new CWeekHeadView(); -} - -test_weekheadview::~test_weekheadview() -{ - delete mWeekHeadView; - mWeekHeadView = nullptr; -} - -QMap getHuangLiDayInfo() -{ - QMap huangLiDayInfo {}; - CaHuangLiDayInfo huangLiInfo1 {}; - huangLiInfo1.mGanZhiYear = "辛丑牛年"; //年干支 - huangLiInfo1.mGanZhiMonth = "庚寅月"; //月干支 - huangLiInfo1.mGanZhiDay = "辛卯日"; //日干支 - huangLiInfo1.mLunarMonthName = "正月"; //农历月名称 - huangLiInfo1.mLunarDayName = "初一"; //农历日名称 - huangLiInfo1.mLunarLeapMonth = 4; //闰月 - huangLiInfo1.mZodiac = "牛"; //生肖 - huangLiInfo1.mTerm = ""; //农历节气 - huangLiInfo1.mSolarFestival = "国庆节"; //阳历节日 - huangLiInfo1.mLunarFestival = "除夕"; //农历节日 - huangLiInfo1.mSuit = "嫁娶"; //黄历宜 - huangLiInfo1.mAvoid = "入土"; //黄历忌 - - huangLiDayInfo.insert(QDate::currentDate(), huangLiInfo1); - return huangLiDayInfo; -} - -QVector getDayList() -{ - QVector dateList {}; - QDate currentDate = QDate::currentDate(); - dateList.append(currentDate); - dateList.append(currentDate.addDays(1)); - dateList.append(currentDate.addDays(2)); - dateList.append(currentDate.addDays(3)); - dateList.append(currentDate.addDays(4)); - dateList.append(currentDate.addDays(5)); - dateList.append(currentDate.addDays(6)); - - return dateList; -} -//void CWeekHeadView::setTheMe(int type) -TEST_F(test_weekheadview, setTheMe) -{ - mWeekHeadView->setTheMe(1); - mWeekHeadView->setTheMe(2); -} - -//void CWeekHeadView::setWeekDay(QVector vDays, const QDate &selectDate) -TEST_F(test_weekheadview, setWeekDay) -{ - QVector dateList {}; - dateList.append(getDayList().first()); - mWeekHeadView->setWeekDay(dateList, QDate::currentDate()); - mWeekHeadView->setWeekDay(getDayList(), QDate::currentDate()); -} - -//void CWeekHeadView::setLunarVisible(bool visible) -TEST_F(test_weekheadview, setLunarvisible) -{ - mWeekHeadView->setLunarVisible(false); - mWeekHeadView->setLunarVisible(true); -} - -//const QString CWeekHeadView::getCellDayNum(int pos) -TEST_F(test_weekheadview, getCellDayNum) -{ - mWeekHeadView->setWeekDay(getDayList(), QDate::currentDate()); - mWeekHeadView->getCellDayNum(4); -} - -//const QDate CWeekHeadView::getCellDate(int pos) -TEST_F(test_weekheadview, getCellDate) -{ - mWeekHeadView->setWeekDay(getDayList(), QDate::currentDate()); - mWeekHeadView->getCellDate(4); -} - -//const QString CWeekHeadView::getLunar(int pos) -TEST_F(test_weekheadview, getLunar) -{ - mWeekHeadView->setWeekDay(getDayList(), QDate::currentDate()); - mWeekHeadView->setHunagLiInfo(getHuangLiDayInfo()); - mWeekHeadView->getLunar(1); -} - -TEST_F(test_weekheadview, getPixmap) -{ - mWeekHeadView->setWeekDay(getDayList(), QDate::currentDate()); - mWeekHeadView->setFixedSize(600, 80); - QPixmap pixmap(mWeekHeadView->size()); - mWeekHeadView->render(&pixmap); -} +//test_weekheadview::test_weekheadview() +//{ +// mWeekHeadView = new CWeekHeadView(); +//} + +//test_weekheadview::~test_weekheadview() +//{ +// delete mWeekHeadView; +// mWeekHeadView = nullptr; +//} + +//QMap getHuangLiDayInfo() +//{ +// QMap huangLiDayInfo {}; +// CaHuangLiDayInfo huangLiInfo1 {}; +// huangLiInfo1.mGanZhiYear = "辛丑牛年"; //年干支 +// huangLiInfo1.mGanZhiMonth = "庚寅月"; //月干支 +// huangLiInfo1.mGanZhiDay = "辛卯日"; //日干支 +// huangLiInfo1.mLunarMonthName = "正月"; //农历月名称 +// huangLiInfo1.mLunarDayName = "初一"; //农历日名称 +// huangLiInfo1.mLunarLeapMonth = 4; //闰月 +// huangLiInfo1.mZodiac = "牛"; //生肖 +// huangLiInfo1.mTerm = ""; //农历节气 +// huangLiInfo1.mSolarFestival = "国庆节"; //阳历节日 +// huangLiInfo1.mLunarFestival = "除夕"; //农历节日 +// huangLiInfo1.mSuit = "嫁娶"; //黄历宜 +// huangLiInfo1.mAvoid = "入土"; //黄历忌 + +// huangLiDayInfo.insert(QDate::currentDate(), huangLiInfo1); +// return huangLiDayInfo; +//} + +//QVector getDayList() +//{ +// QVector dateList {}; +// QDate currentDate = QDate::currentDate(); +// dateList.append(currentDate); +// dateList.append(currentDate.addDays(1)); +// dateList.append(currentDate.addDays(2)); +// dateList.append(currentDate.addDays(3)); +// dateList.append(currentDate.addDays(4)); +// dateList.append(currentDate.addDays(5)); +// dateList.append(currentDate.addDays(6)); + +// return dateList; +//} +////void CWeekHeadView::setTheMe(int type) +//TEST_F(test_weekheadview, setTheMe) +//{ +// mWeekHeadView->setTheMe(1); +// mWeekHeadView->setTheMe(2); +//} + +////void CWeekHeadView::setWeekDay(QVector vDays, const QDate &selectDate) +//TEST_F(test_weekheadview, setWeekDay) +//{ +// QVector dateList {}; +// dateList.append(getDayList().first()); +// mWeekHeadView->setWeekDay(dateList, QDate::currentDate()); +// mWeekHeadView->setWeekDay(getDayList(), QDate::currentDate()); +//} + +////void CWeekHeadView::setLunarVisible(bool visible) +//TEST_F(test_weekheadview, setLunarvisible) +//{ +// mWeekHeadView->setLunarVisible(false); +// mWeekHeadView->setLunarVisible(true); +//} + +////const QString CWeekHeadView::getCellDayNum(int pos) +//TEST_F(test_weekheadview, getCellDayNum) +//{ +// mWeekHeadView->setWeekDay(getDayList(), QDate::currentDate()); +// mWeekHeadView->getCellDayNum(4); +//} + +////const QDate CWeekHeadView::getCellDate(int pos) +//TEST_F(test_weekheadview, getCellDate) +//{ +// mWeekHeadView->setWeekDay(getDayList(), QDate::currentDate()); +// mWeekHeadView->getCellDate(4); +//} + +////const QString CWeekHeadView::getLunar(int pos) +//TEST_F(test_weekheadview, getLunar) +//{ +// mWeekHeadView->setWeekDay(getDayList(), QDate::currentDate()); +// mWeekHeadView->setHunagLiInfo(getHuangLiDayInfo()); +// mWeekHeadView->getLunar(1); +//} + +//TEST_F(test_weekheadview, getPixmap) +//{ +// mWeekHeadView->setWeekDay(getDayList(), QDate::currentDate()); +// mWeekHeadView->setFixedSize(600, 80); +// QPixmap pixmap(mWeekHeadView->size()); +// mWeekHeadView->render(&pixmap); +//} diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_widget/test_weekWidget/test_weekheadview.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_widget/test_weekWidget/test_weekheadview.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_widget/test_weekWidget/test_weekheadview.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_widget/test_weekWidget/test_weekheadview.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,39 +1,23 @@ -/* -* Copyright (C) 2019 ~ 2021 Uniontech Software Technology Co.,Ltd. -* -* Author: zhengxiaokang -* -* Maintainer: zhengxiaokang -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_WEEKHEADVIEW_H #define TEST_WEEKHEADVIEW_H -#include "weekWidget/weekheadview.h" -#include "gtest/gtest.h" -#include +//#include "weekWidget/weekheadview.h" +//#include "gtest/gtest.h" +//#include -class test_weekheadview : public QObject - , public ::testing::Test -{ -public: - test_weekheadview(); - ~test_weekheadview(); +//class test_weekheadview : public QObject +// , public ::testing::Test +//{ +//public: +// test_weekheadview(); +// ~test_weekheadview(); -protected: - CWeekHeadView *mWeekHeadView = nullptr; -}; +//protected: +// CWeekHeadView *mWeekHeadView = nullptr; +//}; #endif // TEST_WEEKHEADVIEW_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_widget/test_weekWidget/test_weekview.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_widget/test_weekWidget/test_weekview.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_widget/test_weekWidget/test_weekview.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_widget/test_weekWidget/test_weekview.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,65 +1,49 @@ -/* -* Copyright (C) 2019 ~ 2021 Uniontech Software Technology Co.,Ltd. -* -* Author: zhengxiaokang -* -* Maintainer: zhengxiaokang -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "test_weekview.h" -int getWeekNumOfYear(const QDate &date) -{ - Q_UNUSED(date); - return 4; -} - -test_weekview::test_weekview() -{ - mWeekView = new CWeekView(&getWeekNumOfYear); -} - -test_weekview::~test_weekview() -{ - delete mWeekView; - mWeekView = nullptr; -} - -//void CWeekView::setSelectDate(const QDate date) -TEST_F(test_weekview, setSelectDate) -{ - mWeekView->setSelectDate(QDate::currentDate()); -} - -//void CWeekView::setCurrent(const QDateTime &dateTime) -TEST_F(test_weekview, setCurrent) -{ - mWeekView->setCurrent(QDateTime::currentDateTime()); -} - -//void CWeekView::setTheMe(int type) -TEST_F(test_weekview, setTheMe) -{ - mWeekView->setTheMe(1); - mWeekView->setTheMe(2); -} - -TEST_F(test_weekview, getPixmap) -{ - mWeekView->setSelectDate(QDate::currentDate()); - mWeekView->setFixedSize(600, 50); - QPixmap pixmap(mWeekView->size()); - mWeekView->render(&pixmap); -} +//int getWeekNumOfYear(const QDate &date) +//{ +// Q_UNUSED(date); +// return 4; +//} + +//test_weekview::test_weekview() +//{ +// mWeekView = new CWeekView(&getWeekNumOfYear); +//} + +//test_weekview::~test_weekview() +//{ +// delete mWeekView; +// mWeekView = nullptr; +//} + +////void CWeekView::setSelectDate(const QDate date) +//TEST_F(test_weekview, setSelectDate) +//{ +// mWeekView->setSelectDate(QDate::currentDate()); +//} + +////void CWeekView::setCurrent(const QDateTime &dateTime) +//TEST_F(test_weekview, setCurrent) +//{ +// mWeekView->setCurrent(QDateTime::currentDateTime()); +//} + +////void CWeekView::setTheMe(int type) +//TEST_F(test_weekview, setTheMe) +//{ +// mWeekView->setTheMe(1); +// mWeekView->setTheMe(2); +//} + +//TEST_F(test_weekview, getPixmap) +//{ +// mWeekView->setSelectDate(QDate::currentDate()); +// mWeekView->setFixedSize(600, 50); +// QPixmap pixmap(mWeekView->size()); +// mWeekView->render(&pixmap); +//} diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_widget/test_weekWidget/test_weekview.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_widget/test_weekWidget/test_weekview.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_widget/test_weekWidget/test_weekview.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_widget/test_weekWidget/test_weekview.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,39 +1,23 @@ -/* -* Copyright (C) 2019 ~ 2021 Uniontech Software Technology Co.,Ltd. -* -* Author: zhengxiaokang -* -* Maintainer: zhengxiaokang -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_WEEKVIEW_H #define TEST_WEEKVIEW_H -#include "weekWidget/weekview.h" -#include "gtest/gtest.h" -#include +//#include "weekWidget/weekview.h" +//#include "gtest/gtest.h" +//#include -class test_weekview : public QObject - , public ::testing::Test -{ -public: - test_weekview(); - ~test_weekview(); +//class test_weekview : public QObject +// , public ::testing::Test +//{ +//public: +// test_weekview(); +// ~test_weekview(); -protected: - CWeekView *mWeekView = nullptr; -}; +//protected: +// CWeekView *mWeekView = nullptr; +//}; #endif // TEST_WEEKVIEW_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_widget/test_weekWidget/test_weekwindow.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_widget/test_weekWidget/test_weekwindow.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_widget/test_weekWidget/test_weekwindow.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_widget/test_weekWidget/test_weekwindow.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "test_weekwindow.h" #include "../third-party_stub/stub.h" diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_widget/test_weekWidget/test_weekwindow.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_widget/test_weekWidget/test_weekwindow.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_widget/test_weekWidget/test_weekwindow.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_widget/test_weekWidget/test_weekwindow.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,44 +1,28 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_WEEKWINDOW_H #define TEST_WEEKWINDOW_H #include "gtest/gtest.h" -#include "weekWidget/weekwindow.h" +//#include "weekWidget/weekwindow.h" + +//#include -#include +//class test_weekWindow : public QObject +// , public ::testing::Test +//{ +// Q_OBJECT +//public: +// explicit test_weekWindow(); +// void SetUp() override; +// void TearDown() override; +//signals: -class test_weekWindow : public QObject - , public ::testing::Test -{ - Q_OBJECT -public: - explicit test_weekWindow(); - void SetUp() override; - void TearDown() override; -signals: - -public slots: -public: - CWeekWindow *m_weekWindow {nullptr}; -}; +//public slots: +//public: +// CWeekWindow *m_weekWindow {nullptr}; +//}; #endif // TEST_WEEKWINDOW_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_widget/test_yearWidget/test_yearscheduleview.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_widget/test_yearWidget/test_yearscheduleview.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_widget/test_yearWidget/test_yearscheduleview.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_widget/test_yearWidget/test_yearscheduleview.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,303 +1,287 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: hejinghai -* -* Maintainer: hejinghai -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "test_yearscheduleview.h" #include "../third-party_stub/stub.h" #include "constants.h" #include -test_yearscheduleview::test_yearscheduleview() -{ -} - -test_yearscheduleview::~test_yearscheduleview() -{ -} - -void test_yearscheduleview::SetUp() -{ - cYearScheduleView = new CYearScheduleView(); - zYearScheduleOutView = new CYearScheduleOutView(); -} - -void test_yearscheduleview::TearDown() -{ - delete cYearScheduleView; - cYearScheduleView = nullptr; - delete zYearScheduleOutView; - zYearScheduleOutView = nullptr; -} - -QVector test_yearscheduleview::getScheduleDataInfo() -{ - QVector scheduleDate {}; - ScheduleDataInfo schedule1, schedule2, schedule3, schedule4, schedule5, scheduleFes; - - schedule1.setID(1); - schedule1.setBeginDateTime(QDateTime(QDate(2021, 1, 1), QTime(0, 0, 0))); - schedule1.setEndDateTime(QDateTime(QDate(2021, 1, 2), QTime(23, 59, 59))); - schedule1.setTitleName("schedule test one"); - schedule1.setAllDay(true); - schedule1.setType(1); - schedule1.setRecurID(0); - - schedule2.setID(2); - schedule2.setBeginDateTime(QDateTime(QDate(2021, 1, 3), QTime(0, 0, 0))); - schedule2.setEndDateTime(QDateTime(QDate(2021, 1, 5), QTime(23, 59, 59))); - schedule2.setTitleName("schedule test two"); - schedule2.setAllDay(true); - schedule2.setType(2); - schedule2.setRecurID(0); - - schedule3.setID(3); - schedule3.setBeginDateTime(QDateTime(QDate(2021, 1, 6), QTime(5, 23, 40))); - schedule3.setEndDateTime(QDateTime(QDate(2021, 1, 9), QTime(6, 23, 40))); - schedule3.setTitleName("schedule test three"); - schedule3.setAllDay(false); - schedule3.setType(3); - schedule3.setRecurID(0); - - schedule4.setID(4); - schedule4.setBeginDateTime(QDateTime(QDate(2021, 1, 10), QTime(7, 23, 40))); - schedule4.setEndDateTime(QDateTime(QDate(2021, 1, 14), QTime(8, 23, 40))); - schedule4.setTitleName("schedule test four"); - schedule4.setAllDay(false); - schedule4.setType(1); - schedule4.setRecurID(0); - - schedule5.setID(5); - schedule5.setBeginDateTime(QDateTime(QDate(2021, 1, 15), QTime(9, 23, 40))); - schedule5.setEndDateTime(QDateTime(QDate(2021, 1, 20), QTime(10, 23, 40))); - schedule5.setTitleName("schedule test five"); - schedule5.setAllDay(false); - schedule5.setType(2); - schedule5.setRecurID(0); - - scheduleFes.setID(6); - scheduleFes.setBeginDateTime(QDateTime(QDate(2021, 1, 21), QTime(0, 0, 0))); - scheduleFes.setEndDateTime(QDateTime(QDate(2021, 1, 21), QTime(23, 59, 59))); - scheduleFes.setTitleName("schedule test festival"); - scheduleFes.setAllDay(true); - scheduleFes.setType(4); - scheduleFes.setRecurID(0); - - scheduleDate.append(schedule1); - scheduleDate.append(schedule2); - scheduleDate.append(schedule3); - scheduleDate.append(schedule4); - scheduleDate.append(schedule5); - scheduleDate.append(scheduleFes); - return scheduleDate; -} - -QVector test_yearscheduleview::getScheduleDateAndTitle() -{ - QVector scheduleDate {}; - ScheduleDataInfo s11, s12; - s11.setBeginDateTime(QDateTime(QDate(2020, 12, 31), QTime(16, 23, 40))); - s11.setEndDateTime(QDateTime(QDate(2021, 1, 1), QTime(16, 23, 40))); - s12.setBeginDateTime(QDateTime(QDate(2020, 12, 31), QTime(16, 23, 40))); - s12.setEndDateTime(QDateTime(QDate(2020, 12, 31), QTime(16, 23, 40))); - ScheduleDataInfo s21, s22; - s21.setBeginDateTime(QDateTime(QDate(2020, 12, 31), QTime(16, 23, 40))); - s21.setEndDateTime(QDateTime(QDate(2020, 12, 31), QTime(16, 23, 40))); - s22.setBeginDateTime(QDateTime(QDate(2020, 12, 31), QTime(16, 23, 40))); - s22.setEndDateTime(QDateTime(QDate(2021, 1, 1), QTime(16, 23, 40))); - ScheduleDataInfo s31, s32; - s31.setBeginDateTime(QDateTime(QDate(2020, 12, 30), QTime(16, 23, 40))); - s31.setEndDateTime(QDateTime(QDate(2021, 1, 1), QTime(16, 23, 40))); - s32.setBeginDateTime(QDateTime(QDate(2020, 12, 31), QTime(16, 23, 40))); - s32.setEndDateTime(QDateTime(QDate(2021, 1, 1), QTime(16, 23, 40))); - ScheduleDataInfo s41, s42; - s41.setBeginDateTime(QDateTime(QDate(2020, 12, 31), QTime(16, 23, 40))); - s41.setEndDateTime(QDateTime(QDate(2021, 1, 1), QTime(16, 23, 40))); - s42.setBeginDateTime(QDateTime(QDate(2020, 12, 30), QTime(16, 23, 40))); - s42.setEndDateTime(QDateTime(QDate(2021, 1, 1), QTime(16, 23, 40))); - ScheduleDataInfo s51, s52; - s51.setBeginDateTime(QDateTime(QDate(2021, 1, 1), QTime(16, 23, 40))); - s51.setEndDateTime(QDateTime(QDate(2021, 1, 1), QTime(16, 23, 40))); - s51.setTitleName("ab"); - s52.setBeginDateTime(QDateTime(QDate(2021, 1, 1), QTime(16, 23, 40))); - s52.setEndDateTime(QDateTime(QDate(2021, 1, 1), QTime(16, 23, 40))); - s52.setTitleName("ba"); - ScheduleDataInfo s61, s62; - s61.setBeginDateTime(QDateTime(QDate(2021, 1, 1), QTime(16, 23, 40))); - s61.setEndDateTime(QDateTime(QDate(2021, 1, 1), QTime(16, 23, 40))); - s61.setTitleName("ba"); - s62.setBeginDateTime(QDateTime(QDate(2021, 1, 1), QTime(16, 23, 40))); - s62.setEndDateTime(QDateTime(QDate(2021, 1, 1), QTime(16, 23, 40))); - s62.setTitleName("ab"); - ScheduleDataInfo s71, s72; - s71.setBeginDateTime(QDateTime(QDate(2021, 1, 1), QTime(16, 2, 40))); - s71.setEndDateTime(QDateTime(QDate(2021, 1, 1), QTime(16, 23, 40))); - s72.setBeginDateTime(QDateTime(QDate(2021, 1, 1), QTime(16, 23, 40))); - s72.setEndDateTime(QDateTime(QDate(2021, 1, 1), QTime(16, 23, 40))); - ScheduleDataInfo s81, s82; - s81.setBeginDateTime(QDateTime(QDate(2021, 1, 1), QTime(16, 23, 40))); - s81.setEndDateTime(QDateTime(QDate(2021, 1, 1), QTime(16, 23, 40))); - s82.setBeginDateTime(QDateTime(QDate(2021, 1, 1), QTime(16, 2, 40))); - s82.setEndDateTime(QDateTime(QDate(2021, 1, 1), QTime(16, 23, 40))); - ScheduleDataInfo s91, s92; - s91.setBeginDateTime(QDateTime(QDate(2020, 12, 31), QTime(16, 23, 40))); - s91.setEndDateTime(QDateTime(QDate(2021, 1, 1), QTime(16, 23, 40))); - s92.setBeginDateTime(QDateTime(QDate(2020, 12, 31), QTime(16, 23, 40))); - s92.setEndDateTime(QDateTime(QDate(2020, 12, 31), QTime(16, 23, 40))); - ScheduleDataInfo sa1, sa2; - sa1.setBeginDateTime(QDateTime(QDate(2020, 12, 31), QTime(16, 23, 40))); - sa1.setEndDateTime(QDateTime(QDate(2021, 1, 1), QTime(16, 23, 40))); - sa2.setBeginDateTime(QDateTime(QDate(2020, 12, 31), QTime(16, 23, 40))); - sa2.setEndDateTime(QDateTime(QDate(2021, 12, 31), QTime(16, 23, 40))); - - scheduleDate << s11 << s12 << s21 << s22 << s31 << s32 << s41 << s42 - << s51 << s52 << s61 << s62 << s71 << s72 << s81 << s82 - << s91 << s92 << sa1 << sa2; - return scheduleDate; -} - -//bool YScheduleDateThan(const ScheduleDataInfo &s1, const ScheduleDataInfo &s2) -bool YScheduleDateThan(const ScheduleDataInfo &s1, const ScheduleDataInfo &s2); -TEST_F(test_yearscheduleview, yschesuledatethan) -{ - //bdate1 != edate1 && bdate2 == edate2 - EXPECT_TRUE(YScheduleDateThan(getScheduleDateAndTitle().at(0), getScheduleDateAndTitle().at(1))); - //bdate1 == edate1 && bdate2 != edate2 - EXPECT_FALSE(YScheduleDateThan(getScheduleDateAndTitle().at(2), getScheduleDateAndTitle().at(3))); - //bdate1 != edate1 && bdate2 != edate2 - //bdate1 < bdate2 - EXPECT_TRUE(YScheduleDateThan(getScheduleDateAndTitle().at(4), getScheduleDateAndTitle().at(5))); - //bdate1 != edate1 && bdate2 != edate2 - //bdate1 < bdate2 - EXPECT_FALSE(YScheduleDateThan(getScheduleDateAndTitle().at(6), getScheduleDateAndTitle().at(7))); - //bdate1 = edate1 && bdate2 = edate2 - //s1.getTitleName() < s2.getTitleName() - EXPECT_TRUE(YScheduleDateThan(getScheduleDateAndTitle().at(8), getScheduleDateAndTitle().at(9))); - //bdate1 = edate1 && bdate2 = edate2 - //s1.getBeginDateTime() == s2.getBeginDateTime() - //s1.getTitleName() < s2.getTitleName() - EXPECT_FALSE(YScheduleDateThan(getScheduleDateAndTitle().at(10), getScheduleDateAndTitle().at(11))); - //bdate1 = edate1 && bdate2 = edate2 - //s1.getBeginDateTime() != s2.getBeginDateTime() - //s1.getBeginDateTime() < s2.getBeginDateTime() - EXPECT_TRUE(YScheduleDateThan(getScheduleDateAndTitle().at(12), getScheduleDateAndTitle().at(13))); - //bdate1 = edate1 && bdate2 = edate2 - //s1.getBeginDateTime() != s2.getBeginDateTime() - //s1.getBeginDateTime() < s2.getBeginDateTime() - EXPECT_FALSE(YScheduleDateThan(getScheduleDateAndTitle().at(14), getScheduleDateAndTitle().at(15))); -} - -//bool YScheduleDaysThan(const ScheduleDataInfo &s1, const ScheduleDataInfo &s2) -bool YScheduleDaysThan(const ScheduleDataInfo &s1, const ScheduleDataInfo &s2); -TEST_F(test_yearscheduleview, yscheduleDaysThan) -{ - //s1.getBeginDateTime().date().daysTo(s1.getEndDateTime().date()) > s2.getBeginDateTime().date().daysTo(s2.getEndDateTime().date()) - EXPECT_TRUE(YScheduleDaysThan(getScheduleDateAndTitle().at(16), getScheduleDateAndTitle().at(17))); - //s1.getBeginDateTime().date().daysTo(s1.getEndDateTime().date()) > s2.getBeginDateTime().date().daysTo(s2.getEndDateTime().date()) - EXPECT_FALSE(YScheduleDaysThan(getScheduleDateAndTitle().at(18), getScheduleDateAndTitle().at(19))); -} - -//void CYearScheduleView::setData(QVector &vListData) -TEST_F(test_yearscheduleview, setDate) -{ - QVector scheduleinfo = getScheduleDataInfo(); - cYearScheduleView->setData(scheduleinfo); -} - -//void CYearScheduleView::clearData() -TEST_F(test_yearscheduleview, clearDate) -{ - cYearScheduleView->clearData(); -} - -//int CYearScheduleView::showWindow() -TEST_F(test_yearscheduleview, showWindow) -{ - QVector vlistData = getScheduleDataInfo(); - cYearScheduleView->showWindow(); - cYearScheduleView->setData(vlistData); - cYearScheduleView->showWindow(); -} - -//void CYearScheduleView::setTheMe(int type) -TEST_F(test_yearscheduleview, setTheMe) -{ - int type = 1; - cYearScheduleView->setTheMe(type); - - type = 2; - cYearScheduleView->setTheMe(type); -} - -//void CYearScheduleView::setCurrentDate(QDate cdate) -TEST_F(test_yearscheduleview, setCurrentDate) -{ - cYearScheduleView->setCurrentDate(QDate(2021, 1, 6)); -} - -//QDate CYearScheduleView::getCurrentDate() -TEST_F(test_yearscheduleview, getCurrentDate) -{ - QDate currentDate = QDate::currentDate(); - cYearScheduleView->setCurrentDate(currentDate); - bool iscurrent = currentDate == cYearScheduleView->getCurrentDate(); - EXPECT_TRUE(iscurrent); - - QDate earlyDate = QDate(1999, 1, 1); - cYearScheduleView->setCurrentDate(earlyDate); - iscurrent = currentDate == cYearScheduleView->getCurrentDate(); - EXPECT_FALSE(iscurrent); -} - - -//void CYearScheduleOutView::setData(QVector &vListData) -TEST_F(test_yearscheduleview, setOutData) -{ - QVector scheduleInfo = getScheduleDataInfo(); - zYearScheduleOutView->setData(scheduleInfo); -} - -//void CYearScheduleOutView::clearData() -TEST_F(test_yearscheduleview, clearOutData) -{ - zYearScheduleOutView->clearData(); -} - -//void CYearScheduleOutView::setTheMe(int type) -TEST_F(test_yearscheduleview, setTheOutMe) -{ - zYearScheduleOutView->setTheMe(1); -} - -//void CYearScheduleOutView::setCurrentDate(QDate cdate) -TEST_F(test_yearscheduleview, setCurrentOutDate) -{ - zYearScheduleOutView->setCurrentDate(QDate(2021, 1, 6)); -} - -TEST_F(test_yearscheduleview, paintEvent) -{ - QPixmap pixmap(cYearScheduleView->size()); - QVector scheduleInfo = getScheduleDataInfo(); - cYearScheduleView->setData(scheduleInfo); - cYearScheduleView->render(&pixmap); -} - -TEST_F(test_yearscheduleview, mousePressEvent) -{ -} +//test_yearscheduleview::test_yearscheduleview() +//{ +//} + +//test_yearscheduleview::~test_yearscheduleview() +//{ +//} + +//void test_yearscheduleview::SetUp() +//{ +// cYearScheduleView = new CYearScheduleView(); +// zYearScheduleOutView = new CYearScheduleOutView(); +//} + +//void test_yearscheduleview::TearDown() +//{ +// delete cYearScheduleView; +// cYearScheduleView = nullptr; +// delete zYearScheduleOutView; +// zYearScheduleOutView = nullptr; +//} + +//QVector test_yearscheduleview::getScheduleDataInfo() +//{ +// QVector scheduleDate {}; +// ScheduleDataInfo schedule1, schedule2, schedule3, schedule4, schedule5, scheduleFes; + +// schedule1.setID(1); +// schedule1.setBeginDateTime(QDateTime(QDate(2021, 1, 1), QTime(0, 0, 0))); +// schedule1.setEndDateTime(QDateTime(QDate(2021, 1, 2), QTime(23, 59, 59))); +// schedule1.setTitleName("schedule test one"); +// schedule1.setAllDay(true); +// schedule1.setType(1); +// schedule1.setRecurID(0); + +// schedule2.setID(2); +// schedule2.setBeginDateTime(QDateTime(QDate(2021, 1, 3), QTime(0, 0, 0))); +// schedule2.setEndDateTime(QDateTime(QDate(2021, 1, 5), QTime(23, 59, 59))); +// schedule2.setTitleName("schedule test two"); +// schedule2.setAllDay(true); +// schedule2.setType(2); +// schedule2.setRecurID(0); + +// schedule3.setID(3); +// schedule3.setBeginDateTime(QDateTime(QDate(2021, 1, 6), QTime(5, 23, 40))); +// schedule3.setEndDateTime(QDateTime(QDate(2021, 1, 9), QTime(6, 23, 40))); +// schedule3.setTitleName("schedule test three"); +// schedule3.setAllDay(false); +// schedule3.setType(3); +// schedule3.setRecurID(0); + +// schedule4.setID(4); +// schedule4.setBeginDateTime(QDateTime(QDate(2021, 1, 10), QTime(7, 23, 40))); +// schedule4.setEndDateTime(QDateTime(QDate(2021, 1, 14), QTime(8, 23, 40))); +// schedule4.setTitleName("schedule test four"); +// schedule4.setAllDay(false); +// schedule4.setType(1); +// schedule4.setRecurID(0); + +// schedule5.setID(5); +// schedule5.setBeginDateTime(QDateTime(QDate(2021, 1, 15), QTime(9, 23, 40))); +// schedule5.setEndDateTime(QDateTime(QDate(2021, 1, 20), QTime(10, 23, 40))); +// schedule5.setTitleName("schedule test five"); +// schedule5.setAllDay(false); +// schedule5.setType(2); +// schedule5.setRecurID(0); + +// scheduleFes.setID(6); +// scheduleFes.setBeginDateTime(QDateTime(QDate(2021, 1, 21), QTime(0, 0, 0))); +// scheduleFes.setEndDateTime(QDateTime(QDate(2021, 1, 21), QTime(23, 59, 59))); +// scheduleFes.setTitleName("schedule test festival"); +// scheduleFes.setAllDay(true); +// scheduleFes.setType(4); +// scheduleFes.setRecurID(0); + +// scheduleDate.append(schedule1); +// scheduleDate.append(schedule2); +// scheduleDate.append(schedule3); +// scheduleDate.append(schedule4); +// scheduleDate.append(schedule5); +// scheduleDate.append(scheduleFes); +// return scheduleDate; +//} + +//QVector test_yearscheduleview::getScheduleDateAndTitle() +//{ +// QVector scheduleDate {}; +// ScheduleDataInfo s11, s12; +// s11.setBeginDateTime(QDateTime(QDate(2020, 12, 31), QTime(16, 23, 40))); +// s11.setEndDateTime(QDateTime(QDate(2021, 1, 1), QTime(16, 23, 40))); +// s12.setBeginDateTime(QDateTime(QDate(2020, 12, 31), QTime(16, 23, 40))); +// s12.setEndDateTime(QDateTime(QDate(2020, 12, 31), QTime(16, 23, 40))); +// ScheduleDataInfo s21, s22; +// s21.setBeginDateTime(QDateTime(QDate(2020, 12, 31), QTime(16, 23, 40))); +// s21.setEndDateTime(QDateTime(QDate(2020, 12, 31), QTime(16, 23, 40))); +// s22.setBeginDateTime(QDateTime(QDate(2020, 12, 31), QTime(16, 23, 40))); +// s22.setEndDateTime(QDateTime(QDate(2021, 1, 1), QTime(16, 23, 40))); +// ScheduleDataInfo s31, s32; +// s31.setBeginDateTime(QDateTime(QDate(2020, 12, 30), QTime(16, 23, 40))); +// s31.setEndDateTime(QDateTime(QDate(2021, 1, 1), QTime(16, 23, 40))); +// s32.setBeginDateTime(QDateTime(QDate(2020, 12, 31), QTime(16, 23, 40))); +// s32.setEndDateTime(QDateTime(QDate(2021, 1, 1), QTime(16, 23, 40))); +// ScheduleDataInfo s41, s42; +// s41.setBeginDateTime(QDateTime(QDate(2020, 12, 31), QTime(16, 23, 40))); +// s41.setEndDateTime(QDateTime(QDate(2021, 1, 1), QTime(16, 23, 40))); +// s42.setBeginDateTime(QDateTime(QDate(2020, 12, 30), QTime(16, 23, 40))); +// s42.setEndDateTime(QDateTime(QDate(2021, 1, 1), QTime(16, 23, 40))); +// ScheduleDataInfo s51, s52; +// s51.setBeginDateTime(QDateTime(QDate(2021, 1, 1), QTime(16, 23, 40))); +// s51.setEndDateTime(QDateTime(QDate(2021, 1, 1), QTime(16, 23, 40))); +// s51.setTitleName("ab"); +// s52.setBeginDateTime(QDateTime(QDate(2021, 1, 1), QTime(16, 23, 40))); +// s52.setEndDateTime(QDateTime(QDate(2021, 1, 1), QTime(16, 23, 40))); +// s52.setTitleName("ba"); +// ScheduleDataInfo s61, s62; +// s61.setBeginDateTime(QDateTime(QDate(2021, 1, 1), QTime(16, 23, 40))); +// s61.setEndDateTime(QDateTime(QDate(2021, 1, 1), QTime(16, 23, 40))); +// s61.setTitleName("ba"); +// s62.setBeginDateTime(QDateTime(QDate(2021, 1, 1), QTime(16, 23, 40))); +// s62.setEndDateTime(QDateTime(QDate(2021, 1, 1), QTime(16, 23, 40))); +// s62.setTitleName("ab"); +// ScheduleDataInfo s71, s72; +// s71.setBeginDateTime(QDateTime(QDate(2021, 1, 1), QTime(16, 2, 40))); +// s71.setEndDateTime(QDateTime(QDate(2021, 1, 1), QTime(16, 23, 40))); +// s72.setBeginDateTime(QDateTime(QDate(2021, 1, 1), QTime(16, 23, 40))); +// s72.setEndDateTime(QDateTime(QDate(2021, 1, 1), QTime(16, 23, 40))); +// ScheduleDataInfo s81, s82; +// s81.setBeginDateTime(QDateTime(QDate(2021, 1, 1), QTime(16, 23, 40))); +// s81.setEndDateTime(QDateTime(QDate(2021, 1, 1), QTime(16, 23, 40))); +// s82.setBeginDateTime(QDateTime(QDate(2021, 1, 1), QTime(16, 2, 40))); +// s82.setEndDateTime(QDateTime(QDate(2021, 1, 1), QTime(16, 23, 40))); +// ScheduleDataInfo s91, s92; +// s91.setBeginDateTime(QDateTime(QDate(2020, 12, 31), QTime(16, 23, 40))); +// s91.setEndDateTime(QDateTime(QDate(2021, 1, 1), QTime(16, 23, 40))); +// s92.setBeginDateTime(QDateTime(QDate(2020, 12, 31), QTime(16, 23, 40))); +// s92.setEndDateTime(QDateTime(QDate(2020, 12, 31), QTime(16, 23, 40))); +// ScheduleDataInfo sa1, sa2; +// sa1.setBeginDateTime(QDateTime(QDate(2020, 12, 31), QTime(16, 23, 40))); +// sa1.setEndDateTime(QDateTime(QDate(2021, 1, 1), QTime(16, 23, 40))); +// sa2.setBeginDateTime(QDateTime(QDate(2020, 12, 31), QTime(16, 23, 40))); +// sa2.setEndDateTime(QDateTime(QDate(2021, 12, 31), QTime(16, 23, 40))); + +// scheduleDate << s11 << s12 << s21 << s22 << s31 << s32 << s41 << s42 +// << s51 << s52 << s61 << s62 << s71 << s72 << s81 << s82 +// << s91 << s92 << sa1 << sa2; +// return scheduleDate; +//} + +////bool YScheduleDateThan(const ScheduleDataInfo &s1, const ScheduleDataInfo &s2) +//bool YScheduleDateThan(const ScheduleDataInfo &s1, const ScheduleDataInfo &s2); +//TEST_F(test_yearscheduleview, yschesuledatethan) +//{ +// //bdate1 != edate1 && bdate2 == edate2 +// EXPECT_TRUE(YScheduleDateThan(getScheduleDateAndTitle().at(0), getScheduleDateAndTitle().at(1))); +// //bdate1 == edate1 && bdate2 != edate2 +// EXPECT_FALSE(YScheduleDateThan(getScheduleDateAndTitle().at(2), getScheduleDateAndTitle().at(3))); +// //bdate1 != edate1 && bdate2 != edate2 +// //bdate1 < bdate2 +// EXPECT_TRUE(YScheduleDateThan(getScheduleDateAndTitle().at(4), getScheduleDateAndTitle().at(5))); +// //bdate1 != edate1 && bdate2 != edate2 +// //bdate1 < bdate2 +// EXPECT_FALSE(YScheduleDateThan(getScheduleDateAndTitle().at(6), getScheduleDateAndTitle().at(7))); +// //bdate1 = edate1 && bdate2 = edate2 +// //s1.getTitleName() < s2.getTitleName() +// EXPECT_TRUE(YScheduleDateThan(getScheduleDateAndTitle().at(8), getScheduleDateAndTitle().at(9))); +// //bdate1 = edate1 && bdate2 = edate2 +// //s1.getBeginDateTime() == s2.getBeginDateTime() +// //s1.getTitleName() < s2.getTitleName() +// EXPECT_FALSE(YScheduleDateThan(getScheduleDateAndTitle().at(10), getScheduleDateAndTitle().at(11))); +// //bdate1 = edate1 && bdate2 = edate2 +// //s1.getBeginDateTime() != s2.getBeginDateTime() +// //s1.getBeginDateTime() < s2.getBeginDateTime() +// EXPECT_TRUE(YScheduleDateThan(getScheduleDateAndTitle().at(12), getScheduleDateAndTitle().at(13))); +// //bdate1 = edate1 && bdate2 = edate2 +// //s1.getBeginDateTime() != s2.getBeginDateTime() +// //s1.getBeginDateTime() < s2.getBeginDateTime() +// EXPECT_FALSE(YScheduleDateThan(getScheduleDateAndTitle().at(14), getScheduleDateAndTitle().at(15))); +//} + +////bool YScheduleDaysThan(const ScheduleDataInfo &s1, const ScheduleDataInfo &s2) +//bool YScheduleDaysThan(const ScheduleDataInfo &s1, const ScheduleDataInfo &s2); +//TEST_F(test_yearscheduleview, yscheduleDaysThan) +//{ +// //s1.getBeginDateTime().date().daysTo(s1.getEndDateTime().date()) > s2.getBeginDateTime().date().daysTo(s2.getEndDateTime().date()) +// EXPECT_TRUE(YScheduleDaysThan(getScheduleDateAndTitle().at(16), getScheduleDateAndTitle().at(17))); +// //s1.getBeginDateTime().date().daysTo(s1.getEndDateTime().date()) > s2.getBeginDateTime().date().daysTo(s2.getEndDateTime().date()) +// EXPECT_FALSE(YScheduleDaysThan(getScheduleDateAndTitle().at(18), getScheduleDateAndTitle().at(19))); +//} + +////void CYearScheduleView::setData(QVector &vListData) +//TEST_F(test_yearscheduleview, setDate) +//{ +// QVector scheduleinfo = getScheduleDataInfo(); +// cYearScheduleView->setData(scheduleinfo); +//} + +////void CYearScheduleView::clearData() +//TEST_F(test_yearscheduleview, clearDate) +//{ +// cYearScheduleView->clearData(); +//} + +////int CYearScheduleView::showWindow() +//TEST_F(test_yearscheduleview, showWindow) +//{ +// QVector vlistData = getScheduleDataInfo(); +// cYearScheduleView->showWindow(); +// cYearScheduleView->setData(vlistData); +// cYearScheduleView->showWindow(); +//} + +////void CYearScheduleView::setTheMe(int type) +//TEST_F(test_yearscheduleview, setTheMe) +//{ +// int type = 1; +// cYearScheduleView->setTheMe(type); + +// type = 2; +// cYearScheduleView->setTheMe(type); +//} + +////void CYearScheduleView::setCurrentDate(QDate cdate) +//TEST_F(test_yearscheduleview, setCurrentDate) +//{ +// cYearScheduleView->setCurrentDate(QDate(2021, 1, 6)); +//} + +////QDate CYearScheduleView::getCurrentDate() +//TEST_F(test_yearscheduleview, getCurrentDate) +//{ +// QDate currentDate = QDate::currentDate(); +// cYearScheduleView->setCurrentDate(currentDate); +// bool iscurrent = currentDate == cYearScheduleView->getCurrentDate(); +// EXPECT_TRUE(iscurrent); + +// QDate earlyDate = QDate(1999, 1, 1); +// cYearScheduleView->setCurrentDate(earlyDate); +// iscurrent = currentDate == cYearScheduleView->getCurrentDate(); +// EXPECT_FALSE(iscurrent); +//} + + +////void CYearScheduleOutView::setData(QVector &vListData) +//TEST_F(test_yearscheduleview, setOutData) +//{ +// QVector scheduleInfo = getScheduleDataInfo(); +// zYearScheduleOutView->setData(scheduleInfo); +//} + +////void CYearScheduleOutView::clearData() +//TEST_F(test_yearscheduleview, clearOutData) +//{ +// zYearScheduleOutView->clearData(); +//} + +////void CYearScheduleOutView::setTheMe(int type) +//TEST_F(test_yearscheduleview, setTheOutMe) +//{ +// zYearScheduleOutView->setTheMe(1); +//} + +////void CYearScheduleOutView::setCurrentDate(QDate cdate) +//TEST_F(test_yearscheduleview, setCurrentOutDate) +//{ +// zYearScheduleOutView->setCurrentDate(QDate(2021, 1, 6)); +//} + +//TEST_F(test_yearscheduleview, paintEvent) +//{ +// QPixmap pixmap(cYearScheduleView->size()); +// QVector scheduleInfo = getScheduleDataInfo(); +// cYearScheduleView->setData(scheduleInfo); +// cYearScheduleView->render(&pixmap); +//} + +//TEST_F(test_yearscheduleview, mousePressEvent) +//{ +//} diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_widget/test_yearWidget/test_yearscheduleview.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_widget/test_yearWidget/test_yearscheduleview.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_widget/test_yearWidget/test_yearscheduleview.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_widget/test_yearWidget/test_yearscheduleview.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,45 +1,29 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: hejinghai -* -* Maintainer: hejinghai -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_YEARSCHEDULEVIEW_H #define TEST_YEARSCHEDULEVIEW_H -#include "yearWidget/yearscheduleview.h" -#include "gtest/gtest.h" -#include - -class test_yearscheduleview : public QObject, public::testing::Test -{ -public: - test_yearscheduleview(); - ~test_yearscheduleview(); - void SetUp() override; - void TearDown() override; - -protected: - CYearScheduleView *cYearScheduleView = nullptr; - CYearScheduleOutView *zYearScheduleOutView = nullptr; - -public: - QVector getScheduleDataInfo(); - QVector getScheduleDateAndTitle(); -}; +//#include "yearWidget/yearscheduleview.h" +//#include "gtest/gtest.h" +//#include + +//class test_yearscheduleview : public QObject, public::testing::Test +//{ +//public: +// test_yearscheduleview(); +// ~test_yearscheduleview(); +// void SetUp() override; +// void TearDown() override; + +//protected: +// CYearScheduleView *cYearScheduleView = nullptr; +// CYearScheduleOutView *zYearScheduleOutView = nullptr; + +//public: +// QVector getScheduleDataInfo(); +// QVector getScheduleDateAndTitle(); +//}; #endif // TEST_YEARSCHEDULEVIEW_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_widget/test_yearWidget/test_yearview.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_widget/test_yearWidget/test_yearview.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_widget/test_yearWidget/test_yearview.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_widget/test_yearWidget/test_yearview.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2021 Uniontech Software Technology Co.,Ltd. -* -* Author: zhengxiaokang -* -* Maintainer: zhengxiaokang -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "test_yearview.h" #include "../third-party_stub/stub.h" diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_widget/test_yearWidget/test_yearview.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_widget/test_yearWidget/test_yearview.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_widget/test_yearWidget/test_yearview.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_widget/test_yearWidget/test_yearview.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,41 +1,25 @@ -/* -* Copyright (C) 2019 ~ 2021 Uniontech Software Technology Co.,Ltd. -* -* Author: zhengxiaokang -* -* Maintainer: zhengxiaokang -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_YEARVIEW_H #define TEST_YEARVIEW_H -#include "yearWidget/yearview.h" -#include "gtest/gtest.h" -#include +//#include "yearWidget/yearview.h" +//#include "gtest/gtest.h" +//#include -class test_yearview : public QObject - , public ::testing::Test -{ -public: - test_yearview(); - ~test_yearview(); - void SetUp() override; - void TearDown() override; +//class test_yearview : public QObject +// , public ::testing::Test +//{ +//public: +// test_yearview(); +// ~test_yearview(); +// void SetUp() override; +// void TearDown() override; -protected: - CYearView *cYearView = nullptr; -}; +//protected: +// CYearView *cYearView = nullptr; +//}; #endif // TEST_YEARVIEW_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_widget/test_yearWidget/test_yearwindow.cpp dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_widget/test_yearWidget/test_yearwindow.cpp --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_widget/test_yearWidget/test_yearwindow.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_widget/test_yearWidget/test_yearwindow.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2021 Uniontech Software Technology Co.,Ltd. -* -* Author: zhengxiaokang -* -* Maintainer: zhengxiaokang -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "test_yearwindow.h" #include "customWidget/customframe.h" #include "widget/yearWidget/yearscheduleview.h" diff -Nru dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_widget/test_yearWidget/test_yearwindow.h dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_widget/test_yearWidget/test_yearwindow.h --- dde-calendar-5.9.1/tests/dde-calendar-client-test/src/test_widget/test_yearWidget/test_yearwindow.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-client-test/src/test_widget/test_yearWidget/test_yearwindow.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,40 +1,24 @@ -/* -* Copyright (C) 2019 ~ 2021 Uniontech Software Technology Co.,Ltd. -* -* Author: zhengxiaokang -* -* Maintainer: zhengxiaokang -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_YEARWINDOW_H #define TEST_YEARWINDOW_H -#include "yearWidget/yearwindow.h" -#include "gtest/gtest.h" -#include +//#include "yearWidget/yearwindow.h" +//#include "gtest/gtest.h" +//#include -class test_yearwindow : public QObject - , public ::testing::Test -{ -public: - test_yearwindow(); - ~test_yearwindow(); +//class test_yearwindow : public QObject +// , public ::testing::Test +//{ +//public: +// test_yearwindow(); +// ~test_yearwindow(); -protected: - CYearWindow *mYearWindow = nullptr; - CalendarDateDataManager *dateaManger = nullptr; -}; +//protected: +// CYearWindow *mYearWindow = nullptr; +// CalendarDateDataManager *dateaManger = nullptr; +//}; #endif // TEST_YEARWINDOW_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-service-test/CMakeLists.txt dde-calendar-5.10.0/tests/dde-calendar-service-test/CMakeLists.txt --- dde-calendar-5.9.1/tests/dde-calendar-service-test/CMakeLists.txt 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-service-test/CMakeLists.txt 2023-04-07 06:02:09.000000000 +0000 @@ -34,7 +34,7 @@ SUBDIRLIST(all_src ${APP_SERVICE_DIR}/src) -#Include all app own subdirectorys +#Include all app own subdirectories foreach(subdir ${all_src}) include_directories(${APP_SERVICE_DIR}/src/${subdir}) endforeach() diff -Nru dde-calendar-5.9.1/tests/dde-calendar-service-test/src/config.h.in dde-calendar-5.10.0/tests/dde-calendar-service-test/src/config.h.in --- dde-calendar-5.9.1/tests/dde-calendar-service-test/src/config.h.in 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-service-test/src/config.h.in 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: hejinghai -* -* Maintainer: hejinghai -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef CONFIG_H #define CONFIG_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-service-test/src/service_stub.cpp dde-calendar-5.10.0/tests/dde-calendar-service-test/src/service_stub.cpp --- dde-calendar-5.9.1/tests/dde-calendar-service-test/src/service_stub.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-service-test/src/service_stub.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "service_stub.h" #include "dbusuiopenschedule.h" diff -Nru dde-calendar-5.9.1/tests/dde-calendar-service-test/src/service_stub.h dde-calendar-5.10.0/tests/dde-calendar-service-test/src/service_stub.h --- dde-calendar-5.9.1/tests/dde-calendar-service-test/src/service_stub.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-service-test/src/service_stub.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: chenhaifeng -* -* Maintainer: chenhaifeng -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef SERVICE_STUB_H #define SERVICE_STUB_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-service-test/src/test_calendarhuangli.cpp dde-calendar-5.10.0/tests/dde-calendar-service-test/src/test_calendarhuangli.cpp --- dde-calendar-5.9.1/tests/dde-calendar-service-test/src/test_calendarhuangli.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-service-test/src/test_calendarhuangli.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: hejinghai -* -* Maintainer: hejinghai -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "test_calendarhuangli.h" #include "../third-party_stub/stub.h" #include "config.h" @@ -53,7 +37,7 @@ { quint32 year = 2020; quint32 month = 12; - QString fesMonth = calendarHuangLi->GetFestivalMonth(year, month); + QString fesMonth = calendarHuangLi->getFestivalMonth(year, month); } //QString CalendarHuangLi::GetHuangLiDay(quint32 year, quint32 month, quint32 day) @@ -68,7 +52,7 @@ quint32 year = 2020; quint32 month = 12; quint32 day = 13; - QString gethuangli = calendarHuangLi->GetHuangLiDay(year, month, day); + QString gethuangli = calendarHuangLi->getHuangLiDay(year, month, day); assert(huangli_20201213 == gethuangli); //2020年12月14日黄历信息 @@ -77,7 +61,7 @@ "\"LunarMonthName\":\"十月\",\"SolarFestival\":\"\",\"Suit\":\"祭祀.入殓.移柩.余事勿取.\",\"Term\":" "\"\",\"Worktime\":0,\"Zodiac\":\"鼠\"}"; day = 14; - gethuangli = calendarHuangLi->GetHuangLiDay(year, month, day); + gethuangli = calendarHuangLi->getHuangLiDay(year, month, day); assert(huangli_20201214 == gethuangli); } @@ -87,10 +71,10 @@ quint32 year = 2020; quint32 month = 12; bool fill = false; - calendarHuangLi->GetHuangLiMonth(year, month, fill); + calendarHuangLi->getHuangLiMonth(year, month, fill); fill = true; - calendarHuangLi->GetHuangLiMonth(year, month, fill); + calendarHuangLi->getHuangLiMonth(year, month, fill); } //CaLunarDayInfo CalendarHuangLi::GetLunarInfoBySolar(quint32 year, quint32 month, quint32 day) @@ -99,7 +83,7 @@ quint32 year = 2020; quint32 month = 12; quint32 day = 13; - CaLunarDayInfo huangliDayInfo = calendarHuangLi->GetLunarInfoBySolar(year, month, day); + CaLunarDayInfo huangliDayInfo = calendarHuangLi->getLunarInfoBySolar(year, month, day); } //CaLunarMonthInfo CalendarHuangLi::GetLunarCalendarMonth(quint32 year, quint32 month, bool fill) @@ -108,8 +92,8 @@ quint32 year = 2020; quint32 month = 12; bool fill = false; - calendarHuangLi->GetLunarCalendarMonth(year, month, fill); + calendarHuangLi->getLunarCalendarMonth(year, month, fill); fill = true; - calendarHuangLi->GetLunarCalendarMonth(year, month, fill); + calendarHuangLi->getLunarCalendarMonth(year, month, fill); } diff -Nru dde-calendar-5.9.1/tests/dde-calendar-service-test/src/test_calendarhuangli.h dde-calendar-5.10.0/tests/dde-calendar-service-test/src/test_calendarhuangli.h --- dde-calendar-5.9.1/tests/dde-calendar-service-test/src/test_calendarhuangli.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-service-test/src/test_calendarhuangli.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: hejinghai -* -* Maintainer: hejinghai -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_CALENDARHUANGLI_H #define TEST_CALENDARHUANGLI_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-service-test/src/test_calendarscheduler.cpp dde-calendar-5.10.0/tests/dde-calendar-service-test/src/test_calendarscheduler.cpp --- dde-calendar-5.9.1/tests/dde-calendar-service-test/src/test_calendarscheduler.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-service-test/src/test_calendarscheduler.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: leilong -* -* Maintainer: leilong -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "test_calendarscheduler.h" #include "../third-party_stub/stub.h" #include "service_stub.h" diff -Nru dde-calendar-5.9.1/tests/dde-calendar-service-test/src/test_calendarscheduler.h dde-calendar-5.10.0/tests/dde-calendar-service-test/src/test_calendarscheduler.h --- dde-calendar-5.9.1/tests/dde-calendar-service-test/src/test_calendarscheduler.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-service-test/src/test_calendarscheduler.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: leilong -* -* Maintainer: leilong -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_CALENDARSCHEDULER_H #define TEST_CALENDARSCHEDULER_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-service-test/src/test_calendarservice.cpp dde-calendar-5.10.0/tests/dde-calendar-service-test/src/test_calendarservice.cpp --- dde-calendar-5.9.1/tests/dde-calendar-service-test/src/test_calendarservice.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-service-test/src/test_calendarservice.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: leilong -* -* Maintainer: leilong -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "test_calendarservice.h" test_calendarservice::test_calendarservice() diff -Nru dde-calendar-5.9.1/tests/dde-calendar-service-test/src/test_calendarservice.h dde-calendar-5.10.0/tests/dde-calendar-service-test/src/test_calendarservice.h --- dde-calendar-5.9.1/tests/dde-calendar-service-test/src/test_calendarservice.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-service-test/src/test_calendarservice.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: leilong -* -* Maintainer: leilong -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_CALENDARSERVICE_H #define TEST_CALENDARSERVICE_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-service-test/src/test_dbmanager/test_huanglidatabase.cpp dde-calendar-5.10.0/tests/dde-calendar-service-test/src/test_dbmanager/test_huanglidatabase.cpp --- dde-calendar-5.9.1/tests/dde-calendar-service-test/src/test_dbmanager/test_huanglidatabase.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-service-test/src/test_dbmanager/test_huanglidatabase.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: hejinghai -* -* Maintainer: hejinghai -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "test_huanglidatabase.h" #include "../third-party_stub/stub.h" #include "config.h" diff -Nru dde-calendar-5.9.1/tests/dde-calendar-service-test/src/test_dbmanager/test_huanglidatabase.h dde-calendar-5.10.0/tests/dde-calendar-service-test/src/test_dbmanager/test_huanglidatabase.h --- dde-calendar-5.9.1/tests/dde-calendar-service-test/src/test_dbmanager/test_huanglidatabase.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-service-test/src/test_dbmanager/test_huanglidatabase.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: hejinghai -* -* Maintainer: hejinghai -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_HUANGLIDATABASE_H #define TEST_HUANGLIDATABASE_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-service-test/src/test_dbmanager/test_schedulerdatabase.cpp dde-calendar-5.10.0/tests/dde-calendar-service-test/src/test_dbmanager/test_schedulerdatabase.cpp --- dde-calendar-5.9.1/tests/dde-calendar-service-test/src/test_dbmanager/test_schedulerdatabase.cpp 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-service-test/src/test_dbmanager/test_schedulerdatabase.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,83 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include "test_schedulerdatabase.h" + +test_schedulerdatabase::test_schedulerdatabase() +{ + +} + +TEST_F(test_schedulerdatabase, GetJob_01) +{ + schedulerdatabase_next = false; + mBase->GetJob(0); +} + +TEST_F(test_schedulerdatabase, GetAllOriginJobs_01) +{ + schedulerdatabase_next = false; + mBase->GetAllOriginJobs("", ""); +} + +TEST_F(test_schedulerdatabase, saveRemindJob_01) +{ + schedulerdatabase_next = false; + mBase->saveRemindJob(Job()); +} + +TEST_F(test_schedulerdatabase, updateRemindJob_01) +{ + schedulerdatabase_next = false; + mBase->updateRemindJob(Job()); +} + +TEST_F(test_schedulerdatabase, getValidRemindJob_01) +{ + schedulerdatabase_next = false; + mBase->getValidRemindJob(); +} + +TEST_F(test_schedulerdatabase, getRemindJob_01) +{ + schedulerdatabase_next = false; + mBase->getRemindJob(1, 2); +} + +TEST_F(test_schedulerdatabase, getRemindJob_02) +{ + schedulerdatabase_next = false; + mBase->getRemindJob(1); +} + +TEST_F(test_schedulerdatabase, UpdateJobIgnore_01) +{ + schedulerdatabase_next = false; + mBase->UpdateJobIgnore("", 0); +} + +TEST_F(test_schedulerdatabase, DeleteJobsByJobType_01) +{ + schedulerdatabase_next = false; + mBase->DeleteJobsByJobType(0); +} + +TEST_F(test_schedulerdatabase, getJobIDByJobType_01) +{ + schedulerdatabase_next = false; + mBase->getJobIDByJobType(0); +} + +TEST_F(test_schedulerdatabase, updateColorType_01) +{ + schedulerdatabase_next = false; + mBase->updateColorType(0, "#000000"); +} + +TEST_F(test_schedulerdatabase, setDbPath_01) +{ + schedulerdatabase_next = false; + mBase->setDbPath("123"); + EXPECT_EQ(mBase->m_dbPath, "123"); +} diff -Nru dde-calendar-5.9.1/tests/dde-calendar-service-test/src/test_dbmanager/test_schedulerdatabase.h dde-calendar-5.10.0/tests/dde-calendar-service-test/src/test_dbmanager/test_schedulerdatabase.h --- dde-calendar-5.9.1/tests/dde-calendar-service-test/src/test_dbmanager/test_schedulerdatabase.h 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-service-test/src/test_dbmanager/test_schedulerdatabase.h 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,66 @@ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef TEST_SCHEDULERDATABASE_H +#define TEST_SCHEDULERDATABASE_H + +#include "schedulerdatabase.h" +#include "gtest/gtest.h" +#include "../third-party_stub/stub.h" +#include +#include +#include + +static bool schedulerdatabase_next = false; + +static bool schedulerdatabase_stub_exec(const QString&) +{ + schedulerdatabase_next = false; + return true; +}; + +static bool schedulerdatabase_stub_next() +{ + static int count = 0; + if (!schedulerdatabase_next) { + schedulerdatabase_next = true; + count = 0; + } + count++; + if (count >= 10) { + schedulerdatabase_next = false; + count = 0; + } + return schedulerdatabase_next; +}; + +static QVariant schedulerdatabase_stub_value(const QString&) +{ + return QVariant(); +}; + +class test_schedulerdatabase: public::testing::Test +{ +public: + test_schedulerdatabase(); + + virtual void SetUp() + { + Stub stub; + stub.set((bool(QSqlQuery::*)(const QString&))ADDR(QSqlQuery, exec), schedulerdatabase_stub_exec); + stub.set((QVariant(QSqlQuery::*)(const QString&)const)ADDR(QSqlQuery, value), schedulerdatabase_stub_value); + stub.set(ADDR(QSqlQuery, next), schedulerdatabase_stub_next); + mBase = new SchedulerDatabase(); + } + + virtual void TearDown() + { + delete mBase; + mBase = nullptr; + } +protected: + SchedulerDatabase *mBase = nullptr; +}; + +#endif // TEST_SCHEDULERDATABASE_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-service-test/src/test_jobremindmanager.cpp dde-calendar-5.10.0/tests/dde-calendar-service-test/src/test_jobremindmanager.cpp --- dde-calendar-5.9.1/tests/dde-calendar-service-test/src/test_jobremindmanager.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-service-test/src/test_jobremindmanager.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: hejinghai -* -* Maintainer: hejinghai -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "test_jobremindmanager.h" #include "../third-party_stub/stub.h" #include "service_stub.h" diff -Nru dde-calendar-5.9.1/tests/dde-calendar-service-test/src/test_jobremindmanager.h dde-calendar-5.10.0/tests/dde-calendar-service-test/src/test_jobremindmanager.h --- dde-calendar-5.9.1/tests/dde-calendar-service-test/src/test_jobremindmanager.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-service-test/src/test_jobremindmanager.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: hejinghai -* -* Maintainer: hejinghai -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_JOBREMINDMANAGER_H #define TEST_JOBREMINDMANAGER_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-service-test/src/test_lunarandfestival/test_method_interface.cpp dde-calendar-5.10.0/tests/dde-calendar-service-test/src/test_lunarandfestival/test_method_interface.cpp --- dde-calendar-5.9.1/tests/dde-calendar-service-test/src/test_lunarandfestival/test_method_interface.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-service-test/src/test_lunarandfestival/test_method_interface.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: hejinghai -* -* Maintainer: hejinghai -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "test_method_interface.h" #include #include @@ -94,26 +78,18 @@ TEST_F(test_method_interface, GetSolarTermName) { // "小满" - int order = 4; - QString stName = GetSolarTermName(order); - //qInfo() << stName; + QString stName = GetSolarTermName(4); assert("小满" == stName); // "" - order = 24; - stName = GetSolarTermName(order); - //qInfo() << stName; + stName = GetSolarTermName(24); assert("" == stName); } //QString GetGanZhiMonth(int year, int monthzhi) TEST_F(test_method_interface, GetGanZhiMonth) { - // "戊子" - int year = 2020; - int month = 12; - QString ganzhi = GetGanZhiMonth(year, month); - //qInfo() << ganzhi; + QString ganzhi = GetGanZhiMonth(2020, 12); assert("戊子" == ganzhi); } @@ -121,9 +97,7 @@ TEST_F(test_method_interface, GetGanZhiYear) { // "庚子" - int lunaryear = 2020; - QString ganzhi = GetGanZhiYear(lunaryear); - //qInfo() << ganzhi; + QString ganzhi = GetGanZhiYear(2020); assert("庚子" == ganzhi); } @@ -131,10 +105,7 @@ TEST_F(test_method_interface, GetGanZhiDay) { // "己丑" - int year = 2020;; - int month = 12; - int day = 12; - QString ganzhi = GetGanZhiDay(year, month, day); + QString ganzhi = GetGanZhiDay(2020, 12, 12); assert("己丑" == ganzhi); } @@ -142,104 +113,69 @@ TEST_F(test_method_interface, GetYearZodiac) { // "鼠" - int lunaryear = 2020; - QString Zodiac = GetYearZodiac(lunaryear); - //qInfo() << Zodiac; + QString Zodiac = GetYearZodiac(2020); assert("鼠" == Zodiac); // "猪" - lunaryear = 2019; - Zodiac = GetYearZodiac(lunaryear); - //qInfo() << Zodiac; + Zodiac = GetYearZodiac(2019); assert("猪" == Zodiac); } //QVector get25SolarTermJDs(int year, int start) TEST_F(test_method_interface, get25SolarTermJDs) { - int year = 0; - int start = 0; - QVector jds = get25SolarTermJDs(year, start); - // TODO + QVector jds = get25SolarTermJDs(0, 0); } //double GetSolarTermJD(int year, int order) TEST_F(test_method_interface, GetSolarTermJD) { - int year = 2020; - int order = 0; //春分 3月20日 - double jd = GetSolarTermJD(year, order); - assert(2.45893e+06 > jd); + //春分 3月20日 + assert(2.45893e+06 > GetSolarTermJD(2020, 0)); } //bool IsLeapYear(int year) TEST_F(test_method_interface, IsLeapYear) { - int leapYear = 2020; // 闰年 - int notLeapYear = 2019; // 非闰年 - assert(true == IsLeapYear(leapYear) && false == IsLeapYear(notLeapYear)); + assert(true == IsLeapYear(2020) && false == IsLeapYear(2019)); } // int GetSolarMonthDays(int year, int month) TEST_F(test_method_interface, GetSolarMonthDays) { - int year = 2020; - int month = 2; - int a = GetSolarMonthDays(year, month); - assert(29 == a); + assert(29 == GetSolarMonthDays(2020, 2)); } //int GetWeekday(int y, int m, int d) TEST_F(test_method_interface, GetWeekday) { - int y = 2020; - int m = 2; - int d = 29; - int a = GetWeekday(y, m, d); - assert(6 == a); + assert(6 == GetWeekday(2020, 2, 29)); } //double DmsToDegrees(int degrees, int mintues, double seconds) TEST_F(test_method_interface, DmsToDegrees) { - int degrees = 4; - int mintues = 3; - double seconds = 7200; - double degress = DmsToDegrees(degrees, mintues, seconds); - assert(qAbs(6.05 - degress) < 0.001); + assert(qAbs(6.05 - DmsToDegrees(4, 3, 7200)) < 0.001); } //double DmsToSeconds(int d, int m, double s) TEST_F(test_method_interface, DmsToSeconds) { - int d = 4; - int m = 3; - double s = 7200; - double degress = DmsToSeconds(d, m, s); - assert(qAbs(21780 - degress) < 0.001); + assert(qAbs(21780 - DmsToSeconds(4, 3, 7200)) < 0.001); } //double DmsToRadians(int d, int m, int s) TEST_F(test_method_interface, DmsToRadians) { - int d = 4; - int m = 3; - int s = 7200; - double degress = DmsToRadians(d, m, s); - assert(0.105592 <= degress); + assert(0.105592 <= DmsToRadians(4, 3, 7200)); } //QDateTime GetDateTimeFromJulianDay(double jd) TEST_F(test_method_interface, GetDateTimeFromJulianDay) { - int year = 2020; - int order = 0; //春分 3月20日 - double jd = GetSolarTermJD(year, order); - QString strJulianDay = "周五 3月 20 03:49:33 2020 GMT"; - QDateTime julianDay = GetDateTimeFromJulianDay(jd); //qInfo() << julianDay.toString(); - assert(strJulianDay.contains(julianDay.toString())); + assert(strJulianDay.contains(GetDateTimeFromJulianDay(GetSolarTermJD(2020, 0)).toString())); } //double GetDeltaT(int year, int month) @@ -250,44 +186,31 @@ 1859, 1899, 1919, 1940, 1960, 1985, 2004, 2049, 2149, 2150 }; - const int mouth = 6; for (int i = 0; i < count; ++i) { - GetDeltaT(year[i], mouth); + GetDeltaT(year[i], 6); } } //double JDBeijingTime2UTC(double bjtJD) TEST_F(test_method_interface, JDBeijingTime2UTC) { - double bjtJD = 1.01; - double utc = JDBeijingTime2UTC(bjtJD); - assert(0.67667 > utc); + assert(0.67667 > JDBeijingTime2UTC(1.01)); } //QString GetSolarDayFestival(int year, int month, int day) TEST_F(test_method_interface, GetSolarDayFestival) { - int year = 2020; - // 建军节 - int month = 8; - int day = 1; - QString getFesStr = GetSolarDayFestival(year, month, day); + QString getFesStr = GetSolarDayFestival(2020, 8, 1); assert("建军节" == getFesStr); - // 儿童节 - month = 6; - day = 1; - getFesStr = GetSolarDayFestival(year, month, day); + getFesStr = GetSolarDayFestival(2020, 6, 1); assert("儿童节" == getFesStr); } //double CalcEarthObliquityNutation(double dt) TEST_F(test_method_interface, CalcEarthObliquityNutation) { - double julianDay = 1; - double dt = GetJulianCentury(julianDay); - CalcEarthObliquityNutation(dt); - //qInfo() << ceon; + CalcEarthObliquityNutation(GetJulianCentury(1)); } //double lightAberration() diff -Nru dde-calendar-5.9.1/tests/dde-calendar-service-test/src/test_lunarandfestival/test_method_interface.h dde-calendar-5.10.0/tests/dde-calendar-service-test/src/test_lunarandfestival/test_method_interface.h --- dde-calendar-5.9.1/tests/dde-calendar-service-test/src/test_lunarandfestival/test_method_interface.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-service-test/src/test_lunarandfestival/test_method_interface.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: hejinghai -* -* Maintainer: hejinghai -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef TEST_METHOD_INTERFACE_H #define TEST_METHOD_INTERFACE_H diff -Nru dde-calendar-5.9.1/tests/dde-calendar-service-test/src/test_main.cpp dde-calendar-5.10.0/tests/dde-calendar-service-test/src/test_main.cpp --- dde-calendar-5.9.1/tests/dde-calendar-service-test/src/test_main.cpp 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/dde-calendar-service-test/src/test_main.cpp 2023-04-07 06:02:09.000000000 +0000 @@ -1,23 +1,7 @@ -/* -* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -* -* Author: hejinghai -* -* Maintainer: hejinghai -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ +// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #include "gtest/gtest.h" #if defined(CMAKE_SAFETYTEST_ARG_ON) diff -Nru dde-calendar-5.9.1/tests/third-party_stub/addr_pri.h dde-calendar-5.10.0/tests/third-party_stub/addr_pri.h --- dde-calendar-5.9.1/tests/third-party_stub/addr_pri.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/third-party_stub/addr_pri.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef __ADDR_PRI_H__ #define __ADDR_PRI_H__ diff -Nru dde-calendar-5.9.1/tests/third-party_stub/stub.h dde-calendar-5.10.0/tests/third-party_stub/stub.h --- dde-calendar-5.9.1/tests/third-party_stub/stub.h 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/tests/third-party_stub/stub.h 2023-04-07 06:02:09.000000000 +0000 @@ -1,8 +1,12 @@ +// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + #ifndef __STUB_H__ #define __STUB_H__ -#ifdef _WIN32 +#ifdef _WIN32 //windows #include #include @@ -15,6 +19,7 @@ #include #include //c++ +#include #include @@ -23,7 +28,7 @@ /********************************************************** replace function **********************************************************/ -#ifdef _WIN32 +#ifdef _WIN32 #define CACHEFLUSH(addr, size) FlushInstructionCache(GetCurrentProcess(), addr, size) #else #define CACHEFLUSH(addr, size) __builtin___clear_cache(addr, addr + size) @@ -33,9 +38,9 @@ #define CODESIZE 16U #define CODESIZE_MIN 16U #define CODESIZE_MAX CODESIZE - // ldr x9, +8 - // br x9 - // addr + // ldr x9, +8 + // br x9 + // addr #define REPLACE_FAR(t, fn, fn_stub)\ ((uint32_t*)fn)[0] = 0x58000040 | 9;\ ((uint32_t*)fn)[1] = 0xd61f0120 | (9 << 5);\ @@ -137,12 +142,12 @@ Stub() { #ifdef _WIN32 - SYSTEM_INFO sys_info; + SYSTEM_INFO sys_info; GetSystemInfo(&sys_info); m_pagesize = sys_info.dwPageSize; #else m_pagesize = sysconf(_SC_PAGE_SIZE); -#endif +#endif if (m_pagesize < 0) { @@ -161,7 +166,7 @@ if(0 != VirtualProtect(pageof(pstub->fn), m_pagesize * 2, PAGE_EXECUTE_READWRITE, &lpflOldProtect)) #else if (0 == mprotect(pageof(pstub->fn), m_pagesize * 2, PROT_READ | PROT_WRITE | PROT_EXEC)) -#endif +#endif { if(pstub->far_jmp) @@ -187,13 +192,13 @@ VirtualProtect(pageof(pstub->fn), m_pagesize * 2, PAGE_EXECUTE_READ, &lpflOldProtect); #else mprotect(pageof(pstub->fn), m_pagesize * 2, PROT_READ | PROT_EXEC); -#endif +#endif } iter->second = NULL; - delete pstub; + delete pstub; } - + return; } template @@ -225,7 +230,7 @@ if(0 == VirtualProtect(pageof(pstub->fn), m_pagesize * 2, PAGE_EXECUTE_READWRITE, &lpflOldProtect)) #else if (-1 == mprotect(pageof(pstub->fn), m_pagesize * 2, PROT_READ | PROT_WRITE | PROT_EXEC)) -#endif +#endif { throw("stub set memory protect to w+r+x faild"); } @@ -244,7 +249,7 @@ if(0 == VirtualProtect(pageof(pstub->fn), m_pagesize * 2, PAGE_EXECUTE_READ, &lpflOldProtect)) #else if (-1 == mprotect(pageof(pstub->fn), m_pagesize * 2, PROT_READ | PROT_EXEC)) -#endif +#endif { throw("stub set memory protect to r+x failed"); } @@ -257,22 +262,22 @@ { char * fn; fn = addrof(addr); - + std::map::iterator iter = m_result.find(fn); - + if (iter == m_result.end()) { return; } struct func_stub *pstub; pstub = iter->second; - + #ifdef _WIN32 DWORD lpflOldProtect; if(0 == VirtualProtect(pageof(pstub->fn), m_pagesize * 2, PAGE_EXECUTE_READWRITE, &lpflOldProtect)) #else if (-1 == mprotect(pageof(pstub->fn), m_pagesize * 2, PROT_READ | PROT_WRITE | PROT_EXEC)) -#endif +#endif { throw("stub reset memory protect to w+r+x faild"); } @@ -300,29 +305,29 @@ if(0 == VirtualProtect(pageof(pstub->fn), m_pagesize * 2, PAGE_EXECUTE_READ, &lpflOldProtect)) #else if (-1 == mprotect(pageof(pstub->fn), m_pagesize * 2, PROT_READ | PROT_EXEC)) -#endif +#endif { throw("stub reset memory protect to r+x failed"); } m_result.erase(iter); delete pstub; - + return; } private: char *pageof(char* addr) - { + { #ifdef _WIN32 return (char *)((unsigned long long)addr & ~(m_pagesize - 1)); #else return (char *)((unsigned long)addr & ~(m_pagesize - 1)); -#endif +#endif } template char* addrof(T addr) { - union + union { T _s; char* _d; @@ -348,9 +353,9 @@ #else //LP64 long m_pagesize; -#endif +#endif std::map m_result; - + }; diff -Nru dde-calendar-5.9.1/translations/dde-calendar_ar.ts dde-calendar-5.10.0/translations/dde-calendar_ar.ts --- dde-calendar-5.9.1/translations/dde-calendar_ar.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar_ar.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,38 +1,96 @@ - + + + + + AccountItem + + + Sync successful + + + + + Network error + + + + + Server exception + + + + + Storage full + + + + + AccountManager + + + Local account + + + + + Event types + + + + + CColorPickerWidget + + + Color + + + + + Cancel + button + إلغاء + + + + Save + button + حفظ + + CDayMonthView - + Monday الاثنين - + Tuesday الثلاثاء - + Wednesday الأربعاء - + Thursday الخميس - + Friday الجمعة - + Saturday السبت - + Sunday الأحد @@ -40,25 +98,30 @@ CDayWindow - + Y السنة - + M الشهر - + D اليوم + + + Lunar + + CGraphicsView - + New Event حدث جديد @@ -66,7 +129,7 @@ CMonthScheduleNumItem - + %1 more 1% أكثر @@ -74,12 +137,12 @@ CMonthView - + New event حدث جديد - + New Event حدث جديد @@ -87,7 +150,7 @@ CMonthWindow - + Y السنة @@ -95,258 +158,301 @@ CMyScheduleView - + My Event الحدث الخاص بي - + OK button موافق - + Delete button حذف - + Edit button تحرير + CPushButton + + + New event type + + + + CScheduleDlg - - + + + New Event لا أحداث - + Edit Event تعديل الأحداث - + End time must be greater than start time يجب أن يكون وقت الانتهاء أكبر من وقت البدء - + OK button حسنا - - - - + + + + + + Never أبدا - + At time of event في وقت الحدث - + 15 minutes before 15 دقيقة قبل - + 30 minutes before 30 دقيقة قبل - + 1 hour before 1 ساعة قبل - - + + 1 day before 1 يوم قبل - - + + 2 days before “2“يومين قبل - - + + 1 week before 1 أسبوع قبل - + On start day (9:00 AM) في يوم البَدْء (9:00 صباحا) - - + + Enter a name please + + + + + The name can not only contain whitespaces + + + + + Type: النوع: - - + + Description: الوصف: - - + + All Day: طوال اليوم: - - + + Starts: يبدأ: - - + + Ends: ينتهي: - - + + Remind Me: ذكرني: - - + + Repeat: تكرار - - + + End Repeat: نهاية التكرار - - Type - النوع - - - - Work - العمل + + Calendar account: + - - Life - الحياة الخاصة + + Calendar account + - - Other - أمر آخر + + Type + النوع - + Description الوصف - + All Day طوال اليوم - + + Time: + + + + + Time + + + + + Solar + + + + + Lunar + + + + Starts يبدأ - + Ends ينتهي - + Remind Me ذكرني - + Repeat تكرار - + + Daily يوميا - + + Weekdays أيام الأسبوع - + + Weekly أسبوعيا - + + + Monthly شهريا - + + + Yearly سنويا - + End Repeat نهاية التكرار - + After بعد - + On تشغيل - - - - + + + + time(s) الوقت(ج) - + Cancel button إلغاء - + Save button حفظ @@ -355,115 +461,126 @@ CScheduleOperation - + All occurrences of a repeating event must have the same all-day status. يجب أن يكون لجميع حالات تكرار الحدث نفس الوضع طوال اليوم. - - + + Do you want to change all occurrences? هل تريد تغيير كل الأحداث؟ - - + + Change All تغيير الكل - + You are changing the repeating rule of this event. أنت تغير قاعدة التكرار لهذا الحدث. - - - + + + You are deleting an event. أنت تقوم بحذف حدث. - + Are you sure you want to delete this event? هل أنت متأكد من أنك تريد حذف هذا الحدث؟ - - - - - - - + + + + + + + Cancel button إلغاء - + Delete button حذف - + Do you want to delete all occurrences of this event, or only the selected occurrence? هل تريد حذف جميع حالات هذا الحدث، أو فقط الأحداث المحددة؟ - + Delete All حذف الكل - - + + Delete Only This Event حذف هذا الحدث فقط - + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? هل تريد حذف هذا وجميع الحالات المستقبلية لهذا الحدث، أو فقط الأحداث المحددة؟ - + Delete All Future Events حذف جميع الأحداث المستقبلية - - + + You are changing a repeating event. أنت تقوم بتغيير حدث متكرر. - + Do you want to change only this occurrence of the event, or all occurrences? هل تريد تغيير هذا الحدث فقط، أو كل الأحداث؟ - + All الجميع - - + + Only This Event هذا الحدث فقط - + Do you want to change only this occurrence of the event, or this and all future occurrences? هل تريد تغيير هذا الحدث فقط، أو هذا وكل الأحداث المستقبلية؟ - + All Future Events كل الأحداث المستقبلية + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + + OK + button + + CScheduleSearchDateItem @@ -486,17 +603,17 @@ CScheduleSearchItem - + Edit تعديل - + Delete حذف - + All Day طوال اليوم @@ -512,61 +629,163 @@ CScheduleView - + ALL DAY طوال اليوم + CSettingDialog + + + Sunday + الأحد + + + + Monday + الاثنين + + + + 24-hour clock + + + + + 12-hour clock + + + + + Manual + + + + + 15 mins + + + + + 30 mins + + + + + 1 hour + + + + + 24 hours + + + + + Sync Now + + + + + Last sync + + + + CTimeEdit - + (%1 mins) - + - + (%1 hour) - + - + (%1 hours) - + CTitleWidget - + Y سنة - + M شهر - + W أسبوع - + D يوم + + + + Search events and festivals + + + + + CWeekWidget + + + Sun + + + + + Mon + + + + + Tue + + + + + Wed + + + + + Thu + + + + + Fri + + + + + Sat + + CWeekWindow - + Week الأسبوع - + Y السنة @@ -574,13 +793,13 @@ CYearScheduleView + - All Day طوال اليوم - + No event لا يوجد حدث @@ -588,7 +807,7 @@ CYearWindow - + Y السنة @@ -596,12 +815,12 @@ CalendarWindow - + Calendar التقويم - + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. التقويم هو برنامج لعرض التواريخ وللتخطيط الذكي لجميع الأشياء في الحياة @@ -609,46 +828,246 @@ Calendarmainwindow - + Calendar التقويم + + + Manage + + + + + Privacy Policy + + + + + Syncing... + + + + + Sync successful + + + + + Sync failed, please try later + + CenterWidget - + All Day طوال اليوم + DAccountDataBase + + + Work + العمل + + + + Life + الحياة الخاصة + + + + Other + أمر آخر + + + + DAlarmManager + + + + + + Close + button + + + + + One day before start + + + + + Remind me tomorrow + + + + + Remind me later + + + + + 15 mins later + + + + + 1 hour later + + + + + 4 hours later + + + + + + + Tomorrow + + + + + Schedule Reminder + + + + + + %1 to %2 + + + + + + Today + اليوم + + + DragInfoGraphicsView - + Edit تحرير - + Delete حذف - + New event حدث جديد - + New Event حدث جديد + JobTypeListView + + + You are deleting an event type. + + + + + All events under this type will be deleted and cannot be recovered. + + + + + Cancel + button + إلغاء + + + + Delete + button + حذف + + + + QObject + + + Account settings + + + + + Account + + + + + Select items to be synced + + + + + Events + + + + + + General settings + + + + + Sync interval + + + + + + Manage calendar + + + + + Calendar account + + + + + + Event types + + + + + General + + + + + First day of week + + + + + Time + + + + Return - + Today Return اليوم @@ -657,56 +1076,138 @@ Return Today - - - + + + Today Return Today اليوم + ScheduleTypeEditDlg + + + New event type + + + + + Edit event type + + + + + Name: + + + + + Color: + + + + + Cancel + button + إلغاء + + + + Save + button + حفظ + + + + The name can not only contain whitespaces + + + + + Enter a name please + + + + Shortcut - + Help مساعدة - + Delete event حذف حدث - + Copy نسخ - + Cut قص - + Paste لصق - + Delete حذف - + Select all تحديد الكل + SidebarCalendarWidget + + + Y + + + + + M + + + + + TimeJumpDialog + + + Go + button + + + + + UserloginWidget + + + Sign In + button + + + + + Sign Out + button + + + + YearFrame - + Y السنة @@ -714,17 +1215,17 @@ today - - - - - - - - + + + + + + + + Today Today اليوم - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar_az.ts dde-calendar-5.10.0/translations/dde-calendar_az.ts --- dde-calendar-5.9.1/translations/dde-calendar_az.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar_az.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,66 +1,96 @@ - + + + + + AccountItem + + + Sync successful + Uğurlu eyniləşdirmə + + + + Network error + Şəbəkə xətası + + + + Server exception + Server istisnası + + + + Storage full + Yaddaş dolub + + + + AccountManager + + + Local account + Yerli hesab + + + + Event types + Tədbirin növləri + + CColorPickerWidget - + Color Rəng - + Cancel button İmtina - + Save button Saxlayın - - Cancel - - - - Save - - CDayMonthView - + Monday Bazar ertəsi - + Tuesday Çərşənbə axşamı - + Wednesday Çərşənbə - + Thursday Cümə axşamı - + Friday Cümə - + Saturday Şənbə - + Sunday Bazar @@ -68,25 +98,30 @@ CDayWindow - + Y İl - + M Ay - + D G + + + Lunar + Ay + CGraphicsView - + New Event Yeni tədbir @@ -94,7 +129,7 @@ CMonthScheduleNumItem - + %1 more %1 daha çox @@ -102,12 +137,12 @@ CMonthView - + New event Yeni tədbir - + New Event Yeni tədbir @@ -115,7 +150,7 @@ CMonthWindow - + Y İl @@ -123,24 +158,24 @@ CMyScheduleView - + My Event Mənim tədbirim - + OK button OLDU - + Delete button Silin - + Edit button Düzəliş edin @@ -149,7 +184,7 @@ CPushButton - + New event type Yeni tədbir növü @@ -157,273 +192,267 @@ CScheduleDlg - - + + + New Event Yeni tədbir - + Edit Event Tədbirə düzəliş etmək - + End time must be greater than start time Bitmə tarixi başlama tarixindən böyük olmalıdır - + OK button OK - - - - - - + + + + + + Never Heç vaxt - + At time of event Tədbir zamanı - + 15 minutes before 15 dəqiqə əvvəl - + 30 minutes before 30 dəqiqə əvvəl - + 1 hour before 1 saat əvvəl - + 1 day before 1 gün əvvəl - + 2 days before 2 gün əvvəl - + 1 week before 1 həftə əvvəl - + On start day (9:00 AM) Başlanğıc günü (9:00) - + + + + + time(s) + vaxt(lar) + + + Enter a name please Lütfən adı daxil edin - + The name can not only contain whitespaces Ad təkcə ara boşluqlarından ibarət ola bilməz - - The name already exists - Ad artıq mövcuddur - - - - + + Type: Növ: - - + + Description: Təsviri: - - + + All Day: Bütün gün: - - + + Starts: Başlayır: - - + + Ends: Başa çatır: - - + + Remind Me: Mənə xatırlat: - - + + Repeat: Təkrar: - - + + End Repeat: Təkrarın sonu: - - Type - Növ + + Calendar account: + Təqvim hesabı: - Work - İş + + Calendar account + Təqvim hesabı - Life - Həyat - - - Other - Digər + + Type + Növ - + Description Təsviri - + All Day Bütün gün - + Time: Vaxt: - + Time Vaxt - + Solar Günəş - + Lunar Ay - + Starts Başlayır - + Ends Başa çatır - + Remind Me Mənə xatırlat - + Repeat Təkrar - - + + Daily Hər gün - - + + Weekdays Həftənin günləri - - + + Weekly Həftə - - - + + + Monthly Ay - - - + + + Yearly İl - + End Repeat Təkrarın sonu - + After Sonra - + On Açıq - - - - - time(s) - vaxt(lar) - - - + Cancel button İmtina - + Save button Saxlayın @@ -432,141 +461,141 @@ CScheduleOperation - + All occurrences of a repeating event must have the same all-day status. Təkrarlanan tədbirlərin bütün hadisələri gün boyu eyni statusa malik olmalıdır. - - + + Do you want to change all occurrences? Bütün hadisələrə dəyişmək istəyrisiniz? - - + + + + + + + + Cancel + button + İmtina + + + + Change All Hamısını dəyişmək - + You are changing the repeating rule of this event. Siz bu tədbirin təkrarlanma qaydasını dəyişirsiniz. - - - + + + You are deleting an event. Siz tədbiri silirsiniz. - + Are you sure you want to delete this event? Bu tədbiri silmək istədiyinizə əminsiniz? - - - - - - - Cancel - button - İmtina - - - Delete button Silmək - + Do you want to delete all occurrences of this event, or only the selected occurrence? Siz bu tədbirin bütün hadisələrini, yoxsa yalnız seçilmiş hadisəsini silmək istəyirsiniz? - + Delete All Hamısını silin - - + + Delete Only This Event Yalnız bu tədbiri silin - + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? Siz bu tədbirin bütün gələcək hadisələrini, yoxsa yalnız seçilmiş hadisəsini silmək istəyirsiniz? - + Delete All Future Events Bütün gələcək tədbirləri silin - - + + You are changing a repeating event. Siz təkrarlanan tədbiri dəyişirsiniz. - + Do you want to change only this occurrence of the event, or all occurrences? Siz bu tədbirin yalnız bu hadisəsini, yoxsa bütün hadisələrini silmək istəyirsiniz? - + All Hamısını - - + + Only This Event Yalnız bu tədbiri - + Do you want to change only this occurrence of the event, or this and all future occurrences? Siz tədbirin yalnız bu hadisəsini yoxsa, bu və bütün gələcək hadisələrini silmək istəyirsiniz? - + All Future Events Bütün gələcək tədbirlər - + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. - + Siz uzun ay seşmisiniz və xatırlatma ay təqvimi qaydalarına uyğun olacaq. - + OK button - + OLDU CScheduleSearchDateItem - + Y İl - + M Ay - + D G @@ -574,17 +603,17 @@ CScheduleSearchItem - + Edit Düzəliş edin - + Delete Silin - + All Day Bütün gün @@ -592,7 +621,7 @@ CScheduleSearchView - + No search results Axtarış nəticəsiz oldu @@ -600,25 +629,83 @@ CScheduleView - + ALL DAY BÜTÜN GÜN + CSettingDialog + + + Sunday + Bazar + + + + Monday + Bazar ertəsi + + + + 24-hour clock + 24 saat vaxt formatı + + + + 12-hour clock + 12 saat vaxt formatı + + + + Manual + Əl ilə + + + + 15 mins + 15 dəqiqə + + + + 30 mins + 30 dəqiqə + + + + 1 hour + 1 saat + + + + 24 hours + 24 saat + + + + Sync Now + İndi eyniləşdirin + + + + Last sync + Sonuncu eyniləşmə + + + CTimeEdit - + (%1 mins) (%1 dəqiqə) - + (%1 hour) (%1 saat) - + (%1 hours) (%1 saat) @@ -626,35 +713,79 @@ CTitleWidget - + Y İl - + M Ay - + W H - + D G + + + + Search events and festivals + Tədbirləri və festivalları axtarın + + + + CWeekWidget + + + Sun + Baz + + + + Mon + B.er + + + + Tue + Ç.ax + + + + Wed + Çər + + + + Thu + C.ax + + + + Fri + Cüm + + + + Sat + Şnb + CWeekWindow - + Week Həftə - + Y İl @@ -662,13 +793,13 @@ CYearScheduleView + - All Day Bütün gün - + No event Tədbir yoxdur @@ -676,7 +807,7 @@ CYearWindow - + Y İl @@ -684,12 +815,12 @@ CalendarWindow - + Calendar Təqvim - + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. Təqvim tarixləri göstərən və həmçinin gündəlik həyatınızdakı gələcək işlərinizi planlamaq üçün bir gündəlikdir. @@ -697,43 +828,147 @@ Calendarmainwindow - + Calendar Təqvim - + Manage İdarə edin + + + Privacy Policy + Məxfilik Siyasəti + + + + Syncing... + Eyniləşdirilir... + + + + Sync successful + Eyniləşdirmə uğurlu oldu + + + + Sync failed, please try later + Eyniləşdirmə alınmadı, lütfən yenidən cəhd edin + CenterWidget - + All Day Bütün gün + DAccountDataBase + + + Work + + + + + Life + + + + + Other + + + + + DAlarmManager + + + + + + Close + button + + + + + One day before start + + + + + Remind me tomorrow + + + + + Remind me later + + + + + 15 mins later + + + + + 1 hour later + + + + + 4 hours later + + + + + + + Tomorrow + + + + + Schedule Reminder + + + + + + %1 to %2 + + + + + + Today + Bu gün + + + DragInfoGraphicsView - + Edit Düzəlt - + Delete Sil - + New event Yeni tədbir - + New Event Yeni tədbir @@ -741,23 +976,23 @@ JobTypeListView - + You are deleting an event type. Siz tədbir növünü silirsiniz. - + All events under this type will be deleted and cannot be recovered. Bu qəbildən bütün tədbirlər silinəcəklər və bərpa oluna bilməzlər. - + Cancel button İmtina - + Delete button Silin @@ -766,20 +1001,73 @@ QObject - + + Manage calendar Təqvimi idarə edin - + + Event types Tədbirin növləri + + + Account settings + Hesab ayarları + + + + Account + İstifadəçi hesabı + + + + Select items to be synced + Eyniləşdiriləcək elementləri seçin + + + + Events + Tədbirlər + + + + + General settings + Ümumi ayarlar + + + + Sync interval + Eyniləşdirmə aralığı + + + + Calendar account + Təqvim hesabı + + + + General + Ümumi + + + + First day of week + Həftənin ilk günü + + + + Time + Vaxt + Return - + Today Return Bu gün @@ -788,9 +1076,9 @@ Return Today - - - + + + Today Return Today Bu gün @@ -799,95 +1087,127 @@ ScheduleTypeEditDlg - + New event type Yeni tədbir növü - + Edit event type Tədbir növünü dəyişin - + Name: Ad: - + Color: Rəng: - + Cancel button İmtina - + Save button Saxla - - Enter a name please - Lütfən adı daxil edin - - - + The name can not only contain whitespaces Ad təkcə ara boşluqlarından ibarət ola bilməz - - The name already exists - Ad artıq mövcuddur + + Enter a name please + Lütfən adı daxil edin Shortcut - + Help Kömək - + Delete event Tədbiri silmək - + Copy Kopyala - + Cut Kəsmək - + Paste Əlavə et - + Delete Sil - + Select all Hamısını seçmək + SidebarCalendarWidget + + + Y + İl + + + + M + Ay + + + + TimeJumpDialog + + + Go + button + Keçin + + + + UserloginWidget + + + Sign In + button + Hesaba giriş + + + + Sign Out + button + Hesabdan çıxış + + + YearFrame - + Y İl @@ -895,17 +1215,17 @@ today - - - - - - - - + + + + + + + + Today Today Bu gün - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar_bo.ts dde-calendar-5.10.0/translations/dde-calendar_bo.ts --- dde-calendar-5.9.1/translations/dde-calendar_bo.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar_bo.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,38 +1,96 @@ - + + + + + AccountItem + + + Sync successful + + + + + Network error + + + + + Server exception + + + + + Storage full + + + + + AccountManager + + + Local account + + + + + Event types + + + + + CColorPickerWidget + + + Color + + + + + Cancel + button + ཕྱིར་འཐེན། + + + + Save + button + ཉར་གསོག་ + + CDayMonthView - + Monday གཟའ་ཟླ་བ། - + Tuesday གཟའ་མིག་དམར། - + Wednesday གཟའ་ལྷག་པ། - + Thursday གཟའ་ཕུར་བུ། - + Friday གཟའ་པ་སངས། - + Saturday གཟའ་སྤེན་པ། - + Sunday གཟའ་ཉི་མ། @@ -40,25 +98,30 @@ CDayWindow - + Y ལོ། - + M ཟླ། - + D ཚེས། + + + Lunar + + CGraphicsView - + New Event ལས་རིམ་གསར་པ། @@ -66,7 +129,7 @@ CMonthScheduleNumItem - + %1 more ད་དུང་%1ཡོད། @@ -74,12 +137,12 @@ CMonthView - + New event ལས་རིམ་གསར་པ། - + New Event ལས་རིམ་གསར་པ། @@ -87,7 +150,7 @@ CMonthWindow - + Y ལོ། @@ -95,258 +158,301 @@ CMyScheduleView - + My Event ངའི་ལས་རིམ། - + OK button གཏན་ཁེལ། - + Delete button སུབ་པ། - + Edit button རྩོམ་སྒྲིག + CPushButton + + + New event type + + + + CScheduleDlg - - + + + New Event ལས་རིམ་གསར་པ། - + Edit Event ལས་རིམ་རྩོམ་སྒྲིག - + End time must be greater than start time མཇུག་འགྲིལ་བའི་དུས་ཚོད་འགོ་འཛུགས་དུས་ཚོད་ལས་འཕྱི་བ་དགོས། - + OK button གཏན་ཁེལ། - - - - + + + + + + Never ནམ་ཡང་མིན། - + At time of event ལས་རིམ་འགོ་འཛུགས་དུས། - + 15 minutes before སྐར་མ་15སྔོན་ལ། - + 30 minutes before སྐར་མ་30སྔོན་ལ། - + 1 hour before ཆུ་ཚོད་1སྔོན་ལ། - - + + 1 day before ཉིན་1སྔོན་ལ། - - + + 2 days before ཉིན་2སྔོན་ལ། - - + + 1 week before གཟའ་འཁོར་1སྔོན་ལ། - + On start day (9:00 AM) ལས་རིམ་འགོ་ཚུགས་པའི་ཉིན།(9:00སྔ་དྲོའི་ཆུ་ཚོད།) - - + + Enter a name please + + + + + The name can not only contain whitespaces + + + + + Type: རིགས་གྲས། - - + + Description: ནང་དོན། - - + + All Day: ཉིན་གང་། - - + + Starts: འགོ་འཛུགས་དུས་ཚོད། - - + + Ends: མཇུག་སྒྲིལ་དུས་ཚོད། - - + + Remind Me: དྲན་སྐུལ། - - + + Repeat: བསྐྱར་ཟློས། - - + + End Repeat: བསྐྱར་ཟློས་མཇུག་འགྲིལ་བ། - - Type - རིགས་གྲས། - - - - Work - ལས་ཀ + + Calendar account: + - - Life - འཆོ་བ། + + Calendar account + - - Other - གཞན་དག + + Type + རིགས་གྲས། - + Description ནང་དོན། - + All Day ཉིན་གང་། - + + Time: + + + + + Time + + + + + Solar + + + + + Lunar + + + + Starts འགོ་འཛུགས་དུས་ཚོད། - + Ends མཇུག་སྒྲིལ་དུས་ཚོད། - + Remind Me དྲན་སྐུལ། - + Repeat བསྐྲར་ཟློས། - + + Daily ཉིན་རེ། - + + Weekdays ལས་ཀའི་ཉིན་གྲངས། - + + Weekly བདུན་རེ། - + + + Monthly ཟླ་རེ། - + + + Yearly ལོ་རེ། - + End Repeat བསྐྱར་ཟློས་མཇུག་འགྲིལ་བ། - + After རྗེས་ལ། - + On ལ། - - - - + + + + time(s) ཐེངས་གྲངས།(ཐེངས) - + Cancel button ཕྱིར་འཐེན། - + Save button ཉར་གསོག་ @@ -355,115 +461,126 @@ CScheduleOperation - + All occurrences of a repeating event must have the same all-day status. བསྐྱར་ཟློས་ཀྱི་ཉིན་རེའི་ལས་རིམ་གྱི་བསྐྱར་ཟློས་ཚང་མར་ཉིན་ཧྲིལ་པོའི་རྣམ་པ་གཅིག་མཚུངས་ཡོད་དགོས། - - + + Do you want to change all occurrences? ཁྱོད་ཀྱིས་བསྐྱར་ཟློས་ཚང་མ་བཟོ་བཅོས་བྱེད་རྒྱུ་ཡིན་ནམ། - - + + Change All ཚང་མ་བཟོ་བཅོས་བྱེད། - + You are changing the repeating rule of this event. ཁྱོད་ཀྱིས་ཉིན་རེའི་ལས་རིམ་གྱི་བསྐྱར་ཟློས་ཀྱི་སྒྲིག་སྲོལ་བཟོ་བཅོས་བྱེད་བཞིན་ཡོད། - - - + + + You are deleting an event. ཁྱོད་ཀྱིས་ཉིན་རེའི་ལས་རིམ་བསུབ་བཞིན་ཡོད། - + Are you sure you want to delete this event? ཁྱོད་ཀྱིས་ཉིན་རེའི་ལས་རིམ་འདི་བསུབ་རྒྱུ་ཡིན་པ་གཏན་འཁེལ་ལམ། - - - - - - - + + + + + + + Cancel button ཕྱིར་འཐེན། - + Delete button སུབ་པ། - + Do you want to delete all occurrences of this event, or only the selected occurrence? ཁྱོད་ཀྱིས་ཉིན་རེའི་ལས་རིམ་འདིའི་བསྐྱར་ཟློས་ཚང་མ་བསུབ་རྒྱུ་ཡིན་ནམ། ཡང་ན་བདམས་ཡོད་པའི་བསྐྱར་ཟློས་དག་བསུབ་རྒྱུ་ཡིན། - + Delete All ཚང་མ་སུབ་པ། - - + + Delete Only This Event ཉིན་རེའི་ལས་རིམ་འདི་སུབ་པ། - + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? ཁྱོད་ཀྱིས་ཉིན་རེའི་ལས་རིམ་འདིའི་བསྐྱར་ཟློས་འདི་དང་མ་འོངས་ཀྱི་བསྐྱར་ཟློས་ཚང་མ་བསུབ་རྒྱུ་ཡིན་ནམ། ཡང་ན་བདམས་ཡོད་པའི་བསྐྱར་ཟློས་དག་བསུབ་རྒྱུ་ཡིན། - + Delete All Future Events མ་འོངས་ཀྱི་ཉིན་རེའི་ལས་རིམ་ཚང་མ་སུབ་པ། - - + + You are changing a repeating event. ཁྱོད་ཀྱིས་བསྐྱར་ཟློས་ཀྱི་ཉིན་རེའི་ལས་རིམ་དག་བཟོ་བཅོས་བྱེད་བཞིན་ཡོད། - + Do you want to change only this occurrence of the event, or all occurrences? ཁྱོད་ཀྱིས་ཉིན་རེའི་ལས་རིམ་འདིའི་བསྐྱར་ཟློས་འདི་བཟོ་བཅོས་བྱེད་རྒྱུ་ཡིན་ནམ། ཡང་ན་དེའི་བསྐྱར་ཟློས་ཚང་མ་བཟོ་བཅོས་བྱེད་རྒྱུ་ཡིན། - + All ཉིན་རེའི་ལས་རིམ་ཆ་ཚང་། - - + + Only This Event ཉིན་རེའི་ལས་རིམ་འདི་ཉིད། - + Do you want to change only this occurrence of the event, or this and all future occurrences? ཁྱོད་ཀྱིས་ཉིན་རེའི་ལས་རིམ་འདིའི་བསྐྱར་ཟློས་འདི་དང་མ་འོངས་ཀྱི་བསྐྱར་ཟློས་ཚང་མ་བཟོ་བཅོས་བྱེད་རྒྱུ་ཡིན་ནམ། ཡང་ན་བདམས་ཡོད་པའི་བསྐྱར་ཟློས་དག་བཟོ་བཅོས་བྱེད་རྒྱུ་ཡིན། - + All Future Events མ་འོངས་ཀྱི་ཉིན་རེའི་ལས་རིམ་ཚང་མ། + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + + OK + button + གཏན་ཁེལ། + CScheduleSearchDateItem @@ -486,17 +603,17 @@ CScheduleSearchItem - + Edit རྩོམ་སྒྲིག - + Delete སུབ་པ། - + All Day ཉིན་གང་། @@ -512,61 +629,163 @@ CScheduleView - + ALL DAY ཉིན་གང་། + CSettingDialog + + + Sunday + གཟའ་ཉི་མ། + + + + Monday + གཟའ་ཟླ་བ། + + + + 24-hour clock + + + + + 12-hour clock + + + + + Manual + + + + + 15 mins + + + + + 30 mins + + + + + 1 hour + + + + + 24 hours + + + + + Sync Now + + + + + Last sync + + + + CTimeEdit - + (%1 mins) - + - + (%1 hour) - + - + (%1 hours) - + CTitleWidget - + Y ལོ། - + M ཟླ། - + W གཟའ། - + D ཚེས། + + + + Search events and festivals + + + + + CWeekWidget + + + Sun + + + + + Mon + + + + + Tue + + + + + Wed + + + + + Thu + + + + + Fri + + + + + Sat + + CWeekWindow - + Week གཟའ་འཁོར། - + Y ལོ། @@ -574,13 +793,13 @@ CYearScheduleView + - All Day ཉིན་གང་། - + No event ལས་རིམ་མེད། @@ -588,7 +807,7 @@ CYearWindow - + Y ལོ། @@ -596,12 +815,12 @@ CalendarWindow - + Calendar ལོ་ཐོ། - + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. ལོ་ཐོ་ནི་ཚེས་གྲངས་བལྟ་བ་དང་ལས་རིམ་དོ་དམ་བྱེད་པའི་ཡོ་བྱད་ཆུང་ཆུང་ཞིག་རེད། @@ -609,46 +828,246 @@ Calendarmainwindow - + Calendar ལོ་ཐོ། + + + Manage + + + + + Privacy Policy + + + + + Syncing... + + + + + Sync successful + + + + + Sync failed, please try later + + CenterWidget - + All Day ཉིན་གང་། + DAccountDataBase + + + Work + ལས་ཀ + + + + Life + འཆོ་བ། + + + + Other + གཞན་དག + + + + DAlarmManager + + + + + + Close + button + + + + + One day before start + + + + + Remind me tomorrow + + + + + Remind me later + + + + + 15 mins later + + + + + 1 hour later + + + + + 4 hours later + + + + + + + Tomorrow + + + + + Schedule Reminder + + + + + + %1 to %2 + + + + + + Today + དེ་རིང་། + + + DragInfoGraphicsView - + Edit རྩོམ་སྒྲིག - + Delete སུབ་པ། - + New event ལས་རིམ་གསར་པ། - + New Event ལས་རིམ་གསར་པ། + JobTypeListView + + + You are deleting an event type. + + + + + All events under this type will be deleted and cannot be recovered. + + + + + Cancel + button + ཕྱིར་འཐེན། + + + + Delete + button + སུབ་པ། + + + + QObject + + + Account settings + + + + + Account + + + + + Select items to be synced + + + + + Events + + + + + + General settings + + + + + Sync interval + + + + + + Manage calendar + + + + + Calendar account + + + + + + Event types + + + + + General + + + + + First day of week + + + + + Time + + + + Return - + Today Return དེ་རིང་། @@ -657,56 +1076,138 @@ Return Today - - - + + + Today Return Today དེ་རིང་། + ScheduleTypeEditDlg + + + New event type + + + + + Edit event type + + + + + Name: + + + + + Color: + + + + + Cancel + button + ཕྱིར་འཐེན། + + + + Save + button + ཉར་གསོག་ + + + + The name can not only contain whitespaces + + + + + Enter a name please + + + + Shortcut - + Help རོགས་རམ། - + Delete event ལས་རིམ་སུབ་པ། - + Copy མཁོ་ཕབ། - + Cut དྲས་གཏུབ། - + Paste སྦྱར་བ། - + Delete སུབ་པ། - + Select all ཡོངས་འདེམས། + SidebarCalendarWidget + + + Y + ལོ། + + + + M + ཟླ། + + + + TimeJumpDialog + + + Go + button + + + + + UserloginWidget + + + Sign In + button + + + + + Sign Out + button + + + + YearFrame - + Y ལོ། @@ -714,17 +1215,17 @@ today - - - - - - - - + + + + + + + + Today Today དེ་རིང་། - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar_ca.ts dde-calendar-5.10.0/translations/dde-calendar_ca.ts --- dde-calendar-5.9.1/translations/dde-calendar_ca.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar_ca.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,66 +1,96 @@ - + + + + + AccountItem + + + Sync successful + Sincronització correcta + + + + Network error + Error de xarxa + + + + Server exception + Excepció del servidor + + + + Storage full + Emmagatzematge ple + + + + AccountManager + + + Local account + Compte local + + + + Event types + Tipus d'esdeveniment + + CColorPickerWidget - + Color Color - + Cancel button Cancel·la - + Save button Desa-ho - - Cancel - - - - Save - - CDayMonthView - + Monday Dilluns - + Tuesday Dimarts - + Wednesday Dimecres - + Thursday Dijous - + Friday Divendres - + Saturday Dissabte - + Sunday Diumenge @@ -68,25 +98,30 @@ CDayWindow - + Y any - + M mes - + D D + + + Lunar + Lunar + CGraphicsView - + New Event Esdeveniment nou @@ -94,7 +129,7 @@ CMonthScheduleNumItem - + %1 more %1 més @@ -102,12 +137,12 @@ CMonthView - + New event Nou esdeveniment - + New Event Esdeveniment nou @@ -115,7 +150,7 @@ CMonthWindow - + Y any @@ -123,24 +158,24 @@ CMyScheduleView - + My Event El meu esdeveniment - + OK button D'acord - + Delete button Elimina - + Edit button Edita @@ -149,7 +184,7 @@ CPushButton - + New event type Tipus d'esdeveniment nou @@ -157,273 +192,267 @@ CScheduleDlg - - + + + New Event Esdeveniment nou - + Edit Event Edita l'esdeveniment - + End time must be greater than start time L'hora d'acabament ha de ser superior a l'hora d'inici. - + OK button D'acord - - - - - - + + + + + + Never Mai - + At time of event Al moment de l'esdeveniment - + 15 minutes before 15 minuts abans - + 30 minutes before 30 minuts abans - + 1 hour before 1 hora abans - + 1 day before 1 dia abans - + 2 days before 2 dies abans - + 1 week before 1 setmana abans - + On start day (9:00 AM) El dia d'inici (9:00) - + + + + + time(s) + cop/s + + + Enter a name please Escriviu un nom, si us plau. - + The name can not only contain whitespaces El nom no només pot contenir espais en blanc. - - The name already exists - El nom ja existeix. - - - - + + Type: Tipus: - - + + Description: Descripció: - - + + All Day: Tot el dia: - - + + Starts: Comença: - - + + Ends: Acaba: - - + + Remind Me: Recorda-m'ho: - - + + Repeat: Repeteix: - - + + End Repeat: Acaba la repetició: - - Type - Tipus + + Calendar account: + Compte del calendari: - Work - Feina + + Calendar account + Compte del calendari - Life - Vida - - - Other - Altres + + Type + Tipus - + Description Descripció - + All Day Tot el dia - + Time: Hora: - + Time Hora - + Solar solar - + Lunar lunar - + Starts Comença - + Ends Acaba - + Remind Me Recorda-m'ho - + Repeat Repeteix - - + + Daily Diàriament - - + + Weekdays Els dies feiners - - + + Weekly Setmanalment - - - + + + Monthly Mensualment - - - + + + Yearly Anualment - + End Repeat Acaba la repetició - + After Després - + On Activat - - - - - time(s) - cop/s - - - + Cancel button Cancel·la - + Save button Desa @@ -432,141 +461,141 @@ CScheduleOperation - + All occurrences of a repeating event must have the same all-day status. Totes les ocurrències d'un esdeveniment repetitiu han de tenir el mateix estat de tot el dia. - - + + Do you want to change all occurrences? Voleu canviar-ne totes les ocurrències? - - + + + + + + + + Cancel + button + Cancel·la + + + + Change All Canvia-les totes - + You are changing the repeating rule of this event. Canvieu la regla de repetició d'aquest esdeveniment. - - - + + + You are deleting an event. Elimineu un esdeveniment. - + Are you sure you want to delete this event? Segur que voleu eliminar aquest esdeveniment? - - - - - - - Cancel - button - Cancel·la - - - Delete button Elimina - + Do you want to delete all occurrences of this event, or only the selected occurrence? Voleu eliminar totes les ocurrències d'aquest esdeveniment o només la seleccionada? - + Delete All Elimina-les totes - - + + Delete Only This Event Elimina només aquest esdeveniment - + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? Voleu eliminar aquesta i totes les ocurrències futures d'aquest esdeveniment o només la seleccionada? - + Delete All Future Events Elimina tots els esdeveniments futurs - - + + You are changing a repeating event. Canvieu un esdeveniment repetitiu. - + Do you want to change only this occurrence of the event, or all occurrences? Voleu canviar només aquesta ocurrència de l'esdeveniment o totes? - + All Totes - - + + Only This Event Només aquest esdeveniment - + Do you want to change only this occurrence of the event, or this and all future occurrences? Voleu canviar només aquesta ocurrència de l'esdeveniment, o aquesta i totes les ocurrències futures? - + All Future Events Tots els esdeveniments futurs - + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. - + Heu seleccionat un mes de traspàs i se us recordarà segons les regles del calendari lunar. - + OK button - + D'acord CScheduleSearchDateItem - + Y A - + M M - + D D @@ -574,17 +603,17 @@ CScheduleSearchItem - + Edit Edita - + Delete Elimina - + All Day Tot el dia @@ -592,7 +621,7 @@ CScheduleSearchView - + No search results No hi ha resultats de la cerca. @@ -600,25 +629,83 @@ CScheduleView - + ALL DAY TOT EL DIA + CSettingDialog + + + Sunday + Diumenge + + + + Monday + Dilluns + + + + 24-hour clock + Rellotge de 24 hores + + + + 12-hour clock + Rellotge de 12 hores + + + + Manual + Manual + + + + 15 mins + 15 min + + + + 30 mins + 30 min + + + + 1 hour + 1 hora + + + + 24 hours + 24 hores + + + + Sync Now + Sincronitza ara + + + + Last sync + Darrera sincronització + + + CTimeEdit - + (%1 mins) (%1 min) - + (%1 hour) (%1 hora) - + (%1 hours) (%1 hores) @@ -626,35 +713,79 @@ CTitleWidget - + Y any - + M mes - + W setmana - + D dia + + + + Search events and festivals + Cerca esdeveniments i festivals + + + + CWeekWidget + + + Sun + dg. + + + + Mon + dl. + + + + Tue + dt. + + + + Wed + dc. + + + + Thu + dj. + + + + Fri + dv. + + + + Sat + ds. + CWeekWindow - + Week Setmana - + Y any @@ -662,13 +793,13 @@ CYearScheduleView + - All Day Tot el dia - + No event Cap esdeveniment @@ -676,7 +807,7 @@ CYearWindow - + Y any @@ -684,12 +815,12 @@ CalendarWindow - + Calendar Calendari - + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. El Calendari és una eina per veure dates i també un planificador diari intel·ligent per programar totes les coses de la vida. @@ -697,43 +828,147 @@ Calendarmainwindow - + Calendar Calendari - + Manage Gestiona + + + Privacy Policy + Política de privadesa + + + + Syncing... + Se sincronitza... + + + + Sync successful + Sincronització correcta + + + + Sync failed, please try later + La sincronització ha fallat. Si us plau, proveu-ho més tard. + CenterWidget - + All Day Tot el dia + DAccountDataBase + + + Work + + + + + Life + + + + + Other + + + + + DAlarmManager + + + + + + Close + button + + + + + One day before start + + + + + Remind me tomorrow + + + + + Remind me later + + + + + 15 mins later + + + + + 1 hour later + + + + + 4 hours later + + + + + + + Tomorrow + + + + + Schedule Reminder + + + + + + %1 to %2 + + + + + + Today + Avui + + + DragInfoGraphicsView - + Edit Edita - + Delete Elimina - + New event Esdeveniment nou - + New Event Esdeveniment nou @@ -741,23 +976,23 @@ JobTypeListView - + You are deleting an event type. Elimineu un tipus d'esdeveniment. - + All events under this type will be deleted and cannot be recovered. Tots els esdeveniments d'aquest tipus s'eliminaran i no es podran recuperar. - + Cancel button Cancel·la - + Delete button Elimina @@ -766,20 +1001,73 @@ QObject - + + Manage calendar Gestiona el calendari - + + Event types Tipus d'esdeveniment + + + Account settings + Paràmetres del compte + + + + Account + Compte + + + + Select items to be synced + Seleccioneu els elements per sincronitzar + + + + Events + Esdeveniments + + + + + General settings + Configuració general + + + + Sync interval + Interval de sincronització + + + + Calendar account + Compte del calendari + + + + General + General + + + + First day of week + Primer dia de la setmana + + + + Time + Hora + Return - + Today Return Avui @@ -788,9 +1076,9 @@ Return Today - - - + + + Today Return Today Avui @@ -799,95 +1087,127 @@ ScheduleTypeEditDlg - + New event type Tipus d'esdeveniment nou - + Edit event type Edita el tipus d'esdeveniment - + Name: Nom: - + Color: Color: - + Cancel button Cancel·la - + Save button Desa-ho - - Enter a name please - Escriviu un nom, si us plau. - - - + The name can not only contain whitespaces El nom no només pot contenir espais en blanc. - - The name already exists - El nom ja existeix. + + Enter a name please + Escriviu un nom, si us plau. Shortcut - + Help Ajuda - + Delete event Suprimeix l'esdeveniment - + Copy Copia - + Cut Retalla - + Paste Enganxa - + Delete Elimina - + Select all Selecciona-ho tot + SidebarCalendarWidget + + + Y + A + + + + M + M + + + + TimeJumpDialog + + + Go + button + Ves-hi + + + + UserloginWidget + + + Sign In + button + Inicia la sessió + + + + Sign Out + button + Surt de la sessió + + + YearFrame - + Y any @@ -895,17 +1215,17 @@ today - - - - - - - - + + + + + + + + Today Today Avui - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar_cs.ts dde-calendar-5.10.0/translations/dde-calendar_cs.ts --- dde-calendar-5.9.1/translations/dde-calendar_cs.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar_cs.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,66 +1,96 @@ - + + + - CColorPickerWidget + AccountItem - - Color - + + Sync successful + Synchronizace byla úspěšná - - Cancel - button - + + Network error + Síťová chyba - - Save - button - + + Server exception + Výjimka na serveru + + + + Storage full + Úložiště je plné + + + + AccountManager + + + Local account + Místní účet + + + + Event types + Typy událostí + + + + CColorPickerWidget + + + Color + Barva + Cancel - + button + Zrušit + Save - + button + Uložit CDayMonthView - + Monday pondělí - + Tuesday úterý - + Wednesday středa - + Thursday čtvrtek - + Friday pátek - + Saturday sobota - + Sunday neděle @@ -68,25 +98,30 @@ CDayWindow - + Y R - + M M - + D D + + + Lunar + Měsíční + CGraphicsView - + New Event Nová událost @@ -94,7 +129,7 @@ CMonthScheduleNumItem - + %1 more %1 další @@ -102,12 +137,12 @@ CMonthView - + New event Nová událost - + New Event Nová událost @@ -115,7 +150,7 @@ CMonthWindow - + Y R @@ -123,24 +158,24 @@ CMyScheduleView - + My Event Moje událost - + OK button OK - + Delete button Smazat - + Edit button Upravit @@ -149,281 +184,275 @@ CPushButton - + New event type - + Nový typ události CScheduleDlg - - + + + New Event Nová událost - + Edit Event Upravit událost - + End time must be greater than start time Je třeba, aby okamžik konce následoval až po okamžiku začátku - + OK button OK - - - - - - + + + + + + Never Nikdy - + At time of event V okamžiku události - + 15 minutes before 15 minut před - + 30 minutes before 30 minut před - + 1 hour before 1 hodinu před - + 1 day before 1 den před - + 2 days before 2 dny před - + 1 week before 1 týden před - + On start day (9:00 AM) V den začátku (9:00 dop.) - - Enter a name please - + + + + + time(s) + krát - - The name can not only contain whitespaces - + + Enter a name please + Zadejte, prosím, název - - The name already exists - + + The name can not only contain whitespaces + Název nemůže obsahovat pouze mezery - - + + Type: Typ: - - + + Description: Popis: - - + + All Day: Celý den: - - + + Starts: Začíná: - - + + Ends: Končí: - - + + Remind Me: Připomenout: - - + + Repeat: Opakovat: - - + + End Repeat: Ukončit opakování: - - Type - Typ - - - Work - Práce + + Calendar account: + Kalendářový účet: - Life - Soukromé + + Calendar account + Kalendářový účet - Other - Ostatní + + Type + Typ - + Description Popis - + All Day Celý den - + Time: - + Čas: - + Time - + Čas - + Solar - + Sluneční - + Lunar - + Měsíční - + Starts Začíná - + Ends Končí - + Remind Me Připomenout - + Repeat Opakování - - + + Daily Denně - - + + Weekdays Všední dny - - + + Weekly Týdně - - - + + + Monthly Měsíčně - - - + + + Yearly Ročně - + End Repeat Ukončit opakování - + After Po - + On Zapnuto - - - - - time(s) - krát - - - + Cancel button Zrušit - + Save button Uložit @@ -432,141 +461,141 @@ CScheduleOperation - + All occurrences of a repeating event must have the same all-day status. Je třeba, aby všechny výskyty opakující se události měly stejný stav „celý den“. - - + + Do you want to change all occurrences? Chcete změnit všechny výskyty? - - + + + + + + + + Cancel + button + Zrušit + + + + Change All Změnit vše - + You are changing the repeating rule of this event. Měníte pravidlo opakování této události. - - - + + + You are deleting an event. Mažete událost. - + Are you sure you want to delete this event? Opravdu chcete tuto událost smazat? - - - - - - - Cancel - button - Zrušit - - - Delete button Smazat - + Do you want to delete all occurrences of this event, or only the selected occurrence? Chcete smazat všechny výskyty této události, nebo jen vybraný výskyt? - + Delete All Smazat vše - - + + Delete Only This Event Smazat jen tuto událost - + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? Chcete smazat tento a všechny budoucí výskyty této události, nebo jen ten vybraný? - + Delete All Future Events Smazat všechny budoucí události - - + + You are changing a repeating event. Měníte pravidlo opakující se události. - + Do you want to change only this occurrence of the event, or all occurrences? Chcete změnit jen tento výskyt události, nebo všechny výskyty? - + All Vše - - + + Only This Event Jen tato událost - + Do you want to change only this occurrence of the event, or this and all future occurrences? Chcete změnit jen tento výskyt události, nebo tento a všechny budoucí výskyty? - + All Future Events Všechny budoucí události - + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. - + Vybrali jste přestupný měsíc, a bude vám připomenut podle pravidel měsíčního kalendáře. - + OK button - + OK CScheduleSearchDateItem - + Y R - + M M - + D D @@ -574,17 +603,17 @@ CScheduleSearchItem - + Edit Upravit - + Delete Smazat - + All Day Celý den @@ -592,7 +621,7 @@ CScheduleSearchView - + No search results Nic nenalezeno @@ -600,25 +629,83 @@ CScheduleView - + ALL DAY CELÝ DEN + CSettingDialog + + + Sunday + neděle + + + + Monday + pondělí + + + + 24-hour clock + 24 hodinové hodiny + + + + 12-hour clock + 12 hodinové hodiny + + + + Manual + Příručka + + + + 15 mins + 15 minut + + + + 30 mins + 30 minut + + + + 1 hour + 1 hodina + + + + 24 hours + 24 hodin + + + + Sync Now + Seřídit nyní + + + + Last sync + Naposledy synchronizováno + + + CTimeEdit - + (%1 mins) (%1 min.) - + (%1 hour) (%1 hod) - + (%1 hours) (%1 hod.) @@ -626,35 +713,79 @@ CTitleWidget - + Y R - + M M - + W T - + D D + + + + Search events and festivals + Vyhledávání událostí a festivalů + + + + CWeekWidget + + + Sun + Ne + + + + Mon + Po + + + + Tue + Út + + + + Wed + St + + + + Thu + Čt + + + + Fri + + + + + Sat + So + CWeekWindow - + Week Týden - + Y R @@ -662,13 +793,13 @@ CYearScheduleView + - All Day Celý den - + No event Žádná událost @@ -676,7 +807,7 @@ CYearWindow - + Y R @@ -684,12 +815,12 @@ CalendarWindow - + Calendar Kalendář - + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. Kalendář slouží k zobrazování datumů a také jako chytrý každodenní plánovač všeho v životě. @@ -697,43 +828,147 @@ Calendarmainwindow - + Calendar Kalendář - + Manage - + Spravovat + + + + Privacy Policy + Zásady ochrany soukromí + + + + Syncing... + Synchronizace… + + + + Sync successful + Synchronizace úspěšná + + + + Sync failed, please try later + Synchronizace se nezdařila, zkuste to, prosím, později CenterWidget - + All Day Celý den + DAccountDataBase + + + Work + + + + + Life + + + + + Other + + + + + DAlarmManager + + + + + + Close + button + + + + + One day before start + + + + + Remind me tomorrow + + + + + Remind me later + + + + + 15 mins later + + + + + 1 hour later + + + + + 4 hours later + + + + + + + Tomorrow + + + + + Schedule Reminder + + + + + + %1 to %2 + + + + + + Today + Dnes + + + DragInfoGraphicsView - + Edit Upravit - + Delete Smazat - + New event Nová událost - + New Event Nová událost @@ -741,45 +976,98 @@ JobTypeListView - + You are deleting an event type. - + Mažete typ události. - + All events under this type will be deleted and cannot be recovered. - + Všechny události tohoto typu budou smazány a nelze je obnovit. - + Cancel button - + Zrušit - + Delete button - + Smazat QObject - + + Manage calendar - + Spravovat kalendář - + + Event types - + Typy událostí + + + + Account settings + Nastavení účtu + + + + Account + Účet + + + + Select items to be synced + Vyberte položky, které mají být synchronizovány + + + + Events + Události + + + + + General settings + Obecná nastavení + + + + Sync interval + Seřizovací interval + + + + Calendar account + Kalendářový účet + + + + General + Obecné + + + + First day of week + První den týdne + + + + Time + Čas Return - + Today Return Dnes @@ -788,9 +1076,9 @@ Return Today - - - + + + Today Return Today Dnes @@ -799,95 +1087,127 @@ ScheduleTypeEditDlg - + New event type - + Nový typ události - + Edit event type - + Upravit typ události - + Name: - + Název: - + Color: - + Barva: - + Cancel button - + Zrušit - + Save button - - - - - Enter a name please - + Uložit - + The name can not only contain whitespaces - + Název nemůže obsahovat pouze mezery - - The name already exists - + + Enter a name please + Zadejte, prosím, název Shortcut - + Help Nápověda - + Delete event Smazat událost - + Copy Kopírovat - + Cut Vyjmout - + Paste Vložit - + Delete Smazat - + Select all Vybrat vše + SidebarCalendarWidget + + + Y + R + + + + M + M + + + + TimeJumpDialog + + + Go + button + Jde se + + + + UserloginWidget + + + Sign In + button + Přihlásit se + + + + Sign Out + button + Odhlásit se + + + YearFrame - + Y R @@ -895,17 +1215,17 @@ today - - - - - - - - + + + + + + + + Today Today Dnes - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar_da.ts dde-calendar-5.10.0/translations/dde-calendar_da.ts --- dde-calendar-5.9.1/translations/dde-calendar_da.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar_da.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,38 +1,96 @@ - + + + + + AccountItem + + + Sync successful + + + + + Network error + + + + + Server exception + + + + + Storage full + + + + + AccountManager + + + Local account + + + + + Event types + + + + + CColorPickerWidget + + + Color + + + + + Cancel + button + Annuller + + + + Save + button + Gem + + CDayMonthView - + Monday Mandag - + Tuesday Tirsdag - + Wednesday Onsdag - + Thursday Torsdag - + Friday Fredag - + Saturday Lørdag - + Sunday Søndag @@ -40,25 +98,30 @@ CDayWindow - + Y Å - + M M - + D D + + + Lunar + + CGraphicsView - + New Event Ny begivenhed @@ -66,7 +129,7 @@ CMonthScheduleNumItem - + %1 more %1 mere @@ -74,12 +137,12 @@ CMonthView - + New event Ny begivenhed - + New Event Ny begivenhed @@ -87,7 +150,7 @@ CMonthWindow - + Y Å @@ -95,258 +158,301 @@ CMyScheduleView - + My Event Min begivenhed - + OK button OK - + Delete button Slet - + Edit button Rediger + CPushButton + + + New event type + + + + CScheduleDlg - - + + + New Event Ny begivenhed - + Edit Event Rediger begivenhed - + End time must be greater than start time Sluttidspunktet skal være større end starttidspunktet - + OK button OK - - - - + + + + + + Never Aldrig - + At time of event På tidspunktet for begivenheden - + 15 minutes before 15 minutter før - + 30 minutes before 30 minutter før - + 1 hour before 1 time før - - + + 1 day before 1 dag før - - + + 2 days before 2 dage før - - + + 1 week before 1 uge før - + On start day (9:00 AM) På starten af dagen (9:00) - - + + Enter a name please + + + + + The name can not only contain whitespaces + + + + + Type: Type: - - + + Description: Beskrivelse: - - + + All Day: Hele dagen: - - + + Starts: Starter: - - + + Ends: Slutter: - - + + Remind Me: Påmind mig: - - + + Repeat: Gentag: - - + + End Repeat: Slut gentag: - - Type - Type - - - - Work - Arbejde + + Calendar account: + - - Life - Leve + + Calendar account + - - Other - Andre + + Type + Type - + Description Beskrivelse - + All Day Hele dagen - + + Time: + + + + + Time + + + + + Solar + + + + + Lunar + + + + Starts - + - + Ends - + - + Remind Me - + - + Repeat Gentag - + + Daily Dagligt - + + Weekdays Ugedage - + + Weekly Ugentligt - + + + Monthly Månedligt - + + + Yearly Årligt - + End Repeat - + - + After Efter - + On Til - - - - + + + + time(s) gang(e) - + Cancel button Annuller - + Save button Gem @@ -355,115 +461,126 @@ CScheduleOperation - + All occurrences of a repeating event must have the same all-day status. Alle forekomster af en begivenhed som gentages skal have den samme hele dagen-status. - - + + Do you want to change all occurrences? Vil du ændre alle forekomster? - - + + Change All Ændr alle - + You are changing the repeating rule of this event. Du er ved at ændre gentagelsesreglen for begivenheden. - - - + + + You are deleting an event. Du er ved at slette en begivenhed. - + Are you sure you want to delete this event? Er du sikker på, at du vil slette begivenheden? - - - - - - - + + + + + + + Cancel button Annuller - + Delete button Slet - + Do you want to delete all occurrences of this event, or only the selected occurrence? Vil du slette alle forekomster af begivenheden eller kun den valgte forekomst? - + Delete All Slet alle - - + + Delete Only This Event Slet kun denne begivenhed - + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? Vil du slette denne og alle fremtidige forekomster af begivenheden eller kun den valgte forekomst? - + Delete All Future Events Slet alle fremtidige begivenheder - - + + You are changing a repeating event. Du er ved at ændre en begivenhed som gentages. - + Do you want to change only this occurrence of the event, or all occurrences? Vil du kun ændre denne forekomst for begivenheden, eller alle forekomster? - + All Alle - - + + Only This Event Kun denne begivenhed - + Do you want to change only this occurrence of the event, or this and all future occurrences? Vil du kun ændre denne forekomst for begivenheden, eller denne og alle fremtidige forekomster? - + All Future Events Alle fremtidige begivenheder + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + + OK + button + OK + CScheduleSearchDateItem @@ -486,17 +603,17 @@ CScheduleSearchItem - + Edit Rediger - + Delete Slet - + All Day Hele dagen @@ -512,61 +629,163 @@ CScheduleView - + ALL DAY HELE DAGEN + CSettingDialog + + + Sunday + Søndag + + + + Monday + Mandag + + + + 24-hour clock + + + + + 12-hour clock + + + + + Manual + + + + + 15 mins + + + + + 30 mins + + + + + 1 hour + + + + + 24 hours + + + + + Sync Now + + + + + Last sync + + + + CTimeEdit - + (%1 mins) - + - + (%1 hour) - + - + (%1 hours) - + CTitleWidget - + Y Å - + M M - + W W - + D D + + + + Search events and festivals + + + + + CWeekWidget + + + Sun + + + + + Mon + + + + + Tue + + + + + Wed + + + + + Thu + + + + + Fri + + + + + Sat + + CWeekWindow - + Week Uge - + Y Å @@ -574,13 +793,13 @@ CYearScheduleView + - All Day Hele dagen - + No event Ingen begivenhed @@ -588,7 +807,7 @@ CYearWindow - + Y Å @@ -596,12 +815,12 @@ CalendarWindow - + Calendar Kalender - + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. Kalender er et værktøj til at vise datoer, og er også en smart dagsplanlægger til alt i dit liv. @@ -609,46 +828,246 @@ Calendarmainwindow - + Calendar Kalender + + + Manage + + + + + Privacy Policy + + + + + Syncing... + + + + + Sync successful + + + + + Sync failed, please try later + + CenterWidget - + All Day Hele dagen + DAccountDataBase + + + Work + Arbejde + + + + Life + Leve + + + + Other + Andre + + + + DAlarmManager + + + + + + Close + button + + + + + One day before start + + + + + Remind me tomorrow + + + + + Remind me later + + + + + 15 mins later + + + + + 1 hour later + + + + + 4 hours later + + + + + + + Tomorrow + + + + + Schedule Reminder + + + + + + %1 to %2 + + + + + + Today + I dag + + + DragInfoGraphicsView - + Edit Rediger - + Delete Slet - + New event Ny begivenhed - + New Event Ny begivenhed + JobTypeListView + + + You are deleting an event type. + + + + + All events under this type will be deleted and cannot be recovered. + + + + + Cancel + button + Annuller + + + + Delete + button + Slet + + + + QObject + + + Account settings + + + + + Account + + + + + Select items to be synced + + + + + Events + + + + + + General settings + + + + + Sync interval + + + + + + Manage calendar + + + + + Calendar account + + + + + + Event types + + + + + General + + + + + First day of week + + + + + Time + + + + Return - + Today Return I dag @@ -657,56 +1076,138 @@ Return Today - - - + + + Today Return Today I dag + ScheduleTypeEditDlg + + + New event type + + + + + Edit event type + + + + + Name: + + + + + Color: + + + + + Cancel + button + Annuller + + + + Save + button + Gem + + + + The name can not only contain whitespaces + + + + + Enter a name please + + + + Shortcut - + Help Hjælp - + Delete event Slet begivenhed - + Copy Kopiér - + Cut Klip - + Paste Indsæt - + Delete Slet - + Select all Vælg alle + SidebarCalendarWidget + + + Y + Å + + + + M + M + + + + TimeJumpDialog + + + Go + button + + + + + UserloginWidget + + + Sign In + button + + + + + Sign Out + button + + + + YearFrame - + Y Å @@ -714,17 +1215,17 @@ today - - - - - - - - + + + + + + + + Today Today I dag - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar_de.ts dde-calendar-5.10.0/translations/dde-calendar_de.ts --- dde-calendar-5.9.1/translations/dde-calendar_de.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar_de.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,66 +1,96 @@ - + + + - CColorPickerWidget + AccountItem - - Color - + + Sync successful + Synchronisierung erfolgreich - - Cancel - button - + + Network error + Netzwerkfehler - - Save - button - + + Server exception + Serverausnahme + + + + Storage full + Speicher voll + + + + AccountManager + + + Local account + Lokales Konto + + + + Event types + Termintypen + + + + CColorPickerWidget + + + Color + Farbe + Cancel - + button + Abbrechen + Save - + button + Speichern CDayMonthView - + Monday Montag - + Tuesday Dienstag - + Wednesday Mittwoch - + Thursday Donnerstag - + Friday Freitag - + Saturday Samstag - + Sunday Sonntag @@ -68,25 +98,30 @@ CDayWindow - + Y J - + M M - + D T + + + Lunar + Lunar + CGraphicsView - + New Event Neuer Termin @@ -94,7 +129,7 @@ CMonthScheduleNumItem - + %1 more %1 weitere @@ -102,12 +137,12 @@ CMonthView - + New event Neuer Termin - + New Event Neuer Termin @@ -115,7 +150,7 @@ CMonthWindow - + Y J @@ -123,24 +158,24 @@ CMyScheduleView - + My Event Mein Termin - + OK button OK - + Delete button Löschen - + Edit button Bearbeiten @@ -149,281 +184,275 @@ CPushButton - + New event type - + Neuer Termintyp CScheduleDlg - - + + + New Event Neuer Termin - + Edit Event Termin bearbeiten - + End time must be greater than start time Endzeit muss größer als Startzeit sein - + OK button OK - - - - - - + + + + + + Never Nie - + At time of event Zum Zeitpunkt des Termins - + 15 minutes before 15 Minuten vorher - + 30 minutes before 30 Minuten vorher - + 1 hour before 1 Stunde vorher - + 1 day before 1 Tag vorher - + 2 days before 2 Tage vorher - + 1 week before 1 Woche vorher - + On start day (9:00 AM) Am Starttag (9:00 Uhr) - - Enter a name please - + + + + + time(s) + mal - - The name can not only contain whitespaces - + + Enter a name please + Bitte einen Namen eingeben - - The name already exists - + + The name can not only contain whitespaces + Der Name darf nicht nur Leerzeichen enthalten - - + + Type: Typ: - - + + Description: Beschreibung: - - + + All Day: Ganztägig: - - + + Starts: Beginnt: - - + + Ends: Endet: - - + + Remind Me: Erinnere mich: - - + + Repeat: Wiederholung: - - + + End Repeat: Wiederholung beenden: - - Type - Typ - - - Work - Arbeit + + Calendar account: + Kalenderkonto: - Life - Leben + + Calendar account + Kalenderkonto - Other - Andere + + Type + Typ - + Description Beschreibung - + All Day Ganztägig - + Time: - + Zeit: - + Time - + Zeit - + Solar - + Solar - + Lunar - + Lunar - + Starts Beginnt - + Ends Endet - + Remind Me Erinnere mich - + Repeat Wiederholung - - + + Daily Täglich - - + + Weekdays Wochentage - - + + Weekly Wöchentlich - - - + + + Monthly Monatlich - - - + + + Yearly Jährlich - + End Repeat Wiederholung beenden - + After Nach - + On Am - - - - - time(s) - mal - - - + Cancel button Abbrechen - + Save button Speichern @@ -432,141 +461,141 @@ CScheduleOperation - + All occurrences of a repeating event must have the same all-day status. Alle Vorkommen eines sich wiederholenden Termins müssen den gleichen Ganztagsstatus haben. - - + + Do you want to change all occurrences? Möchten Sie alle Vorkommen ändern? - - + + + + + + + + Cancel + button + Abbrechen + + + + Change All Alle ändern - + You are changing the repeating rule of this event. Sie ändern die Wiederholungsregel dieses Termins. - - - + + + You are deleting an event. Sie löschen einen Termin. - + Are you sure you want to delete this event? Sind Sie sicher, dass Sie diesen Termin löschen möchten? - - - - - - - Cancel - button - Abbrechen - - - Delete button Löschen - + Do you want to delete all occurrences of this event, or only the selected occurrence? Möchten Sie alle Vorkommen dieses Termins löschen oder nur das ausgewählte Vorkommen? - + Delete All Alle löschen - - + + Delete Only This Event Nur diesen Termin löschen - + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? Möchten Sie diesen und alle zukünftigen Vorkommen dieses Termins löschen, oder nur das ausgewählte Vorkommen? - + Delete All Future Events Alle zukünftigen Termine löschen - - + + You are changing a repeating event. Sie ändern einen sich wiederholenden Termin. - + Do you want to change only this occurrence of the event, or all occurrences? Möchten Sie nur dieses Vorkommen des Termins oder alle Vorkommnisse ändern? - + All Alle - - + + Only This Event Nur diesen Termin - + Do you want to change only this occurrence of the event, or this and all future occurrences? Möchten Sie nur dieses Ereignis oder dieses und alle zukünftigen Ereignisse ändern? - + All Future Events Alle zukünftigen Termine - + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. - + Sie haben einen Schaltmonat ausgewählt und werden nach den Regeln des Mondkalenders daran erinnert. - + OK button - + OK CScheduleSearchDateItem - + Y J - + M M - + D T @@ -574,17 +603,17 @@ CScheduleSearchItem - + Edit Bearbeiten - + Delete Löschen - + All Day Ganztägig @@ -592,7 +621,7 @@ CScheduleSearchView - + No search results Keine Suchergebnisse @@ -600,25 +629,83 @@ CScheduleView - + ALL DAY GANZTÄGIG + CSettingDialog + + + Sunday + Sonntag + + + + Monday + Montag + + + + 24-hour clock + 24-Stunden-Uhr + + + + 12-hour clock + 12-Stunden-Uhr + + + + Manual + Manuell + + + + 15 mins + 15 Minuten + + + + 30 mins + 30 Minuten + + + + 1 hour + 1 Stunde + + + + 24 hours + 24 Stunden + + + + Sync Now + Jetzt synchronisieren + + + + Last sync + Letzte Synchronisierung + + + CTimeEdit - + (%1 mins) (%1 Minuten) - + (%1 hour) (%1 Stunde) - + (%1 hours) (%1 Stunden) @@ -626,35 +713,79 @@ CTitleWidget - + Y J - + M M - + W W - + D T + + + + Search events and festivals + Suche nach Veranstaltungen und Festen + + + + CWeekWidget + + + Sun + So + + + + Mon + Mo + + + + Tue + Di + + + + Wed + Mi + + + + Thu + Do + + + + Fri + Fr + + + + Sat + Sa + CWeekWindow - + Week Woche - + Y J @@ -662,13 +793,13 @@ CYearScheduleView + - All Day Ganztägig - + No event Kein Termin @@ -676,7 +807,7 @@ CYearWindow - + Y J @@ -684,12 +815,12 @@ CalendarWindow - + Calendar Kalender - + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. Der Kalender ist ein Werkzeug zum Anzeigen von Terminen und auch ein intelligenter Tagesplaner, um alle Dinge im Leben zu planen. @@ -697,43 +828,147 @@ Calendarmainwindow - + Calendar Kalender - + Manage - + Verwalten + + + + Privacy Policy + Datenschutzerklärung + + + + Syncing... + Wird synchronisiert ... + + + + Sync successful + Synchronisierung erfolgreich + + + + Sync failed, please try later + Synchronisierung fehlgeschlagen, bitte später erneut versuchen CenterWidget - + All Day Ganztägig + DAccountDataBase + + + Work + + + + + Life + + + + + Other + + + + + DAlarmManager + + + + + + Close + button + + + + + One day before start + + + + + Remind me tomorrow + + + + + Remind me later + + + + + 15 mins later + + + + + 1 hour later + + + + + 4 hours later + + + + + + + Tomorrow + + + + + Schedule Reminder + + + + + + %1 to %2 + + + + + + Today + Heute + + + DragInfoGraphicsView - + Edit Bearbeiten - + Delete Löschen - + New event Neuer Termin - + New Event Neuer Termin @@ -741,45 +976,98 @@ JobTypeListView - + You are deleting an event type. - + Sie löschen einen Termintyp. - + All events under this type will be deleted and cannot be recovered. - + Alle Termine dieses Typs werden gelöscht und können nicht wiederhergestellt werden. - + Cancel button - + Abbrechen - + Delete button - + Löschen QObject - + + Manage calendar - + Kalender verwalten - + + Event types - + Termintypen + + + + Account settings + Kontoeinstellungen + + + + Account + Konto + + + + Select items to be synced + Zu synchronisierende Elemente auswählen + + + + Events + Termine + + + + + General settings + Allgemeine Einstellungen + + + + Sync interval + Synchronisierungsintervall + + + + Calendar account + Kalenderkonto + + + + General + Allgemein + + + + First day of week + Erster Tag der Woche + + + + Time + Zeit Return - + Today Return Heute @@ -788,9 +1076,9 @@ Return Today - - - + + + Today Return Today Heute @@ -799,95 +1087,127 @@ ScheduleTypeEditDlg - + New event type - + Neuer Termintyp - + Edit event type - + Termintyp bearbeiten - + Name: - + Name: - + Color: - + Farbe: - + Cancel button - + Abbrechen - + Save button - - - - - Enter a name please - + Speichern - + The name can not only contain whitespaces - + Der Name darf nicht nur Leerzeichen enthalten - - The name already exists - + + Enter a name please + Bitte einen Namen eingeben Shortcut - + Help Hilfe - + Delete event Termin löschen - + Copy Kopieren - + Cut Ausschneiden - + Paste Einfügen - + Delete Löschen - + Select all Alles auswählen + SidebarCalendarWidget + + + Y + J + + + + M + M + + + + TimeJumpDialog + + + Go + button + Los + + + + UserloginWidget + + + Sign In + button + Anmelden + + + + Sign Out + button + Abmelden + + + YearFrame - + Y J @@ -895,17 +1215,17 @@ today - - - - - - - - + + + + + + + + Today Today Heute - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar_el.ts dde-calendar-5.10.0/translations/dde-calendar_el.ts --- dde-calendar-5.9.1/translations/dde-calendar_el.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar_el.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,38 +1,96 @@ - + + + + + AccountItem + + + Sync successful + + + + + Network error + + + + + Server exception + + + + + Storage full + + + + + AccountManager + + + Local account + + + + + Event types + + + + + CColorPickerWidget + + + Color + + + + + Cancel + button + Ακύρωση + + + + Save + button + Αποθήκευση + + CDayMonthView - + Monday Δευτέρα - + Tuesday Τρίτη - + Wednesday Τετάρτη - + Thursday Πέμπτη - + Friday Παρασκευή - + Saturday Σάββατο - + Sunday Κυριακή @@ -40,25 +98,30 @@ CDayWindow - + Y Ε - + M Μ - + D Η + + + Lunar + + CGraphicsView - + New Event Νέο Συμβάν @@ -66,7 +129,7 @@ CMonthScheduleNumItem - + %1 more %1 περισσότερο-α @@ -74,12 +137,12 @@ CMonthView - + New event Νέο συμβάν - + New Event Νέο Συμβάν @@ -87,7 +150,7 @@ CMonthWindow - + Y Y @@ -95,258 +158,301 @@ CMyScheduleView - + My Event Το συμβάν μου - + OK button ΟΚ - + Delete button Διαγραφή - + Edit button Επεξεργασία + CPushButton + + + New event type + + + + CScheduleDlg - - + + + New Event Νέο συμβάν - + Edit Event Επεξεργασία συμβάντος - + End time must be greater than start time Ο χρόνος λήξης πρέπει να είναι μεγαλύτερος του χρόνου έναρξης - + OK button OK - - - - + + + + + + Never Ποτέ - + At time of event Την ώρα του συμβάντος - + 15 minutes before 15 λεπτά πριν - + 30 minutes before 30 λεπτά πριν - + 1 hour before 1 ώρα πριν - - + + 1 day before 1 ημέρα πριν - - + + 2 days before 2 ημέρες πριν - - + + 1 week before 1 εβδομάδα πριν - + On start day (9:00 AM) Στην έναρξη της ημέρας (9:00 ΠΜ) - - + + Enter a name please + + + + + The name can not only contain whitespaces + + + + + Type: Τύπος: - - + + Description: Περιγραφή: - - + + All Day: Ολοήμερο: - - + + Starts: Αρχίζει: - - + + Ends: Τελειώνει: - - + + Remind Me: Υπενθύμισέ μου: - - + + Repeat: Επανάληψη: - - + + End Repeat: Τέλος Επανάληψης: - - Type - Τύπος - - - - Work - Εργασία + + Calendar account: + - - Life - Ζωή + + Calendar account + - - Other - Άλλο + + Type + Τύπος - + Description Περιγραφή - + All Day Ολοήμερο - + + Time: + + + + + Time + + + + + Solar + + + + + Lunar + + + + Starts Αρχίζει - + Ends Τελειώνει - + Remind Me Υπενθύμισέ μου - + Repeat Επανάληψη - + + Daily Ημερήσιο - + + Weekdays Εργάσιμες - + + Weekly Εβδομαδιαίο - + + + Monthly Μηνιαίο - + + + Yearly Ετήσιο - + End Repeat Τέλος Επανάληψης - + After Μετά - + On Ενεργό - - - - + + + + time(s) φορά(ές) - + Cancel button Ακύρωση - + Save button Αποθήκευση @@ -355,115 +461,126 @@ CScheduleOperation - + All occurrences of a repeating event must have the same all-day status. Όλες οι εμφανίσεις ενός επαναλαμβανόμενου συμβάντος πρέπει να έχουν την ίδια ολοήμερη κατάσταση. - - + + Do you want to change all occurrences? Θέλετε να αλλάξετε όλες τις εμφανίσεις; - - + + Change All Αλλαγή Όλων - + You are changing the repeating rule of this event. Αλλάζεις τον κανόνα επανάληψης αυτού του συμβάντος. - - - + + + You are deleting an event. Διαγράφεις ένα συμβάν - + Are you sure you want to delete this event? Είστε σίγουρος ότι θέλετε να διαγράψετε αυτό το συμβάν; - - - - - - - + + + + + + + Cancel button Ακύρωση - + Delete button Διαγραφή - + Do you want to delete all occurrences of this event, or only the selected occurrence? Θέλετε να διαγράψετε όλες τις εμφανίσεις αυτού του συμβάντος ή μόνο την επιλεγμένη εμφάνιση; - + Delete All Διαγραφή όλων - - + + Delete Only This Event Διαγραφή Μόνο Αυτού του Συμβάντος - + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? Θέλετε να διαγράψετε αυτήν και όλες τις μελλοντικές εμφανίσεις αυτού του συμβάντος ή μόνο την επιλεγμένη εμφάνιση; - + Delete All Future Events Διαγραφή Όλων των Μελλοντικών Συμβάντων - - + + You are changing a repeating event. Αλλάζεις ένα επαναλαμβανόμενο συμβάν. - + Do you want to change only this occurrence of the event, or all occurrences? Θέλετε να αλλάξετε μόνο αυτήν την εμφάνιση του συμβάντος ή όλες τις εμφανίσεις; - + All Όλα - - + + Only This Event Μόνο Αυτό το Συμβάν - + Do you want to change only this occurrence of the event, or this and all future occurrences? Θέλετε να αλλάξετε μόνο αυτήν την εμφάνιση του συμβάντος ή αυτήν και όλες τις μελλοντικές εμφανίσεις; - + All Future Events Όλα τα Μελλοντικά Συμβάντα + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + + OK + button + + CScheduleSearchDateItem @@ -486,17 +603,17 @@ CScheduleSearchItem - + Edit Επεξεργασία - + Delete Διαγραφή - + All Day Ολοήμερο @@ -512,61 +629,163 @@ CScheduleView - + ALL DAY ΟΛΟΗΜΕΡΟ + CSettingDialog + + + Sunday + Κυριακή + + + + Monday + Δευτέρα + + + + 24-hour clock + + + + + 12-hour clock + + + + + Manual + + + + + 15 mins + + + + + 30 mins + + + + + 1 hour + + + + + 24 hours + + + + + Sync Now + + + + + Last sync + + + + CTimeEdit - + (%1 mins) - + - + (%1 hour) - + - + (%1 hours) - + CTitleWidget - + Y Ε - + M Μ - + W Β - + D Η + + + + Search events and festivals + + + + + CWeekWidget + + + Sun + + + + + Mon + + + + + Tue + + + + + Wed + + + + + Thu + + + + + Fri + + + + + Sat + + CWeekWindow - + Week Εβδομάδα - + Y Y @@ -574,13 +793,13 @@ CYearScheduleView + - All Day Ολοήμερο - + No event Χωρίς συμβάν @@ -588,7 +807,7 @@ CYearWindow - + Y Y @@ -596,12 +815,12 @@ CalendarWindow - + Calendar Ημερολόγιο - + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. Το Ημερολόγιο είναι ένα εργαλείο για να δεις ημερομηνίες, αλλα και επίσης ένας εξύπνος σχεδιαστής ημέρας για να προγραμματίσεις όλα τα πράγματα στην ζωή. @@ -609,46 +828,246 @@ Calendarmainwindow - + Calendar Ημερολόγιο + + + Manage + + + + + Privacy Policy + + + + + Syncing... + + + + + Sync successful + + + + + Sync failed, please try later + + CenterWidget - + All Day Ολοήμερο + DAccountDataBase + + + Work + Εργασία + + + + Life + Ζωή + + + + Other + Άλλο + + + + DAlarmManager + + + + + + Close + button + + + + + One day before start + + + + + Remind me tomorrow + + + + + Remind me later + + + + + 15 mins later + + + + + 1 hour later + + + + + 4 hours later + + + + + + + Tomorrow + + + + + Schedule Reminder + + + + + + %1 to %2 + + + + + + Today + Σήμερα + + + DragInfoGraphicsView - + Edit Επεξεργασία - + Delete Διαγραφή - + New event Νέο συμβάν - + New Event Νέο Συμβάν + JobTypeListView + + + You are deleting an event type. + + + + + All events under this type will be deleted and cannot be recovered. + + + + + Cancel + button + Ακύρωση + + + + Delete + button + Διαγραφή + + + + QObject + + + Account settings + + + + + Account + + + + + Select items to be synced + + + + + Events + + + + + + General settings + + + + + Sync interval + + + + + + Manage calendar + + + + + Calendar account + + + + + + Event types + + + + + General + + + + + First day of week + + + + + Time + + + + Return - + Today Return Σήμερα @@ -657,56 +1076,138 @@ Return Today - - - + + + Today Return Today Σήμερα + ScheduleTypeEditDlg + + + New event type + + + + + Edit event type + + + + + Name: + + + + + Color: + + + + + Cancel + button + Ακύρωση + + + + Save + button + Αποθήκευση + + + + The name can not only contain whitespaces + + + + + Enter a name please + + + + Shortcut - + Help Βοήθεια - + Delete event Διαγραφή συμβάντος - + Copy Αντιγραφή - + Cut Αποκοπή - + Paste Επικόλληση - + Delete Διαγραφή - + Select all Επιλογή όλων + SidebarCalendarWidget + + + Y + + + + + M + Μ + + + + TimeJumpDialog + + + Go + button + + + + + UserloginWidget + + + Sign In + button + + + + + Sign Out + button + + + + YearFrame - + Y Y @@ -714,17 +1215,17 @@ today - - - - - - - - + + + + + + + + Today Today Σήμερα - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar_en_AU.ts dde-calendar-5.10.0/translations/dde-calendar_en_AU.ts --- dde-calendar-5.9.1/translations/dde-calendar_en_AU.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar_en_AU.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,38 +1,96 @@ - + + + + + AccountItem + + + Sync successful + + + + + Network error + + + + + Server exception + + + + + Storage full + + + + + AccountManager + + + Local account + + + + + Event types + + + + + CColorPickerWidget + + + Color + + + + + Cancel + button + Cancel + + + + Save + button + Save + + CDayMonthView - + Monday Monday - + Tuesday Tuesday - + Wednesday Wednesday - + Thursday Thursday - + Friday Friday - + Saturday Saturday - + Sunday Sunday @@ -40,25 +98,30 @@ CDayWindow - + Y Y - + M M - + D D + + + Lunar + + CGraphicsView - + New Event New Event @@ -66,7 +129,7 @@ CMonthScheduleNumItem - + %1 more %1 more @@ -74,12 +137,12 @@ CMonthView - + New event New event - + New Event New Event @@ -87,7 +150,7 @@ CMonthWindow - + Y Y @@ -95,258 +158,301 @@ CMyScheduleView - + My Event My Event - + OK button OK - + Delete button Delete - + Edit button Edit + CPushButton + + + New event type + + + + CScheduleDlg - - + + + New Event New Event - + Edit Event Edit Event - + End time must be greater than start time End time must be greater than start time - + OK button OK - - - - + + + + + + Never Never - + At time of event At time of event - + 15 minutes before 15 minutes before - + 30 minutes before 30 minutes before - + 1 hour before 1 hour before - - + + 1 day before 1 day before - - + + 2 days before 2 days before - - + + 1 week before 1 week before - + On start day (9:00 AM) On start day (9:00 AM) - - + + Enter a name please + + + + + The name can not only contain whitespaces + + + + + Type: Type: - - + + Description: Description: - - + + All Day: All Day: - - + + Starts: Starts: - - + + Ends: Ends: - - + + Remind Me: Remind Me: - - + + Repeat: Repeat: - - + + End Repeat: End Repeat: - - Type - Type - - - - Work - Work + + Calendar account: + - - Life - Life + + Calendar account + - - Other - Other + + Type + Type - + Description Description - + All Day All Day - + + Time: + + + + + Time + + + + + Solar + + + + + Lunar + + + + Starts Starts - + Ends Ends - + Remind Me Remind Me - + Repeat Repeat - + + Daily Daily - + + Weekdays Weekdays - + + Weekly Weekly - + + + Monthly Monthly - + + + Yearly Yearly - + End Repeat End Repeat - + After After - + On On - - - - + + + + time(s) time(s) - + Cancel button Cancel - + Save button Save @@ -355,115 +461,126 @@ CScheduleOperation - + All occurrences of a repeating event must have the same all-day status. All occurrences of a repeating event must have the same all-day status. - - + + Do you want to change all occurrences? Do you want to change all occurrences? - - + + Change All Change All - + You are changing the repeating rule of this event. You are changing the repeating rule of this event. - - - + + + You are deleting an event. You are deleting an event. - + Are you sure you want to delete this event? Are you sure you want to delete this event? - - - - - - - + + + + + + + Cancel button Cancel - + Delete button Delete - + Do you want to delete all occurrences of this event, or only the selected occurrence? Do you want to delete all occurrences of this event, or only the selected occurrence? - + Delete All Delete All - - + + Delete Only This Event Delete Only This Event - + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? Do you want to delete this and all future occurrences of this event, or only the selected occurrence? - + Delete All Future Events Delete All Future Events - - + + You are changing a repeating event. You are changing a repeating event. - + Do you want to change only this occurrence of the event, or all occurrences? Do you want to change only this occurrence of the event, or all occurrences? - + All All - - + + Only This Event Only This Event - + Do you want to change only this occurrence of the event, or this and all future occurrences? Do you want to change only this occurrence of the event, or this and all future occurrences? - + All Future Events All Future Events + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + + OK + button + OK + CScheduleSearchDateItem @@ -486,17 +603,17 @@ CScheduleSearchItem - + Edit Edit - + Delete Delete - + All Day All Day @@ -512,61 +629,163 @@ CScheduleView - + ALL DAY ALL DAY + CSettingDialog + + + Sunday + Sunday + + + + Monday + Monday + + + + 24-hour clock + + + + + 12-hour clock + + + + + Manual + + + + + 15 mins + + + + + 30 mins + + + + + 1 hour + + + + + 24 hours + + + + + Sync Now + + + + + Last sync + + + + CTimeEdit - + (%1 mins) - + - + (%1 hour) - + - + (%1 hours) - + CTitleWidget - + Y Y - + M M - + W W - + D D + + + + Search events and festivals + + + + + CWeekWidget + + + Sun + + + + + Mon + + + + + Tue + + + + + Wed + + + + + Thu + + + + + Fri + + + + + Sat + + CWeekWindow - + Week Week - + Y Y @@ -574,13 +793,13 @@ CYearScheduleView + - All Day All Day - + No event No event @@ -588,7 +807,7 @@ CYearWindow - + Y Y @@ -596,12 +815,12 @@ CalendarWindow - + Calendar Calendar - + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. @@ -609,46 +828,246 @@ Calendarmainwindow - + Calendar Calendar + + + Manage + + + + + Privacy Policy + + + + + Syncing... + + + + + Sync successful + + + + + Sync failed, please try later + + CenterWidget - + All Day All Day + DAccountDataBase + + + Work + Work + + + + Life + Life + + + + Other + Other + + + + DAlarmManager + + + + + + Close + button + + + + + One day before start + + + + + Remind me tomorrow + + + + + Remind me later + + + + + 15 mins later + + + + + 1 hour later + + + + + 4 hours later + + + + + + + Tomorrow + + + + + Schedule Reminder + + + + + + %1 to %2 + + + + + + Today + Today + + + DragInfoGraphicsView - + Edit Edit - + Delete Delete - + New event New event - + New Event New Event + JobTypeListView + + + You are deleting an event type. + + + + + All events under this type will be deleted and cannot be recovered. + + + + + Cancel + button + Cancel + + + + Delete + button + Delete + + + + QObject + + + Account settings + + + + + Account + + + + + Select items to be synced + + + + + Events + + + + + + General settings + + + + + Sync interval + + + + + + Manage calendar + + + + + Calendar account + + + + + + Event types + + + + + General + + + + + First day of week + + + + + Time + + + + Return - + Today Return Today @@ -657,56 +1076,138 @@ Return Today - - - + + + Today Return Today Today + ScheduleTypeEditDlg + + + New event type + + + + + Edit event type + + + + + Name: + + + + + Color: + + + + + Cancel + button + Cancel + + + + Save + button + Save + + + + The name can not only contain whitespaces + + + + + Enter a name please + + + + Shortcut - + Help Help - + Delete event Delete event - + Copy Copy - + Cut Cut - + Paste Paste - + Delete Delete - + Select all Select all + SidebarCalendarWidget + + + Y + Y + + + + M + M + + + + TimeJumpDialog + + + Go + button + + + + + UserloginWidget + + + Sign In + button + + + + + Sign Out + button + + + + YearFrame - + Y Y @@ -714,17 +1215,17 @@ today - - - - - - - - + + + + + + + + Today Today Today - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar_en_GB.ts dde-calendar-5.10.0/translations/dde-calendar_en_GB.ts --- dde-calendar-5.9.1/translations/dde-calendar_en_GB.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar_en_GB.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,38 +1,96 @@ - + + + + + AccountItem + + + Sync successful + + + + + Network error + + + + + Server exception + + + + + Storage full + + + + + AccountManager + + + Local account + + + + + Event types + + + + + CColorPickerWidget + + + Color + + + + + Cancel + button + Cancel + + + + Save + button + Save + + CDayMonthView - + Monday Monday - + Tuesday Tuesday - + Wednesday Wednesday - + Thursday Thursday - + Friday Friday - + Saturday Saturday - + Sunday Sunday @@ -40,25 +98,30 @@ CDayWindow - + Y Y - + M M - + D D + + + Lunar + + CGraphicsView - + New Event New Event @@ -66,7 +129,7 @@ CMonthScheduleNumItem - + %1 more %1 more @@ -74,12 +137,12 @@ CMonthView - + New event New event - + New Event New Event @@ -87,7 +150,7 @@ CMonthWindow - + Y Y @@ -95,258 +158,301 @@ CMyScheduleView - + My Event My Event - + OK button OK - + Delete button Delete - + Edit button Edit + CPushButton + + + New event type + + + + CScheduleDlg - - + + + New Event New Event - + Edit Event Edit Event - + End time must be greater than start time End time must be greater than start time - + OK button OK - - - - + + + + + + Never Never - + At time of event At time of event - + 15 minutes before 15 minutes before - + 30 minutes before 30 minutes before - + 1 hour before 1 hour before - - + + 1 day before 1 day before - - + + 2 days before 2 days before - - + + 1 week before 1 week before - + On start day (9:00 AM) On start day (9:00 AM) - - + + Enter a name please + + + + + The name can not only contain whitespaces + + + + + Type: Type: - - + + Description: Description: - - + + All Day: All Day: - - + + Starts: Starts: - - + + Ends: Ends: - - + + Remind Me: Remind Me: - - + + Repeat: Repeat: - - + + End Repeat: End Repeat: - - Type - Type - - - - Work - Work + + Calendar account: + - - Life - Life + + Calendar account + - - Other - Other + + Type + Type - + Description Dscription - + All Day All Day - + + Time: + + + + + Time + + + + + Solar + + + + + Lunar + + + + Starts Starts - + Ends Ends - + Remind Me Remind Me - + Repeat Repeat - + + Daily Daily - + + Weekdays Weekdays - + + Weekly Weekly - + + + Monthly Monthly - + + + Yearly Yearly - + End Repeat End Repeat - + After After - + On On - - - - + + + + time(s) time(s) - + Cancel button Cancel - + Save button Save @@ -355,115 +461,126 @@ CScheduleOperation - + All occurrences of a repeating event must have the same all-day status. All occurrences of a repeating event must have the same all-day status. - - + + Do you want to change all occurrences? Do you want to change all occurrences? - - + + Change All Change All - + You are changing the repeating rule of this event. You are changing the repeating rule of this event. - - - + + + You are deleting an event. You are deleting an event. - + Are you sure you want to delete this event? Are you sure you want to delete this event? - - - - - - - + + + + + + + Cancel button Cancel - + Delete button Delete - + Do you want to delete all occurrences of this event, or only the selected occurrence? Do you want to delete the occurrence of this event, or the selected occurrence? - + Delete All Delete All - - + + Delete Only This Event Delete Only This Event - + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? Do you want to delete this and all future occurrences of this event, or only the selected occurrence? - + Delete All Future Events Delete All Future Events - - + + You are changing a repeating event. You are changing a repeating event. - + Do you want to change only this occurrence of the event, or all occurrences? Do you want to change only this occurrence of the event, or all occurrences? - + All All - - + + Only This Event Only This Event - + Do you want to change only this occurrence of the event, or this and all future occurrences? Do you want to change the occurrence of the event, or this and all future occurrences - + All Future Events All Future Events + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + + OK + button + OK + CScheduleSearchDateItem @@ -486,17 +603,17 @@ CScheduleSearchItem - + Edit Edit - + Delete Delete - + All Day All Day @@ -512,61 +629,163 @@ CScheduleView - + ALL DAY ALL DAY + CSettingDialog + + + Sunday + Sunday + + + + Monday + Monday + + + + 24-hour clock + + + + + 12-hour clock + + + + + Manual + + + + + 15 mins + + + + + 30 mins + + + + + 1 hour + + + + + 24 hours + + + + + Sync Now + + + + + Last sync + + + + CTimeEdit - + (%1 mins) - + - + (%1 hour) - + - + (%1 hours) - + CTitleWidget - + Y Y - + M M - + W W - + D D + + + + Search events and festivals + + + + + CWeekWidget + + + Sun + + + + + Mon + + + + + Tue + + + + + Wed + + + + + Thu + + + + + Fri + + + + + Sat + + CWeekWindow - + Week Week - + Y Y @@ -574,13 +793,13 @@ CYearScheduleView + - All Day All Day - + No event No event @@ -588,7 +807,7 @@ CYearWindow - + Y Y @@ -596,12 +815,12 @@ CalendarWindow - + Calendar Calendar - + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. @@ -609,46 +828,246 @@ Calendarmainwindow - + Calendar Calendar + + + Manage + + + + + Privacy Policy + + + + + Syncing... + + + + + Sync successful + + + + + Sync failed, please try later + + CenterWidget - + All Day All Day + DAccountDataBase + + + Work + Work + + + + Life + Life + + + + Other + Other + + + + DAlarmManager + + + + + + Close + button + + + + + One day before start + + + + + Remind me tomorrow + + + + + Remind me later + + + + + 15 mins later + + + + + 1 hour later + + + + + 4 hours later + + + + + + + Tomorrow + + + + + Schedule Reminder + + + + + + %1 to %2 + + + + + + Today + Today + + + DragInfoGraphicsView - + Edit Edit - + Delete Delete - + New event New event - + New Event New Event + JobTypeListView + + + You are deleting an event type. + + + + + All events under this type will be deleted and cannot be recovered. + + + + + Cancel + button + Cancel + + + + Delete + button + Delete + + + + QObject + + + Account settings + + + + + Account + + + + + Select items to be synced + + + + + Events + + + + + + General settings + + + + + Sync interval + + + + + + Manage calendar + + + + + Calendar account + + + + + + Event types + + + + + General + + + + + First day of week + + + + + Time + + + + Return - + Today Return Today @@ -657,56 +1076,138 @@ Return Today - - - + + + Today Return Today Today + ScheduleTypeEditDlg + + + New event type + + + + + Edit event type + + + + + Name: + + + + + Color: + + + + + Cancel + button + Cancel + + + + Save + button + Save + + + + The name can not only contain whitespaces + + + + + Enter a name please + + + + Shortcut - + Help Help - + Delete event Delete event - + Copy Copy - + Cut Cut - + Paste Paste - + Delete Delete - + Select all Select all + SidebarCalendarWidget + + + Y + Y + + + + M + M + + + + TimeJumpDialog + + + Go + button + + + + + UserloginWidget + + + Sign In + button + + + + + Sign Out + button + + + + YearFrame - + Y Y @@ -714,17 +1215,17 @@ today - - - - - - - - + + + + + + + + Today Today Today - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar_en.ts dde-calendar-5.10.0/translations/dde-calendar_en.ts --- dde-calendar-5.9.1/translations/dde-calendar_en.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar_en.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,66 +1,96 @@ - + + + + + AccountItem + + + Sync successful + Sync successful + + + + Network error + Network error + + + + Server exception + Server exception + + + + Storage full + Storage full + + + + AccountManager + + + Local account + Local account + + + + Event types + Event types + + CColorPickerWidget - + Color Color - + Cancel button Cancel - + Save button Save - - Cancel - - - - Save - - CDayMonthView - + Monday Monday - + Tuesday Tuesday - + Wednesday Wednesday - + Thursday Thursday - + Friday Friday - + Saturday Saturday - + Sunday Sunday @@ -68,25 +98,30 @@ CDayWindow - + Y Y - + M M - + D D + + + Lunar + Lunar + CGraphicsView - + New Event New Event @@ -94,7 +129,7 @@ CMonthScheduleNumItem - + %1 more %1 more @@ -102,12 +137,12 @@ CMonthView - + New event New event - + New Event New Event @@ -115,7 +150,7 @@ CMonthWindow - + Y Y @@ -123,24 +158,24 @@ CMyScheduleView - + My Event My Event - + OK button OK - + Delete button Delete - + Edit button Edit @@ -149,7 +184,7 @@ CPushButton - + New event type New event type @@ -157,273 +192,267 @@ CScheduleDlg - - + + + New Event New Event - + Edit Event Edit Event - + End time must be greater than start time End time must be greater than start time - + OK button OK - - - - - - + + + + + + Never Never - + At time of event At time of event - + 15 minutes before 15 minutes before - + 30 minutes before 30 minutes before - + 1 hour before 1 hour before - + 1 day before 1 day before - + 2 days before 2 days before - + 1 week before 1 week before - + On start day (9:00 AM) On start day (9:00 AM) - + + + + + time(s) + time(s) + + + Enter a name please Enter a name please - + The name can not only contain whitespaces The name can not only contain whitespaces - - The name already exists - The name already exists - - - - + + Type: Type: - - + + Description: Description: - - + + All Day: All Day: - - + + Starts: Starts: - - + + Ends: Ends: - - + + Remind Me: Remind Me: - - + + Repeat: Repeat: - - + + End Repeat: End Repeat: - - Type - Type + + Calendar account: + Calendar account: - Work - Work - - - Life - Life + + Calendar account + Calendar account - Other - Other + + Type + Type - + Description Description - + All Day All Day - + Time: Time: - + Time Time - + Solar Solar - + Lunar Lunar - + Starts Starts - + Ends Ends - + Remind Me Remind Me - + Repeat Repeat - - + + Daily Daily - - + + Weekdays Weekdays - - + + Weekly Weekly - - - + + + Monthly Monthly - - - + + + Yearly Yearly - + End Repeat End Repeat - + After After - + On On - - - - - time(s) - time(s) - - - + Cancel button Cancel - + Save button Save @@ -432,122 +461,122 @@ CScheduleOperation - + All occurrences of a repeating event must have the same all-day status. All occurrences of a repeating event must have the same all-day status. - - + + Do you want to change all occurrences? Do you want to change all occurrences? - - + + + + + + + + Cancel + button + Cancel + + + + Change All Change All - + You are changing the repeating rule of this event. You are changing the repeating rule of this event. - - - + + + You are deleting an event. You are deleting an event. - + Are you sure you want to delete this event? Are you sure you want to delete this event? - - - - - - - Cancel - button - Cancel - - - Delete button Delete - + Do you want to delete all occurrences of this event, or only the selected occurrence? Do you want to delete all occurrences of this event, or only the selected occurrence? - + Delete All Delete All - - + + Delete Only This Event Delete Only This Event - + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? Do you want to delete this and all future occurrences of this event, or only the selected occurrence? - + Delete All Future Events Delete All Future Events - - + + You are changing a repeating event. You are changing a repeating event. - + Do you want to change only this occurrence of the event, or all occurrences? Do you want to change only this occurrence of the event, or all occurrences? - + All All - - + + Only This Event Only This Event - + Do you want to change only this occurrence of the event, or this and all future occurrences? Do you want to change only this occurrence of the event, or this and all future occurrences? - + All Future Events All Future Events - + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. You have selected a leap month, and will be reminded according to the rules of the lunar calendar. - + OK button OK @@ -556,17 +585,17 @@ CScheduleSearchDateItem - + Y Y - + M M - + D D @@ -574,17 +603,17 @@ CScheduleSearchItem - + Edit Edit - + Delete Delete - + All Day All Day @@ -592,7 +621,7 @@ CScheduleSearchView - + No search results No search results @@ -600,25 +629,83 @@ CScheduleView - + ALL DAY ALL DAY + CSettingDialog + + + Sunday + Sunday + + + + Monday + Monday + + + + 24-hour clock + 24-hour clock + + + + 12-hour clock + 12-hour clock + + + + Manual + Manual + + + + 15 mins + 15 mins + + + + 30 mins + 30 mins + + + + 1 hour + 1 hour + + + + 24 hours + 24 hours + + + + Sync Now + Sync Now + + + + Last sync + Last sync + + + CTimeEdit - + (%1 mins) (%1 mins) - + (%1 hour) (%1 hour) - + (%1 hours) (%1 hours) @@ -626,35 +713,79 @@ CTitleWidget - + Y Y - + M M - + W W - + D D + + + + Search events and festivals + Search events and festivals + + + + CWeekWidget + + + Sun + Sun + + + + Mon + Mon + + + + Tue + Tue + + + + Wed + Wed + + + + Thu + Thu + + + + Fri + Fri + + + + Sat + Sat + CWeekWindow - + Week Week - + Y Y @@ -662,13 +793,13 @@ CYearScheduleView + - All Day All Day - + No event No event @@ -676,7 +807,7 @@ CYearWindow - + Y Y @@ -684,12 +815,12 @@ CalendarWindow - + Calendar Calendar - + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. @@ -697,43 +828,147 @@ Calendarmainwindow - + Calendar Calendar - + Manage Manage + + + Privacy Policy + Privacy Policy + + + + Syncing... + Syncing... + + + + Sync successful + Sync successful + + + + Sync failed, please try later + Sync failed, please try later + CenterWidget - + All Day All Day + DAccountDataBase + + + Work + + + + + Life + + + + + Other + + + + + DAlarmManager + + + + + + Close + button + + + + + One day before start + + + + + Remind me tomorrow + + + + + Remind me later + + + + + 15 mins later + + + + + 1 hour later + + + + + 4 hours later + + + + + + + Tomorrow + + + + + Schedule Reminder + + + + + + %1 to %2 + + + + + + Today + Today + + + DragInfoGraphicsView - + Edit Edit - + Delete Delete - + New event New event - + New Event New Event @@ -741,23 +976,23 @@ JobTypeListView - + You are deleting an event type. You are deleting an event type. - + All events under this type will be deleted and cannot be recovered. All events under this type will be deleted and cannot be recovered. - + Cancel button Cancel - + Delete button Delete @@ -766,20 +1001,73 @@ QObject - + + Manage calendar Manage calendar - + + Event types Event types + + + Account settings + Account settings + + + + Account + Account + + + + Select items to be synced + Select items to be synced + + + + Events + Events + + + + + General settings + General settings + + + + Sync interval + Sync interval + + + + Calendar account + Calendar account + + + + General + General + + + + First day of week + First day of week + + + + Time + Time + Return - + Today Return Today @@ -788,9 +1076,9 @@ Return Today - - - + + + Today Return Today Today @@ -799,95 +1087,127 @@ ScheduleTypeEditDlg - + New event type New event type - + Edit event type Edit event type - + Name: Name: - + Color: Color: - + Cancel button Cancel - + Save button Save - - Enter a name please - Enter a name please - - - + The name can not only contain whitespaces The name can not only contain whitespaces - - The name already exists - The name already exists + + Enter a name please + Enter a name please Shortcut - + Help Help - + Delete event Delete event - + Copy Copy - + Cut Cut - + Paste Paste - + Delete Delete - + Select all Select all + SidebarCalendarWidget + + + Y + Y + + + + M + M + + + + TimeJumpDialog + + + Go + button + Go + + + + UserloginWidget + + + Sign In + button + Sign In + + + + Sign Out + button + Sign Out + + + YearFrame - + Y Y @@ -895,17 +1215,17 @@ today - - - - - - - - + + + + + + + + Today Today Today - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar_en_US.ts dde-calendar-5.10.0/translations/dde-calendar_en_US.ts --- dde-calendar-5.9.1/translations/dde-calendar_en_US.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar_en_US.ts 2023-04-07 06:02:09.000000000 +0000 @@ -2,67 +2,95 @@ - CColorPickerWidget + AccountItem - - Color - + + Sync successful + Sync successful - - Cancel - button - Cancel + + Network error + Network error - - Save - button - Save + + Server exception + Server exception + + Storage full + Storage full + + + + AccountManager + + + Local account + Local account + + + + Event types + Event types + + + + CColorPickerWidget + + + Color + Color + + + Cancel - Cancel + button + Cancel + Save - Save + button + Save CDayMonthView - + Monday Monday - + Tuesday Tuesday - + Wednesday Wednesday - + Thursday Thursday - + Friday Friday - + Saturday Saturday - + Sunday Sunday @@ -70,25 +98,30 @@ CDayWindow - + Y Y - + M M - + D D + + + Lunar + Lunar + CGraphicsView - + New Event New Event @@ -96,7 +129,7 @@ CMonthScheduleNumItem - + %1 more %1 more @@ -104,12 +137,12 @@ CMonthView - + New event New event - + New Event New Event @@ -117,7 +150,7 @@ CMonthWindow - + Y Y @@ -125,24 +158,24 @@ CMyScheduleView - + My Event My Event - + OK button OK - + Delete button Delete - + Edit button Edit @@ -151,281 +184,275 @@ CPushButton - + New event type - + New event type CScheduleDlg - - + + + New Event New Event - + Edit Event Edit Event - + End time must be greater than start time End time must be greater than start time - + OK button OK - - - - - - + + + + + + Never Never - + At time of event At time of event - + 15 minutes before 15 minutes before - + 30 minutes before 30 minutes before - + 1 hour before 1 hour before - + 1 day before 1 day before - + 2 days before 2 days before - + 1 week before 1 week before - + On start day (9:00 AM) On start day (9:00 AM) - - Enter a name please - + + + + + time(s) + time(s) - - The name can not only contain whitespaces - + + Enter a name please + Enter a name please - - The name already exists - + + The name can not only contain whitespaces + The name can not only contain whitespaces - - + + Type: Type: - - + + Description: Description: - - + + All Day: All Day: - - + + Starts: Starts: - - + + Ends: Ends: - - + + Remind Me: Remind Me: - - + + Repeat: Repeat: - - + + End Repeat: End Repeat: - - Type - Type - - - Work - Work + + Calendar account: + Calendar account: - Life - Life + + Calendar account + Calendar account - Other - Other + + Type + Type - + Description Description - + All Day All Day - + Time: - + Time: - + Time - + Time - + Solar - + Solar - + Lunar - + Lunar - + Starts Starts - + Ends Ends - + Remind Me Remind Me - + Repeat Repeat - - + + Daily Daily - - + + Weekdays Weekdays - - + + Weekly Weekly - - - + + + Monthly Monthly - - - + + + Yearly Yearly - + End Repeat End Repeat - + After After - + On On - - - - - time(s) - time(s) - - - + Cancel button Cancel - + Save button Save @@ -434,141 +461,141 @@ CScheduleOperation - + All occurrences of a repeating event must have the same all-day status. All occurrences of a repeating event must have the same all-day status. - - + + Do you want to change all occurrences? Do you want to change all occurrences? - - + + + + + + + + Cancel + button + Cancel + + + + Change All Change All - + You are changing the repeating rule of this event. You are changing the repeating rule of this event. - - - + + + You are deleting an event. You are deleting an event. - + Are you sure you want to delete this event? Are you sure you want to delete this event? - - - - - - - Cancel - button - Cancel - - - Delete button Delete - + Do you want to delete all occurrences of this event, or only the selected occurrence? Do you want to delete all occurrences of this event, or only the selected occurrence? - + Delete All Delete All - - + + Delete Only This Event Delete Only This Event - + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? Do you want to delete this and all future occurrences of this event, or only the selected occurrence? - + Delete All Future Events Delete All Future Events - - + + You are changing a repeating event. You are changing a repeating event. - + Do you want to change only this occurrence of the event, or all occurrences? Do you want to change only this occurrence of the event, or all occurrences? - + All All - - + + Only This Event Only This Event - + Do you want to change only this occurrence of the event, or this and all future occurrences? Do you want to change only this occurrence of the event, or this and all future occurrences? - + All Future Events All Future Events - + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. - + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. - + OK button - OK + OK CScheduleSearchDateItem - + Y Y - + M M - + D D @@ -576,17 +603,17 @@ CScheduleSearchItem - + Edit Edit - + Delete Delete - + All Day All Day @@ -594,7 +621,7 @@ CScheduleSearchView - + No search results No search results @@ -602,61 +629,163 @@ CScheduleView - + ALL DAY ALL DAY + CSettingDialog + + + Sunday + Sunday + + + + Monday + Monday + + + + 24-hour clock + 24-hour clock + + + + 12-hour clock + 12-hour clock + + + + Manual + Manual + + + + 15 mins + 15 mins + + + + 30 mins + 30 mins + + + + 1 hour + 1 hour + + + + 24 hours + 24 hours + + + + Sync Now + Sync Now + + + + Last sync + Last sync + + + CTimeEdit - + (%1 mins) - + (%1 mins) - + (%1 hour) - + (%1 hour) - + (%1 hours) - + (%1 hours) CTitleWidget - + Y Y - + M M - + W W - + D D + + + + Search events and festivals + Search events and festivals + + + + CWeekWidget + + + Sun + Sun + + + + Mon + Mon + + + + Tue + Tue + + + + Wed + Wed + + + + Thu + Thu + + + + Fri + Fri + + + + Sat + Sat + CWeekWindow - + Week Week - + Y Y @@ -664,13 +793,13 @@ CYearScheduleView + - All Day All Day - + No event No event @@ -678,7 +807,7 @@ CYearWindow - + Y Y @@ -686,12 +815,12 @@ CalendarWindow - + Calendar Calendar - + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. @@ -699,43 +828,147 @@ Calendarmainwindow - + Calendar Calendar - + Manage - + Manage + + + + Privacy Policy + Privacy Policy + + + + Syncing... + Syncing... + + + + Sync successful + Sync successful + + + + Sync failed, please try later + Sync failed, please try later CenterWidget - + All Day All Day + DAccountDataBase + + + Work + + + + + Life + + + + + Other + + + + + DAlarmManager + + + + + + Close + button + + + + + One day before start + + + + + Remind me tomorrow + + + + + Remind me later + + + + + 15 mins later + + + + + 1 hour later + + + + + 4 hours later + + + + + + + Tomorrow + + + + + Schedule Reminder + + + + + + %1 to %2 + + + + + + Today + Today + + + DragInfoGraphicsView - + Edit Edit - + Delete Delete - + New event New event - + New Event New Event @@ -743,45 +976,98 @@ JobTypeListView - + You are deleting an event type. - + You are deleting an event type. - + All events under this type will be deleted and cannot be recovered. - + All events under this type will be deleted and cannot be recovered. - + Cancel button - Cancel + Cancel - + Delete button - Delete + Delete QObject - + + Manage calendar - + Manage calendar - + + Event types - + Event types + + + + Account settings + Account settings + + + + Account + Account + + + + Select items to be synced + Select items to be synced + + + + Events + Events + + + + + General settings + General settings + + + + Sync interval + Sync interval + + + + Calendar account + Calendar account + + + + General + General + + + + First day of week + First day of week + + + + Time + Time Return - + Today Return Today @@ -790,9 +1076,9 @@ Return Today - - - + + + Today Return Today Today @@ -801,95 +1087,127 @@ ScheduleTypeEditDlg - + New event type - + New event type - + Edit event type - + Edit event type - + Name: - + Name: - + Color: - + Color: - + Cancel button - Cancel + Cancel - + Save button - Save - - - - Enter a name please - + Save - + The name can not only contain whitespaces - + The name can not only contain whitespaces - - The name already exists - + + Enter a name please + Enter a name please Shortcut - + Help Help - + Delete event Delete event - + Copy Copy - + Cut Cut - + Paste Paste - + Delete Delete - + Select all Select all + SidebarCalendarWidget + + + Y + Y + + + + M + M + + + + TimeJumpDialog + + + Go + button + Go + + + + UserloginWidget + + + Sign In + button + Sign In + + + + Sign Out + button + Sign Out + + + YearFrame - + Y Y @@ -897,14 +1215,14 @@ today - - - - - - - - + + + + + + + + Today Today Today diff -Nru dde-calendar-5.9.1/translations/dde-calendar_es.ts dde-calendar-5.10.0/translations/dde-calendar_es.ts --- dde-calendar-5.9.1/translations/dde-calendar_es.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar_es.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,66 +1,96 @@ - + + + - CColorPickerWidget + AccountItem - - Color - + + Sync successful + Sincronización exitosa - - Cancel - button - + + Network error + Error de red - - Save - button - + + Server exception + Excepción del servidor + + + + Storage full + Almacenamiento lleno + + + + AccountManager + + + Local account + Cuenta local + + + + Event types + Tipos de eventos + + + + CColorPickerWidget + + + Color + Color + Cancel - + button + Cancelar + Save - + button + Guardar CDayMonthView - + Monday lunes - + Tuesday martes - + Wednesday miércoles - + Thursday jueves - + Friday viernes - + Saturday sábado - + Sunday domingo @@ -68,25 +98,30 @@ CDayWindow - + Y A - + M M - + D D + + + Lunar + Lunar + CGraphicsView - + New Event Nuevo evento @@ -94,7 +129,7 @@ CMonthScheduleNumItem - + %1 more %1 más @@ -102,12 +137,12 @@ CMonthView - + New event Nuevo evento - + New Event Nuevo evento @@ -115,7 +150,7 @@ CMonthWindow - + Y A @@ -123,24 +158,24 @@ CMyScheduleView - + My Event Mi evento - + OK button Aceptar - + Delete button Borrar - + Edit button Editar @@ -149,281 +184,275 @@ CPushButton - + New event type - + Nuevo tipo de evento CScheduleDlg - - + + + New Event Nuevo evento - + Edit Event Editar evento - + End time must be greater than start time El tiempo final debe ser mayor que el tiempo inicial - + OK button Aceptar - - - - - - + + + + + + Never Nunca - + At time of event En el momento del evento. - + 15 minutes before 15 minutos antes - + 30 minutes before 30 minutos antes - + 1 hour before 1 hora antes - + 1 day before 1 día antes - + 2 days before 2 días antes - + 1 week before 1 semana antes - + On start day (9:00 AM) El día de inicio (9:00 a.m.) - - Enter a name please - + + + + + time(s) + hora(s) - - The name can not only contain whitespaces - + + Enter a name please + Por favor ingrese un nombre - - The name already exists - + + The name can not only contain whitespaces + El nombre no puede contener espacios en blanco - - + + Type: Tipo: - - + + Description: Descripción: - - + + All Day: Todo el día: - - + + Starts: Inicia: - - + + Ends: Termina: - - + + Remind Me: Recordarme: - - + + Repeat: Repetir: - - + + End Repeat: Fin de repetición: - - Type - Tipo + + Calendar account: + Cuenta de calendario: - Work - Trabajo - - - Life - Personal + + Calendar account + Cuenta de calendario - Other - Otro + + Type + Tipo - + Description Descripción - + All Day Todo el día - + Time: - + Tiempo: - + Time - + Tiempo - + Solar - + Solar - + Lunar - + Lunar - + Starts Inicia - + Ends Termina - + Remind Me Recordarme - + Repeat Repetir - - + + Daily Diariamente - - + + Weekdays Días laborables - - + + Weekly Semanalmente - - - + + + Monthly Mensualmente - - - + + + Yearly Anualmente - + End Repeat Fin de repetición - + After Después - + On Encendido - - - - - time(s) - hora(s) - - - + Cancel button Cancelar - + Save button Guardar @@ -432,141 +461,141 @@ CScheduleOperation - + All occurrences of a repeating event must have the same all-day status. Todas las instancias de un evento repetido debe tener el mismo estado todo el día. - - + + Do you want to change all occurrences? ¿Desea cambiar todas las instancias? - - + + + + + + + + Cancel + button + Cancelar + + + + Change All Cambiar todos - + You are changing the repeating rule of this event. Está cambiando la regla de repetición de este evento. - - - + + + You are deleting an event. Esta borrando un evento - + Are you sure you want to delete this event? ¿Está seguro que desea borrar este evento? - - - - - - - Cancel - button - Cancelar - - - Delete button Borrar - + Do you want to delete all occurrences of this event, or only the selected occurrence? ¿Desea borrar todas las instancias de este evento, o solo la instancia seleccionada? - + Delete All Eliminar todo - - + + Delete Only This Event Borrar solo este evento - + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? ¿Desea eliminar este y todas las instancias futuras de este evento, o solo la instancia seleccionada? - + Delete All Future Events Borrar todos los eventos futuros - - + + You are changing a repeating event. Esta cambiando una repetición de un evento. - + Do you want to change only this occurrence of the event, or all occurrences? ¿Desea cambiar solo la instancia de este evento, o todas las instancias? - + All Todos - - + + Only This Event Solo este evento - + Do you want to change only this occurrence of the event, or this and all future occurrences? ¿Desea cambiar solo este acontecimiento del evento, o este y todos los acontecimientos futuros? - + All Future Events Todos los eventos futuros - + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. - + Ha seleccionado un mes bisiesto y se le recordará de acuerdo con las reglas del calendario lunar. - + OK button - + Aceptar CScheduleSearchDateItem - + Y Y - + M M - + D D @@ -574,17 +603,17 @@ CScheduleSearchItem - + Edit Editar - + Delete Eliminar - + All Day Todo el día @@ -592,7 +621,7 @@ CScheduleSearchView - + No search results Sin resultados @@ -600,25 +629,83 @@ CScheduleView - + ALL DAY EVENTOS + CSettingDialog + + + Sunday + Domingo + + + + Monday + Lunes + + + + 24-hour clock + Reloj de 24 horas + + + + 12-hour clock + Reloj de 12 horas + + + + Manual + Manual + + + + 15 mins + 15 minutos + + + + 30 mins + 30 minutos + + + + 1 hour + 1 hora + + + + 24 hours + 24 horas + + + + Sync Now + Sincronizar ahora + + + + Last sync + Ultima sincronizacion + + + CTimeEdit - + (%1 mins) (%1 mins) - + (%1 hour) (%1 hora) - + (%1 hours) (%1 horas) @@ -626,35 +713,79 @@ CTitleWidget - + Y Y - + M M - + W W - + D D + + + + Search events and festivals + Buscar eventos y festivales + + + + CWeekWidget + + + Sun + Domingo + + + + Mon + Lunes + + + + Tue + Mar + + + + Wed + Miércoles + + + + Thu + Jue + + + + Fri + Viernes + + + + Sat + Sábado + CWeekWindow - + Week Semana - + Y A @@ -662,13 +793,13 @@ CYearScheduleView + - All Day Todo el día - + No event No hay eventos @@ -676,7 +807,7 @@ CYearWindow - + Y A @@ -684,12 +815,12 @@ CalendarWindow - + Calendar Calendario - + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. Calendario de Deepin es una herramienta para consultar fechas, y un conveniente planificador para agendar sus reuniones y eventos. @@ -697,43 +828,147 @@ Calendarmainwindow - + Calendar Calendario - + Manage - + Gestionar + + + + Privacy Policy + Política de privacidad + + + + Syncing... + Sincronizando… + + + + Sync successful + Sincronización exitosa + + + + Sync failed, please try later + La sincronización falló, intentelo más tarde CenterWidget - + All Day Todo el día + DAccountDataBase + + + Work + + + + + Life + + + + + Other + + + + + DAlarmManager + + + + + + Close + button + + + + + One day before start + + + + + Remind me tomorrow + + + + + Remind me later + + + + + 15 mins later + + + + + 1 hour later + + + + + 4 hours later + + + + + + + Tomorrow + + + + + Schedule Reminder + + + + + + %1 to %2 + + + + + + Today + Hoy + + + DragInfoGraphicsView - + Edit Editar - + Delete Borrar - + New event Nuevo evento - + New Event Nuevo evento @@ -741,45 +976,98 @@ JobTypeListView - + You are deleting an event type. - + Está eliminando un tipo de evento. - + All events under this type will be deleted and cannot be recovered. - + Todos los eventos de este tipo se eliminarán y no se podrán recuperar. - + Cancel button - + Cancelar - + Delete button - + Eliminar QObject - + + Manage calendar - + Administrar calendario - + + Event types - + Tipos de eventos + + + + Account settings + Ajustes de la cuenta + + + + Account + Cuenta + + + + Select items to be synced + Seleccionar elementos a sincronizar + + + + Events + Eventos + + + + + General settings + Ajustes generales + + + + Sync interval + Intervalo de sincronización + + + + Calendar account + Cuenta de calendario + + + + General + General + + + + First day of week + Primer día de la semana + + + + Time + Tiempo Return - + Today Return Hoy @@ -788,9 +1076,9 @@ Return Today - - - + + + Today Return Today Hoy @@ -799,95 +1087,127 @@ ScheduleTypeEditDlg - + New event type - + Nuevo tipo de evento - + Edit event type - + Editar tipo de evento - + Name: - + Nombre: - + Color: - + Color: - + Cancel button - + Cancelar - + Save button - - - - - Enter a name please - + Guardar - + The name can not only contain whitespaces - + El nombre no puede contener espacios en blanco - - The name already exists - + + Enter a name please + Por favor ingrese un nombre Shortcut - + Help Ayuda - + Delete event Borrar evento - + Copy Duplicar - + Cut Cortar - + Paste Pegar - + Delete Borrar - + Select all Seleccionar todo + SidebarCalendarWidget + + + Y + A + + + + M + M + + + + TimeJumpDialog + + + Go + button + Ir + + + + UserloginWidget + + + Sign In + button + Iniciar sesión + + + + Sign Out + button + Cerrar sesión + + + YearFrame - + Y A @@ -895,17 +1215,17 @@ today - - - - - - - - + + + + + + + + Today Today Hoy - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar_fi.ts dde-calendar-5.10.0/translations/dde-calendar_fi.ts --- dde-calendar-5.9.1/translations/dde-calendar_fi.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar_fi.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,66 +1,96 @@ - + + + - CColorPickerWidget + AccountItem - - Color - + + Sync successful + Synkronointi onnistui - - Cancel - button - + + Network error + Verkkovirhe - - Save - button - + + Server exception + Palvelimen poikkeus + + + + Storage full + Levytila täynnä + + + + AccountManager + + + Local account + Paikallinen tili + + + + Event types + Tapahtumatyypit + + + + CColorPickerWidget + + + Color + Väri + Cancel - + button + Peruuta + Save - + button + Tallenna CDayMonthView - + Monday Maanantai - + Tuesday Tiistai - + Wednesday Keskiviikko - + Thursday Torstai - + Friday Perjantai - + Saturday Lauantai - + Sunday Sunnuntai @@ -68,25 +98,30 @@ CDayWindow - + Y V - + M K - + D P + + + Lunar + Kuu + CGraphicsView - + New Event Uusi tapahtuma @@ -94,7 +129,7 @@ CMonthScheduleNumItem - + %1 more %1 lisää @@ -102,12 +137,12 @@ CMonthView - + New event Uusi tapahtuma - + New Event Uusi tapahtuma @@ -115,7 +150,7 @@ CMonthWindow - + Y V @@ -123,24 +158,24 @@ CMyScheduleView - + My Event Tapahtuma - + OK button OK - + Delete button Poista - + Edit button Muokkaa @@ -149,281 +184,275 @@ CPushButton - + New event type - + Uusi tapahtuman tyyppi CScheduleDlg - - + + + New Event Uusi tapahtuma - + Edit Event Muokkaa tapahtumaa - + End time must be greater than start time Lopetusajan on oltava pidempi kuin aloitusaika - + OK button OK - - - - - - + + + + + + Never Ei koskaan - + At time of event Tapahtuman aikaan - + 15 minutes before 15 min ennen - + 30 minutes before 30 min ennen - + 1 hour before 1 tunti ennen - + 1 day before 1 päivä ennen - + 2 days before 2 päivää ennen - + 1 week before 1 viikko ennen - + On start day (9:00 AM) Aloituspäivänä (9:00) - - Enter a name please - + + + + + time(s) + kertaa - - The name can not only contain whitespaces - + + Enter a name please + Anna nimi - - The name already exists - + + The name can not only contain whitespaces + Nimi ei voi sisältää vain välilyöntejä - - + + Type: Tyyppi: - - + + Description: Kuvaus: - - + + All Day: Koko päivä: - - + + Starts: Alkaa: - - + + Ends: Loppuu: - - + + Remind Me: Muistuta minua: - - + + Repeat: Toista: - - + + End Repeat: Lopeta toisto: - - Type - Tyyppi - - - Work - Työ + + Calendar account: + Kalenteritili: - Life - Oma + + Calendar account + Kalenteritili - Other - Muut + + Type + Tyyppi - + Description Kuvaus - + All Day Koko päivä - + Time: - + Aika: - + Time - + Aika - + Solar - + Aurinko - + Lunar - + Kuu - + Starts Alkaa - + Ends Loppuu - + Remind Me Muistuta minua - + Repeat Toista - - + + Daily Päivittäin - - + + Weekdays Arkisin - - + + Weekly Viikoittain - - - + + + Monthly Kuukausittain - - - + + + Yearly Vuosittain - + End Repeat Lopeta toisto - + After Jälkeen - + On Päällä - - - - - time(s) - kertaa - - - + Cancel button Peruuta - + Save button Tallenna @@ -432,141 +461,141 @@ CScheduleOperation - + All occurrences of a repeating event must have the same all-day status. Kaikilla toistuvilla tapahtumilla on oltava sama koko päivän tila. - - + + Do you want to change all occurrences? Haluatko muuttaa kaikkia tapahtumia? - - + + + + + + + + Cancel + button + Peruuta + + + + Change All Vaihda kaikki - + You are changing the repeating rule of this event. Olet muuttamassa tämän tapahtuman toistuvaa sääntöä. - - - + + + You are deleting an event. Olet poistamassa tapahtumaa. - + Are you sure you want to delete this event? Haluatko varmasti poistaa tämän tapahtuman? - - - - - - - Cancel - button - Peruuta - - - Delete button Poista - + Do you want to delete all occurrences of this event, or only the selected occurrence? Haluatko poistaa kaikki tämän tapahtuman esiintymät vai vain valitun tapahtuman? - + Delete All Poista kaikki - - + + Delete Only This Event Poista vain tämä tapahtuma - + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? Haluatko poistaa tämän ja kaikki tämän tapahtuman tulevat esiintymät vai vain valitun tapahtuman? - + Delete All Future Events Poista kaikki tulevat tapahtumat - - + + You are changing a repeating event. Olet vaihtamassa toistuvaa tapahtumaa. - + Do you want to change only this occurrence of the event, or all occurrences? Haluatko muuttaa vain tämän tapahtuman vai kaikki tapahtumat? - + All Kaikki - - + + Only This Event Vain tämä tapahtuma - + Do you want to change only this occurrence of the event, or this and all future occurrences? Haluatko muuttaa vain tämän tapahtuman vai tätä ja kaikkia tulevia tapahtumia? - + All Future Events Kaikki tulevat tapahtumat - + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. - + Olet valinnut karkauskuukauden ja sinua muistutetaan kuukalenterin sääntöjen mukaisesti. - + OK button - + OK CScheduleSearchDateItem - + Y V - + M K - + D P @@ -574,17 +603,17 @@ CScheduleSearchItem - + Edit Muokkaa - + Delete Poista - + All Day Koko päivä @@ -592,7 +621,7 @@ CScheduleSearchView - + No search results Ei hakutuloksia @@ -600,25 +629,83 @@ CScheduleView - + ALL DAY AIKA + CSettingDialog + + + Sunday + Sunnuntai + + + + Monday + Maanantai + + + + 24-hour clock + 24h kello + + + + 12-hour clock + 12h kello + + + + Manual + Manuaalinen + + + + 15 mins + 15 min + + + + 30 mins + 30 min + + + + 1 hour + 1 tunti + + + + 24 hours + 24 tuntia + + + + Sync Now + Synkronoi nyt + + + + Last sync + Viimeisin synkronointi + + + CTimeEdit - + (%1 mins) (%1 min) - + (%1 hour) (%1 tunti) - + (%1 hours) (%1 tuntia) @@ -626,35 +713,79 @@ CTitleWidget - + Y V - + M KK - + W VK - + D PV + + + + Search events and festivals + Hae tapahtumia ja festivaaleja + + + + CWeekWidget + + + Sun + Su + + + + Mon + Ma + + + + Tue + Ti + + + + Wed + Ke + + + + Thu + To + + + + Fri + Pe + + + + Sat + La + CWeekWindow - + Week Viikko - + Y V @@ -662,13 +793,13 @@ CYearScheduleView + - All Day Koko päivä - + No event Ei tapahtumaa @@ -676,7 +807,7 @@ CYearWindow - + Y V @@ -684,12 +815,12 @@ CalendarWindow - + Calendar Kalenteri - + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. Kalenteri on työkalu almanakan tarkasteluun ja voit myös tehdä hälytykset ja muistutukset kalenteriin. @@ -697,43 +828,147 @@ Calendarmainwindow - + Calendar Kalenteri - + Manage - + Hallitse + + + + Privacy Policy + Tietosuojakäytäntö + + + + Syncing... + Synkronoidaan... + + + + Sync successful + Synkronointi onnistui + + + + Sync failed, please try later + Synkronointi epäonnistui, yritä myöhemmin CenterWidget - + All Day Koko päivä + DAccountDataBase + + + Work + + + + + Life + + + + + Other + + + + + DAlarmManager + + + + + + Close + button + + + + + One day before start + + + + + Remind me tomorrow + + + + + Remind me later + + + + + 15 mins later + + + + + 1 hour later + + + + + 4 hours later + + + + + + + Tomorrow + + + + + Schedule Reminder + + + + + + %1 to %2 + + + + + + Today + Tänään + + + DragInfoGraphicsView - + Edit Muokkaa - + Delete Poista - + New event Uusi tapahtuma - + New Event Uusi tapahtuma @@ -741,45 +976,98 @@ JobTypeListView - + You are deleting an event type. - + Olet poistamassa tapahtumatyyppiä. - + All events under this type will be deleted and cannot be recovered. - + Kaikki tämän tyypin tapahtumat poistetaan, eikä niitä voi palauttaa. - + Cancel button - + Peruuta - + Delete button - + Poista QObject - + + Manage calendar - + Hallitse kalenteria - + + Event types - + Tapahtumatyypit + + + + Account settings + Tilin asetukset + + + + Account + Tili + + + + Select items to be synced + Valitse synkronoitavat kohteet + + + + Events + Tapahtumat + + + + + General settings + Yleiset asetukset + + + + Sync interval + Synkronointiväli + + + + Calendar account + Kalenteritili + + + + General + Yleinen + + + + First day of week + Viikon ensimmäinen päivä + + + + Time + Aika Return - + Today Return Tänään @@ -788,9 +1076,9 @@ Return Today - - - + + + Today Return Today Tänään @@ -799,95 +1087,127 @@ ScheduleTypeEditDlg - + New event type - + Uusi tapahtuman tyyppi - + Edit event type - + Muokkaa tapahtuman tyyppiä - + Name: - + Nimi: - + Color: - + Väri: - + Cancel button - + Peruuta - + Save button - - - - - Enter a name please - + Tallenna - + The name can not only contain whitespaces - + Nimi ei voi sisältää vain välilyöntejä - - The name already exists - + + Enter a name please + Anna nimi Shortcut - + Help Ohje - + Delete event Poista tapahtuma - + Copy Kopioi - + Cut Leikkaa - + Paste Liitä - + Delete Poista - + Select all Valitse kaikki + SidebarCalendarWidget + + + Y + V + + + + M + K + + + + TimeJumpDialog + + + Go + button + Mene + + + + UserloginWidget + + + Sign In + button + Kirjaudu sisään + + + + Sign Out + button + Kirjaudu ulos + + + YearFrame - + Y V @@ -895,17 +1215,17 @@ today - - - - - - - - + + + + + + + + Today Today Tänään - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar_fr.ts dde-calendar-5.10.0/translations/dde-calendar_fr.ts --- dde-calendar-5.9.1/translations/dde-calendar_fr.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar_fr.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,38 +1,96 @@ - + + + + + AccountItem + + + Sync successful + Synchronisation réussie + + + + Network error + Erreur réseau + + + + Server exception + Exception de serveur + + + + Storage full + Stockage plein + + + + AccountManager + + + Local account + + + + + Event types + Type d'événement + + + + CColorPickerWidget + + + Color + Couleur + + + + Cancel + button + Annuler + + + + Save + button + Sauvegarder + + CDayMonthView - + Monday Lundi - + Tuesday Mardi - + Wednesday Mercredi - + Thursday Jeudi - + Friday Vendredi - + Saturday Samedi - + Sunday Dimanche @@ -40,25 +98,30 @@ CDayWindow - + Y A - + M M - + D J + + + Lunar + Lunaire + CGraphicsView - + New Event Nouvel événement @@ -66,7 +129,7 @@ CMonthScheduleNumItem - + %1 more %1 de plus @@ -74,12 +137,12 @@ CMonthView - + New event Nouvel événement - + New Event Nouvel événement @@ -87,7 +150,7 @@ CMonthWindow - + Y A @@ -95,258 +158,301 @@ CMyScheduleView - + My Event Mon événement - + OK button OK - + Delete button Supprimer - + Edit button - Editer + Éditer + + + + CPushButton + + + New event type + Nouveau type d'événement CScheduleDlg - - + + + New Event Nouvel évènement - + Edit Event - Modifier l'événement + Éditer l'événement - + End time must be greater than start time L'heure de fin doit être supérieure à l'heure de début - + OK button OK - - - - + + + + + + Never Jamais - + At time of event Au moment de l'événement - + 15 minutes before 15 minutes avant - + 30 minutes before 30 minutes avant - + 1 hour before 1 heure avant - - + + 1 day before 1 jour avant - - + + 2 days before 2 jours avant - - + + 1 week before 1 semaine avant - + On start day (9:00 AM) Le jour de début (9h00) - - + + + + + time(s) + heure(s) + + + + Enter a name please + Entrer un nom s'il vous plait + + + + The name can not only contain whitespaces + Le nom ne peut pas contenir que des espaces blancs + + + + Type: Type : - - + + Description: Description : - - + + All Day: Toute la journée : - - + + Starts: Débuts : - - + + Ends: Fin : - - + + Remind Me: - Rappelle moi : + Rappelez-moi : - - + + Repeat: Répéter : - - + + End Repeat: Fin de la répétition : - - Type - Type + + Calendar account: + Compte de calendrier : - - Work - Travail - - - - Life - Vie + + Calendar account + Compte de calendrier - - Other - Autre + + Type + Type - + Description Description - + All Day Toute la journée - + + Time: + Temps : + + + + Time + Temps + + + + Solar + Solaire + + + + Lunar + Lunaire + + + Starts Débuts - + Ends Fin - + Remind Me - Rappelle moi + Rappelez-moi - + Repeat Répéter - + + Daily Journalier - + + Weekdays Jours de la semaine - + + Weekly Hebdomadaire - + + + Monthly Mensuel - + + + Yearly Annuel - + End Repeat Terminer la répétition - + After Après - + On Sur - - - - - time(s) - heure(s) - - - + Cancel button Annuler - + Save button Sauvegarder @@ -355,115 +461,126 @@ CScheduleOperation - + All occurrences of a repeating event must have the same all-day status. Toutes les occurrences d'un événement répétitif doivent avoir le même statut toute la journée. - - + + Do you want to change all occurrences? Voulez-vous modifier toutes les occurrences ? - + + + + + + + Cancel + button + Annuler + + + + Change All Tout changer - + You are changing the repeating rule of this event. Vous modifiez la règle de répétition de cet événement. - - - + + + You are deleting an event. Vous êtes en train de supprimer un événement. - + Are you sure you want to delete this event? Êtes-vous sûr de vouloir supprimer cet événement ? - - - - - - - - Cancel - button - Annuler - - - + Delete button Supprimer - + Do you want to delete all occurrences of this event, or only the selected occurrence? Voulez-vous supprimer toutes les occurrences de cet événement ou uniquement l'occurrence sélectionnée ? - + Delete All Tout supprimer - - + + Delete Only This Event Supprimer uniquement cet événement - + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? Voulez-vous supprimer cet événement et toutes les occurrences futures de cet événement, ou uniquement l'occurrence sélectionnée ? - + Delete All Future Events Supprimer tous les événements futurs - - + + You are changing a repeating event. Vous modifiez un événement récurrent. - + Do you want to change only this occurrence of the event, or all occurrences? Voulez-vous modifier uniquement cette occurrence de l'événement ou toutes les occurrences ? - + All Tout - - + + Only This Event Seulement cet événement - + Do you want to change only this occurrence of the event, or this and all future occurrences? Voulez-vous modifier uniquement cette occurrence de l'événement, ou cette occurrence et toutes les occurrences futures ? - + All Future Events Tous les événements futurs + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + Vous avez sélectionné un mois bissextile, et sera rappelé selon les règles du calendrier lunaire. + + + + OK + button + OK + CScheduleSearchDateItem @@ -486,17 +603,17 @@ CScheduleSearchItem - + Edit Éditer - + Delete Supprimer - + All Day Toute la journée @@ -512,61 +629,163 @@ CScheduleView - + ALL DAY TOUTE LA JOURNÉE + CSettingDialog + + + Sunday + Dimanche + + + + Monday + Lundi + + + + 24-hour clock + Horloge 24 heures + + + + 12-hour clock + horloge 12 heures + + + + Manual + Manuel + + + + 15 mins + 15 minutes + + + + 30 mins + 30 min + + + + 1 hour + 1 heure + + + + 24 hours + 24 heures + + + + Sync Now + Synchroniser maintenant + + + + Last sync + Dernière synchronisation + + + CTimeEdit - + (%1 mins) - + (%1 minutes) - + (%1 hour) - + (%1 heure) - + (%1 hours) - + (%1 heure) CTitleWidget - + Y A - + M M - + W W - + D J + + + + Search events and festivals + Rechercher des événements et des festivals + + + + CWeekWidget + + + Sun + Dim + + + + Mon + Lun + + + + Tue + Mar + + + + Wed + Mer + + + + Thu + Jeu + + + + Fri + Ven + + + + Sat + Sam + CWeekWindow - + Week Semaine - + Y A @@ -574,13 +793,13 @@ CYearScheduleView + - All Day Toute la journée - + No event Pas d'évènement @@ -588,7 +807,7 @@ CYearWindow - + Y A @@ -596,12 +815,12 @@ CalendarWindow - + Calendar Calendrier - + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. Le calendrier est un outil pour afficher les dates, et aussi un planificateur quotidien intelligent pour planifier toutes les choses de la vie. @@ -609,46 +828,246 @@ Calendarmainwindow - + Calendar Calendrier + + + Manage + Faire en sorte + + + + Privacy Policy + Politique de confidentialité + + + + Syncing... + Synchronisation... + + + + Sync successful + Synchronisation réussie + + + + Sync failed, please try later + Échec de la synchronisation, veuillez réessayer plus tard + CenterWidget - + All Day Toute la journée + DAccountDataBase + + + Work + + + + + Life + + + + + Other + + + + + DAlarmManager + + + + + + Close + button + + + + + One day before start + + + + + Remind me tomorrow + + + + + Remind me later + + + + + 15 mins later + + + + + 1 hour later + + + + + 4 hours later + + + + + + + Tomorrow + + + + + Schedule Reminder + + + + + + %1 to %2 + + + + + + Today + Aujourd'hui + + + DragInfoGraphicsView - + Edit Éditer - + Delete Supprimer - + New event Nouvel événement - + New Event Nouvel événement + JobTypeListView + + + You are deleting an event type. + Vous supprimez un type d'événement. + + + + All events under this type will be deleted and cannot be recovered. + Tous les événements de ce type seront supprimés et ne pourront pas être récupérés. + + + + Cancel + button + Annuler + + + + Delete + button + Effacer + + + + QObject + + + + Manage calendar + Gérer le calendrier + + + + + Event types + Type d'événement + + + + Account settings + Paramètres du compte + + + + Account + Compte + + + + Select items to be synced + Sélectionner les éléments à synchroniser + + + + Events + Événements + + + + + General settings + Paramètres généraux + + + + Sync interval + Intervalle de synchronisation + + + + Calendar account + Compte de calendrier + + + + General + Général + + + + First day of week + Premier jour de la semaine + + + + Time + Temps + + + Return - + Today Return Aujourd'hui @@ -657,56 +1076,138 @@ Return Today - - - + + + Today Return Today Aujourd'hui + ScheduleTypeEditDlg + + + New event type + Nouveau type d'événement + + + + Edit event type + Éditer le type d'événement + + + + Name: + Nom : + + + + Color: + Couleur : + + + + Cancel + button + Annuler + + + + Save + button + Sauvegarder + + + + The name can not only contain whitespaces + Le nom ne peut pas contenir que des espaces blancs + + + + Enter a name please + Entrez un nom s'il vous plait + + + Shortcut - + Help Aide - + Delete event Supprimer l'événement - + Copy Copier - + Cut Couper - + Paste Coller - + Delete Supprimer - + Select all Tout sélectionner + SidebarCalendarWidget + + + Y + A + + + + M + M + + + + TimeJumpDialog + + + Go + button + Aller + + + + UserloginWidget + + + Sign In + button + S'identifier + + + + Sign Out + button + Se déconnecter + + + YearFrame - + Y A @@ -714,17 +1215,17 @@ today - - - - - - - - + + + + + + + + Today Today Aujourd'hui - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar_gl_ES.ts dde-calendar-5.10.0/translations/dde-calendar_gl_ES.ts --- dde-calendar-5.9.1/translations/dde-calendar_gl_ES.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar_gl_ES.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,38 +1,96 @@ - + + + + + AccountItem + + + Sync successful + + + + + Network error + + + + + Server exception + + + + + Storage full + + + + + AccountManager + + + Local account + + + + + Event types + + + + + CColorPickerWidget + + + Color + + + + + Cancel + button + Cancelar + + + + Save + button + Gardar + + CDayMonthView - + Monday Luns - + Tuesday Martes - + Wednesday Mércores - + Thursday Xoves - + Friday Venres - + Saturday Sábado - + Sunday Domingo @@ -40,25 +98,30 @@ CDayWindow - + Y Y - + M M - + D D + + + Lunar + + CGraphicsView - + New Event Novo evento @@ -66,7 +129,7 @@ CMonthScheduleNumItem - + %1 more %1 máis @@ -74,12 +137,12 @@ CMonthView - + New event Novo evento - + New Event Novo evento @@ -87,7 +150,7 @@ CMonthWindow - + Y Y @@ -95,258 +158,301 @@ CMyScheduleView - + My Event O meu evento - + OK button Aceptar - + Delete button Eliminar - + Edit button Editar + CPushButton + + + New event type + + + + CScheduleDlg - - + + + New Event Novo evento - + Edit Event Editar evento - + End time must be greater than start time O tempo de finalización ten de ser maior que o de inicio - + OK button Aceptar - - - - + + + + + + Never Nunca - + At time of event Na hora do evento - + 15 minutes before 15 minutos antes - + 30 minutes before 30 minutos antes - + 1 hour before 1 hora antes - - + + 1 day before 1 día antes - - + + 2 days before 2 días antes - - + + 1 week before 1 semana antes - + On start day (9:00 AM) Ao comezo do día (9:00 AM) - - + + Enter a name please + + + + + The name can not only contain whitespaces + + + + + Type: Tipo: - - + + Description: Descrición: - - + + All Day: Todo o día: - - + + Starts: Comeza: - - + + Ends: Remata: - - + + Remind Me: Lembrarme: - - + + Repeat: Repetir: - - + + End Repeat: Fin da repetición: - - Type - Tipo - - - - Work - Traballo + + Calendar account: + - - Life - Persoal + + Calendar account + - - Other - Outro + + Type + Tipo - + Description Descrición - + All Day Todo o día - + + Time: + + + + + Time + + + + + Solar + + + + + Lunar + + + + Starts Comeza - + Ends Remata - + Remind Me Lembrarme - + Repeat Repetir - + + Daily Diariamente - + + Weekdays Días da semana - + + Weekly Semanalmente - + + + Monthly Mensualmente - + + + Yearly Anualmente - + End Repeat Finalizar a repetición - + After Despois - + On O - - - - + + + + time(s) vez(ces) - + Cancel button Cancelar - + Save button Gardar @@ -355,115 +461,126 @@ CScheduleOperation - + All occurrences of a repeating event must have the same all-day status. Todas as ocorrencias dun evento repetitivo teñen de ter o mesmo estado durante todo o día. - - + + Do you want to change all occurrences? Queres cambiar todas as ocorrencias? - - + + Change All Cambiar todo - + You are changing the repeating rule of this event. Estás a cambiar a regra de repetición deste evento. - - - + + + You are deleting an event. Estás eliminando un evento. - + Are you sure you want to delete this event? Tes a certeza de querer eliminar este evento? - - - - - - - + + + + + + + Cancel button Cancelar - + Delete button Eliminar - + Do you want to delete all occurrences of this event, or only the selected occurrence? Queres eliminar todas as ocorrencias deste evento, ou só a ocorrencia seleccionada? - + Delete All Eliminar todo - - + + Delete Only This Event Eliminar só este evento - + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? Queres eliminar esta e todas as vindeiras ocorrencias deste evento, ou só a ocorrencia seleccionada? - + Delete All Future Events Eliminar todo os eventos futuros - - + + You are changing a repeating event. Estás a cambiar un evento repetitivo. - + Do you want to change only this occurrence of the event, or all occurrences? Queres cambiar só esta ocorrencia deste evento, ou todas as ocorrencias? - + All Todo - - + + Only This Event Só este evento - + Do you want to change only this occurrence of the event, or this and all future occurrences? Queres cambiar só esta ocorrencia deste evento, ou esta e todas as vindeiras ocorrencias? - + All Future Events Todos os eventos futuros + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + + OK + button + Aceptar + CScheduleSearchDateItem @@ -486,17 +603,17 @@ CScheduleSearchItem - + Edit Editar - + Delete Eliminar - + All Day Todo o día @@ -512,61 +629,163 @@ CScheduleView - + ALL DAY TODO O DÍA + CSettingDialog + + + Sunday + Domingo + + + + Monday + Luns + + + + 24-hour clock + + + + + 12-hour clock + + + + + Manual + + + + + 15 mins + + + + + 30 mins + + + + + 1 hour + + + + + 24 hours + + + + + Sync Now + + + + + Last sync + + + + CTimeEdit - + (%1 mins) - + - + (%1 hour) - + - + (%1 hours) - + CTitleWidget - + Y Y - + M M - + W W - + D D + + + + Search events and festivals + + + + + CWeekWidget + + + Sun + + + + + Mon + + + + + Tue + + + + + Wed + + + + + Thu + + + + + Fri + + + + + Sat + + CWeekWindow - + Week Semana - + Y Y @@ -574,13 +793,13 @@ CYearScheduleView + - All Day Todo o día - + No event Sen evento @@ -588,7 +807,7 @@ CYearWindow - + Y Y @@ -596,12 +815,12 @@ CalendarWindow - + Calendar Calendario - + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. O calendario é unha ferramenta para ver as datas e tamén un planificador diario intelixente para programar todas as cousas da vida. @@ -609,46 +828,246 @@ Calendarmainwindow - + Calendar Calendario + + + Manage + + + + + Privacy Policy + + + + + Syncing... + + + + + Sync successful + + + + + Sync failed, please try later + + CenterWidget - + All Day Todo o día + DAccountDataBase + + + Work + Traballo + + + + Life + Persoal + + + + Other + Outro + + + + DAlarmManager + + + + + + Close + button + + + + + One day before start + + + + + Remind me tomorrow + + + + + Remind me later + + + + + 15 mins later + + + + + 1 hour later + + + + + 4 hours later + + + + + + + Tomorrow + + + + + Schedule Reminder + + + + + + %1 to %2 + + + + + + Today + Hoxe + + + DragInfoGraphicsView - + Edit Editar - + Delete Eliminar - + New event Novo evento - + New Event Novo evento + JobTypeListView + + + You are deleting an event type. + + + + + All events under this type will be deleted and cannot be recovered. + + + + + Cancel + button + Cancelar + + + + Delete + button + Eliminar + + + + QObject + + + Account settings + + + + + Account + + + + + Select items to be synced + + + + + Events + + + + + + General settings + + + + + Sync interval + + + + + + Manage calendar + + + + + Calendar account + + + + + + Event types + + + + + General + + + + + First day of week + + + + + Time + + + + Return - + Today Return Hoxe @@ -657,56 +1076,138 @@ Return Today - - - + + + Today Return Today Hoxe + ScheduleTypeEditDlg + + + New event type + + + + + Edit event type + + + + + Name: + + + + + Color: + + + + + Cancel + button + Cancelar + + + + Save + button + Gardar + + + + The name can not only contain whitespaces + + + + + Enter a name please + + + + Shortcut - + Help Axuda - + Delete event Eliminar evento - + Copy Copiar - + Cut Cortar - + Paste Pegar - + Delete Eliminar - + Select all Seleccionar todo + SidebarCalendarWidget + + + Y + Y + + + + M + M + + + + TimeJumpDialog + + + Go + button + + + + + UserloginWidget + + + Sign In + button + + + + + Sign Out + button + + + + YearFrame - + Y Y @@ -714,17 +1215,17 @@ today - - - - - - - - + + + + + + + + Today Today Hoxe - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar_hr.ts dde-calendar-5.10.0/translations/dde-calendar_hr.ts --- dde-calendar-5.9.1/translations/dde-calendar_hr.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar_hr.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,38 +1,96 @@ - + + + + + AccountItem + + + Sync successful + + + + + Network error + + + + + Server exception + + + + + Storage full + + + + + AccountManager + + + Local account + + + + + Event types + + + + + CColorPickerWidget + + + Color + + + + + Cancel + button + Otkaži + + + + Save + button + Spremi + + CDayMonthView - + Monday Ponedjeljak - + Tuesday Utorak - + Wednesday Srijeda - + Thursday Četvrtak - + Friday Petak - + Saturday Subota - + Sunday Nedjelja @@ -40,25 +98,30 @@ CDayWindow - + Y Y - + M M - + D D + + + Lunar + + CGraphicsView - + New Event Novi događaj @@ -66,20 +129,20 @@ CMonthScheduleNumItem - + %1 more - + CMonthView - + New event Novi događaj - + New Event Novi događaj @@ -87,7 +150,7 @@ CMonthWindow - + Y Y @@ -95,258 +158,301 @@ CMyScheduleView - + My Event Moj događaj - + OK button U redu - + Delete button Obriši - + Edit button Uredi + CPushButton + + + New event type + + + + CScheduleDlg - - + + + New Event Novi događaj - + Edit Event Uredi događaj - + End time must be greater than start time Vrijeme završetka mora biti veće od vremena početka - + OK button U redu - - - - + + + + + + Never Nikada - + At time of event U vrijeme događaja - + 15 minutes before 15 minuta prije - + 30 minutes before 30 minuta prije - + 1 hour before 1 sat prije - - + + 1 day before 1 dan prije - - + + 2 days before 2 dana prije - - + + 1 week before 1 tjedan prije - + On start day (9:00 AM) Na dan početka (9:00 AM) - - + + Enter a name please + + + + + The name can not only contain whitespaces + + + + + Type: Vrsta: - - + + Description: Opis: - - + + All Day: Cijeli dan: - - + + Starts: Započinje: - - + + Ends: Završava: - - + + Remind Me: Podsjeti me: - - + + Repeat: Ponovi: - - + + End Repeat: - + - - Type - Vrsta - - - - Work - Posao + + Calendar account: + - - Life - Život + + Calendar account + - - Other - Ostalo + + Type + Vrsta - + Description Opis - + All Day Cijeli dan - + + Time: + + + + + Time + + + + + Solar + + + + + Lunar + + + + Starts Počinje - + Ends Završava - + Remind Me Podsjeti me - + Repeat Ponovi - + + Daily Dnevno - + + Weekdays Dani vikenda - + + Weekly Tjedno - + + + Monthly Mjesečno - + + + Yearly Godišnje - + End Repeat - + - + After Poslije - + On Uključeno - - - - + + + + time(s) - + - + Cancel button Otkaži - + Save button Spremi @@ -355,115 +461,126 @@ CScheduleOperation - + All occurrences of a repeating event must have the same all-day status. - + - - + + Do you want to change all occurrences? - + - - + + Change All Promijeni sve - + You are changing the repeating rule of this event. - + - - - + + + You are deleting an event. Brišete događaj. - + Are you sure you want to delete this event? Jeste li sigurni da želite izbrisati ovaj događaj? - - - - - - - + + + + + + + Cancel button Otkaži - + Delete button Obriši - + Do you want to delete all occurrences of this event, or only the selected occurrence? - + - + Delete All Obrišite sve - - + + Delete Only This Event Obrišite samo ovaj događaj - + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? - + - + Delete All Future Events Obriši sve buduće događaje - - + + You are changing a repeating event. - + - + Do you want to change only this occurrence of the event, or all occurrences? - + - + All Sve - - + + Only This Event Samo ovaj događaj - + Do you want to change only this occurrence of the event, or this and all future occurrences? - + - + All Future Events Svi budući događaji + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + + OK + button + U redu + CScheduleSearchDateItem @@ -486,17 +603,17 @@ CScheduleSearchItem - + Edit Uredi - + Delete Obriši - + All Day Cijeli dan @@ -512,61 +629,163 @@ CScheduleView - + ALL DAY CIJELI DAN + CSettingDialog + + + Sunday + Nedjelja + + + + Monday + Ponedjeljak + + + + 24-hour clock + + + + + 12-hour clock + + + + + Manual + + + + + 15 mins + + + + + 30 mins + + + + + 1 hour + + + + + 24 hours + + + + + Sync Now + + + + + Last sync + + + + CTimeEdit - + (%1 mins) - + - + (%1 hour) - + - + (%1 hours) - + CTitleWidget - + Y Y - + M M - + W - + - + D D + + + + Search events and festivals + + + + + CWeekWidget + + + Sun + + + + + Mon + + + + + Tue + + + + + Wed + + + + + Thu + + + + + Fri + + + + + Sat + + CWeekWindow - + Week Tjedan - + Y Y @@ -574,13 +793,13 @@ CYearScheduleView + - All Day Cijeli dan - + No event Nema događaja @@ -588,7 +807,7 @@ CYearWindow - + Y Y @@ -596,59 +815,259 @@ CalendarWindow - + Calendar Kalendar - + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. - + Calendarmainwindow - + Calendar Kalendar + + + Manage + + + + + Privacy Policy + + + + + Syncing... + + + + + Sync successful + + + + + Sync failed, please try later + + CenterWidget - + All Day Cijeli dan + DAccountDataBase + + + Work + Posao + + + + Life + Život + + + + Other + Ostalo + + + + DAlarmManager + + + + + + Close + button + + + + + One day before start + + + + + Remind me tomorrow + + + + + Remind me later + + + + + 15 mins later + + + + + 1 hour later + + + + + 4 hours later + + + + + + + Tomorrow + + + + + Schedule Reminder + + + + + + %1 to %2 + + + + + + Today + Danas + + + DragInfoGraphicsView - + Edit Uredi - + Delete Obriši - + New event Novi događaj - + New Event Novi događaj + JobTypeListView + + + You are deleting an event type. + + + + + All events under this type will be deleted and cannot be recovered. + + + + + Cancel + button + Otkaži + + + + Delete + button + Obriši + + + + QObject + + + Account settings + + + + + Account + + + + + Select items to be synced + + + + + Events + + + + + + General settings + + + + + Sync interval + + + + + + Manage calendar + + + + + Calendar account + + + + + + Event types + + + + + General + + + + + First day of week + + + + + Time + + + + Return - + Today Return Danas @@ -657,56 +1076,138 @@ Return Today - - - + + + Today Return Today Danas + ScheduleTypeEditDlg + + + New event type + + + + + Edit event type + + + + + Name: + + + + + Color: + + + + + Cancel + button + Otkaži + + + + Save + button + Spremi + + + + The name can not only contain whitespaces + + + + + Enter a name please + + + + Shortcut - + Help Pomoć - + Delete event Izbriši događaj - + Copy Kopiraj - + Cut Izreži - + Paste Zalijepi - + Delete Obriši - + Select all Odaberi sve + SidebarCalendarWidget + + + Y + Y + + + + M + M + + + + TimeJumpDialog + + + Go + button + + + + + UserloginWidget + + + Sign In + button + + + + + Sign Out + button + + + + YearFrame - + Y Y @@ -714,17 +1215,17 @@ today - - - - - - - - + + + + + + + + Today Today Danas - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar_hu.ts dde-calendar-5.10.0/translations/dde-calendar_hu.ts --- dde-calendar-5.9.1/translations/dde-calendar_hu.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar_hu.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,66 +1,96 @@ - + + + + + AccountItem + + + Sync successful + A szinkronizálás sikeres + + + + Network error + Hálózati hiba + + + + Server exception + Szerver kivétel + + + + Storage full + A tárhely megtelt + + + + AccountManager + + + Local account + Helyi fiók + + + + Event types + Esemény típusok + + CColorPickerWidget - + Color Szín - + Cancel button Mégsem - + Save button Mentés - - Cancel - - - - Save - - CDayMonthView - + Monday Hétfő - + Tuesday Kedd - + Wednesday Szerda - + Thursday Csütörtök - + Friday Péntek - + Saturday Szombat - + Sunday Vasárnap @@ -68,25 +98,30 @@ CDayWindow - + Y Éves - + M Havi - + D Napi + + + Lunar + Hold naptár + CGraphicsView - + New Event Új esemény @@ -94,7 +129,7 @@ CMonthScheduleNumItem - + %1 more %1 továbbiak @@ -102,12 +137,12 @@ CMonthView - + New event Új esemény - + New Event Új esemény @@ -115,7 +150,7 @@ CMonthWindow - + Y Év @@ -123,24 +158,24 @@ CMyScheduleView - + My Event Eseményeim - + OK button OK - + Delete button Törlés - + Edit button Szerkesztés @@ -149,7 +184,7 @@ CPushButton - + New event type Új esemény típusa @@ -157,273 +192,267 @@ CScheduleDlg - - + + + New Event Új esemény - + Edit Event Esemény szerkesztése - + End time must be greater than start time A befejezés időpontjának a kezdés időpontjánál későbbre kell esnie - + OK button OK - - - - - - + + + + + + Never Soha - + At time of event Az esemény időpontjában - + 15 minutes before 15 perccel előtte - + 30 minutes before 30 perccel előtte - + 1 hour before 1 órával előtte - + 1 day before 1 nappal előtte - + 2 days before 2 nappal előtte - + 1 week before 1 héttel előtte - + On start day (9:00 AM) Esemény kezdete napján (De. 09:00) - + + + + + time(s) + Időpont(ok) + + + Enter a name please Kérjük adjon meg egy nevet - + The name can not only contain whitespaces A név nem tartalmazhat csak szóközöket - - The name already exists - Ez a név már létezik - - - - + + Type: Típus: - - + + Description: Leírás: - - + + All Day: Egész nap: - - + + Starts: Kezdés: - - + + Ends: Befejezés: - - + + Remind Me: Emlékeztessen: - - + + Repeat: Ismétlés: - - + + End Repeat: Ismétlés vége: - - Type - Típus - - - Work - Munka + + Calendar account: + Naptár fiók: - Life - Magénélet + + Calendar account + Naptár fiók - Other - Egyéb + + Type + Típus - + Description Leírás - + All Day Egész nap - + Time: Idő: - + Time Idő - + Solar Nap - + Lunar Hold - + Starts Kezdés - + Ends Befejezés - + Remind Me Emlékeztessen - + Repeat Ismétlés - - + + Daily Naponta - - + + Weekdays Hétköznapokon - - + + Weekly Hetente - - - + + + Monthly Havonta - - - + + + Yearly Évente - + End Repeat Ismétlés vége - + After Utána - + On Ekkor - - - - - time(s) - Időpont(ok) - - - + Cancel button Mégsem - + Save button Mentés @@ -432,141 +461,141 @@ CScheduleOperation - + All occurrences of a repeating event must have the same all-day status. Az ismétlődő események valamennyiének "egész nap" állapotúnak kell lennie. - - + + Do you want to change all occurrences? Minden alkalmat módosítani szeretne? - - + + + + + + + + Cancel + button + Mégsem + + + + Change All Összes módosítása - + You are changing the repeating rule of this event. Módosítja az esemény ismétlődési szabályát. - - - + + + You are deleting an event. Ön töröl egy eseményt. - + Are you sure you want to delete this event? Biztosan törli ezt az eseményt? - - - - - - - Cancel - button - Mégsem - - - Delete button Törlés - + Do you want to delete all occurrences of this event, or only the selected occurrence? Törlöni szeretné az esemény összes előfordulását, vagy csak a kiválasztott eseményt? - + Delete All Összes törlése - - + + Delete Only This Event Csak ezen esemény törlése - + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? Törölni szeretné ezt, és az esemény összes jövőbeli előfordulását, vagy csak a kiválasztott eseményt? - + Delete All Future Events Összes jövőbeli esemény törlése - - + + You are changing a repeating event. Ön egy ismétlődő eseményt módosít. - + Do you want to change only this occurrence of the event, or all occurrences? Csak az esemény ezen előfordulását akarja megváltoztatni, vagy az összes jövőbeni eseményt? - + All Összes - - + + Only This Event Csak ezen esemény - + Do you want to change only this occurrence of the event, or this and all future occurrences? Csak az esemény ezen előfordulását akarja megváltoztatni, vagy ezt és az összes jövőbeni eseményt? - + All Future Events Összes jövőbeli esemény - + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. - + Szökőhónap lett kiválasztva, ezért a holdnaptár szabályai fognak érvényesülni. - + OK button - + OK CScheduleSearchDateItem - + Y Év - + M Hónap - + D Nap @@ -574,17 +603,17 @@ CScheduleSearchItem - + Edit Szerkesztés - + Delete Törlés - + All Day Egész nap @@ -592,7 +621,7 @@ CScheduleSearchView - + No search results Nincs keresési eredmény @@ -600,25 +629,83 @@ CScheduleView - + ALL DAY Egész nap + CSettingDialog + + + Sunday + Vasárnap + + + + Monday + Hétfő + + + + 24-hour clock + 24 órás óra formátum + + + + 12-hour clock + 12 órás óra formátum + + + + Manual + Manuális + + + + 15 mins + 15 perc + + + + 30 mins + 30 perc + + + + 1 hour + 1 óra + + + + 24 hours + 24 óra + + + + Sync Now + Szinkronizálás most + + + + Last sync + Utolsó szinkronizálás + + + CTimeEdit - + (%1 mins) (%1 perc) - + (%1 hour) (%1 óra) - + (%1 hours) (%1 óra) @@ -626,35 +713,79 @@ CTitleWidget - + Y - Éves + Év - + M - Havi + - + W - Heti + Hét - + D - Napi + Nap + + + + + Search events and festivals + Események és fesztiválok keresése + + + + CWeekWidget + + + Sun + V. + + + + Mon + H. + + + + Tue + K. + + + + Wed + Sze. + + + + Thu + Cs. + + + + Fri + P. + + + + Sat + Szo. CWeekWindow - + Week Hét - + Y Év @@ -662,13 +793,13 @@ CYearScheduleView + - All Day Egész nap - + No event Nincs esemény @@ -676,7 +807,7 @@ CYearWindow - + Y Év @@ -684,12 +815,12 @@ CalendarWindow - + Calendar Naptár - + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. A Naptár egy eszköz a dátumok megtekintésére, valamint egy intelligens napi tervező az élet minden dolgának ütemezéséhez. @@ -697,43 +828,147 @@ Calendarmainwindow - + Calendar Naptár - + Manage Kezelés + + + Privacy Policy + Adatvédelmi irányelvek + + + + Syncing... + Szinkronizálás... + + + + Sync successful + A szinkronizálás sikeres + + + + Sync failed, please try later + A szinkronizálás sikertelen, kérjük próbálja később + CenterWidget - + All Day Egész nap + DAccountDataBase + + + Work + + + + + Life + + + + + Other + + + + + DAlarmManager + + + + + + Close + button + + + + + One day before start + + + + + Remind me tomorrow + + + + + Remind me later + + + + + 15 mins later + + + + + 1 hour later + + + + + 4 hours later + + + + + + + Tomorrow + + + + + Schedule Reminder + + + + + + %1 to %2 + + + + + + Today + Ma + + + DragInfoGraphicsView - + Edit Szerkesztés - + Delete Törlés - + New event Új esemény - + New Event Új esemény @@ -741,23 +976,23 @@ JobTypeListView - + You are deleting an event type. Ön töröl egy eseménytípust. - + All events under this type will be deleted and cannot be recovered. Az összes ilyen típusú esemény törlődik, és nem állítható helyre. - + Cancel button Mégsem - + Delete button Törlés @@ -766,20 +1001,73 @@ QObject - + + Manage calendar Naptár kezelése - + + Event types Esemény típusok + + + Account settings + Felhasználói fiók beállítások + + + + Account + Felhasználói fiók + + + + Select items to be synced + Válassza ki a szinkronizálni kívánt elemeket + + + + Events + Események + + + + + General settings + Általános beállítások + + + + Sync interval + Szinkronizálási időintervallum + + + + Calendar account + Naptár fiók + + + + General + Általános + + + + First day of week + A hét első napja + + + + Time + Idő + Return - + Today Return Ma @@ -788,9 +1076,9 @@ Return Today - - - + + + Today Return Today Ma @@ -799,95 +1087,127 @@ ScheduleTypeEditDlg - + New event type Új esemény típusa - + Edit event type Eseménytípus szerkesztése - + Name: Név: - + Color: Szín: - + Cancel button Mégsem - + Save button Mentés - - Enter a name please - Kérjük adjon meg egy nevet - - - + The name can not only contain whitespaces A név nem tartalmazhat csak szóközöket - - The name already exists - Ez a név már létezik + + Enter a name please + Kérjük adjon meg egy nevet Shortcut - + Help Segítség - + Delete event Esemény törlése - + Copy Másolás - + Cut Kivágás - + Paste Beillesztés - + Delete Törlés - + Select all Összes kijelölése + SidebarCalendarWidget + + + Y + Éves + + + + M + Havi + + + + TimeJumpDialog + + + Go + button + Ugrás + + + + UserloginWidget + + + Sign In + button + Bejelentkezés + + + + Sign Out + button + Kijelentkezés + + + YearFrame - + Y Év @@ -895,17 +1215,17 @@ today - - - - - - - - + + + + + + + + Today Today Ma - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar_it.ts dde-calendar-5.10.0/translations/dde-calendar_it.ts --- dde-calendar-5.9.1/translations/dde-calendar_it.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar_it.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,38 +1,96 @@ - + + + + + AccountItem + + + Sync successful + Sincronizzazione riuscita + + + + Network error + Errore rete + + + + Server exception + Eccezione del server + + + + Storage full + Memoria piena + + + + AccountManager + + + Local account + Account locale + + + + Event types + Tipi di evento + + + + CColorPickerWidget + + + Color + Colore + + + + Cancel + button + Annulla + + + + Save + button + Salva + + CDayMonthView - + Monday Lunedì - + Tuesday Martedì - + Wednesday Mercoledì - + Thursday Giovedì - + Friday Venerdì - + Saturday Sabato - + Sunday Domenica @@ -40,25 +98,30 @@ CDayWindow - + Y Y - + M M - + D D + + + Lunar + Lunare + CGraphicsView - + New Event Nuovo evento @@ -66,7 +129,7 @@ CMonthScheduleNumItem - + %1 more %1 in più @@ -74,12 +137,12 @@ CMonthView - + New event Nuovo evento - + New Event Nuovo evento @@ -87,7 +150,7 @@ CMonthWindow - + Y Y @@ -95,258 +158,301 @@ CMyScheduleView - + My Event I miei eventi - + OK button OK - + Delete button Elimina - + Edit button Modifica + CPushButton + + + New event type + Nuovo tipo di evento + + + CScheduleDlg - - + + + New Event Nuovo evento - + Edit Event Modifica evento - + End time must be greater than start time La data di fine deve essere maggiore di quella di inizio - + OK button OK - - - - + + + + + + Never Mai - + At time of event All'ora dell'evento - + 15 minutes before 15 minuti prima - + 30 minutes before 30 minuti prima - + 1 hour before 1 ora prima - - + + 1 day before 1 giorno prima - - + + 2 days before 2 giorni prima - - + + 1 week before 1 settimana prima - + On start day (9:00 AM) All'inizio della giornata (9:00 AM) - - + + + + + time(s) + volta(e) + + + + Enter a name please + Inserisci un nome + + + + The name can not only contain whitespaces + Il nome non può contenere solo spazi bianchi + + + + Type: Tipo: - - + + Description: Descrizione: - - + + All Day: Tutto il giorno: - - + + Starts: Inizio: - - + + Ends: Fine: - - + + Remind Me: Promemoria: - - + + Repeat: Ripetizione: - - + + End Repeat: Fine ripetizione: - - Type - Tipo + + Calendar account: + Account calendario: - - Work - Lavoro - - - - Life - Personale + + Calendar account + Account calendario - - Other - Altro + + Type + Tipo - + Description Descrizione - + All Day Tutto il giorno - + + Time: + Ora: + + + + Time + Ora + + + + Solar + Solare + + + + Lunar + Lunare + + + Starts Inizio - + Ends Fine - + Remind Me Promemoria - + Repeat Ripetizione - + + Daily Giornaliera - + + Weekdays Giorni della settimana - + + Weekly Settimanale - + + + Monthly Mensile - + + + Yearly Annuale - + End Repeat Fine ripetizione - + After Dopo - + On Acceso - - - - - time(s) - volta(e) - - - + Cancel button Annulla - + Save button Salva @@ -355,115 +461,126 @@ CScheduleOperation - + All occurrences of a repeating event must have the same all-day status. Tutte le occorrenze di una ripetizione devono avere i medesimi parametri. - - + + Do you want to change all occurrences? Desideri modificare tutte le occorrenze? - + + + + + + + Cancel + button + Annulla + + + + Change All Cambia tutte - + You are changing the repeating rule of this event. Stai cambiando le regole di pianificazione di questo evento. - - - + + + You are deleting an event. Stai eliminando un evento. - + Are you sure you want to delete this event? Sicuro di voler eliminare questo evento? - - - - - - - - Cancel - button - Annulla - - - + Delete button Elimina - + Do you want to delete all occurrences of this event, or only the selected occurrence? Desideri eliminare tutte le occorrenze di questo evento, oppure solo quella selezionata? - + Delete All Eliminale tutte - - + + Delete Only This Event Elimina solo questo evento - + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? Desideri eliminare questa e tutte le occorrenze successive di questo evento, oppure solo quella selezionata? - + Delete All Future Events Tutte le occorrenze future - - + + You are changing a repeating event. Stai modificando un evento ripetitivo - + Do you want to change only this occurrence of the event, or all occurrences? Desideri modificare solo questa occorrenza dell'evento, o tutte quelle ad esso associate? - + All Tutti - - + + Only This Event Solo questo evento - + Do you want to change only this occurrence of the event, or this and all future occurrences? Desideri modificare solo il singolo evento,oppure tutte le future ripetizioni? - + All Future Events Tutte le future ripetizioni + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + Hai selezionato un mese bisestile e ti verrà ricordato secondo le regole del calendario lunare. + + + + OK + button + OK + CScheduleSearchDateItem @@ -486,17 +603,17 @@ CScheduleSearchItem - + Edit Modifica - + Delete Elimina - + All Day Tutto il giorno @@ -512,61 +629,163 @@ CScheduleView - + ALL DAY Tutto il giorno + CSettingDialog + + + Sunday + Domenica + + + + Monday + Lunedì + + + + 24-hour clock + Orologio 24 ore + + + + 12-hour clock + Orologio 12 ore + + + + Manual + Manuale + + + + 15 mins + 15 minuti + + + + 30 mins + 30 minuti + + + + 1 hour + 1 ora + + + + 24 hours + 24 ore + + + + Sync Now + Sincronizza ora + + + + Last sync + Ultima sincronizzazione + + + CTimeEdit - + (%1 mins) - + (%1 min) - + (%1 hour) - + (%1 ora) - + (%1 hours) - + (%1 ore) CTitleWidget - + Y A - + M M - + W S - + D G + + + + Search events and festivals + Cerca eventi + + + + CWeekWidget + + + Sun + Dom + + + + Mon + Lun + + + + Tue + Mar + + + + Wed + Mer + + + + Thu + Gio + + + + Fri + Ven + + + + Sat + Sab + CWeekWindow - + Week Settimana - + Y Y @@ -574,13 +793,13 @@ CYearScheduleView + - All Day Tutto il giorno - + No event Nessun evento @@ -588,7 +807,7 @@ CYearWindow - + Y Y @@ -596,12 +815,12 @@ CalendarWindow - + Calendar Calendario - + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. Calendario è uno strumento per visualizzare il calendario ma anche per pianificare in modo intelligente tutti gli eventi della propria vita quotidiana. Localizzazione italiana a cura di Massimo A. Carofano. @@ -610,46 +829,246 @@ Calendarmainwindow - + Calendar Calendario + + + Manage + Gestisci + + + + Privacy Policy + Privacy Policy + + + + Syncing... + Sincronizzazione... + + + + Sync successful + Sincronizzazione riuscita + + + + Sync failed, please try later + Sincronizzazione fallita, riprova più tardi + CenterWidget - + All Day Tutto il giorno + DAccountDataBase + + + Work + + + + + Life + + + + + Other + + + + + DAlarmManager + + + + + + Close + button + + + + + One day before start + + + + + Remind me tomorrow + + + + + Remind me later + + + + + 15 mins later + + + + + 1 hour later + + + + + 4 hours later + + + + + + + Tomorrow + + + + + Schedule Reminder + + + + + + %1 to %2 + + + + + + Today + Oggi + + + DragInfoGraphicsView - + Edit Modifica - + Delete Elimina - + New event Nuovo evento - + New Event Nuovo evento + JobTypeListView + + + You are deleting an event type. + Stai eliminando un tipo di evento. + + + + All events under this type will be deleted and cannot be recovered. + Tutti gli eventi di questo tipo verranno eliminati e non potranno essere recuperati. + + + + Cancel + button + Annulla + + + + Delete + button + Elimina + + + + QObject + + + + Manage calendar + Gestisci calendario + + + + + Event types + Tipi di evento + + + + Account settings + Impostazioni account + + + + Account + Account + + + + Select items to be synced + Seleziona elementi da sincronizzare + + + + Events + Eventi + + + + + General settings + Impostazioni generali + + + + Sync interval + Intervallo di sincronizzazione + + + + Calendar account + Account calendario + + + + General + Generale + + + + First day of week + Primo giorno della settimana + + + + Time + Ora + + + Return - + Today Return Oggi @@ -658,56 +1077,138 @@ Return Today - - - + + + Today Return Today Oggi + ScheduleTypeEditDlg + + + New event type + Nuovo tipo di evento + + + + Edit event type + Modifica tipo di evento + + + + Name: + Nome: + + + + Color: + Colore: + + + + Cancel + button + Annulla + + + + Save + button + Salva + + + + The name can not only contain whitespaces + Il nome non può contenere solo spazi bianchi + + + + Enter a name please + Inserisci un nome + + + Shortcut - + Help Aiuto - + Delete event Elimina evento - + Copy Copia - + Cut Taglia - + Paste Incolla - + Delete Elimina - + Select all Seleziona tutto + SidebarCalendarWidget + + + Y + A + + + + M + M + + + + TimeJumpDialog + + + Go + button + Vai + + + + UserloginWidget + + + Sign In + button + Login + + + + Sign Out + button + Logout + + + YearFrame - + Y Y @@ -715,17 +1216,17 @@ today - - - - - - - - + + + + + + + + Today Today Oggi - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar_ja.ts dde-calendar-5.10.0/translations/dde-calendar_ja.ts --- dde-calendar-5.9.1/translations/dde-calendar_ja.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar_ja.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,38 +1,96 @@ - + + + + + AccountItem + + + Sync successful + + + + + Network error + + + + + Server exception + + + + + Storage full + + + + + AccountManager + + + Local account + + + + + Event types + + + + + CColorPickerWidget + + + Color + + + + + Cancel + button + キャンセル + + + + Save + button + 保存 + + CDayMonthView - + Monday 月曜日 - + Tuesday 火曜日 - + Wednesday 水曜日 - + Thursday 木曜日 - + Friday 金曜日 - + Saturday 土曜日 - + Sunday 日曜日 @@ -40,25 +98,30 @@ CDayWindow - + Y - + M - + D + + + Lunar + + CGraphicsView - + New Event 新規イベント @@ -66,20 +129,20 @@ CMonthScheduleNumItem - + %1 more - + CMonthView - + New event 新規イベント - + New Event 新規イベント @@ -87,7 +150,7 @@ CMonthWindow - + Y @@ -95,258 +158,301 @@ CMyScheduleView - + My Event イベント - + OK button OK - + Delete button 削除 - + Edit button 編集 + CPushButton + + + New event type + + + + CScheduleDlg - - + + + New Event 新しイベント - + Edit Event イベントを編集 - + End time must be greater than start time 開始時間より前の時間を設定して下さい - + OK button OK - - - - + + + + + + Never しない - + At time of event イベント時 - + 15 minutes before 15分前 - + 30 minutes before 30分前 - + 1 hour before 1時間前 - - + + 1 day before 一日前 - - + + 2 days before 2日前 - - + + 1 week before 1週間前 - + On start day (9:00 AM) 開始日 (9:00) に - - + + Enter a name please + + + + + The name can not only contain whitespaces + + + + + Type: 種類: - - + + Description: 説明: - - + + All Day: 終日: - - + + Starts: 開始: - - + + Ends: 終了: - - + + Remind Me: 通知: - - + + Repeat: 繰り返し: - - + + End Repeat: 繰り返し終了: - - Type - 種類 - - - - Work - 仕事 + + Calendar account: + - - Life - 生活 + + Calendar account + - - Other - その他 + + Type + 種類 - + Description 説明 - + All Day 終日 - + + Time: + + + + + Time + + + + + Solar + + + + + Lunar + + + + Starts 開始 - + Ends 終了 - + Remind Me 通知 - + Repeat 繰り返す - + + Daily 毎日 - + + Weekdays 平日 - + + Weekly 毎週 - + + + Monthly 毎月 - + + + Yearly 毎年 - + End Repeat 繰り返し終了 - + After - + On オン - - - - + + + + time(s) 回後 - + Cancel button キャンセル - + Save button 保存 @@ -355,115 +461,126 @@ CScheduleOperation - + All occurrences of a repeating event must have the same all-day status. - + - - + + Do you want to change all occurrences? - + - - + + Change All すべて変更 - + You are changing the repeating rule of this event. このイベントの繰り返しルールを変更しています。 - - - + + + You are deleting an event. イベントを削除しています。 - + Are you sure you want to delete this event? イベントを削除してもよろしいですか? - - - - - - - + + + + + + + Cancel button キャンセル - + Delete button 削除 - + Do you want to delete all occurrences of this event, or only the selected occurrence? - + - + Delete All 全て削除 - - + + Delete Only This Event このイベントのみ削除 - + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? - + - + Delete All Future Events 今後のイベントをすべて削除 - - + + You are changing a repeating event. 繰り返しイベントを変更しています。 - + Do you want to change only this occurrence of the event, or all occurrences? - + - + All すべて - - + + Only This Event このイベントのみ - + Do you want to change only this occurrence of the event, or this and all future occurrences? - + - + All Future Events 今後のすべてのイベント + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + + OK + button + OK + CScheduleSearchDateItem @@ -486,17 +603,17 @@ CScheduleSearchItem - + Edit 編集 - + Delete 削除 - + All Day 終日 @@ -512,61 +629,163 @@ CScheduleView - + ALL DAY 終日 + CSettingDialog + + + Sunday + 日曜日 + + + + Monday + 月曜日 + + + + 24-hour clock + + + + + 12-hour clock + + + + + Manual + + + + + 15 mins + + + + + 30 mins + + + + + 1 hour + + + + + 24 hours + + + + + Sync Now + + + + + Last sync + + + + CTimeEdit - + (%1 mins) - + - + (%1 hour) - + - + (%1 hours) - + CTitleWidget - + Y - + M - + W - + D + + + + Search events and festivals + + + + + CWeekWidget + + + Sun + + + + + Mon + + + + + Tue + + + + + Wed + + + + + Thu + + + + + Fri + + + + + Sat + + CWeekWindow - + Week - + Y @@ -574,13 +793,13 @@ CYearScheduleView + - All Day 終日 - + No event イベントなし @@ -588,7 +807,7 @@ CYearWindow - + Y @@ -596,12 +815,12 @@ CalendarWindow - + Calendar カレンダー - + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. カレンダーは、日付を表示するツールであり、また生活のあらゆることをスケジューリングするスマートデイリープランナーです。 @@ -609,46 +828,246 @@ Calendarmainwindow - + Calendar カレンダー + + + Manage + + + + + Privacy Policy + + + + + Syncing... + + + + + Sync successful + + + + + Sync failed, please try later + + CenterWidget - + All Day 終日 + DAccountDataBase + + + Work + 仕事 + + + + Life + 生活 + + + + Other + その他 + + + + DAlarmManager + + + + + + Close + button + + + + + One day before start + + + + + Remind me tomorrow + + + + + Remind me later + + + + + 15 mins later + + + + + 1 hour later + + + + + 4 hours later + + + + + + + Tomorrow + + + + + Schedule Reminder + + + + + + %1 to %2 + + + + + + Today + 今日 + + + DragInfoGraphicsView - + Edit 編集 - + Delete 削除 - + New event 新規イベント - + New Event 新規イベント + JobTypeListView + + + You are deleting an event type. + + + + + All events under this type will be deleted and cannot be recovered. + + + + + Cancel + button + キャンセル + + + + Delete + button + 削除 + + + + QObject + + + Account settings + + + + + Account + + + + + Select items to be synced + + + + + Events + + + + + + General settings + + + + + Sync interval + + + + + + Manage calendar + + + + + Calendar account + + + + + + Event types + + + + + General + + + + + First day of week + + + + + Time + + + + Return - + Today Return 今日 @@ -657,56 +1076,138 @@ Return Today - - - + + + Today Return Today 今日 + ScheduleTypeEditDlg + + + New event type + + + + + Edit event type + + + + + Name: + + + + + Color: + + + + + Cancel + button + キャンセル + + + + Save + button + 保存 + + + + The name can not only contain whitespaces + + + + + Enter a name please + + + + Shortcut - + Help ヘルプ - + Delete event イベントを削除 - + Copy コピー - + Cut 切り取り - + Paste 貼り付け - + Delete 削除 - + Select all すべて選択 + SidebarCalendarWidget + + + Y + + + + + M + + + + + TimeJumpDialog + + + Go + button + + + + + UserloginWidget + + + Sign In + button + + + + + Sign Out + button + + + + YearFrame - + Y @@ -714,17 +1215,17 @@ today - - - - - - - - + + + + + + + + Today Today 今日 - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar_kab.ts dde-calendar-5.10.0/translations/dde-calendar_kab.ts --- dde-calendar-5.9.1/translations/dde-calendar_kab.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar_kab.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,38 +1,96 @@ - + + + + + AccountItem + + + Sync successful + + + + + Network error + + + + + Server exception + + + + + Storage full + + + + + AccountManager + + + Local account + + + + + Event types + + + + + CColorPickerWidget + + + Color + + + + + Cancel + button + Sefsex + + + + Save + button + Sekles + + CDayMonthView - + Monday Arim - + Tuesday Aram - + Wednesday Ahad - + Thursday Amhad - + Friday Sem - + Saturday Sed - + Sunday Acer @@ -40,25 +98,30 @@ CDayWindow - + Y Aseggas - + M Ayyur - + D Ass + + + Lunar + + CGraphicsView - + New Event Tadyant tamaynut @@ -74,12 +137,12 @@ CMonthView - + New event Tadyant tamaynut - + New Event Tadyant tamaynut @@ -87,7 +150,7 @@ CMonthWindow - + Y Aseggas @@ -95,258 +158,301 @@ CMyScheduleView - + My Event Tadyant-iw - + OK button IH - + Delete button Kkes - + Edit button Ẓreg + CPushButton + + + New event type + + + + CScheduleDlg - - + + + New Event Tadyant tamaynut - + Edit Event Ẓreg tadyant - + End time must be greater than start time Akud n taggara yezmer d netta ara igerrzen ɣef wakud n tazwara - + OK button IH - - - - + + + + + + Never Werǧin - + At time of event Deg wakud n tedyant - + 15 minutes before 15 tesdatin send - + 30 minutes before 30 tesdatin send - + 1 hour before 1 usrag send - - + + 1 day before 1 wass send - - + + 2 days before 2 wussan send - - + + 1 week before 1 dduṛt send - + On start day (9:00 AM) Deg tazwara n wass (9:00 SRG) - - + + Enter a name please + + + + + The name can not only contain whitespaces + + + + + Type: Anaw: - - + + Description: Aglam: - - + + All Day: Yal ass: - - + + Starts: Yebda - - + + Ends: Yekfa - - + + Remind Me: Smekti-yi-d: - - + + Repeat: Ales - - + + End Repeat: Taggara n wallus: - - Type - Anaw - - - - Work - Amahil + + Calendar account: + - - Life - Tudert + + Calendar account + - - Other - Wayeḍ + + Type + Anaw - + Description Aglam - + All Day Meṛṛa ass - + + Time: + + + + + Time + + + + + Solar + + + + + Lunar + + + + Starts Yebda - + Ends Yekfa - + Remind Me Smekti-yi-d - + Repeat Ales - + + Daily S wass - + + Weekdays Ussan n yimalas - + + Weekly S yimalas - + + + Monthly S wayyur - + + + Yearly S useggas - + End Repeat Taggara n wallus - + After Seld - + On Ɣef - - - - + + + + time(s) Akud (akuden) - + Cancel button Sefsex - + Save button Sekles @@ -355,130 +461,141 @@ CScheduleOperation - + All occurrences of a repeating event must have the same all-day status. Meṛṛa timeḍriwin n tedyant i d-yettuɣalen ilaq ad sɛunt yiwen waddad i wass kamel. - - + + Do you want to change all occurrences? Tebɣiḍ ad tesnefleḍ meṛṛa timeḍriwin? - - + + Change All Senfel kullec - + You are changing the repeating rule of this event. Tbeddleḍ alugen i d-yettuɣalen n tedyant-a. - - - + + + You are deleting an event. Tekkseḍ yiwet tedyant. - + Are you sure you want to delete this event? D tidet tebɣiḍ ad tekkseḍ tadyant-a? - - - - - - - + + + + + + + Cancel button Sefsex - + Delete button Kkes - + Do you want to delete all occurrences of this event, or only the selected occurrence? Tebɣiḍ ad tekkseḍ meṛṛa timeḍriwin n tedyant-a neɣ tid kan i d-yettwafernen? - + Delete All Kkes kullec - - + + Delete Only This Event Kkes kan tadyant-a - + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? Tebɣiḍ ad tekkseḍ timeḍriwt-a d tid meṛṛa i d-iteddun, neɣ d tid kan i d-yettufernen? - + Delete All Future Events Kkes meṛṛa tidyanin i d-iteddun - - + + You are changing a repeating event. Tbeddleḍ tadyant i d-yettuɣalen. - + Do you want to change only this occurrence of the event, or all occurrences? Tebɣiḍ ad tbeddleḍ timeḍriwt-agi kan n tedyant, neɣ meṛṛa timeḍriwen? - + All Meṛṛa - - + + Only This Event Tadyant-agi kan - + Do you want to change only this occurrence of the event, or this and all future occurrences? Tebɣiḍ ad tbeddleḍ timeḍriwt-a n tedyant, neɣ tagi d meṛṛa timeḍriwen i d-iteddun? - + All Future Events Tidyanin akk i d-iteddun + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + + OK + button + IH + CScheduleSearchDateItem - + Y Aseggas - + M Ayyur - + D Ass @@ -486,17 +603,17 @@ CScheduleSearchItem - + Edit Ẓreg - + Delete Kkes - + All Day Meṛṛa ass @@ -504,7 +621,7 @@ CScheduleSearchView - + No search results Ulac igmaḍ n unadi @@ -518,55 +635,157 @@ + CSettingDialog + + + Sunday + Acer + + + + Monday + Arim + + + + 24-hour clock + + + + + 12-hour clock + + + + + Manual + + + + + 15 mins + + + + + 30 mins + + + + + 1 hour + + + + + 24 hours + + + + + Sync Now + + + + + Last sync + + + + CTimeEdit - + (%1 mins) - + - + (%1 hour) - + - + (%1 hours) - + CTitleWidget - + Y Aseggas - + M Ayyur - + W Imalas - + D Ass + + + + Search events and festivals + + + + + CWeekWidget + + + Sun + + + + + Mon + + + + + Tue + + + + + Wed + + + + + Thu + + + + + Fri + + + + + Sat + + CWeekWindow - + Week Dduṛt - + Y Aseggas @@ -574,13 +793,13 @@ CYearScheduleView - - + + All Day Meṛṛa ass - + No event Ulac tadyant @@ -588,7 +807,7 @@ CYearWindow - + Y Aseggas @@ -596,12 +815,12 @@ CalendarWindow - + Calendar Awitay - + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. Awitay d afecku i uskan n wazemz akked daɣen d aɣawas n yal ass i usɣiwes n wayen akk ara tgeḍ deg tudert. @@ -609,46 +828,244 @@ Calendarmainwindow - + Calendar Awitay + + + Manage + + + + + Privacy Policy + + + + + Syncing... + + + + + Sync successful + + + + + Sync failed, please try later + + CenterWidget - + All Day Yal ass + DAccountDataBase + + + Work + Amahil + + + + Life + Tudert + + + + Other + Wayeḍ + + + + DAlarmManager + + + + + + Close + button + + + + + One day before start + + + + + Remind me tomorrow + + + + + Remind me later + + + + + 15 mins later + + + + + 1 hour later + + + + + 4 hours later + + + + + + + Tomorrow + + + + + Schedule Reminder + + + + + + %1 to %2 + + + + + + Today + Ass-a + + + DragInfoGraphicsView - + Edit Ẓreg - + Delete Kkes - + New event Tadyant tamaynut - + New Event Tadyant tamaynut + JobTypeListView + + + You are deleting an event type. + + + + + All events under this type will be deleted and cannot be recovered. + + + + + Cancel + button + Sefsex + + + + Delete + button + Kkes + + + + QObject + + + Account settings + + + + + Account + + + + + Select items to be synced + + + + + Events + + + + + + General settings + + + + + Sync interval + + + + + Manage calendar + + + + + Calendar account + + + + + Event types + + + + + General + + + + + First day of week + + + + + Time + + + + Return - + Today Return Ass-a @@ -657,15 +1074,60 @@ Return Today - - - + + + Today Return Today Ass-a + ScheduleTypeEditDlg + + + New event type + + + + + Edit event type + + + + + Name: + + + + + Color: + + + + + Cancel + button + Sefsex + + + + Save + button + Sekles + + + + The name can not only contain whitespaces + + + + + Enter a name please + + + + Shortcut @@ -704,9 +1166,46 @@ + SidebarCalendarWidget + + + Y + Aseggas + + + + M + Ayyur + + + + TimeJumpDialog + + + Go + button + + + + + UserloginWidget + + + Sign In + button + + + + + Sign Out + button + + + + YearFrame - + Y Aseggas @@ -714,17 +1213,17 @@ today - - - - + + + + - - - + + + Today Today Ass-a - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar_ka.ts dde-calendar-5.10.0/translations/dde-calendar_ka.ts --- dde-calendar-5.9.1/translations/dde-calendar_ka.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar_ka.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,38 +1,96 @@ - + + + + + AccountItem + + + Sync successful + + + + + Network error + + + + + Server exception + + + + + Storage full + + + + + AccountManager + + + Local account + + + + + Event types + + + + + CColorPickerWidget + + + Color + + + + + Cancel + button + გაუქმება + + + + Save + button + შენახვა + + CDayMonthView - + Monday ორშაბათი - + Tuesday სამშაბათი - + Wednesday ოთხშაბათი - + Thursday ხუთშაბათი - + Friday პარასკევი - + Saturday შაბათი - + Sunday კვირა @@ -40,25 +98,30 @@ CDayWindow - + Y - + M - + D + + + Lunar + + CGraphicsView - + New Event ახალი ივენთი @@ -66,7 +129,7 @@ CMonthScheduleNumItem - + %1 more %1 მეტი @@ -74,12 +137,12 @@ CMonthView - + New event ახალი ივენთი - + New Event ახალი ივენთი @@ -87,7 +150,7 @@ CMonthWindow - + Y @@ -95,258 +158,301 @@ CMyScheduleView - + My Event ჩემი ივენთები - + OK button OK - + Delete button წაშლა - + Edit button რედაქტირება + CPushButton + + + New event type + + + + CScheduleDlg - - + + + New Event ჩემი ივენთები - + Edit Event ივენთის რედაქტირება - + End time must be greater than start time დასრულების დრო უნდა აღემატებოდეს დაწყების დროს - + OK button OK - - - - + + + + + + Never არასდროს - + At time of event ივენთის სრული დრო - + 15 minutes before 15 წუთით ადრე - + 30 minutes before 30 წუთით ადრე - + 1 hour before 1 საათით ადრე - - + + 1 day before 1 დღით ადრე - - + + 2 days before 2 დღით ადრე - - + + 1 week before 1 კვირით ადრე - + On start day (9:00 AM) დრის დასაწყისში (9:00 AM) - - + + Enter a name please + + + + + The name can not only contain whitespaces + + + + + Type: ტიპი: - - + + Description: აღწერა: - - + + All Day: მთელი დღე: - - + + Starts: დასაწყისი: - - + + Ends: დასასრული: - - + + Remind Me: შემახსენე: - - + + Repeat: გამეორება: - - + + End Repeat: გამეორების დასასრული: - - Type - ტიპი - - - - Work - სამსახური + + Calendar account: + - - Life - ცხოვრება + + Calendar account + - - Other - სხვა + + Type + ტიპი - + Description აღწერა - + All Day ყველა დღე - + + Time: + + + + + Time + + + + + Solar + + + + + Lunar + + + + Starts დასაწყისი - + Ends დასასრული - + Remind Me შემახსენე - + Repeat განმეორება - + + Daily დღიური - + + Weekdays ვიქენდი - + + Weekly კვირეული - + + + Monthly თვიური - + + + Yearly წლიური - + End Repeat განმეორების დასასრული - + After შემდეგ - + On ზე - - - - + + + + time(s) ჯერ - + Cancel button გაუქმება - + Save button შენახვა @@ -355,115 +461,126 @@ CScheduleOperation - + All occurrences of a repeating event must have the same all-day status. ყველა განმეორებად მოვლენებს უნდა ჰქონდეს ყველა დღის სტატუს - - + + Do you want to change all occurrences? გსურთი მოვლენების შეცვლა? - - + + Change All ყველას შეცვლა - + You are changing the repeating rule of this event. თქვენ ცვლით განმეორების რულებს აღნიშნული ივენთისთვის - - - + + + You are deleting an event. თქვენ შლით ივენთს - + Are you sure you want to delete this event? დაწრმუნებული ხართ, რომ გსურთ ამ ივენთის წაშლა? - - - - - - - + + + + + + + Cancel button გაუქმება - + Delete button წაშლა - + Do you want to delete all occurrences of this event, or only the selected occurrence? გსრუთ აღნიშნული მოვლენების ივენთიდან ამოშლა? - + Delete All ყველას წაშლა - - + + Delete Only This Event მხოლოდ ამ ივენთის წაშლა - + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? გსურთ წაშალოთ ყველა შემდგომი მოვლენა, თუ მხოლოდ არჩეული მოვლენები? - + Delete All Future Events ყველა მომდევნო მოვლენის წაშლა - - + + You are changing a repeating event. თქვენ ცვლით განმეორებად ივენთს - + Do you want to change only this occurrence of the event, or all occurrences? გსრუთ ყველა მოვლენის შეცვლა, თუ მხოლოდ მონიშნულის? - + All ყველა - - + + Only This Event მხოლოდ ეს ივენთი - + Do you want to change only this occurrence of the event, or this and all future occurrences? მხოლოდ ამ ერთი მოვლენის შეცვლა, თუ ყველა მომდევნო მოვლენის შეცვლა? - + All Future Events ყველა მომდევნო ივენთი + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + + OK + button + OK + CScheduleSearchDateItem @@ -486,17 +603,17 @@ CScheduleSearchItem - + Edit რედაქტირება - + Delete წაშლა - + All Day ყველა დღე @@ -512,61 +629,163 @@ CScheduleView - + ALL DAY ყველა დღე + CSettingDialog + + + Sunday + კვირა + + + + Monday + ორშაბათი + + + + 24-hour clock + + + + + 12-hour clock + + + + + Manual + + + + + 15 mins + + + + + 30 mins + + + + + 1 hour + + + + + 24 hours + + + + + Sync Now + + + + + Last sync + + + + CTimeEdit - + (%1 mins) - + - + (%1 hour) - + - + (%1 hours) - + CTitleWidget - + Y - + M - + W - + D + + + + Search events and festivals + + + + + CWeekWidget + + + Sun + + + + + Mon + + + + + Tue + + + + + Wed + + + + + Thu + + + + + Fri + + + + + Sat + + CWeekWindow - + Week კვირა - + Y @@ -574,13 +793,13 @@ CYearScheduleView + - All Day ყველა დღე - + No event არ არის ივენთი @@ -588,7 +807,7 @@ CYearWindow - + Y @@ -596,12 +815,12 @@ CalendarWindow - + Calendar კალენდარი - + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. კალენდარი არის ხელსაწყო თარიღების სანახავად და გრაფიკის დასაგეგმად @@ -609,46 +828,246 @@ Calendarmainwindow - + Calendar კალენდარი + + + Manage + + + + + Privacy Policy + + + + + Syncing... + + + + + Sync successful + + + + + Sync failed, please try later + + CenterWidget - + All Day ყველა დღე + DAccountDataBase + + + Work + სამსახური + + + + Life + ცხოვრება + + + + Other + სხვა + + + + DAlarmManager + + + + + + Close + button + + + + + One day before start + + + + + Remind me tomorrow + + + + + Remind me later + + + + + 15 mins later + + + + + 1 hour later + + + + + 4 hours later + + + + + + + Tomorrow + + + + + Schedule Reminder + + + + + + %1 to %2 + + + + + + Today + დღეს + + + DragInfoGraphicsView - + Edit რედაქტირება - + Delete წაშლა - + New event ახალი ივენთი - + New Event ახალი ივენთი + JobTypeListView + + + You are deleting an event type. + + + + + All events under this type will be deleted and cannot be recovered. + + + + + Cancel + button + გაუქმება + + + + Delete + button + წაშლა + + + + QObject + + + Account settings + + + + + Account + + + + + Select items to be synced + + + + + Events + + + + + + General settings + + + + + Sync interval + + + + + + Manage calendar + + + + + Calendar account + + + + + + Event types + + + + + General + + + + + First day of week + + + + + Time + + + + Return - + Today Return დღეს @@ -657,56 +1076,138 @@ Return Today - - - + + + Today Return Today დღეს + ScheduleTypeEditDlg + + + New event type + + + + + Edit event type + + + + + Name: + + + + + Color: + + + + + Cancel + button + გაუქმება + + + + Save + button + შენახვა + + + + The name can not only contain whitespaces + + + + + Enter a name please + + + + Shortcut - + Help დახმარება - + Delete event ივენთის წაშლა - + Copy კოპირება - + Cut ამოჭრა - + Paste ჩასმა - + Delete წაშლა - + Select all ყველას მონიშნვა + SidebarCalendarWidget + + + Y + + + + + M + + + + + TimeJumpDialog + + + Go + button + + + + + UserloginWidget + + + Sign In + button + + + + + Sign Out + button + + + + YearFrame - + Y @@ -714,17 +1215,17 @@ today - - - - - - - - + + + + + + + + Today Today დღეს - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar_km_KH.ts dde-calendar-5.10.0/translations/dde-calendar_km_KH.ts --- dde-calendar-5.9.1/translations/dde-calendar_km_KH.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar_km_KH.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,38 +1,96 @@ - + + + + + AccountItem + + + Sync successful + + + + + Network error + + + + + Server exception + + + + + Storage full + + + + + AccountManager + + + Local account + + + + + Event types + + + + + CColorPickerWidget + + + Color + + + + + Cancel + button + បោះបង់ + + + + Save + button + រក្សាទុក + + CDayMonthView - + Monday ថ្ងៃចន្ទ - + Tuesday ថ្ងៃអង្គារ - + Wednesday ថ្ងៃពុធ - + Thursday ថ្ងៃព្រហស្បតិ៍ - + Friday ថ្ងៃសុក្រ - + Saturday ថ្ងៃសៅរ៍ - + Sunday ថ្ងៃអាទិត្យ @@ -40,25 +98,30 @@ CDayWindow - + Y ឆ្នាំ - + M ខែ - + D ថ្ងៃ + + + Lunar + + CGraphicsView - + New Event ព្រឹត្តិការណ៍ថ្មី @@ -66,20 +129,20 @@ CMonthScheduleNumItem - + %1 more - + CMonthView - + New event ព្រឹត្តិការណ៍ថ្មី - + New Event ព្រឹត្តិការណ៍ថ្មី @@ -87,7 +150,7 @@ CMonthWindow - + Y ឆ្នាំ @@ -95,258 +158,301 @@ CMyScheduleView - + My Event ព្រឹត្តិការណ៍របស់ខ្ញុំ - + OK button យល់ព្រម - + Delete button លុប - + Edit button កែសម្រួល + CPushButton + + + New event type + + + + CScheduleDlg - - + + + New Event ព្រឹត្តិការណ៍ថ្មី - + Edit Event កែព្រឹត្តិការណ៍ - + End time must be greater than start time - + - + OK button យល់ព្រម - - - - + + + + + + Never មិនដែល - + At time of event នៅពេលព្រឹត្តិការណ៍ - + 15 minutes before 15 នាទីមុន - + 30 minutes before 30 នាទីមុន - + 1 hour before 1 ម៉ោងមុន - - + + 1 day before 1 ថ្ងៃមុន - - + + 2 days before 2 ថ្ងៃមុន - - + + 1 week before 1 សប្តាហ៍មុន - + On start day (9:00 AM) នៅថ្ងៃចាប់ផ្តើម (9:00 ព្រឹក) - - + + Enter a name please + + + + + The name can not only contain whitespaces + + + + + Type: ប្រភេទ: - - + + Description: ការពិពណ៌នាសង្ខេប: - - + + All Day: ពេញមួយថ្ងៃ៖ - - + + Starts: ចាប់ផ្តើម៖ - - + + Ends: បញ្ចប់៖ - - + + Remind Me: រំឭក​ខ្ញុំ: - - + + Repeat: ធ្វើម្តងទៀត៖ - - + + End Repeat: បញ្ចប់ម្តងទៀត៖ - - Type - + + Calendar account: + - - Work - ធ្វើការ - - - - Life - ជីវិត + + Calendar account + - - Other - ផ្សេងទៀត + + Type + - + Description - + - + All Day ពេញមួយថ្ងៃ - + + Time: + + + + + Time + + + + + Solar + + + + + Lunar + + + + Starts - + - + Ends - + - + Remind Me - + - + Repeat - + - + + Daily រាល់ថ្ងៃ - + + Weekdays ថ្ងៃធ្វើការ - + + Weekly ប្រចាំសប្តាហ៍ - + + + Monthly ប្រចាំខែ - + + + Yearly ប្រចាំឆ្នាំ - + End Repeat - + - + After បន្ទាប់ពី - + On បើក - - - - + + + + time(s) ដង() - + Cancel button បោះបង់ - + Save button រក្សាទុក @@ -355,115 +461,126 @@ CScheduleOperation - + All occurrences of a repeating event must have the same all-day status. រាល់ការកើតឡើងនៃព្រឹត្តិការណ៍ដដែលៗត្រូវតែមានស្ថានភាពពេញមួយថ្ងៃ។ - - + + Do you want to change all occurrences? តើអ្នកចង់ផ្លាស់ប្តូរការកើតឡើងទាំងអស់ទេ? - - + + Change All ផ្លាស់ប្តូរទាំងអស់ - + You are changing the repeating rule of this event. អ្នកកំពុងផ្លាស់ប្តូរវិធានដដែលៗនៃព្រឹត្តិការណ៍នេះ។ - - - + + + You are deleting an event. អ្នកកំពុងលុបព្រឹត្តិការណ៍មួយ។ - + Are you sure you want to delete this event? តើអ្នកប្រាកដជាចង់លុបព្រឹត្តិការណ៍នេះឬ? - - - - - - - + + + + + + + Cancel button បោះបង់ - + Delete button លុប - + Do you want to delete all occurrences of this event, or only the selected occurrence? តើអ្នកចង់លុបរាល់ការកើតឡើងនៃព្រឹត្តិការណ៍នេះឬតែការកើតឡើងដែលបានជ្រើសរើសទេ? - + Delete All លុបទាំងអស់ - - + + Delete Only This Event លុបតែព្រឹត្តិការណ៍នេះ - + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? តើអ្នកចង់លុបវានិងការកើតឡើងនាពេលអនាគតនៃព្រឹត្តិការណ៍នេះឬមានតែការកើតឡើងដែលបានជ្រើសរើសទេ? - + Delete All Future Events លុបព្រឹត្តិការណ៍អនាគតទាំងអស់ - - + + You are changing a repeating event. អ្នកកំពុងផ្លាស់ប្តូរព្រឹត្តិការណ៍ដដែលៗ។ - + Do you want to change only this occurrence of the event, or all occurrences? តើអ្នកចង់ផ្លាស់ប្តូរតែការកើតឡើងនៃព្រឹត្តិការណ៍នេះឬការកើតឡើងទាំងអស់ទេ? - + All ទាំងអស់ - - + + Only This Event តែព្រឹត្តិការណ៍នេះទេ - + Do you want to change only this occurrence of the event, or this and all future occurrences? តើអ្នកចង់ផ្លាស់ប្តូរតែការកើតឡើងនៃព្រឹត្តិការណ៍នេះឬព្រឹត្តិការណ៍នេះនិងការកើតឡើងនាពេលអនាគតទេ? - + All Future Events ព្រឹត្តិការណ៍អនាគតទាំងអស់ + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + + OK + button + យល់ព្រម + CScheduleSearchDateItem @@ -486,17 +603,17 @@ CScheduleSearchItem - + Edit កែសម្រួល - + Delete លុប - + All Day ពេញមួយថ្ងៃ @@ -512,61 +629,163 @@ CScheduleView - + ALL DAY ពេញមួយថ្ងៃ + CSettingDialog + + + Sunday + ថ្ងៃអាទិត្យ + + + + Monday + ថ្ងៃចន្ទ + + + + 24-hour clock + + + + + 12-hour clock + + + + + Manual + + + + + 15 mins + + + + + 30 mins + + + + + 1 hour + + + + + 24 hours + + + + + Sync Now + + + + + Last sync + + + + CTimeEdit - + (%1 mins) - + - + (%1 hour) - + - + (%1 hours) - + CTitleWidget - + Y ឆ្នាំ - + M ខែ - + W សប្ដាហ៍ - + D ថ្ងៃ + + + + Search events and festivals + + + + + CWeekWidget + + + Sun + + + + + Mon + + + + + Tue + + + + + Wed + + + + + Thu + + + + + Fri + + + + + Sat + + CWeekWindow - + Week សប្ដាហ៍ - + Y ឆ្នាំ @@ -574,13 +793,13 @@ CYearScheduleView + - All Day ពេញមួយថ្ងៃ - + No event គ្មានព្រឹត្តិការណ៍ @@ -588,7 +807,7 @@ CYearWindow - + Y ឆ្នាំ @@ -596,12 +815,12 @@ CalendarWindow - + Calendar ប្រតិទិន - + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. ប្រតិទិនគឺជាឧបករណ៍សម្រាប់មើលកាលបរិច្ឆេទហើយក៏ជាអ្នករៀបចំផែនការប្រចាំថ្ងៃដ៏ឆ្លាតវៃផងដែរដើម្បីរៀបចំកាលវិភាគទាំងអស់ក្នុងជីវិត។ @@ -609,46 +828,246 @@ Calendarmainwindow - + Calendar ប្រតិទិន + + + Manage + + + + + Privacy Policy + + + + + Syncing... + + + + + Sync successful + + + + + Sync failed, please try later + + CenterWidget - + All Day ពេញមួយថ្ងៃ + DAccountDataBase + + + Work + ធ្វើការ + + + + Life + ជីវិត + + + + Other + ផ្សេងទៀត + + + + DAlarmManager + + + + + + Close + button + + + + + One day before start + + + + + Remind me tomorrow + + + + + Remind me later + + + + + 15 mins later + + + + + 1 hour later + + + + + 4 hours later + + + + + + + Tomorrow + + + + + Schedule Reminder + + + + + + %1 to %2 + + + + + + Today + ថ្ងៃនេះ + + + DragInfoGraphicsView - + Edit កែសម្រួល - + Delete លុប - + New event ព្រឹត្តិការណ៍ថ្មី - + New Event ព្រឹត្តិការណ៍ថ្មី + JobTypeListView + + + You are deleting an event type. + + + + + All events under this type will be deleted and cannot be recovered. + + + + + Cancel + button + បោះបង់ + + + + Delete + button + លុប + + + + QObject + + + Account settings + + + + + Account + + + + + Select items to be synced + + + + + Events + + + + + + General settings + + + + + Sync interval + + + + + + Manage calendar + + + + + Calendar account + + + + + + Event types + + + + + General + + + + + First day of week + + + + + Time + + + + Return - + Today Return ថ្ងៃនេះ @@ -657,56 +1076,138 @@ Return Today - - - + + + Today Return Today ថ្ងៃនេះ + ScheduleTypeEditDlg + + + New event type + + + + + Edit event type + + + + + Name: + + + + + Color: + + + + + Cancel + button + បោះបង់ + + + + Save + button + រក្សាទុក + + + + The name can not only contain whitespaces + + + + + Enter a name please + + + + Shortcut - + Help ជំនួយ - + Delete event លុបព្រឹត្តិការណ៍ - + Copy ចម្លង - + Cut កាត់ - + Paste បិទភ្ជាប់ - + Delete លុប - + Select all ជ្រើស​យក​ទាំងអស់ + SidebarCalendarWidget + + + Y + ឆ្នាំ + + + + M + ខែ + + + + TimeJumpDialog + + + Go + button + + + + + UserloginWidget + + + Sign In + button + + + + + Sign Out + button + + + + YearFrame - + Y ឆ្នាំ @@ -714,17 +1215,17 @@ today - - - - - - - - + + + + + + + + Today Today ថ្ងៃនេះ - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar_ko.ts dde-calendar-5.10.0/translations/dde-calendar_ko.ts --- dde-calendar-5.9.1/translations/dde-calendar_ko.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar_ko.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,38 +1,96 @@ - + + + + + AccountItem + + + Sync successful + + + + + Network error + + + + + Server exception + + + + + Storage full + + + + + AccountManager + + + Local account + + + + + Event types + + + + + CColorPickerWidget + + + Color + + + + + Cancel + button + 취소 + + + + Save + button + 저장 + + CDayMonthView - + Monday 월요일 - + Tuesday 화요일 - + Wednesday 수요일 - + Thursday 목요일 - + Friday 금요일 - + Saturday 토요일 - + Sunday 일요일 @@ -40,25 +98,30 @@ CDayWindow - + Y - + M - + D + + + Lunar + + CGraphicsView - + New Event 새 이벤트 @@ -66,7 +129,7 @@ CMonthScheduleNumItem - + %1 more %1 더 @@ -74,12 +137,12 @@ CMonthView - + New event 새 이벤트 - + New Event 새 이벤트 @@ -87,7 +150,7 @@ CMonthWindow - + Y @@ -95,258 +158,301 @@ CMyScheduleView - + My Event 나의 이벤트 - + OK button 확인 - + Delete button 삭제 - + Edit button 편집 + CPushButton + + + New event type + + + + CScheduleDlg - - + + + New Event 새 이벤트 - + Edit Event 이벤트 편집 - + End time must be greater than start time 종료 시간은 시작 시간보다 커야 합니다. - + OK button 확인 - - - - + + + + + + Never 없음 - + At time of event 이벤트 시 - + 15 minutes before 15분 전 - + 30 minutes before 30분 전 - + 1 hour before 1시간 전 - - + + 1 day before 1일 전 - - + + 2 days before 2일 전 - - + + 1 week before 1주일 전 - + On start day (9:00 AM) 시작일 (오전 9:00) - - + + Enter a name please + + + + + The name can not only contain whitespaces + + + + + Type: 종류: - - + + Description: 설명: - - + + All Day: 하루 종일: - - + + Starts: 시작: - - + + Ends: 종료 - - + + Remind Me: 알림 메시지: - - + + Repeat: 반복: - - + + End Repeat: 종료 반복: - - Type - 타입 - - - - Work - 작업 + + Calendar account: + - - Life - 생활 + + Calendar account + - - Other - 기타 + + Type + 타입 - + Description 설명 - + All Day 하루 종일 - + + Time: + + + + + Time + + + + + Solar + + + + + Lunar + + + + Starts 시작 - + Ends 종료 - + Remind Me 알림 - + Repeat 다시 - + + Daily 매일 - + + Weekdays 요일 - + + Weekly 매주 - + + + Monthly 매달 - + + + Yearly 매년 - + End Repeat 반복 종료 - + After 이후 - + On 진행 - - - - + + + + time(s) 시간 - + Cancel button 취소 - + Save button 저장 @@ -355,115 +461,126 @@ CScheduleOperation - + All occurrences of a repeating event must have the same all-day status. 반복 이벤트의 모든 발생은 하루 종일 동일한 상태를 가져야 합니다. - - + + Do you want to change all occurrences? 모든 항목을 변경하시겠습니까? - - + + Change All 모두 변경 - + You are changing the repeating rule of this event. 이 이벤트의 반복 규칙을 변경하고 있습니다. - - - + + + You are deleting an event. 이벤트를 삭제하는 중. - + Are you sure you want to delete this event? 이 이벤트를 삭제하시겠습니까? - - - - - - - + + + + + + + Cancel button 취소 - + Delete button 삭제 - + Do you want to delete all occurrences of this event, or only the selected occurrence? 이 이벤트의 모든 발생 항목을 삭제하시겠습니까, 아니면 선택한 발생 항목만 삭제하시겠습니까? - + Delete All 모두 삭제 - - + + Delete Only This Event 이 이벤트만 삭제 - + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? 이 이벤트와 이 이벤트의 모든 향후 발생 항목을 삭제하시겠습니까? 아니면 선택한 발생 항목만 삭제하시겠습니까? - + Delete All Future Events 모든 향후 이벤트 삭제 - - + + You are changing a repeating event. 반복 이벤트를 변경하는 중입니다. - + Do you want to change only this occurrence of the event, or all occurrences? 이벤트의 이 발생만 변경하시겠습니까, 아니면 모든 발생을 변경하시겠습니까? - + All 모두 - - + + Only This Event 이 이벤트만 - + Do you want to change only this occurrence of the event, or this and all future occurrences? 이벤트의 이 발생만 변경하시겠습니까, 아니면 이 발생과 향후 모든 발생만 변경하시겠습니까? - + All Future Events 모든 향후 이벤트 + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + + OK + button + 확인 + CScheduleSearchDateItem @@ -486,17 +603,17 @@ CScheduleSearchItem - + Edit 편집 - + Delete 삭제 - + All Day 하루 종일 @@ -512,61 +629,163 @@ CScheduleView - + ALL DAY 하루 종일 + CSettingDialog + + + Sunday + 일요일 + + + + Monday + 월요일 + + + + 24-hour clock + + + + + 12-hour clock + + + + + Manual + + + + + 15 mins + + + + + 30 mins + + + + + 1 hour + + + + + 24 hours + + + + + Sync Now + + + + + Last sync + + + + CTimeEdit - + (%1 mins) - + - + (%1 hour) - + - + (%1 hours) - + CTitleWidget - + Y - + M - + W - + D + + + + Search events and festivals + + + + + CWeekWidget + + + Sun + + + + + Mon + + + + + Tue + + + + + Wed + + + + + Thu + + + + + Fri + + + + + Sat + + CWeekWindow - + Week 일주일 - + Y @@ -574,13 +793,13 @@ CYearScheduleView + - All Day 하루 종일 - + No event 이벤트 없음 @@ -588,7 +807,7 @@ CYearWindow - + Y @@ -596,12 +815,12 @@ CalendarWindow - + Calendar 달력 - + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. 캘린더는 날짜를 볼 수있는 도구이며, 일상의 모든 것을 예약 할 수있는 현명한 일일 플래너입니다 @@ -609,46 +828,246 @@ Calendarmainwindow - + Calendar 달력 + + + Manage + + + + + Privacy Policy + + + + + Syncing... + + + + + Sync successful + + + + + Sync failed, please try later + + CenterWidget - + All Day 하루 종일 + DAccountDataBase + + + Work + 작업 + + + + Life + 생활 + + + + Other + 기타 + + + + DAlarmManager + + + + + + Close + button + + + + + One day before start + + + + + Remind me tomorrow + + + + + Remind me later + + + + + 15 mins later + + + + + 1 hour later + + + + + 4 hours later + + + + + + + Tomorrow + + + + + Schedule Reminder + + + + + + %1 to %2 + + + + + + Today + 오늘 + + + DragInfoGraphicsView - + Edit 편집 - + Delete 삭제 - + New event 새 이벤트 - + New Event 새 이벤트 + JobTypeListView + + + You are deleting an event type. + + + + + All events under this type will be deleted and cannot be recovered. + + + + + Cancel + button + 취소 + + + + Delete + button + 삭제 + + + + QObject + + + Account settings + + + + + Account + + + + + Select items to be synced + + + + + Events + + + + + + General settings + + + + + Sync interval + + + + + + Manage calendar + + + + + Calendar account + + + + + + Event types + + + + + General + + + + + First day of week + + + + + Time + + + + Return - + Today Return 오늘 @@ -657,56 +1076,138 @@ Return Today - - - + + + Today Return Today 오늘 + ScheduleTypeEditDlg + + + New event type + + + + + Edit event type + + + + + Name: + + + + + Color: + + + + + Cancel + button + 취소 + + + + Save + button + 저장 + + + + The name can not only contain whitespaces + + + + + Enter a name please + + + + Shortcut - + Help 도움말 - + Delete event 이벤트 삭제 - + Copy 복사 - + Cut 잘라내기 - + Paste 붙여넣기 - + Delete 삭제 - + Select all 전체 선택 + SidebarCalendarWidget + + + Y + + + + + M + + + + + TimeJumpDialog + + + Go + button + + + + + UserloginWidget + + + Sign In + button + + + + + Sign Out + button + + + + YearFrame - + Y @@ -714,17 +1215,17 @@ today - - - - - - - - + + + + + + + + Today Today 오늘 - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar_lv.ts dde-calendar-5.10.0/translations/dde-calendar_lv.ts --- dde-calendar-5.9.1/translations/dde-calendar_lv.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar_lv.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,38 +1,96 @@ - + + + + + AccountItem + + + Sync successful + + + + + Network error + + + + + Server exception + + + + + Storage full + + + + + AccountManager + + + Local account + + + + + Event types + + + + + CColorPickerWidget + + + Color + + + + + Cancel + button + Atcelt + + + + Save + button + Saglabāt + + CDayMonthView - + Monday Pirmdiena - + Tuesday Otrdiena - + Wednesday Trešdiena - + Thursday Ceturtdiena - + Friday Piektdiena - + Saturday Sestdiena - + Sunday Svētdiena @@ -40,25 +98,30 @@ CDayWindow - + Y G - + M M - + D D + + + Lunar + + CGraphicsView - + New Event Jauns notikums @@ -66,7 +129,7 @@ CMonthScheduleNumItem - + %1 more %1 vairāk @@ -74,12 +137,12 @@ CMonthView - + New event Jauns notikums - + New Event Jauns notikums @@ -87,7 +150,7 @@ CMonthWindow - + Y G @@ -95,258 +158,301 @@ CMyScheduleView - + My Event Mans notikums - + OK button Labi - + Delete button Dzēst - + Edit button Rediģēt + CPushButton + + + New event type + + + + CScheduleDlg - - + + + New Event Jauns notikums - + Edit Event Rediģēt notikumu - + End time must be greater than start time Beigu laikam ir jābūt vēlākam kā sākuma laikam - + OK button Labi - - - - + + + + + + Never Nekad - + At time of event Notikuma laikā - + 15 minutes before 15 minūtes pirms - + 30 minutes before 30 minūtes pirms - + 1 hour before 1 Stundu pirms - - + + 1 day before 1 Dienu pirms - - + + 2 days before 2 Dienas pirms - - + + 1 week before 1 Nedēļu pirms - + On start day (9:00 AM) Dienas sākumā (9:00) - - + + Enter a name please + + + + + The name can not only contain whitespaces + + + + + Type: Veids: - - + + Description: Apraksts: - - + + All Day: Visu dienu: - - + + Starts: Sākas: - - + + Ends: Beidzas: - - + + Remind Me: Atgādināt: - - + + Repeat: Atkārtot: - - + + End Repeat: Beigt atkārtošanu: - - Type - Veids - - - - Work - Darbs + + Calendar account: + - - Life - Dzīve + + Calendar account + - - Other - Cits + + Type + Veids - + Description Apraksts - + All Day Visu dienu - + + Time: + + + + + Time + + + + + Solar + + + + + Lunar + + + + Starts Sākas - + Ends Beidzas - + Remind Me Atgādināt - + Repeat Atkārtot - + + Daily Katru dienu - + + Weekdays Darba dienās - + + Weekly Katru nedēļu - + + + Monthly Katru mēnesi - + + + Yearly Katru gadu - + End Repeat Beigt atkārtošanu - + After Pēc - + On Līdz - - - - + + + + time(s) reize(s) - + Cancel button Atcelt - + Save button Saglabāt @@ -355,115 +461,126 @@ CScheduleOperation - + All occurrences of a repeating event must have the same all-day status. Visiem periodiska notikuma atkārtojumiem ir jābūt identiskam visas dienas statusam - - + + Do you want to change all occurrences? Vai vēlaties mainīt visus periodiskos atkārtojumus? - - + + Change All Mainīt visus - + You are changing the repeating rule of this event. Jūs maināt notikuma periodiskas atkārtošanās iestatījumus - - - + + + You are deleting an event. Jūs dzēšat notikumu - + Are you sure you want to delete this event? Vai esat drošs, ka vēlaties dzēst šo notikumu? - - - - - - - + + + + + + + Cancel button Atcelt - + Delete button Dzēst - + Do you want to delete all occurrences of this event, or only the selected occurrence? Jūs vēlaties dzēst visus periodiskos notikumus vai tikai atlasīto notikumu? - + Delete All Dzēst visu - - + + Delete Only This Event Dzēst Tikai Šo Notikumu - + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? Jūs vēlaties dzēst šo un turpmākos notikums vai tikai šo notikumu? - + Delete All Future Events Dzēst visus nākotnes notikums - - + + You are changing a repeating event. Jūs maināt periodisku notikumu. - + Do you want to change only this occurrence of the event, or all occurrences? Jūs vēlaties mainīt tikai šo notikumu vai visus periodiskos notikumus? - + All Visi - - + + Only This Event Tikai Šo Notikumu - + Do you want to change only this occurrence of the event, or this and all future occurrences? Jūs vēlaties mainīt tikai šo notikumu vai šo un visus turpmākos notikumus? - + All Future Events Visus Turpmākos Notikumus + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + + OK + button + Labi + CScheduleSearchDateItem @@ -486,17 +603,17 @@ CScheduleSearchItem - + Edit Rediģēt - + Delete Dzēst - + All Day Visu dienu @@ -512,61 +629,163 @@ CScheduleView - + ALL DAY VISU DIENU + CSettingDialog + + + Sunday + Svētdiena + + + + Monday + Pirmdiena + + + + 24-hour clock + + + + + 12-hour clock + + + + + Manual + + + + + 15 mins + + + + + 30 mins + + + + + 1 hour + + + + + 24 hours + + + + + Sync Now + + + + + Last sync + + + + CTimeEdit - + (%1 mins) - + - + (%1 hour) - + - + (%1 hours) - + CTitleWidget - + Y G - + M M - + W N - + D D + + + + Search events and festivals + + + + + CWeekWidget + + + Sun + + + + + Mon + + + + + Tue + + + + + Wed + + + + + Thu + + + + + Fri + + + + + Sat + + CWeekWindow - + Week Nedēļa - + Y G @@ -574,13 +793,13 @@ CYearScheduleView + - All Day Visu dienu - + No event Nav notikumu @@ -588,7 +807,7 @@ CYearWindow - + Y G @@ -596,12 +815,12 @@ CalendarWindow - + Calendar Kalendārs - + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. Kalendārs ir palīgs ikdienas dzīvē kas palīdz sakārtot tavu laiku. @@ -609,46 +828,246 @@ Calendarmainwindow - + Calendar Kalendārs + + + Manage + + + + + Privacy Policy + + + + + Syncing... + + + + + Sync successful + + + + + Sync failed, please try later + + CenterWidget - + All Day Visu dienu + DAccountDataBase + + + Work + Darbs + + + + Life + Dzīve + + + + Other + Cits + + + + DAlarmManager + + + + + + Close + button + + + + + One day before start + + + + + Remind me tomorrow + + + + + Remind me later + + + + + 15 mins later + + + + + 1 hour later + + + + + 4 hours later + + + + + + + Tomorrow + + + + + Schedule Reminder + + + + + + %1 to %2 + + + + + + Today + Šodiena + + + DragInfoGraphicsView - + Edit Rediģēt - + Delete Dzēst - + New event Jauns notikums - + New Event Jauns notikums + JobTypeListView + + + You are deleting an event type. + + + + + All events under this type will be deleted and cannot be recovered. + + + + + Cancel + button + Atcelt + + + + Delete + button + Dzēst + + + + QObject + + + Account settings + + + + + Account + + + + + Select items to be synced + + + + + Events + + + + + + General settings + + + + + Sync interval + + + + + + Manage calendar + + + + + Calendar account + + + + + + Event types + + + + + General + + + + + First day of week + + + + + Time + + + + Return - + Today Return Šodiena @@ -657,56 +1076,138 @@ Return Today - - - + + + Today Return Today Šodiena + ScheduleTypeEditDlg + + + New event type + + + + + Edit event type + + + + + Name: + + + + + Color: + + + + + Cancel + button + Atcelt + + + + Save + button + Saglabāt + + + + The name can not only contain whitespaces + + + + + Enter a name please + + + + Shortcut - + Help Palīdzība - + Delete event Dzēst notikumu - + Copy Kopēt - + Cut Izgriezt - + Paste Ielīmēt - + Delete Dzēst - + Select all Izvēlēties visus + SidebarCalendarWidget + + + Y + G + + + + M + M + + + + TimeJumpDialog + + + Go + button + + + + + UserloginWidget + + + Sign In + button + + + + + Sign Out + button + + + + YearFrame - + Y G @@ -714,17 +1215,17 @@ today - - - - - - - - + + + + + + + + Today Today Šodiena - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar_ms.ts dde-calendar-5.10.0/translations/dde-calendar_ms.ts --- dde-calendar-5.9.1/translations/dde-calendar_ms.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar_ms.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,38 +1,96 @@ - + + + + + AccountItem + + + Sync successful + + + + + Network error + + + + + Server exception + + + + + Storage full + + + + + AccountManager + + + Local account + + + + + Event types + + + + + CColorPickerWidget + + + Color + + + + + Cancel + button + Batal + + + + Save + button + Simpan + + CDayMonthView - + Monday Isnin - + Tuesday Selasa - + Wednesday Rabu - + Thursday Khamis - + Friday Jumaat - + Saturday Sabtu - + Sunday Ahad @@ -40,25 +98,30 @@ CDayWindow - + Y T - + M B - + D H + + + Lunar + + CGraphicsView - + New Event Peristiwa Baharu @@ -66,7 +129,7 @@ CMonthScheduleNumItem - + %1 more %1 lagi @@ -74,12 +137,12 @@ CMonthView - + New event Peristiwa baharu - + New Event Peristiwa Baharu @@ -87,7 +150,7 @@ CMonthWindow - + Y T @@ -95,258 +158,301 @@ CMyScheduleView - + My Event Peristiwa Saya - + OK button OK - + Delete button Padam - + Edit button Sunting + CPushButton + + + New event type + + + + CScheduleDlg - - + + + New Event Peristiwa Baharu - + Edit Event Sunting Peristiwa - + End time must be greater than start time Masa tamat mesti lebih besar dari masa mula - + OK button OK - - - - + + + + + + Never Tidak sesekali - + At time of event Semua tempoh peristiwa - + 15 minutes before 15 minit sebelum - + 30 minutes before 30 minit sebelum - + 1 hour before 1 jam sebelum - - + + 1 day before 1 hari sebelum - - + + 2 days before 2 hari sebelum - - + + 1 week before 1 minggu sebelum - + On start day (9:00 AM) Pada hari mula (9:00 AM) - - + + Enter a name please + + + + + The name can not only contain whitespaces + + + + + Type: Jenis: - - + + Description: Keterangan: - - + + All Day: Sepanjang Hari: - - + + Starts: Mula: - - + + Ends: Tamat: - - + + Remind Me: Ingatkan Saya: - - + + Repeat: Ulang: - - + + End Repeat: Tamat Ulang: - - Type - Jenis - - - - Work - Kerja + + Calendar account: + - - Life - Lapang + + Calendar account + - - Other - Lain-lain + + Type + Jenis - + Description Keterangan - + All Day Sepanjang Hari - + + Time: + + + + + Time + + + + + Solar + + + + + Lunar + + + + Starts Mula - + Ends Tamat - + Remind Me Ingatkan Saya - + Repeat Ulang - + + Daily Harian - + + Weekdays Hari Bekerja - + + Weekly Mingguan - + + + Monthly Bulanan - + + + Yearly Tahunan - + End Repeat Tamat Ulang - + After Selepas - + On Pada - - - - + + + + time(s) kali - + Cancel button Batal - + Save button Simpan @@ -355,115 +461,126 @@ CScheduleOperation - + All occurrences of a repeating event must have the same all-day status. Semua kemunculan bagi peristiwa berulang mesti mempunyai status sepanjang-hari yang sama. - - + + Do you want to change all occurrences? Anda pasti mahu mengubah semua kemunculan? - - + + Change All Ubah Semua - + You are changing the repeating rule of this event. Anda mengubah peraturan berulang bagi peristiwa ini. - - - + + + You are deleting an event. Anda telah memadam satu peristiwa. - + Are you sure you want to delete this event? Anda pasti mahu memadam peristiwa ini? - - - - - - - + + + + + + + Cancel button Batal - + Delete button Padam - + Do you want to delete all occurrences of this event, or only the selected occurrence? Anda pasti mahu memadam semua kemunculan peristiwa ini, atau hanya kemunculan terpilih? - + Delete All Padam Semua - - + + Delete Only This Event Hanya Padam Peristiwa Ini - + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? Anda pasti mahu memadam semua kemunculan peristiwa ini dan akan datang, atau hanya kemunculan terpilih? - + Delete All Future Events Padam Semua Peristiwa Akan Datang - - + + You are changing a repeating event. Anda mengubah satu peristiwa berulang. - + Do you want to change only this occurrence of the event, or all occurrences? Anda pasti mahu mengubah hanya kemunculan peristiwa ini, atau semua kemunculan? - + All Semua - - + + Only This Event Hanya Peristiwa Ini - + Do you want to change only this occurrence of the event, or this and all future occurrences? Anda pasti mahu mengubah hanya kemunculan peristiwa ini, atau ini dan semua kemunculan masa hadapan? - + All Future Events Semua Peristiwa Masa Hadapan + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + + OK + button + OK + CScheduleSearchDateItem @@ -486,17 +603,17 @@ CScheduleSearchItem - + Edit Sunting - + Delete Padam - + All Day Sepanjang Hari @@ -512,61 +629,163 @@ CScheduleView - + ALL DAY SEPANJANG HARI + CSettingDialog + + + Sunday + Ahad + + + + Monday + Isnin + + + + 24-hour clock + + + + + 12-hour clock + + + + + Manual + + + + + 15 mins + + + + + 30 mins + + + + + 1 hour + + + + + 24 hours + + + + + Sync Now + + + + + Last sync + + + + CTimeEdit - + (%1 mins) - + - + (%1 hour) - + - + (%1 hours) - + CTitleWidget - + Y T - + M B - + W M - + D H + + + + Search events and festivals + + + + + CWeekWidget + + + Sun + + + + + Mon + + + + + Tue + + + + + Wed + + + + + Thu + + + + + Fri + + + + + Sat + + CWeekWindow - + Week Minggu - + Y T @@ -574,13 +793,13 @@ CYearScheduleView + - All Day Sepanjang Hari - + No event Tiada peristiwa @@ -588,7 +807,7 @@ CYearWindow - + Y T @@ -596,12 +815,12 @@ CalendarWindow - + Calendar Kalendar - + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. Kalendar ialah sebuah alat untuk melihat tarikh, dan juga satu perancang harian pintar yang dapat menjadualkan semua perkara dalam hidup ini. @@ -609,46 +828,246 @@ Calendarmainwindow - + Calendar Kalendar + + + Manage + + + + + Privacy Policy + + + + + Syncing... + + + + + Sync successful + + + + + Sync failed, please try later + + CenterWidget - + All Day Sepanjang Hari + DAccountDataBase + + + Work + Kerja + + + + Life + Lapang + + + + Other + Lain-lain + + + + DAlarmManager + + + + + + Close + button + + + + + One day before start + + + + + Remind me tomorrow + + + + + Remind me later + + + + + 15 mins later + + + + + 1 hour later + + + + + 4 hours later + + + + + + + Tomorrow + + + + + Schedule Reminder + + + + + + %1 to %2 + + + + + + Today + Hari ini + + + DragInfoGraphicsView - + Edit Sunting - + Delete Padam - + New event Peristiwa baharu - + New Event Peristiwa Baharu + JobTypeListView + + + You are deleting an event type. + + + + + All events under this type will be deleted and cannot be recovered. + + + + + Cancel + button + Batal + + + + Delete + button + Padam + + + + QObject + + + Account settings + + + + + Account + + + + + Select items to be synced + + + + + Events + + + + + + General settings + + + + + Sync interval + + + + + + Manage calendar + + + + + Calendar account + + + + + + Event types + + + + + General + + + + + First day of week + + + + + Time + + + + Return - + Today Return Hari ini @@ -657,56 +1076,138 @@ Return Today - - - + + + Today Return Today Hari ini + ScheduleTypeEditDlg + + + New event type + + + + + Edit event type + + + + + Name: + + + + + Color: + + + + + Cancel + button + Batal + + + + Save + button + Simpan + + + + The name can not only contain whitespaces + + + + + Enter a name please + + + + Shortcut - + Help Bantuan - + Delete event Padam peristiwa - + Copy Salin - + Cut Potong - + Paste Tampal - + Delete Padam - + Select all Pilih semua + SidebarCalendarWidget + + + Y + T + + + + M + B + + + + TimeJumpDialog + + + Go + button + + + + + UserloginWidget + + + Sign In + button + + + + + Sign Out + button + + + + YearFrame - + Y T @@ -714,17 +1215,17 @@ today - - - - - - - - + + + + + + + + Today Today Hari ini - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar_nl.ts dde-calendar-5.10.0/translations/dde-calendar_nl.ts --- dde-calendar-5.9.1/translations/dde-calendar_nl.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar_nl.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,66 +1,96 @@ - + + + + + AccountItem + + + Sync successful + Sychroniseren voltooid + + + + Network error + Netwerkfout + + + + Server exception + Serveruitzondering + + + + Storage full + Geen vrije schijfruimte + + + + AccountManager + + + Local account + Lokaal account + + + + Event types + Afspraaktypes + + CColorPickerWidget - + Color Kleur - + Cancel button Annuleren - + Save button Opslaan - - Cancel - - - - Save - - CDayMonthView - + Monday Maandag - + Tuesday Dinsdag - + Wednesday Woensdag - + Thursday Donderdag - + Friday Vrijdag - + Saturday Zaterdag - + Sunday Zondag @@ -68,25 +98,30 @@ CDayWindow - + Y J - + M M - + D D + + + Lunar + Maan + CGraphicsView - + New Event Nieuwe afspraak @@ -94,7 +129,7 @@ CMonthScheduleNumItem - + %1 more Nog %1 andere @@ -102,12 +137,12 @@ CMonthView - + New event Nieuwe afspraak - + New Event Nieuwe afspraak @@ -115,7 +150,7 @@ CMonthWindow - + Y J @@ -123,24 +158,24 @@ CMyScheduleView - + My Event Mijn afspraak - + OK button Oké - + Delete button Verwijderen - + Edit button Bewerken @@ -149,7 +184,7 @@ CPushButton - + New event type Nieuw afspraaktype @@ -157,273 +192,267 @@ CScheduleDlg - - + + + New Event Nieuwe afspraak - + Edit Event Afspraak bewerken - + End time must be greater than start time De eindtijd moet later zijn dan de begintijd - + OK button Oké - - - - - - + + + + + + Never Nooit - + At time of event Bij aanvang - + 15 minutes before 15 minuten van tevoren - + 30 minutes before 30 minuten van tevoren - + 1 hour before 1 uur van tevoren - + 1 day before 1 dag van tevoren - + 2 days before 2 dagen van tevoren - + 1 week before 1 week van tevoren - + On start day (9:00 AM) Op de dag van de afspraak (9:00 AM) - + + + + + time(s) + keer + + + Enter a name please Voer een naam in - + The name can not only contain whitespaces De naam mag niet alleen bestaan uit spaties - - The name already exists - Deze naam is al in gebruik - - - - + + Type: Soort: - - + + Description: Omschrijving: - - + + All Day: Hele dag: - - + + Starts: Begint om: - - + + Ends: Eindigt om: - - + + Remind Me: Herinneren: - - + + Repeat: Herhalen: - - + + End Repeat: Herhaling eindigt op: - - Type - Soort + + Calendar account: + Agenda-account: - Work - Zakelijk + + Calendar account + Agenda-account - Life - Persoonlijk - - - Other - Overig + + Type + Soort - + Description Omschrijving - + All Day Hele dag - + Time: Tijdstip: - + Time Tijdstip - + Solar Zon - + Lunar Maan - + Starts Begint om - + Ends Eindigt om - + Remind Me Herinneren - + Repeat Herhalen - - + + Daily Dagelijks - - + + Weekdays Weekdagen - - + + Weekly Wekelijks - - - + + + Monthly Maandelijks - - - + + + Yearly Jaarlijks - + End Repeat Herhaling eindigt op - + After Na - + On Op - - - - - time(s) - keer - - - + Cancel button Annuleren - + Save button Opslaan @@ -432,141 +461,141 @@ CScheduleOperation - + All occurrences of a repeating event must have the same all-day status. Alle afspraken in reeks moeten voorzien zijn van de status 'hele dag'. - - + + Do you want to change all occurrences? Wil je alle afspraken in de reeks bewerken? - - + + + + + + + + Cancel + button + Annuleren + + + + Change All Reeks bewerken - + You are changing the repeating rule of this event. Je past de herhaalinstellingen van deze afspraak aan. - - - + + + You are deleting an event. Je verwijdert een afspraak. - + Are you sure you want to delete this event? Weet je zeker dat je deze afspraak wilt verwijderen? - - - - - - - Cancel - button - Annuleren - - - Delete button Verwijderen - + Do you want to delete all occurrences of this event, or only the selected occurrence? Wil je alle afspraken in de reeks verwijderen of enkel deze? - + Delete All Reeks verwijderen - - + + Delete Only This Event Deze afspraak verwijderen - + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? Wil je deze en toekomstige afspraken verwijderen of enkel de deze? - + Delete All Future Events Toekomstige afspraken verwijderen - - + + You are changing a repeating event. Je past een reeks afspraken aan. - + Do you want to change only this occurrence of the event, or all occurrences? Wil je deze en toekomstige afspraken aanpassen of enkel deze? - + All Reeks - - + + Only This Event Deze afspraak - + Do you want to change only this occurrence of the event, or this and all future occurrences? Wil je deze en toekomstige afspraken aanpassen of enkel deze? - + All Future Events Toekomstige afspraken - + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. - + Je hebt een schrikkelmaand gekozen. De herinnering wordt op basis van de maankalender getoond. - + OK button - + Oké CScheduleSearchDateItem - + Y J - + M M - + D D @@ -574,17 +603,17 @@ CScheduleSearchItem - + Edit Bewerken - + Delete Verwijderen - + All Day Hele dag @@ -592,7 +621,7 @@ CScheduleSearchView - + No search results Geen zoekresultaten @@ -600,25 +629,83 @@ CScheduleView - + ALL DAY HELE DAG + CSettingDialog + + + Sunday + zondag + + + + Monday + maandag + + + + 24-hour clock + 24-uursklok + + + + 12-hour clock + 12-uursklok + + + + Manual + Handmatig + + + + 15 mins + 15 min. + + + + 30 mins + 30 min. + + + + 1 hour + 1 uur + + + + 24 hours + 24 uur + + + + Sync Now + Nu synchroniseren + + + + Last sync + Recentste synchronisatie + + + CTimeEdit - + (%1 mins) (%1 min.) - + (%1 hour) (%1 uur) - + (%1 hours) (%1 uur) @@ -626,35 +713,79 @@ CTitleWidget - + Y J - + M M - + W W - + D D + + + + Search events and festivals + Zoeken naar afspraken en festivals + + + + CWeekWidget + + + Sun + zo + + + + Mon + ma + + + + Tue + di + + + + Wed + woe + + + + Thu + do + + + + Fri + vrij + + + + Sat + za + CWeekWindow - + Week Week - + Y J @@ -662,13 +793,13 @@ CYearScheduleView + - All Day Hele dag - + No event Geen afspraak @@ -676,7 +807,7 @@ CYearWindow - + Y J @@ -684,12 +815,12 @@ CalendarWindow - + Calendar Kalender - + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. Met Kalender kun je je afspraken en planning beheren, zowel werk als privé. @@ -697,43 +828,147 @@ Calendarmainwindow - + Calendar Kalender - + Manage Beheren + + + Privacy Policy + Privacybeleid + + + + Syncing... + Bezig met synchroniseren… + + + + Sync successful + Sychroniseren voltooid + + + + Sync failed, please try later + Synchroniseren mislukt - probeer het later opnieuw + CenterWidget - + All Day Hele dag + DAccountDataBase + + + Work + + + + + Life + + + + + Other + + + + + DAlarmManager + + + + + + Close + button + + + + + One day before start + + + + + Remind me tomorrow + + + + + Remind me later + + + + + 15 mins later + + + + + 1 hour later + + + + + 4 hours later + + + + + + + Tomorrow + + + + + Schedule Reminder + + + + + + %1 to %2 + + + + + + Today + Vandaag + + + DragInfoGraphicsView - + Edit Aanpassen - + Delete Verwijderen - + New event Nieuwe afspraak - + New Event Nieuwe afspraak @@ -741,23 +976,23 @@ JobTypeListView - + You are deleting an event type. Je staat op het punt om een afspraaktype te verwijderen. - + All events under this type will be deleted and cannot be recovered. Alle bijbehorende afspraken worden verwijderd en kunnen niet worden hersteld. - + Cancel button Annuleren - + Delete button Verwijderen @@ -766,20 +1001,73 @@ QObject - + + Manage calendar Agenda beheren - + + Event types Afspraaktypes + + + Account settings + Accountinstellingen + + + + Account + Account + + + + Select items to be synced + Selecteer de te synchroniseren items + + + + Events + Afspraken + + + + + General settings + Algemene instellingen + + + + Sync interval + Synchroniseren, elke + + + + Calendar account + Agenda-account + + + + General + Algemeen + + + + First day of week + Eerste dag van de week + + + + Time + Tijdstip + Return - + Today Return Vandaag @@ -788,9 +1076,9 @@ Return Today - - - + + + Today Return Today Vandaag @@ -799,95 +1087,127 @@ ScheduleTypeEditDlg - + New event type Nieuw afspraaktype - + Edit event type Afspraaktype bewerken - + Name: Naam: - + Color: Kleur: - + Cancel button Annuleren - + Save button Opslaan - - Enter a name please - Voer een naam in - - - + The name can not only contain whitespaces De naam mag niet alleen bestaan uit spaties - - The name already exists - Deze naam is al in gebruik + + Enter a name please + Voer een naam in Shortcut - + Help Hulp - + Delete event Afspraak verwijderen - + Copy Kopiëren - + Cut Knippen - + Paste Plakken - + Delete Verwijderen - + Select all Alles selecteren + SidebarCalendarWidget + + + Y + J + + + + M + M + + + + TimeJumpDialog + + + Go + button + Ga + + + + UserloginWidget + + + Sign In + button + Inloggen + + + + Sign Out + button + Uitloggen + + + YearFrame - + Y J @@ -895,17 +1215,17 @@ today - - - - - - - - + + + + + + + + Today Today Vandaag - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar_pl.ts dde-calendar-5.10.0/translations/dde-calendar_pl.ts --- dde-calendar-5.9.1/translations/dde-calendar_pl.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar_pl.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,66 +1,96 @@ - + + + + + AccountItem + + + Sync successful + Synchronizacja zakończona + + + + Network error + Błąd sieci + + + + Server exception + Wyjątek serwera + + + + Storage full + Pamięć zapełniona + + + + AccountManager + + + Local account + Konto lokalne + + + + Event types + Typy wydarzeń + + CColorPickerWidget - + Color Kolor - + Cancel button Anuluj - + Save button Zapisz - - Cancel - - - - Save - - CDayMonthView - + Monday Poniedziałek - + Tuesday Wtorek - + Wednesday Środa - + Thursday Czwartek - + Friday Piątek - + Saturday Sobota - + Sunday Niedziela @@ -68,25 +98,30 @@ CDayWindow - + Y R - + M M - + D D + + + Lunar + Księżycowy + CGraphicsView - + New Event Nowe wydarzenie @@ -94,7 +129,7 @@ CMonthScheduleNumItem - + %1 more jeszcze 1% @@ -102,12 +137,12 @@ CMonthView - + New event Nowe wydarzenie - + New Event Nowe wydarzenie @@ -115,7 +150,7 @@ CMonthWindow - + Y R @@ -123,24 +158,24 @@ CMyScheduleView - + My Event Moje wydarzenie - + OK button OK - + Delete button Usuń - + Edit button Edytuj @@ -149,7 +184,7 @@ CPushButton - + New event type Nowy typ wydarzenia @@ -157,273 +192,267 @@ CScheduleDlg - - + + + New Event Nowe wydarzenie - + Edit Event Edytuj wydarzenie - + End time must be greater than start time Czas zakończenia musi być późniejszy niż czas rozpoczęcia - + OK button OK - - - - - - + + + + + + Never Nigdy - + At time of event W czasie wydarzenia - + 15 minutes before 15 minut przed - + 30 minutes before 30 minut przed - + 1 hour before 1 godzinę przed - + 1 day before 1 dzień przed - + 2 days before 2 dni przed - + 1 week before 1 tydzień przed - + On start day (9:00 AM) W dniu rozpoczęcia (9:00) - + + + + + time(s) + raz(y) + + + Enter a name please Wprowadź nazwę - + The name can not only contain whitespaces Nazwa nie może zawierać tylko znaków spacji - - The name already exists - Taka nazwa już istnieje - - - - + + Type: Typ: - - + + Description: Opis: - - + + All Day: Cały dzień: - - + + Starts: Początek: - - + + Ends: Koniec: - - + + Remind Me: Przypomnij mi: - - + + Repeat: Powtórz: - - + + End Repeat: Zakończ powtarzanie: - - Type - Typ + + Calendar account: + Konto kalendarza: - Work - Praca + + Calendar account + Konto kalendarza - Life - Życie - - - Other - Inne + + Type + Typ - + Description Opis - + All Day Cały dzień - + Time: - Data: + Czas: - + Time - Data + Czas - + Solar Słoneczny - + Lunar Księżycowy - + Starts Początek - + Ends Koniec - + Remind Me Przypomnij mi - + Repeat Powtórz - - + + Daily Codziennie - - + + Weekdays W dni robocze - - + + Weekly Co tydzień - - - + + + Monthly Co miesiąc - - - + + + Yearly Co rok - + End Repeat Zakończ Powtarzanie - + After Po - + On - - - - - time(s) - raz(y) - - - + Cancel button Anuluj - + Save button Zapisz @@ -432,141 +461,141 @@ CScheduleOperation - + All occurrences of a repeating event must have the same all-day status. Wszystkie wystąpienia powtarzającego się wydarzenia muszą zawierać ten sam stan całodniowy. - - + + Do you want to change all occurrences? Czy chcesz zmienić wszystkie wystąpienia? - - + + + + + + + + Cancel + button + Anuluj + + + + Change All Zmień wszystkie - + You are changing the repeating rule of this event. Zmieniasz regułę powtarzania tego wydarzenia. - - - + + + You are deleting an event. Usuwasz wydarzenie. - + Are you sure you want to delete this event? Czy na pewno chcesz usunąć to wydarzenie? - - - - - - - Cancel - button - Anuluj - - - Delete button Usuń - + Do you want to delete all occurrences of this event, or only the selected occurrence? Czy chcesz usunąć wszystkie wystąpienia tego zdarzenia, czy tylko wybrane wystąpienie? - + Delete All - Usuń wszystko + Usuń wszystkie - - + + Delete Only This Event Usuń tylko to wydarzenie - + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? Czy chcesz usunąć to i wszystkie przyszłe wystąpienia tego wydarzenia, czy tylko wybrane wystąpienie? - + Delete All Future Events Usuń wszystkie przyszłe wydarzenia - - + + You are changing a repeating event. Zmieniasz powtarzające się wydarzenie. - + Do you want to change only this occurrence of the event, or all occurrences? Czy chcesz zmienić tylko to wystąpienie wydarzenia, czy wszystkie wydarzenia? - + All Wszystko - - + + Only This Event Tylko to wydarzenie - + Do you want to change only this occurrence of the event, or this and all future occurrences? Czy chcesz zmienić tylko to wystąpienie wydarzenia, czy to i wszystkie przyszłe wydarzenia? - + All Future Events Wszystkie przyszłe wydarzenia - + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. - + Zaznaczono miesiąc przestępny, przypomnienie będzie działać zgodnie z zasadami kalendarza księżycowego. - + OK button - + OK CScheduleSearchDateItem - + Y R - + M M - + D D @@ -574,17 +603,17 @@ CScheduleSearchItem - + Edit Edytuj - + Delete Usuń - + All Day Cały dzień @@ -592,7 +621,7 @@ CScheduleSearchView - + No search results Brak wyników wyszukiwania @@ -600,25 +629,83 @@ CScheduleView - + ALL DAY CAŁY DZIEŃ + CSettingDialog + + + Sunday + Niedziela + + + + Monday + Poniedziałek + + + + 24-hour clock + Zegar 24-godzinny + + + + 12-hour clock + Zegar 12-godzinny + + + + Manual + Ręcznie + + + + 15 mins + 15 min + + + + 30 mins + 30 min + + + + 1 hour + 1 godz + + + + 24 hours + 24 godz + + + + Sync Now + Synchronizuj teraz + + + + Last sync + Ostatnia synchronizacja + + + CTimeEdit - + (%1 mins) (%1 minut) - + (%1 hour) (%1 godzina) - + (%1 hours) (%1 godzin) @@ -626,35 +713,79 @@ CTitleWidget - + Y R - + M M - + W T - + D D + + + + Search events and festivals + Szukaj wydarzeń i festiwalów + + + + CWeekWidget + + + Sun + Nie + + + + Mon + Pon + + + + Tue + Wt + + + + Wed + Śr + + + + Thu + Czw + + + + Fri + Pt + + + + Sat + Sob + CWeekWindow - + Week Tydzień - + Y Y @@ -662,13 +793,13 @@ CYearScheduleView + - All Day Cały dzień - + No event Brak wydarzeń @@ -676,7 +807,7 @@ CYearWindow - + Y Y @@ -684,56 +815,160 @@ CalendarWindow - + Calendar Kalendarz - + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. - Kalendarz to narzędzie do przeglądania dat, a także inteligentny planer dzienny do planowania wszystkich rzeczy w życiu. + Kalendarz to narzędzie umożliwiające przeglądanie dat, jak i inteligentny terminarz, w którym możesz zaplanować wszystkie wydarzenia w życiu. Calendarmainwindow - + Calendar Kalendarz - + Manage Zarządzaj + + + Privacy Policy + Polityka prywatności + + + + Syncing... + Synchronizuję... + + + + Sync successful + Synchronizacja zakończona + + + + Sync failed, please try later + Błąd synchronizacji, spróbuj ponownie później + CenterWidget - + All Day Cały dzień + DAccountDataBase + + + Work + + + + + Life + + + + + Other + + + + + DAlarmManager + + + + + + Close + button + + + + + One day before start + + + + + Remind me tomorrow + + + + + Remind me later + + + + + 15 mins later + + + + + 1 hour later + + + + + 4 hours later + + + + + + + Tomorrow + + + + + Schedule Reminder + + + + + + %1 to %2 + + + + + + Today + Dzisiaj + + + DragInfoGraphicsView - + Edit Edytuj - + Delete Usuń - + New event Nowe wydarzenie - + New Event Nowe wydarzenie @@ -741,23 +976,23 @@ JobTypeListView - + You are deleting an event type. Usuwasz typ wydarzenia. - + All events under this type will be deleted and cannot be recovered. Wszystkie wydarzenia skatalogowane pod tym typem zostaną usunięte i nie będzie można ich przywrócić. - + Cancel button Anuluj - + Delete button Usuń @@ -766,20 +1001,73 @@ QObject - + + Manage calendar Zarządzaj kalendarzem - + + Event types Typy wydarzeń + + + Account settings + Ustawienia konta + + + + Account + Konto + + + + Select items to be synced + Wybierz przedmioty do synchronizacji + + + + Events + Wydarzenia + + + + + General settings + Ustawienia ogólne + + + + Sync interval + Interwał synchronizacji + + + + Calendar account + Konto kalendarza + + + + General + Ogólne + + + + First day of week + Pierwszy dzień tygodnia + + + + Time + Czas + Return - + Today Return Dzisiaj @@ -788,9 +1076,9 @@ Return Today - - - + + + Today Return Today Dzisiaj @@ -799,95 +1087,127 @@ ScheduleTypeEditDlg - + New event type Nowy typ wydarzenia - + Edit event type Edytuj typ wydarzenia - + Name: Nazwa: - + Color: Kolor: - + Cancel button Anuluj - + Save button Zapisz - - Enter a name please - Wprowadź nazwę - - - + The name can not only contain whitespaces Nazwa nie może zawierać tylko znaków spacji - - The name already exists - Taka nazwa już istnieje + + Enter a name please + Wprowadź nazwę Shortcut - + Help Pomoc - + Delete event Usuń wydarzenie - + Copy Kopiuj - + Cut Wytnij - + Paste Wklej - + Delete Usuń - + Select all Zaznacz wszystko + SidebarCalendarWidget + + + Y + R + + + + M + M + + + + TimeJumpDialog + + + Go + button + Przejdź + + + + UserloginWidget + + + Sign In + button + Zaloguj się + + + + Sign Out + button + Wyloguj się + + + YearFrame - + Y Y @@ -895,17 +1215,17 @@ today - - - - - - - - + + + + + + + + Today Today Dzisiaj - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar_pt_BR.ts dde-calendar-5.10.0/translations/dde-calendar_pt_BR.ts --- dde-calendar-5.9.1/translations/dde-calendar_pt_BR.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar_pt_BR.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,38 +1,96 @@ - + + + + + AccountItem + + + Sync successful + Conexão bem-sucedida + + + + Network error + Erro de rede + + + + Server exception + Exceção do servidor + + + + Storage full + Armazenamento cheio + + + + AccountManager + + + Local account + Conta local + + + + Event types + Tipos de eventos + + + + CColorPickerWidget + + + Color + Cor + + + + Cancel + button + Cancelar + + + + Save + button + Salvar + + CDayMonthView - + Monday Segunda-feira - + Tuesday Terça-feira - + Wednesday Quarta-feira - + Thursday Quinta-feira - + Friday Sexta-feira - + Saturday Sábado - + Sunday Domingo @@ -40,25 +98,30 @@ CDayWindow - + Y A - + M M - + D D + + + Lunar + Lunar + CGraphicsView - + New Event Novo Evento @@ -66,7 +129,7 @@ CMonthScheduleNumItem - + %1 more %1 mais @@ -74,12 +137,12 @@ CMonthView - + New event Novo evento - + New Event Novo Evento @@ -87,7 +150,7 @@ CMonthWindow - + Y A @@ -95,258 +158,301 @@ CMyScheduleView - + My Event Evento - + OK button OK - + Delete button Excluir - + Edit button Editar + CPushButton + + + New event type + Novo tipo de evento + + + CScheduleDlg - - + + + New Event Novo Evento - + Edit Event Editar Evento - + End time must be greater than start time O tempo de término deve ser maior que o tempo de início - + OK button OK - - - - + + + + + + Never Nunca - + At time of event No momento do evento - + 15 minutes before 15 minutos antes - + 30 minutes before 30 minutos antes - + 1 hour before 1 hora antes - - + + 1 day before 1 dia antes - - + + 2 days before 2 dias antes - - + + 1 week before 1 semana antes - + On start day (9:00 AM) No dia de início (9:00 AM) - - + + + + + time(s) + vez(es) + + + + Enter a name please + Digite um nome, por favor + + + + The name can not only contain whitespaces + O nome não pode conter apenas espaços em branco + + + + Type: Tipo: - - + + Description: Descrição: - - + + All Day: Dia Inteiro: - - + + Starts: Inicia em: - - + + Ends: Termina em: - - + + Remind Me: Lembre-me: - - + + Repeat: Repetir: - - + + End Repeat: Termina em: - - Type - Tipo + + Calendar account: + Conta de calendário: - - Work - Trabalho - - - - Life - Vida Pessoal + + Calendar account + Conta de calendário - - Other - Outro + + Type + Tipo - + Description Descrição - + All Day Dia Inteiro - + + Time: + Horário: + + + + Time + Horário + + + + Solar + Solar + + + + Lunar + Lunar + + + Starts Inicia em - + Ends Termina em - + Remind Me Lembre-me - + Repeat Repetir - + + Daily Diariamente - + + Weekdays Dias úteis - + + Weekly Semanalmente - + + + Monthly Mensalmente - + + + Yearly Anualmente - + End Repeat Termina em - + After Depois - + On Ativo - - - - - time(s) - vez(es) - - - + Cancel button Cancelar - + Save button Salvar @@ -355,115 +461,126 @@ CScheduleOperation - + All occurrences of a repeating event must have the same all-day status. Todas as ocorrências de um evento repetitivo devem ter o mesmo status durante o dia inteiro. - - + + Do you want to change all occurrences? Alterar todas as ocorrências? - + + + + + + + Cancel + button + Cancelar + + + + Change All Alterar Tudo - + You are changing the repeating rule of this event. A regra de repetição deste evento será alterada. - - - + + + You are deleting an event. Um evento será excluído. - + Are you sure you want to delete this event? Excluir este evento? - - - - - - - - Cancel - button - Cancelar - - - + Delete button Excluir - + Do you want to delete all occurrences of this event, or only the selected occurrence? Excluir todas as ocorrências deste evento; ou apenas a ocorrência selecionada? - + Delete All Excluir Tudo - - + + Delete Only This Event Excluir Apenas Este Evento - + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? Excluir este evento e todas as suas ocorrências futuras; ou apenas a ocorrência selecionada? - + Delete All Future Events Excluir Todos os Eventos Futuros - - + + You are changing a repeating event. Um evento repetido será alterado. - + Do you want to change only this occurrence of the event, or all occurrences? Alterar apenas esta ocorrência do evento; ou todas as ocorrências? - + All Tudo - - + + Only This Event Apenas Este Evento - + Do you want to change only this occurrence of the event, or this and all future occurrences? Alterar apenas esta ocorrência do evento; ou esta e todas as ocorrências futuras? - + All Future Events Todos os Eventos Futuros + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + Você selecionou um mês bissexto e será lembrado de acordo com as regras do calendário lunar. + + + + OK + button + Ok + CScheduleSearchDateItem @@ -486,17 +603,17 @@ CScheduleSearchItem - + Edit Editar - + Delete Excluir - + All Day Dia Inteiro @@ -512,61 +629,163 @@ CScheduleView - + ALL DAY DIA INTEIRO + CSettingDialog + + + Sunday + Domingo + + + + Monday + Segunda-feira + + + + 24-hour clock + Formato de 24 horas + + + + 12-hour clock + Formato de 12 horas + + + + Manual + Manual + + + + 15 mins + 15 mins + + + + 30 mins + 30 mins + + + + 1 hour + 1 hora + + + + 24 hours + 24 horas + + + + Sync Now + Sincronizar Agora + + + + Last sync + Última sincronização + + + CTimeEdit - + (%1 mins) - + (%1 minutos) - + (%1 hour) - + (%1 hora) - + (%1 hours) - + (%1 horas) CTitleWidget - + Y A - + M M - + W S - + D D + + + + Search events and festivals + Procurar eventos e datas comemorativas + + + + CWeekWidget + + + Sun + Dom + + + + Mon + Seg + + + + Tue + Ter + + + + Wed + Qua + + + + Thu + Qui + + + + Fri + Sex + + + + Sat + Sáb + CWeekWindow - + Week Semana - + Y A @@ -574,13 +793,13 @@ CYearScheduleView + - All Day Dia Inteiro - + No event Nenhum evento @@ -588,7 +807,7 @@ CYearWindow - + Y A @@ -596,12 +815,12 @@ CalendarWindow - + Calendar Calendário - + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. O Calendário é uma ferramenta que permite agendar e visualizar eventos. @@ -609,46 +828,246 @@ Calendarmainwindow - + Calendar Calendário + + + Manage + Gerenciar + + + + Privacy Policy + Política de Privacidade + + + + Syncing... + Sincronizando... + + + + Sync successful + Sincronização bem-sucedida + + + + Sync failed, please try later + A sincronização falhou, tente novamente mais tarde + CenterWidget - + All Day Dia Inteiro + DAccountDataBase + + + Work + + + + + Life + + + + + Other + + + + + DAlarmManager + + + + + + Close + button + + + + + One day before start + + + + + Remind me tomorrow + + + + + Remind me later + + + + + 15 mins later + + + + + 1 hour later + + + + + 4 hours later + + + + + + + Tomorrow + + + + + Schedule Reminder + + + + + + %1 to %2 + + + + + + Today + Hoje + + + DragInfoGraphicsView - + Edit Editar - + Delete Excluir - + New event Novo evento - + New Event Novo Evento + JobTypeListView + + + You are deleting an event type. + Você está a eliminar um tipo de evento. + + + + All events under this type will be deleted and cannot be recovered. + Todos os eventos deste tipo serão eliminados e não poderão ser recuperados. + + + + Cancel + button + Cancelar. + + + + Delete + button + Excluir + + + + QObject + + + + Manage calendar + Gerenciar calendário + + + + + Event types + Tipos de eventos + + + + Account settings + Configurações de conta + + + + Account + Conta + + + + Select items to be synced + Selecionar itens para sincronizar + + + + Events + Eventos + + + + + General settings + Definições gerais + + + + Sync interval + Intervalo de sincronização + + + + Calendar account + Conta de calendário + + + + General + Geral + + + + First day of week + Primeiro dia da semana + + + + Time + Horário + + + Return - + Today Return Hoje @@ -657,56 +1076,138 @@ Return Today - - - + + + Today Return Today Hoje + ScheduleTypeEditDlg + + + New event type + Novo tipo de evento + + + + Edit event type + Editar o tipo de evento + + + + Name: + Nome: + + + + Color: + Cor: + + + + Cancel + button + Cancelar + + + + Save + button + Salvar + + + + The name can not only contain whitespaces + O nome não pode ser apenas espaços em branco + + + + Enter a name please + Digite um nome por favor + + + Shortcut - + Help Ajuda - + Delete event Excluir evento - + Copy Copiar - + Cut Recortar - + Paste Colar - + Delete Excluir - + Select all Selecionar Tudo + SidebarCalendarWidget + + + Y + A + + + + M + M + + + + TimeJumpDialog + + + Go + button + Ir + + + + UserloginWidget + + + Sign In + button + Entrar + + + + Sign Out + button + Sair + + + YearFrame - + Y A @@ -714,17 +1215,17 @@ today - - - - - - - - + + + + + + + + Today Today Hoje - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar_pt.ts dde-calendar-5.10.0/translations/dde-calendar_pt.ts --- dde-calendar-5.9.1/translations/dde-calendar_pt.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar_pt.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,66 +1,96 @@ - + + + - CColorPickerWidget + AccountItem - - Color - + + Sync successful + Sincronização bem sucedida - - Cancel - button - + + Network error + Erro de rede - - Save - button - + + Server exception + Exceção do servidor + + Storage full + Armazenamento cheio + + + + AccountManager + + + Local account + Conta local + + + + Event types + Tipos de evento + + + + CColorPickerWidget + + + Color + Cor + + + Cancel - + button + Cancelar + Save - + button + Guardar CDayMonthView - + Monday Seg - + Tuesday Ter - + Wednesday Qua - + Thursday Qui - + Friday Sex - + Saturday Sáb - + Sunday Dom @@ -68,25 +98,30 @@ CDayWindow - + Y A - + M M - + D D + + + Lunar + Lunar + CGraphicsView - + New Event Novo evento @@ -94,7 +129,7 @@ CMonthScheduleNumItem - + %1 more mais %1 @@ -102,12 +137,12 @@ CMonthView - + New event Novo evento - + New Event Novo evento @@ -115,7 +150,7 @@ CMonthWindow - + Y A @@ -123,24 +158,24 @@ CMyScheduleView - + My Event O meu evento - + OK button Aceitar - + Delete button Eliminar - + Edit button Editar @@ -149,281 +184,275 @@ CPushButton - + New event type - + Novo tipo de evento CScheduleDlg - - + + + New Event Novo evento - + Edit Event Editar evento - + End time must be greater than start time A hora de fim deve ser maior do que a hora de início - + OK button Aceitar - - - - - - + + + + + + Never Nunca - + At time of event Na hora do evento - + 15 minutes before 15 minutos antes - + 30 minutes before 30 minutos antes - + 1 hour before 1 hora antes - + 1 day before 1 dia antes - + 2 days before 2 dias antes - + 1 week before 1 semana antes - + On start day (9:00 AM) No início do dia (9:00 AM) - - Enter a name please - + + + + + time(s) + vez(es) - - The name can not only contain whitespaces - + + Enter a name please + Introduza um nome - - The name already exists - + + The name can not only contain whitespaces + O nome não pode conter apenas espaços em branco - - + + Type: Tipo: - - + + Description: Descrição: - - + + All Day: Dia todo: - - + + Starts: Inicia: - - + + Ends: Termina: - - + + Remind Me: Lembrar-me: - - + + Repeat: Repetir: - - + + End Repeat: Fim de repetição: - - Type - Tipo - - - Work - Trabalho + + Calendar account: + Conta de calendário: - Life - Vida + + Calendar account + Conta de calendário - Other - Outros + + Type + Tipo - + Description Descrição - + All Day Dia todo - + Time: - + Hora: - + Time - + Hora - + Solar - + Solar - + Lunar - + Lunar - + Starts Inicia - + Ends Termina - + Remind Me Lembrar-me - + Repeat Repetir - - + + Daily Diário - - + + Weekdays Dias da semana - - + + Weekly Semanal - - - + + + Monthly Mensal - - - + + + Yearly Anual - + End Repeat Fim da repetição - + After Depois - + On Em - - - - - time(s) - vez(es) - - - + Cancel button Cancelar - + Save button Guardar @@ -432,141 +461,141 @@ CScheduleOperation - + All occurrences of a repeating event must have the same all-day status. Todas as ocorrências de um evento repetido devem ter o mesmo estado durante todo o dia. - - + + Do you want to change all occurrences? Deseja alterar todas as ocorrências? - - + + + + + + + + Cancel + button + Cancelar + + + + Change All Alterar tudo - + You are changing the repeating rule of this event. Está a alterar a regra da repetição deste evento. - - - + + + You are deleting an event. Está a eliminar um evento. - + Are you sure you want to delete this event? Tem a certeza que deseja eliminar este evento? - - - - - - - Cancel - button - Cancelar - - - Delete button Eliminar - + Do you want to delete all occurrences of this event, or only the selected occurrence? Deseja eliminar todas as ocorrências deste evento ou apenas a ocorrência selecionada? - + Delete All Eliminar tudo - - + + Delete Only This Event Eliminar apenas este evento - + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? Deseja eliminar esta e todas as ocorrências futuras deste evento ou apenas a ocorrência selecionada? - + Delete All Future Events Eliminar todos os eventos futuros - - + + You are changing a repeating event. Está a alterar um evento repetido. - + Do you want to change only this occurrence of the event, or all occurrences? Deseja alterar apenas esta ocorrência do evento, ou todas as ocorrências? - + All Tudo - - + + Only This Event Apenas este evento - + Do you want to change only this occurrence of the event, or this and all future occurrences? Deseja alterar apenas esta ocorrência do evento ou esta e todas as ocorrências futuras? - + All Future Events Todos os eventos futuros - + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. - + Selecionou um mês bissexto, e será lembrado de acordo com as regras do calendário lunar. - + OK button - + Aceitar CScheduleSearchDateItem - + Y A - + M M - + D D @@ -574,17 +603,17 @@ CScheduleSearchItem - + Edit Editar - + Delete Eliminar - + All Day Dia todo @@ -592,7 +621,7 @@ CScheduleSearchView - + No search results Sem resultados de pesquisa @@ -600,25 +629,83 @@ CScheduleView - + ALL DAY DIA TODO + CSettingDialog + + + Sunday + Domingo + + + + Monday + Segunda + + + + 24-hour clock + Relógio de 24 horas + + + + 12-hour clock + Relógio de 12 horas + + + + Manual + Manual + + + + 15 mins + 15 mins + + + + 30 mins + 30 mins + + + + 1 hour + 1 hora + + + + 24 hours + 24 horas + + + + Sync Now + Sincronizar agora + + + + Last sync + Última sincronização + + + CTimeEdit - + (%1 mins) (%1 mins) - + (%1 hour) (%1 hora) - + (%1 hours) (%1 horas) @@ -626,35 +713,79 @@ CTitleWidget - + Y A - + M M - + W S - + D D + + + + Search events and festivals + Pesquisar eventos e festivais + + + + CWeekWidget + + + Sun + Dom + + + + Mon + Seg + + + + Tue + Ter + + + + Wed + Qua + + + + Thu + Qui + + + + Fri + Sex + + + + Sat + Sáb + CWeekWindow - + Week Semana - + Y A @@ -662,13 +793,13 @@ CYearScheduleView + - All Day Dia todo - + No event Nenhum evento @@ -676,7 +807,7 @@ CYearWindow - + Y A @@ -684,12 +815,12 @@ CalendarWindow - + Calendar Calendário - + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. O Calendário é uma ferramenta para visualizar datas e também uma agenda diária inteligente para agendar todas as coisas na vida. @@ -697,43 +828,147 @@ Calendarmainwindow - + Calendar Calendário - + Manage - + Gerir + + + + Privacy Policy + Política de privacidade + + + + Syncing... + A sincronizar... + + + + Sync successful + Sincronização bem sucedida + + + + Sync failed, please try later + Falha ao sincronizar. Tente novamente mais tarde CenterWidget - + All Day Dia todo + DAccountDataBase + + + Work + + + + + Life + + + + + Other + + + + + DAlarmManager + + + + + + Close + button + + + + + One day before start + + + + + Remind me tomorrow + + + + + Remind me later + + + + + 15 mins later + + + + + 1 hour later + + + + + 4 hours later + + + + + + + Tomorrow + + + + + Schedule Reminder + + + + + + %1 to %2 + + + + + + Today + Hoje + + + DragInfoGraphicsView - + Edit Editar - + Delete Eliminar - + New event Novo evento - + New Event Novo evento @@ -741,45 +976,98 @@ JobTypeListView - + You are deleting an event type. - + Está a eliminar um tipo de evento. - + All events under this type will be deleted and cannot be recovered. - + Todos os eventos deste tipo serão eliminados e não podem ser recuperados. - + Cancel button - + Cancelar - + Delete button - + Eliminar QObject - + + Manage calendar - + Gerir calendário - + + Event types - + Tipos de evento + + + + Account settings + Definições de conta + + + + Account + Conta + + + + Select items to be synced + Selecionar itens a sincronizar + + + + Events + Eventos + + + + + General settings + Definições gerais + + + + Sync interval + Intervalo de sincronização + + + + Calendar account + Conta de calendário + + + + General + Geral + + + + First day of week + Primeiro dia da semana + + + + Time + Hora Return - + Today Return Hoje @@ -788,9 +1076,9 @@ Return Today - - - + + + Today Return Today Hoje @@ -799,95 +1087,127 @@ ScheduleTypeEditDlg - + New event type - + Novo tipo de evento - + Edit event type - + Editar tipo de evento - + Name: - + Nome: - + Color: - + Cor: - + Cancel button - + Cancelar - + Save button - - - - - Enter a name please - + Guardar - + The name can not only contain whitespaces - + O nome não pode conter apenas espaços em branco - - The name already exists - + + Enter a name please + Introduza um nome Shortcut - + Help Ajuda - + Delete event Eliminar evento - + Copy Copiar - + Cut Cortar - + Paste Colar - + Delete Eliminar - + Select all Selecionar tudo + SidebarCalendarWidget + + + Y + A + + + + M + M + + + + TimeJumpDialog + + + Go + button + Ir + + + + UserloginWidget + + + Sign In + button + Iniciar sessão + + + + Sign Out + button + Terminar sessão + + + YearFrame - + Y A @@ -895,17 +1215,17 @@ today - - - - - - - - + + + + + + + + Today Today Hoje - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar_ro.ts dde-calendar-5.10.0/translations/dde-calendar_ro.ts --- dde-calendar-5.9.1/translations/dde-calendar_ro.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar_ro.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,38 +1,96 @@ - + + + + + AccountItem + + + Sync successful + + + + + Network error + + + + + Server exception + + + + + Storage full + + + + + AccountManager + + + Local account + + + + + Event types + + + + + CColorPickerWidget + + + Color + + + + + Cancel + button + Anulează + + + + Save + button + Salvare + + CDayMonthView - + Monday Luni - + Tuesday Marţi - + Wednesday Miercuri - + Thursday Joi - + Friday Vineri - + Saturday Sâmbătă - + Sunday Duminică @@ -40,25 +98,30 @@ CDayWindow - + Y Y - + M l - + D z + + + Lunar + + CGraphicsView - + New Event Eveniment nou @@ -66,7 +129,7 @@ CMonthScheduleNumItem - + %1 more %1 mai mult @@ -74,12 +137,12 @@ CMonthView - + New event Eveniment nou - + New Event Eveniment nou @@ -87,7 +150,7 @@ CMonthWindow - + Y A @@ -95,258 +158,301 @@ CMyScheduleView - + My Event Evenimentul meu - + OK button Ok - + Delete button Ștergeți - + Edit button Editare + CPushButton + + + New event type + + + + CScheduleDlg - - + + + New Event Eveniment nou - + Edit Event Editare eveniment - + End time must be greater than start time Ora de încheiere trebuie să fie mai mare decât ora de început - + OK button Ok - - - - + + + + + + Never Niciodată - + At time of event La momentul evenimentului - + 15 minutes before Cu 15 minute înainte - + 30 minutes before Cu 30 minute înainte - + 1 hour before Cu 1 oră înainte - - + + 1 day before Cu 1 zi înainte - - + + 2 days before Cu 2 zile înainte - - + + 1 week before Cu 1 săptămână înainte - + On start day (9:00 AM) Începutul zilei (9:00 AM) - - + + Enter a name please + + + + + The name can not only contain whitespaces + + + + + Type: Tip: - - + + Description: Descriere: - - + + All Day: Toată ziua: - - + + Starts: Începe: - - + + Ends: Se termină: - - + + Remind Me: Aminteşte-mi: - - + + Repeat: Repetă: - - + + End Repeat: Repetarea se termină: - - Type - Tip - - - - Work - Serviciu + + Calendar account: + - - Life - Viaţă + + Calendar account + - - Other - Altul + + Type + Tip - + Description Descriere - + All Day Toată ziua - + + Time: + + + + + Time + + + + + Solar + + + + + Lunar + + + + Starts Începe - + Ends Se termină - + Remind Me Aminteşte-mi - + Repeat Repetă - + + Daily Zilnic - + + Weekdays Zilele saptămânii - + + Weekly Săptămânal - + + + Monthly Lunar - + + + Yearly Anual - + End Repeat Opreşte repetarea - + After După - + On Pornire - - - - + + + + time(s) ori - + Cancel button Anulează - + Save button Salvare @@ -355,115 +461,126 @@ CScheduleOperation - + All occurrences of a repeating event must have the same all-day status. Toate aparițiile unui eveniment repetat trebuie să aibă același statut toată ziua. - - + + Do you want to change all occurrences? Doriți să schimbați toate aparițiile? - - + + Change All Schimbă tot - + You are changing the repeating rule of this event. Modificați regula de repetare a acestui eveniment. - - - + + + You are deleting an event. Ştergeţi un eveniment. - + Are you sure you want to delete this event? Sigur doriţi să ştergeţi acest eveniment? - - - - - - - + + + + + + + Cancel button Anulează - + Delete button Ștergeți - + Do you want to delete all occurrences of this event, or only the selected occurrence? Doriți să ștergeți toate aparițiile acestui eveniment sau doar evenimentul selectat? - + Delete All Şterge tot - - + + Delete Only This Event Şterge doar acest eveniment - + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? Doriți să ștergeți toate aparițiile acestui eveniment sau doar evenimentul selectat? - + Delete All Future Events Şterge toate evenimentele viitoare - - + + You are changing a repeating event. Modificați un eveniment care se repetă. - + Do you want to change only this occurrence of the event, or all occurrences? Doriți să schimbați doar această apariție a evenimentului sau toate evenimentele? - + All Tot - - + + Only This Event Doar acest eveniment - + Do you want to change only this occurrence of the event, or this and all future occurrences? Doriți să schimbați doar această apariție a evenimentului sau aceasta și toate evenimentele viitoare? - + All Future Events Toate evenimentele viitoare + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + + OK + button + Ok + CScheduleSearchDateItem @@ -486,17 +603,17 @@ CScheduleSearchItem - + Edit Editează - + Delete Șterge - + All Day Toată ziua @@ -512,61 +629,163 @@ CScheduleView - + ALL DAY TOATĂ ZIUA + CSettingDialog + + + Sunday + Duminică + + + + Monday + Luni + + + + 24-hour clock + + + + + 12-hour clock + + + + + Manual + + + + + 15 mins + + + + + 30 mins + + + + + 1 hour + + + + + 24 hours + + + + + Sync Now + + + + + Last sync + + + + CTimeEdit - + (%1 mins) - + - + (%1 hour) - + - + (%1 hours) - + CTitleWidget - + Y A - + M L - + W S - + D Z + + + + Search events and festivals + + + + + CWeekWidget + + + Sun + + + + + Mon + + + + + Tue + + + + + Wed + + + + + Thu + + + + + Fri + + + + + Sat + + CWeekWindow - + Week Săptămână - + Y A @@ -574,13 +793,13 @@ CYearScheduleView + - All Day Toată ziua - + No event Nici un eveniment @@ -588,7 +807,7 @@ CYearWindow - + Y A @@ -596,12 +815,12 @@ CalendarWindow - + Calendar Calendar - + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. Calendarul este un instrument pentru a vizualiza datele și, de asemenea, un planificator inteligent zilnic pentru a programa toate lucrurile din viață. @@ -609,46 +828,246 @@ Calendarmainwindow - + Calendar Calendar + + + Manage + + + + + Privacy Policy + + + + + Syncing... + + + + + Sync successful + + + + + Sync failed, please try later + + CenterWidget - + All Day Toată ziua + DAccountDataBase + + + Work + Serviciu + + + + Life + Viaţă + + + + Other + Altul + + + + DAlarmManager + + + + + + Close + button + + + + + One day before start + + + + + Remind me tomorrow + + + + + Remind me later + + + + + 15 mins later + + + + + 1 hour later + + + + + 4 hours later + + + + + + + Tomorrow + + + + + Schedule Reminder + + + + + + %1 to %2 + + + + + + Today + Astăzi + + + DragInfoGraphicsView - + Edit Editare - + Delete Ștergeți - + New event Eveniment nou - + New Event Eveniment nou + JobTypeListView + + + You are deleting an event type. + + + + + All events under this type will be deleted and cannot be recovered. + + + + + Cancel + button + Anulează + + + + Delete + button + + + + + QObject + + + Account settings + + + + + Account + + + + + Select items to be synced + + + + + Events + + + + + + General settings + + + + + Sync interval + + + + + + Manage calendar + + + + + Calendar account + + + + + + Event types + + + + + General + + + + + First day of week + + + + + Time + + + + Return - + Today Return Astăzi @@ -657,56 +1076,138 @@ Return Today - - - + + + Today Return Today Astăzi + ScheduleTypeEditDlg + + + New event type + + + + + Edit event type + + + + + Name: + + + + + Color: + + + + + Cancel + button + Anulează + + + + Save + button + Salvare + + + + The name can not only contain whitespaces + + + + + Enter a name please + + + + Shortcut - + Help Ajutor - + Delete event Ştergere eveniment - + Copy Copiere - + Cut Tăiere - + Paste Lipire - + Delete Ștergeți - + Select all Selectează totul + SidebarCalendarWidget + + + Y + + + + + M + + + + + TimeJumpDialog + + + Go + button + + + + + UserloginWidget + + + Sign In + button + + + + + Sign Out + button + + + + YearFrame - + Y A @@ -714,17 +1215,17 @@ today - - - - - - - - + + + + + + + + Today Today Astăzi - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar_ru.ts dde-calendar-5.10.0/translations/dde-calendar_ru.ts --- dde-calendar-5.9.1/translations/dde-calendar_ru.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar_ru.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,66 +1,96 @@ - + + + - CColorPickerWidget + AccountItem - - Color - + + Sync successful + Успешная синхронизация - - Cancel - button - + + Network error + Ошибка сети - - Save - button - + + Server exception + Исключение сервера + + + + Storage full + Хранилище заполнено + + + + AccountManager + + + Local account + Учетная запись домена + + + + Event types + + + + + CColorPickerWidget + + + Color + Цвет + Cancel - + button + Отмена + Save - + button + Сохранить CDayMonthView - + Monday Понедельник - + Tuesday Вторник - + Wednesday Среда - + Thursday Четверг - + Friday Пятница - + Saturday Суббота - + Sunday Воскресенье @@ -68,25 +98,30 @@ CDayWindow - + Y Г - + M М - + D Д + + + Lunar + Лунный + CGraphicsView - + New Event Новое Событие @@ -94,7 +129,7 @@ CMonthScheduleNumItem - + %1 more более %1 @@ -102,12 +137,12 @@ CMonthView - + New event Новое событие - + New Event Новое Событие @@ -115,7 +150,7 @@ CMonthWindow - + Y Г @@ -123,24 +158,24 @@ CMyScheduleView - + My Event Моё событие - + OK button OK - + Delete button Удалить - + Edit button Редактировать @@ -149,281 +184,275 @@ CPushButton - + New event type - + Новый тип события CScheduleDlg - - + + + New Event Новое событие - + Edit Event Редактировать событие - + End time must be greater than start time Время окончания должно быть больше времени начала - + OK button OK - - - - - - + + + + + + Never Никогда - + At time of event Во время события - + 15 minutes before За 15 минут до этого - + 30 minutes before За 30 минут до этого - + 1 hour before За 1 час до этого - + 1 day before За 1 день до этого - + 2 days before За 2 дня до этого - + 1 week before За 1 неделю до этого - + On start day (9:00 AM) В день начала (9:00) - - Enter a name please - + + + + + time(s) + раз(а) - - The name can not only contain whitespaces - + + Enter a name please + Введите имя, пожалуйста - - The name already exists - + + The name can not only contain whitespaces + Имя не может содержать только пробелы - - + + Type: Тип: - - + + Description: Описание: - - + + All Day: Весь день: - - + + Starts: Начинается: - - + + Ends: Заканчивается: - - + + Remind Me: Напомнить: - - + + Repeat: Повторять: - - + + End Repeat: Повторять до: - - Type - Тип - - - Work - Работа + + Calendar account: + Учетная запись календаря: - Life - Жизнь + + Calendar account + Учетная запись календаря: - Other - Другое + + Type + Тип - + Description Описание - + All Day Весь день - + Time: - + Время: - + Time - + Время - + Solar - + Солнечно - + Lunar - + Лунный - + Starts Начало - + Ends Конец - + Remind Me Напомнить - + Repeat Повторять - - + + Daily Ежедневно - - + + Weekdays По будням - - + + Weekly Еженедельно - - - + + + Monthly Ежемесячно - - - + + + Yearly Ежегодно - + End Repeat Повторять до: - + After После - + On Вкл. - - - - - time(s) - раз(а) - - - + Cancel button Отмена - + Save button Сохранить @@ -432,141 +461,141 @@ CScheduleOperation - + All occurrences of a repeating event must have the same all-day status. Все экземпляры повторяющегося события должны иметь одинаковый статус в течение всего дня. - - + + Do you want to change all occurrences? Вы хотите изменить все экземпляры? - - + + + + + + + + Cancel + button + Отмена + + + + Change All Изменить все - + You are changing the repeating rule of this event. Вы изменяете правило повторения этого события. - - - + + + You are deleting an event. Вы удаляете событие. - + Are you sure you want to delete this event? Вы действительно хотите удалить событие? - - - - - - - Cancel - button - Отмена - - - Delete button Удалить - + Do you want to delete all occurrences of this event, or only the selected occurrence? Вы хотите удалить все экземпляры данного события или только выбранного экземпляра? - + Delete All Удалить все - - + + Delete Only This Event Удалить только это событие - + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? Вы хотите удалить только это и будущие проявления события или только выбранные проявления? - + Delete All Future Events Удалить Все Будущие События - - + + You are changing a repeating event. Вы изменяете повторяющееся событие - + Do you want to change only this occurrence of the event, or all occurrences? Вы хотите изменить только это проявление события или все проявления. - + All Все - - + + Only This Event Только Это Событие - + Do you want to change only this occurrence of the event, or this and all future occurrences? Вы хотите изменить только это проявление данного события или всё событие и все будущие проявления? - + All Future Events Только Будущие События - + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. - + - + OK button - + OK CScheduleSearchDateItem - + Y Г - + M М - + D Д @@ -574,17 +603,17 @@ CScheduleSearchItem - + Edit Правка - + Delete Удалить - + All Day Весь День @@ -592,7 +621,7 @@ CScheduleSearchView - + No search results Поиск результатов не дал @@ -600,25 +629,83 @@ CScheduleView - + ALL DAY ВЕСЬ ДЕНЬ + CSettingDialog + + + Sunday + Воскресенье + + + + Monday + Понедельник + + + + 24-hour clock + 24-часовой + + + + 12-hour clock + 24-часовой {12-?} + + + + Manual + Вручную + + + + 15 mins + + + + + 30 mins + + + + + 1 hour + 1 час + + + + 24 hours + + + + + Sync Now + + + + + Last sync + + + + CTimeEdit - + (%1 mins) (%1 минут) - + (%1 hour) (%1 час) - + (%1 hours) (%1 часов) @@ -626,35 +713,79 @@ CTitleWidget - + Y Г - + M М - + W Н - + D Д + + + + Search events and festivals + + + + + CWeekWidget + + + Sun + Вс + + + + Mon + Пн + + + + Tue + Вт + + + + Wed + Ср + + + + Thu + Чт + + + + Fri + Пт + + + + Sat + Сб + CWeekWindow - + Week Неделя - + Y Г @@ -662,13 +793,13 @@ CYearScheduleView + - All Day Весь День - + No event Нет события @@ -676,7 +807,7 @@ CYearWindow - + Y Г @@ -684,12 +815,12 @@ CalendarWindow - + Calendar Календарь - + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. Календарь - это инструмент для просмотра дат, а также умный ежедневник для планирования всех событий вашей повседневной жизни. @@ -697,43 +828,147 @@ Calendarmainwindow - + Calendar Календарь - + Manage - + + + + + Privacy Policy + Политика конфиденциальности + + + + Syncing... + Синхронизация... + + + + Sync successful + Успешная синхронизация + + + + Sync failed, please try later + CenterWidget - + All Day Весь День: + DAccountDataBase + + + Work + + + + + Life + + + + + Other + + + + + DAlarmManager + + + + + + Close + button + + + + + One day before start + + + + + Remind me tomorrow + + + + + Remind me later + + + + + 15 mins later + + + + + 1 hour later + + + + + 4 hours later + + + + + + + Tomorrow + + + + + Schedule Reminder + + + + + + %1 to %2 + + + + + + Today + Сегодня + + + DragInfoGraphicsView - + Edit Редактировать - + Delete Удалить - + New event Новое событие - + New Event Новое Событие @@ -741,45 +976,98 @@ JobTypeListView - + You are deleting an event type. - + - + All events under this type will be deleted and cannot be recovered. - + - + Cancel button - + Отмена - + Delete button - + Удалить QObject - + + Manage calendar - + - + + Event types - + + + + + Account settings + + + + + Account + Учетная запись + + + + Select items to be synced + + + + + Events + + + + + + General settings + + + + + Sync interval + + + + + Calendar account + Учетная запись календаря: + + + + General + Общие + + + + First day of week + + + + + Time + Время Return - + Today Return Сегодня @@ -788,9 +1076,9 @@ Return Today - - - + + + Today Return Today Сегодня @@ -799,95 +1087,127 @@ ScheduleTypeEditDlg - + New event type - + Новый тип события - + Edit event type - + - + Name: - + Имя: - + Color: - + Цвет: - + Cancel button - + Отмена - + Save button - - - - - Enter a name please - + Сохранить - + The name can not only contain whitespaces - + Имя не может содержать только пробелы - - The name already exists - + + Enter a name please + Введите имя, пожалуйста Shortcut - + Help Помощь - + Delete event Удалить событие - + Copy Копировать - + Cut Вырезать - + Paste Вставить - + Delete Удалить - + Select all Выбрать всё + SidebarCalendarWidget + + + Y + Г + + + + M + М + + + + TimeJumpDialog + + + Go + button + + + + + UserloginWidget + + + Sign In + button + Войти + + + + Sign Out + button + Выйти + + + YearFrame - + Y Г @@ -895,17 +1215,17 @@ today - - - - - - - - + + + + + + + + Today Today Сегодня - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar-service_am_ET.ts dde-calendar-5.10.0/translations/dde-calendar-service_am_ET.ts --- dde-calendar-5.9.1/translations/dde-calendar-service_am_ET.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar-service_am_ET.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,52 +1,1231 @@ - + + + - JobRemindManager + AccountItem - - One day before start - አንድ ቀን ከ መጀመሩ በፊት + + Sync successful + + + + + Network error + + + + + Server exception + + + + + Storage full + + + + + AccountManager + + + Local account + + + + + Event types + + + + + CColorPickerWidget + + + Color + + + + + Cancel + button + + + + + Save + button + + + + + CDayMonthView + + + Monday + + + + + Tuesday + + + + + Wednesday + + + + + Thursday + + + + + Friday + + + + + Saturday + + + + + Sunday + + + + + CDayWindow + + + Y + + + + + M + + + + + D + + + + + Lunar + + + + + CGraphicsView + + + New Event + + + + + CMonthScheduleNumItem + + + %1 more + + + + + CMonthView + + + New event + + + + + New Event + + + + + CMonthWindow + + + Y + + + + + CMyScheduleView + + + My Event + + + + + OK + button + + + + + Delete + button + + + + + Edit + button + + + + + CPushButton + + + New event type + + + + + CScheduleDlg + + + + + New Event + + + + + Edit Event + + + + + End time must be greater than start time + + + + + OK + button + + + + + + + + + + Never + + + + + At time of event + + + + + 15 minutes before + + + + + 30 minutes before + + + + + 1 hour before + + + + + + 1 day before + + + + + + 2 days before + + + + + + 1 week before + + + + + On start day (9:00 AM) + + + + + + + + time(s) + + + + + Enter a name please + + + + + The name can not only contain whitespaces + + + + + + Type: + + + + + + Description: + + + + + + All Day: + - - - - + + + Starts: + + + + + + Ends: + + + + + + Remind Me: + + + + + + Repeat: + + + + + + End Repeat: + + + + + Calendar account: + + + + + Calendar account + + + + + Type + + + + + Description + + + + + All Day + + + + + Time: + + + + + Time + + + + + Solar + + + + + Lunar + + + + + Starts + + + + + Ends + + + + + Remind Me + + + + + Repeat + + + + + + Daily + + + + + + Weekdays + + + + + + Weekly + + + + + + + Monthly + + + + + + + Yearly + + + + + End Repeat + + + + + After + + + + + On + + + + + Cancel + button + + + + + Save + button + + + + + CScheduleOperation + + + All occurrences of a repeating event must have the same all-day status. + + + + + + Do you want to change all occurrences? + + + + + + + + + + + Cancel + button + + + + + + Change All + + + + + You are changing the repeating rule of this event. + + + + + + + You are deleting an event. + + + + + Are you sure you want to delete this event? + + + + + Delete + button + + + + + Do you want to delete all occurrences of this event, or only the selected occurrence? + + + + + Delete All + + + + + + Delete Only This Event + + + + + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? + + + + + Delete All Future Events + + + + + + You are changing a repeating event. + + + + + Do you want to change only this occurrence of the event, or all occurrences? + + + + + All + + + + + + Only This Event + + + + + Do you want to change only this occurrence of the event, or this and all future occurrences? + + + + + All Future Events + + + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + + OK + button + + + + + CScheduleSearchDateItem + + + Y + + + + + M + + + + + D + + + + + CScheduleSearchItem + + + Edit + + + + + Delete + + + + + All Day + + + + + CScheduleSearchView + + + No search results + + + + + CScheduleView + + + ALL DAY + + + + + CSettingDialog + + + Sunday + + + + + Monday + + + + + 24-hour clock + + + + + 12-hour clock + + + + + Manual + + + + + 15 mins + + + + + 30 mins + + + + + 1 hour + + + + + 24 hours + + + + + Sync Now + + + + + Last sync + + + + + CTimeEdit + + + (%1 mins) + + + + + (%1 hour) + + + + + (%1 hours) + + + + + CTitleWidget + + + Y + + + + + M + + + + + W + + + + + D + + + + + + Search events and festivals + + + + + CWeekWidget + + + Sun + + + + + Mon + + + + + Tue + + + + + Wed + + + + + Thu + + + + + Fri + + + + + Sat + + + + + CWeekWindow + + + Week + + + + + Y + + + + + CYearScheduleView + + + + All Day + + + + + No event + + + + + CYearWindow + + + Y + + + + + CalendarWindow + + + Calendar + + + + + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. + + + + + Calendarmainwindow + + + Calendar + + + + + Manage + + + + + Privacy Policy + + + + + Syncing... + + + + + Sync successful + + + + + Sync failed, please try later + + + + + CenterWidget + + + All Day + + + + + DAccountDataBase + + + Work + + + + + Life + + + + + Other + + + + + DAlarmManager + + + + + Close button - መዝጊያ + መዝጊያ - + + One day before start + አንድ ቀን ከ መጀመሩ በፊት + + + Remind me tomorrow - ነገ አስታውሰኝ + ነገ አስታውሰኝ - + Remind me later - በኋላ አስታውሰኝ + በኋላ አስታውሰኝ + + + + 15 mins later + + + + + 1 hour later + + + + + 4 hours later + - + + + + Tomorrow + ነገ + + + Schedule Reminder - አስታዋሽ ማሰናጃ + አስታዋሽ ማሰናጃ - - + + %1 to %2 - %1 እስከ %2 + %1 እስከ %2 - - + + Today - ዛሬ + ዛሬ + + + + DragInfoGraphicsView + + + Edit + - - - Tomorrow - ነገ + + Delete + + + + + New event + + + + + New Event + + + + + JobTypeListView + + + You are deleting an event type. + + + + + All events under this type will be deleted and cannot be recovered. + + + + + Cancel + button + + + + + Delete + button + + + + + QObject + + + Account settings + + + + + Account + + + + + Select items to be synced + + + + + Events + + + + + + General settings + + + + + Sync interval + + + + + + Manage calendar + + + + + Calendar account + + + + + + Event types + + + + + General + + + + + First day of week + + + + + Time + + + + + Return + + + Today + Return + ዛሬ + + + + Return Today + + + + + Today + Return Today + ዛሬ + + + + ScheduleTypeEditDlg + + + New event type + + + + + Edit event type + + + + + Name: + + + + + Color: + + + + + Cancel + button + + + + + Save + button + + + + + The name can not only contain whitespaces + + + + + Enter a name please + + + + + Shortcut + + + Help + + + + + Delete event + + + + + Copy + + + + + Cut + + + + + Paste + + + + + Delete + + + + + Select all + + + + + SidebarCalendarWidget + + + Y + + + + + M + + + + + TimeJumpDialog + + + Go + button + + + + + UserloginWidget + + + Sign In + button + + + + + Sign Out + button + + + + + YearFrame + + + Y + + + + + today + + + + + + + + + + Today + Today + ዛሬ - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar-service_ar.ts dde-calendar-5.10.0/translations/dde-calendar-service_ar.ts --- dde-calendar-5.9.1/translations/dde-calendar-service_ar.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar-service_ar.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,52 +1,1231 @@ - + + + - JobRemindManager + AccountItem - - One day before start - يوم قبل البداية + + Sync successful + + + + + Network error + + + + + Server exception + + + + + Storage full + + + + + AccountManager + + + Local account + + + + + Event types + + + + + CColorPickerWidget + + + Color + + + + + Cancel + button + + + + + Save + button + + + + + CDayMonthView + + + Monday + + + + + Tuesday + + + + + Wednesday + + + + + Thursday + + + + + Friday + + + + + Saturday + + + + + Sunday + + + + + CDayWindow + + + Y + + + + + M + + + + + D + + + + + Lunar + + + + + CGraphicsView + + + New Event + + + + + CMonthScheduleNumItem + + + %1 more + + + + + CMonthView + + + New event + + + + + New Event + + + + + CMonthWindow + + + Y + + + + + CMyScheduleView + + + My Event + + + + + OK + button + + + + + Delete + button + + + + + Edit + button + + + + + CPushButton + + + New event type + + + + + CScheduleDlg + + + + + New Event + + + + + Edit Event + + + + + End time must be greater than start time + + + + + OK + button + + + + + + + + + + Never + + + + + At time of event + + + + + 15 minutes before + + + + + 30 minutes before + + + + + 1 hour before + + + + + + 1 day before + + + + + + 2 days before + + + + + + 1 week before + + + + + On start day (9:00 AM) + + + + + + + + time(s) + + + + + Enter a name please + + + + + The name can not only contain whitespaces + + + + + + Type: + + + + + + Description: + + + + + + All Day: + - - - - + + + Starts: + + + + + + Ends: + + + + + + Remind Me: + + + + + + Repeat: + + + + + + End Repeat: + + + + + Calendar account: + + + + + Calendar account + + + + + Type + + + + + Description + + + + + All Day + + + + + Time: + + + + + Time + + + + + Solar + + + + + Lunar + + + + + Starts + + + + + Ends + + + + + Remind Me + + + + + Repeat + + + + + + Daily + + + + + + Weekdays + + + + + + Weekly + + + + + + + Monthly + + + + + + + Yearly + + + + + End Repeat + + + + + After + + + + + On + + + + + Cancel + button + + + + + Save + button + + + + + CScheduleOperation + + + All occurrences of a repeating event must have the same all-day status. + + + + + + Do you want to change all occurrences? + + + + + + + + + + + Cancel + button + + + + + + Change All + + + + + You are changing the repeating rule of this event. + + + + + + + You are deleting an event. + + + + + Are you sure you want to delete this event? + + + + + Delete + button + + + + + Do you want to delete all occurrences of this event, or only the selected occurrence? + + + + + Delete All + + + + + + Delete Only This Event + + + + + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? + + + + + Delete All Future Events + + + + + + You are changing a repeating event. + + + + + Do you want to change only this occurrence of the event, or all occurrences? + + + + + All + + + + + + Only This Event + + + + + Do you want to change only this occurrence of the event, or this and all future occurrences? + + + + + All Future Events + + + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + + OK + button + + + + + CScheduleSearchDateItem + + + Y + + + + + M + + + + + D + + + + + CScheduleSearchItem + + + Edit + + + + + Delete + + + + + All Day + + + + + CScheduleSearchView + + + No search results + + + + + CScheduleView + + + ALL DAY + + + + + CSettingDialog + + + Sunday + + + + + Monday + + + + + 24-hour clock + + + + + 12-hour clock + + + + + Manual + + + + + 15 mins + + + + + 30 mins + + + + + 1 hour + + + + + 24 hours + + + + + Sync Now + + + + + Last sync + + + + + CTimeEdit + + + (%1 mins) + + + + + (%1 hour) + + + + + (%1 hours) + + + + + CTitleWidget + + + Y + + + + + M + + + + + W + + + + + D + + + + + + Search events and festivals + + + + + CWeekWidget + + + Sun + + + + + Mon + + + + + Tue + + + + + Wed + + + + + Thu + + + + + Fri + + + + + Sat + + + + + CWeekWindow + + + Week + + + + + Y + + + + + CYearScheduleView + + + + All Day + + + + + No event + + + + + CYearWindow + + + Y + + + + + CalendarWindow + + + Calendar + + + + + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. + + + + + Calendarmainwindow + + + Calendar + + + + + Manage + + + + + Privacy Policy + + + + + Syncing... + + + + + Sync successful + + + + + Sync failed, please try later + + + + + CenterWidget + + + All Day + + + + + DAccountDataBase + + + Work + + + + + Life + + + + + Other + + + + + DAlarmManager + + + + + Close button - إغلاق + إغلاق - + + One day before start + يوم قبل البداية + + + Remind me tomorrow - ذكرني غدا + ذكرني غدا - + Remind me later - ذكرني لاحقا + ذكرني لاحقا + + + + 15 mins later + + + + + 1 hour later + + + + + 4 hours later + - + + + + Tomorrow + غدا + + + Schedule Reminder - تذكير بالبرنامج + تذكير بالبرنامج - - + + %1 to %2 - + - - + + Today - اليوم + اليوم + + + + DragInfoGraphicsView + + + Edit + - - - Tomorrow - غدا + + Delete + + + + + New event + + + + + New Event + + + + + JobTypeListView + + + You are deleting an event type. + + + + + All events under this type will be deleted and cannot be recovered. + + + + + Cancel + button + + + + + Delete + button + + + + + QObject + + + Account settings + + + + + Account + + + + + Select items to be synced + + + + + Events + + + + + + General settings + + + + + Sync interval + + + + + + Manage calendar + + + + + Calendar account + + + + + + Event types + + + + + General + + + + + First day of week + + + + + Time + + + + + Return + + + Today + Return + اليوم + + + + Return Today + + + + + Today + Return Today + اليوم + + + + ScheduleTypeEditDlg + + + New event type + + + + + Edit event type + + + + + Name: + + + + + Color: + + + + + Cancel + button + + + + + Save + button + + + + + The name can not only contain whitespaces + + + + + Enter a name please + + + + + Shortcut + + + Help + + + + + Delete event + + + + + Copy + + + + + Cut + + + + + Paste + + + + + Delete + + + + + Select all + + + + + SidebarCalendarWidget + + + Y + + + + + M + + + + + TimeJumpDialog + + + Go + button + + + + + UserloginWidget + + + Sign In + button + + + + + Sign Out + button + + + + + YearFrame + + + Y + + + + + today + + + + + + + + + + Today + Today + اليوم - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar-service_az.ts dde-calendar-5.10.0/translations/dde-calendar-service_az.ts --- dde-calendar-5.9.1/translations/dde-calendar-service_az.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar-service_az.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,86 +1,965 @@ - + + + - JobRemindManager + AccountItem - - One day before start - Başlamadan bir gün əvvəl + Sync successful + + + + Network error + + + + Server exception + + + + Storage full + + + + + AccountManager + + Local account + + + + Event types + + + + + CColorPickerWidget + + Color + + + + Cancel + button + + + + Save + button + + + + + CDayMonthView + + Monday + + + + Tuesday + + + + Wednesday + - - - - + Thursday + + + + Friday + + + + Saturday + + + + Sunday + + + + + CDayWindow + + Y + + + + M + + + + D + + + + Lunar + + + + + CGraphicsView + + New Event + + + + + CMonthScheduleNumItem + + %1 more + + + + + CMonthView + + New event + + + + New Event + + + + + CMonthWindow + + Y + + + + + CMyScheduleView + + My Event + + + + OK + button + + + + Delete + button + + + + Edit + button + + + + + CPushButton + + New event type + + + + + CScheduleDlg + + New Event + + + + Edit Event + + + + End time must be greater than start time + + + + OK + button + + + + Never + + + + At time of event + + + + 15 minutes before + + + + 30 minutes before + + + + 1 hour before + + + + 1 day before + + + + 2 days before + + + + 1 week before + + + + On start day (9:00 AM) + + + + time(s) + + + + Enter a name please + + + + The name can not only contain whitespaces + + + + Type: + + + + Description: + + + + All Day: + + + + Starts: + + + + Ends: + + + + Remind Me: + + + + Repeat: + + + + End Repeat: + + + + Calendar account: + + + + Calendar account + + + + Type + + + + Description + + + + All Day + + + + Time: + + + + Time + + + + Solar + + + + Lunar + + + + Starts + + + + Ends + + + + Remind Me + + + + Repeat + + + + Daily + + + + Weekdays + + + + Weekly + + + + Monthly + + + + Yearly + + + + End Repeat + + + + After + + + + On + + + + Cancel + button + + + + Save + button + + + + + CScheduleOperation + + All occurrences of a repeating event must have the same all-day status. + + + + Do you want to change all occurrences? + + + + Cancel + button + + + + Change All + + + + You are changing the repeating rule of this event. + + + + You are deleting an event. + + + + Are you sure you want to delete this event? + + + + Delete + button + + + + Do you want to delete all occurrences of this event, or only the selected occurrence? + + + + Delete All + + + + Delete Only This Event + + + + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? + + + + Delete All Future Events + + + + You are changing a repeating event. + + + + Do you want to change only this occurrence of the event, or all occurrences? + + + + All + + + + Only This Event + + + + Do you want to change only this occurrence of the event, or this and all future occurrences? + + + + All Future Events + + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + OK + button + + + + + CScheduleSearchDateItem + + Y + + + + M + + + + D + + + + + CScheduleSearchItem + + Edit + + + + Delete + + + + All Day + + + + + CScheduleSearchView + + No search results + + + + + CScheduleView + + ALL DAY + + + + + CSettingDialog + + Sunday + + + + Monday + + + + 24-hour clock + + + + 12-hour clock + + + + Manual + + + + 15 mins + + + + 30 mins + + + + 1 hour + + + + 24 hours + + + + Sync Now + + + + Last sync + + + + + CTimeEdit + + (%1 mins) + + + + (%1 hour) + + + + (%1 hours) + + + + + CTitleWidget + + Y + + + + M + + + + W + + + + D + + + + Search events and festivals + + + + + CWeekWidget + + Sun + + + + Mon + + + + Tue + + + + Wed + + + + Thu + + + + Fri + + + + Sat + + + + + CWeekWindow + + Week + + + + Y + + + + + CYearScheduleView + + All Day + + + + No event + + + + + CYearWindow + + Y + + + + + CalendarWindow + + Calendar + + + + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. + + + + + Calendarmainwindow + + Calendar + + + + Manage + + + + Privacy Policy + + + + Syncing... + + + + Sync successful + + + + Sync failed, please try later + + + + + CenterWidget + + All Day + + + + + DAccountDataBase + + Work + İş + + + Life + Həyat + + + Other + Digər + + + + DAlarmManager + Close button Bağlayın - + One day before start + Başlamadan bir gün əvvəl + + Remind me tomorrow - Sabah mənə xatırlat + Mənə sabah xatırlat - Remind me later - Sonra mənə xatırlat + Mənə sonra xatırlat - 15 mins later 15 dəq sonra - 1 hour later 1 saat sonra - 4 hours later 4 saat sonra - + Tomorrow + Sabah + + Schedule Reminder Xatırlatma cədvəli - - %1 to %2 %1 ilə %2 arası - - Today Bu gün + + + DragInfoGraphicsView - - - - Tomorrow - Sabah + Edit + + + + Delete + + + + New event + + + + New Event + - SchedulerDatabase + JobTypeListView - - Work - İş + You are deleting an event type. + - - Life - Həyat + All events under this type will be deleted and cannot be recovered. + - - Other - Başqa + Cancel + button + + + + Delete + button + + + + + QObject + + Account settings + + + + Account + + + + Select items to be synced + + + + Events + + + + General settings + + + + Sync interval + + + + Manage calendar + + + + Calendar account + + + + Event types + + + + General + + + + First day of week + + + + Time + + + + + Return + + Today + Return + Bu gün + + + + Return Today + + Today + Return Today + Bu gün + + + + ScheduleTypeEditDlg + + New event type + + + + Edit event type + + + + Name: + + + + Color: + + + + Cancel + button + + + + Save + button + + + + The name can not only contain whitespaces + + + + Enter a name please + + + + + Shortcut + + Help + + + + Delete event + + + + Copy + + + + Cut + + + + Paste + + + + Delete + + + + Select all + + + + + SidebarCalendarWidget + + Y + + + + M + + + + + TimeJumpDialog + + Go + button + + + + + UserloginWidget + + Sign In + button + + + + Sign Out + button + + + + + YearFrame + + Y + + + + + today + + Today + Today + Bu gün - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar-service_bo.ts dde-calendar-5.10.0/translations/dde-calendar-service_bo.ts --- dde-calendar-5.9.1/translations/dde-calendar-service_bo.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar-service_bo.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,52 +1,965 @@ - + + + - JobRemindManager + AccountItem - - One day before start - ཉིན་1སྔོན་ལ་དྲན་སྐུལ་བྱེད་པ། + Sync successful + + + + Network error + + + + Server exception + + + + Storage full + + + + + AccountManager + + Local account + + + + Event types + + + + + CColorPickerWidget + + Color + + + + Cancel + button + + + + Save + button + + + + + CDayMonthView + + Monday + + + + Tuesday + + + + Wednesday + + + + Thursday + + + + Friday + + + + Saturday + + + + Sunday + + + + + CDayWindow + + Y + + + + M + + + + D + + + + Lunar + + + + + CGraphicsView + + New Event + + + + + CMonthScheduleNumItem + + %1 more + + + + + CMonthView + + New event + + + + New Event + + + + + CMonthWindow + + Y + + + + + CMyScheduleView + + My Event + + + + OK + button + + + + Delete + button + + + + Edit + button + + + + + CPushButton + + New event type + + + + + CScheduleDlg + + New Event + + + + Edit Event + + + + End time must be greater than start time + + + + OK + button + + + + Never + + + + At time of event + + + + 15 minutes before + + + + 30 minutes before + + + + 1 hour before + + + + 1 day before + + + + 2 days before + + + + 1 week before + + + + On start day (9:00 AM) + + + + time(s) + + + + Enter a name please + + + + The name can not only contain whitespaces + + + + Type: + + + + Description: + + + + All Day: + - - - - + Starts: + + + + Ends: + + + + Remind Me: + + + + Repeat: + + + + End Repeat: + + + + Calendar account: + + + + Calendar account + + + + Type + + + + Description + + + + All Day + + + + Time: + + + + Time + + + + Solar + + + + Lunar + + + + Starts + + + + Ends + + + + Remind Me + + + + Repeat + + + + Daily + + + + Weekdays + + + + Weekly + + + + Monthly + + + + Yearly + + + + End Repeat + + + + After + + + + On + + + + Cancel + button + + + + Save + button + + + + + CScheduleOperation + + All occurrences of a repeating event must have the same all-day status. + + + + Do you want to change all occurrences? + + + + Cancel + button + + + + Change All + + + + You are changing the repeating rule of this event. + + + + You are deleting an event. + + + + Are you sure you want to delete this event? + + + + Delete + button + + + + Do you want to delete all occurrences of this event, or only the selected occurrence? + + + + Delete All + + + + Delete Only This Event + + + + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? + + + + Delete All Future Events + + + + You are changing a repeating event. + + + + Do you want to change only this occurrence of the event, or all occurrences? + + + + All + + + + Only This Event + + + + Do you want to change only this occurrence of the event, or this and all future occurrences? + + + + All Future Events + + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + OK + button + + + + + CScheduleSearchDateItem + + Y + + + + M + + + + D + + + + + CScheduleSearchItem + + Edit + + + + Delete + + + + All Day + + + + + CScheduleSearchView + + No search results + + + + + CScheduleView + + ALL DAY + + + + + CSettingDialog + + Sunday + + + + Monday + + + + 24-hour clock + + + + 12-hour clock + + + + Manual + + + + 15 mins + + + + 30 mins + + + + 1 hour + + + + 24 hours + + + + Sync Now + + + + Last sync + + + + + CTimeEdit + + (%1 mins) + + + + (%1 hour) + + + + (%1 hours) + + + + + CTitleWidget + + Y + + + + M + + + + W + + + + D + + + + Search events and festivals + + + + + CWeekWidget + + Sun + + + + Mon + + + + Tue + + + + Wed + + + + Thu + + + + Fri + + + + Sat + + + + + CWeekWindow + + Week + + + + Y + + + + + CYearScheduleView + + All Day + + + + No event + + + + + CYearWindow + + Y + + + + + CalendarWindow + + Calendar + + + + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. + + + + + Calendarmainwindow + + Calendar + + + + Manage + + + + Privacy Policy + + + + Syncing... + + + + Sync successful + + + + Sync failed, please try later + + + + + CenterWidget + + All Day + + + + + DAccountDataBase + + Work + ལས་ཀ + + + Life + འཆོ་བ། + + + Other + གཞན་དག + + + + DAlarmManager + Close button ཁ་རྒྱག - + One day before start + ཉིན་1སྔོན་ལ་དྲན་སྐུལ་བྱེད་པ། + + Remind me tomorrow སང་ཉིན་དྲན་སྐུལ་བྱེད། - Remind me later - ཏོག་ཙམ་ནས་དྲན་སྐུལ་བྱེད། + གཏོགས་ཙམ་ནས་དྲན་སྐུལ་བྱེད། + + + 15 mins later + + + + 1 hour later + + + + 4 hours later + + + + Tomorrow + སང་ཉིན། - Schedule Reminder ཉིན་རེའི་ལས་རིམ་དྲན་སྐུལ། - - %1 to %2 %1 ནས་ %2བར། - - Today - དེ་རིང་། + དེ་རིང་། + + + DragInfoGraphicsView - - - Tomorrow - སང་ཉིན། + Edit + + + + Delete + + + + New event + + + + New Event + + + + + JobTypeListView + + You are deleting an event type. + + + + All events under this type will be deleted and cannot be recovered. + + + + Cancel + button + + + + Delete + button + + + + + QObject + + Account settings + + + + Account + + + + Select items to be synced + + + + Events + + + + General settings + + + + Sync interval + + + + Manage calendar + + + + Calendar account + + + + Event types + + + + General + + + + First day of week + + + + Time + + + + + Return + + Today + Return + དེ་རིང་། + + + + Return Today + + Today + Return Today + དེ་རིང་། + + + + ScheduleTypeEditDlg + + New event type + + + + Edit event type + + + + Name: + + + + Color: + + + + Cancel + button + + + + Save + button + + + + The name can not only contain whitespaces + + + + Enter a name please + + + + + Shortcut + + Help + + + + Delete event + + + + Copy + + + + Cut + + + + Paste + + + + Delete + + + + Select all + + + + + SidebarCalendarWidget + + Y + + + + M + + + + + TimeJumpDialog + + Go + button + + + + + UserloginWidget + + Sign In + button + + + + Sign Out + button + + + + + YearFrame + + Y + + + + + today + + Today + Today + དེ་རིང་། - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar-service_ca.ts dde-calendar-5.10.0/translations/dde-calendar-service_ca.ts --- dde-calendar-5.9.1/translations/dde-calendar-service_ca.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar-service_ca.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,86 +1,965 @@ - + + + - JobRemindManager + AccountItem - - One day before start - Un dia abans de l'inici + Sync successful + + + + Network error + + + + Server exception + + + + Storage full + + + + + AccountManager + + Local account + + + + Event types + + + + + CColorPickerWidget + + Color + + + + Cancel + button + + + + Save + button + + + + + CDayMonthView + + Monday + + + + Tuesday + + + + Wednesday + + + + Thursday + + + + Friday + + + + Saturday + + + + Sunday + + + + + CDayWindow + + Y + + + + M + + + + D + + + + Lunar + + + + + CGraphicsView + + New Event + + + + + CMonthScheduleNumItem + + %1 more + + + + + CMonthView + + New event + + + + New Event + + + + + CMonthWindow + + Y + + + + + CMyScheduleView + + My Event + + + + OK + button + + + + Delete + button + + + + Edit + button + + + + + CPushButton + + New event type + + + + + CScheduleDlg + + New Event + + + + Edit Event + + + + End time must be greater than start time + + + + OK + button + + + + Never + + + + At time of event + + + + 15 minutes before + + + + 30 minutes before + + + + 1 hour before + + + + 1 day before + + + + 2 days before + + + + 1 week before + + + + On start day (9:00 AM) + + + + time(s) + + + + Enter a name please + + + + The name can not only contain whitespaces + + + + Type: + + + + Description: + + + + All Day: + + + + Starts: + + + + Ends: + + + + Remind Me: + + + + Repeat: + + + + End Repeat: + + + + Calendar account: + + + + Calendar account + + + + Type + + + + Description + + + + All Day + + + + Time: + + + + Time + + + + Solar + + + + Lunar + + + + Starts + + + + Ends + + + + Remind Me + + + + Repeat + + + + Daily + + + + Weekdays + + + + Weekly + + + + Monthly + + + + Yearly + + + + End Repeat + + + + After + + + + On + + + + Cancel + button + + + + Save + button + + + + + CScheduleOperation + + All occurrences of a repeating event must have the same all-day status. + - - - - + Do you want to change all occurrences? + + + + Cancel + button + + + + Change All + + + + You are changing the repeating rule of this event. + + + + You are deleting an event. + + + + Are you sure you want to delete this event? + + + + Delete + button + + + + Do you want to delete all occurrences of this event, or only the selected occurrence? + + + + Delete All + + + + Delete Only This Event + + + + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? + + + + Delete All Future Events + + + + You are changing a repeating event. + + + + Do you want to change only this occurrence of the event, or all occurrences? + + + + All + + + + Only This Event + + + + Do you want to change only this occurrence of the event, or this and all future occurrences? + + + + All Future Events + + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + OK + button + + + + + CScheduleSearchDateItem + + Y + + + + M + + + + D + + + + + CScheduleSearchItem + + Edit + + + + Delete + + + + All Day + + + + + CScheduleSearchView + + No search results + + + + + CScheduleView + + ALL DAY + + + + + CSettingDialog + + Sunday + + + + Monday + + + + 24-hour clock + + + + 12-hour clock + + + + Manual + + + + 15 mins + + + + 30 mins + + + + 1 hour + + + + 24 hours + + + + Sync Now + + + + Last sync + + + + + CTimeEdit + + (%1 mins) + + + + (%1 hour) + + + + (%1 hours) + + + + + CTitleWidget + + Y + + + + M + + + + W + + + + D + + + + Search events and festivals + + + + + CWeekWidget + + Sun + + + + Mon + + + + Tue + + + + Wed + + + + Thu + + + + Fri + + + + Sat + + + + + CWeekWindow + + Week + + + + Y + + + + + CYearScheduleView + + All Day + + + + No event + + + + + CYearWindow + + Y + + + + + CalendarWindow + + Calendar + + + + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. + + + + + Calendarmainwindow + + Calendar + + + + Manage + + + + Privacy Policy + + + + Syncing... + + + + Sync successful + + + + Sync failed, please try later + + + + + CenterWidget + + All Day + + + + + DAccountDataBase + + Work + Feina + + + Life + Vida + + + Other + Altres + + + + DAlarmManager + Close button Tanca - + One day before start + Un dia abans de l'inici + + Remind me tomorrow - Recorda-m'ho demà + Recorda-m'ho demà. - Remind me later - Recorda-m'ho més tard + Recorda-m'ho més tard. - 15 mins later 15 minuts més tard - 1 hour later 1 hora més tard - 4 hours later 4 hores més tard - + Tomorrow + Demà + + Schedule Reminder - Programació del recordatori + Programació del recrdatori - - %1 to %2 de %1 a %2 - - Today Avui + + + DragInfoGraphicsView - - - - Tomorrow - Demà + Edit + + + + Delete + + + + New event + + + + New Event + - SchedulerDatabase + JobTypeListView - - Work - Feina + You are deleting an event type. + - - Life - Vida + All events under this type will be deleted and cannot be recovered. + - - Other - Altres + Cancel + button + + + + Delete + button + + + + + QObject + + Account settings + + + + Account + + + + Select items to be synced + + + + Events + + + + General settings + + + + Sync interval + + + + Manage calendar + + + + Calendar account + + + + Event types + + + + General + + + + First day of week + + + + Time + + + + + Return + + Today + Return + Avui + + + + Return Today + + Today + Return Today + Avui + + + + ScheduleTypeEditDlg + + New event type + + + + Edit event type + + + + Name: + + + + Color: + + + + Cancel + button + + + + Save + button + + + + The name can not only contain whitespaces + + + + Enter a name please + + + + + Shortcut + + Help + + + + Delete event + + + + Copy + + + + Cut + + + + Paste + + + + Delete + + + + Select all + + + + + SidebarCalendarWidget + + Y + + + + M + + + + + TimeJumpDialog + + Go + button + + + + + UserloginWidget + + Sign In + button + + + + Sign Out + button + + + + + YearFrame + + Y + + + + + today + + Today + Today + Avui - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar-service_cs.ts dde-calendar-5.10.0/translations/dde-calendar-service_cs.ts --- dde-calendar-5.9.1/translations/dde-calendar-service_cs.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar-service_cs.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,52 +1,965 @@ - + + + - JobRemindManager + AccountItem - - One day before start - Jeden den před začátkem + Sync successful + + + + Network error + + + + Server exception + + + + Storage full + + + + + AccountManager + + Local account + + + + Event types + + + + + CColorPickerWidget + + Color + + + + Cancel + button + + + + Save + button + + + + + CDayMonthView + + Monday + + + + Tuesday + + + + Wednesday + + + + Thursday + + + + Friday + + + + Saturday + + + + Sunday + + + + + CDayWindow + + Y + + + + M + + + + D + + + + Lunar + + + + + CGraphicsView + + New Event + + + + + CMonthScheduleNumItem + + %1 more + + + + + CMonthView + + New event + + + + New Event + + + + + CMonthWindow + + Y + + + + + CMyScheduleView + + My Event + + + + OK + button + + + + Delete + button + + + + Edit + button + + + + + CPushButton + + New event type + + + + + CScheduleDlg + + New Event + + + + Edit Event + + + + End time must be greater than start time + + + + OK + button + + + + Never + + + + At time of event + + + + 15 minutes before + + + + 30 minutes before + + + + 1 hour before + + + + 1 day before + + + + 2 days before + + + + 1 week before + + + + On start day (9:00 AM) + + + + time(s) + + + + Enter a name please + + + + The name can not only contain whitespaces + + + + Type: + + + + Description: + + + + All Day: + - - - - + Starts: + + + + Ends: + + + + Remind Me: + + + + Repeat: + + + + End Repeat: + + + + Calendar account: + + + + Calendar account + + + + Type + + + + Description + + + + All Day + + + + Time: + + + + Time + + + + Solar + + + + Lunar + + + + Starts + + + + Ends + + + + Remind Me + + + + Repeat + + + + Daily + + + + Weekdays + + + + Weekly + + + + Monthly + + + + Yearly + + + + End Repeat + + + + After + + + + On + + + + Cancel + button + + + + Save + button + + + + + CScheduleOperation + + All occurrences of a repeating event must have the same all-day status. + + + + Do you want to change all occurrences? + + + + Cancel + button + + + + Change All + + + + You are changing the repeating rule of this event. + + + + You are deleting an event. + + + + Are you sure you want to delete this event? + + + + Delete + button + + + + Do you want to delete all occurrences of this event, or only the selected occurrence? + + + + Delete All + + + + Delete Only This Event + + + + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? + + + + Delete All Future Events + + + + You are changing a repeating event. + + + + Do you want to change only this occurrence of the event, or all occurrences? + + + + All + + + + Only This Event + + + + Do you want to change only this occurrence of the event, or this and all future occurrences? + + + + All Future Events + + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + OK + button + + + + + CScheduleSearchDateItem + + Y + + + + M + + + + D + + + + + CScheduleSearchItem + + Edit + + + + Delete + + + + All Day + + + + + CScheduleSearchView + + No search results + + + + + CScheduleView + + ALL DAY + + + + + CSettingDialog + + Sunday + + + + Monday + + + + 24-hour clock + + + + 12-hour clock + + + + Manual + + + + 15 mins + + + + 30 mins + + + + 1 hour + + + + 24 hours + + + + Sync Now + + + + Last sync + + + + + CTimeEdit + + (%1 mins) + + + + (%1 hour) + + + + (%1 hours) + + + + + CTitleWidget + + Y + + + + M + + + + W + + + + D + + + + Search events and festivals + + + + + CWeekWidget + + Sun + + + + Mon + + + + Tue + + + + Wed + + + + Thu + + + + Fri + + + + Sat + + + + + CWeekWindow + + Week + + + + Y + + + + + CYearScheduleView + + All Day + + + + No event + + + + + CYearWindow + + Y + + + + + CalendarWindow + + Calendar + + + + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. + + + + + Calendarmainwindow + + Calendar + + + + Manage + + + + Privacy Policy + + + + Syncing... + + + + Sync successful + + + + Sync failed, please try later + + + + + CenterWidget + + All Day + + + + + DAccountDataBase + + Work + Práce + + + Life + Soukromé + + + Other + Ostatní + + + + DAlarmManager + Close button Zavřít - + One day before start + Jeden den před začátkem + + Remind me tomorrow Připomenout zítra - Remind me later Připomenout později - + 15 mins later + o 15 minut později + + + 1 hour later + o 1 hodinu později + + + 4 hours later + o 4 hodiny později + + + Tomorrow + Zítra + + Schedule Reminder Připomínání naplánovaného - - %1 to %2 %1 až %2 - - Today Dnes + + + DragInfoGraphicsView - - - Tomorrow - Zítra + Edit + + + + Delete + + + + New event + + + + New Event + + + + + JobTypeListView + + You are deleting an event type. + + + + All events under this type will be deleted and cannot be recovered. + + + + Cancel + button + + + + Delete + button + + + + + QObject + + Account settings + + + + Account + + + + Select items to be synced + + + + Events + + + + General settings + + + + Sync interval + + + + Manage calendar + + + + Calendar account + + + + Event types + + + + General + + + + First day of week + + + + Time + + + + + Return + + Today + Return + Dnes + + + + Return Today + + Today + Return Today + Dnes + + + + ScheduleTypeEditDlg + + New event type + + + + Edit event type + + + + Name: + + + + Color: + + + + Cancel + button + + + + Save + button + + + + The name can not only contain whitespaces + + + + Enter a name please + + + + + Shortcut + + Help + + + + Delete event + + + + Copy + + + + Cut + + + + Paste + + + + Delete + + + + Select all + + + + + SidebarCalendarWidget + + Y + + + + M + + + + + TimeJumpDialog + + Go + button + + + + + UserloginWidget + + Sign In + button + + + + Sign Out + button + + + + + YearFrame + + Y + + + + + today + + Today + Today + Dnes - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar-service_da.ts dde-calendar-5.10.0/translations/dde-calendar-service_da.ts --- dde-calendar-5.9.1/translations/dde-calendar-service_da.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar-service_da.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,52 +1,1231 @@ - + + + - JobRemindManager + AccountItem - - One day before start - En dag før start + + Sync successful + + + + + Network error + + + + + Server exception + + + + + Storage full + + + + + AccountManager + + + Local account + + + + + Event types + + + + + CColorPickerWidget + + + Color + + + + + Cancel + button + + + + + Save + button + + + + + CDayMonthView + + + Monday + + + + + Tuesday + + + + + Wednesday + + + + + Thursday + + + + + Friday + + + + + Saturday + + + + + Sunday + + + + + CDayWindow + + + Y + + + + + M + + + + + D + + + + + Lunar + + + + + CGraphicsView + + + New Event + + + + + CMonthScheduleNumItem + + + %1 more + + + + + CMonthView + + + New event + + + + + New Event + + + + + CMonthWindow + + + Y + + + + + CMyScheduleView + + + My Event + + + + + OK + button + + + + + Delete + button + + + + + Edit + button + + + + + CPushButton + + + New event type + + + + + CScheduleDlg + + + + + New Event + + + + + Edit Event + + + + + End time must be greater than start time + + + + + OK + button + + + + + + + + + + Never + + + + + At time of event + + + + + 15 minutes before + + + + + 30 minutes before + + + + + 1 hour before + + + + + + 1 day before + + + + + + 2 days before + + + + + + 1 week before + + + + + On start day (9:00 AM) + + + + + + + + time(s) + + + + + Enter a name please + + + + + The name can not only contain whitespaces + + + + + + Type: + + + + + + Description: + + + + + + All Day: + - - - - + + + Starts: + + + + + + Ends: + + + + + + Remind Me: + + + + + + Repeat: + + + + + + End Repeat: + + + + + Calendar account: + + + + + Calendar account + + + + + Type + + + + + Description + + + + + All Day + + + + + Time: + + + + + Time + + + + + Solar + + + + + Lunar + + + + + Starts + + + + + Ends + + + + + Remind Me + + + + + Repeat + + + + + + Daily + + + + + + Weekdays + + + + + + Weekly + + + + + + + Monthly + + + + + + + Yearly + + + + + End Repeat + + + + + After + + + + + On + + + + + Cancel + button + + + + + Save + button + + + + + CScheduleOperation + + + All occurrences of a repeating event must have the same all-day status. + + + + + + Do you want to change all occurrences? + + + + + + + + + + + Cancel + button + + + + + + Change All + + + + + You are changing the repeating rule of this event. + + + + + + + You are deleting an event. + + + + + Are you sure you want to delete this event? + + + + + Delete + button + + + + + Do you want to delete all occurrences of this event, or only the selected occurrence? + + + + + Delete All + + + + + + Delete Only This Event + + + + + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? + + + + + Delete All Future Events + + + + + + You are changing a repeating event. + + + + + Do you want to change only this occurrence of the event, or all occurrences? + + + + + All + + + + + + Only This Event + + + + + Do you want to change only this occurrence of the event, or this and all future occurrences? + + + + + All Future Events + + + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + + OK + button + + + + + CScheduleSearchDateItem + + + Y + + + + + M + + + + + D + + + + + CScheduleSearchItem + + + Edit + + + + + Delete + + + + + All Day + + + + + CScheduleSearchView + + + No search results + + + + + CScheduleView + + + ALL DAY + + + + + CSettingDialog + + + Sunday + + + + + Monday + + + + + 24-hour clock + + + + + 12-hour clock + + + + + Manual + + + + + 15 mins + + + + + 30 mins + + + + + 1 hour + + + + + 24 hours + + + + + Sync Now + + + + + Last sync + + + + + CTimeEdit + + + (%1 mins) + + + + + (%1 hour) + + + + + (%1 hours) + + + + + CTitleWidget + + + Y + + + + + M + + + + + W + + + + + D + + + + + + Search events and festivals + + + + + CWeekWidget + + + Sun + + + + + Mon + + + + + Tue + + + + + Wed + + + + + Thu + + + + + Fri + + + + + Sat + + + + + CWeekWindow + + + Week + + + + + Y + + + + + CYearScheduleView + + + + All Day + + + + + No event + + + + + CYearWindow + + + Y + + + + + CalendarWindow + + + Calendar + + + + + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. + + + + + Calendarmainwindow + + + Calendar + + + + + Manage + + + + + Privacy Policy + + + + + Syncing... + + + + + Sync successful + + + + + Sync failed, please try later + + + + + CenterWidget + + + All Day + + + + + DAccountDataBase + + + Work + + + + + Life + + + + + Other + + + + + DAlarmManager + + + + + Close button - Luk + Luk - + + One day before start + En dag før start + + + Remind me tomorrow - Påmind mig i morgen + Påmind mig i morgen - + Remind me later - Påmind mig senere + Påmind mig senere + + + + 15 mins later + + + + + 1 hour later + + + + + 4 hours later + - + + + + Tomorrow + I morgen + + + Schedule Reminder - Planlæg påmindelse + Planlæg påmindelse - - + + %1 to %2 - + - - + + Today - I dag + I dag + + + + DragInfoGraphicsView + + + Edit + - - - Tomorrow - I morgen + + Delete + + + + + New event + + + + + New Event + + + + + JobTypeListView + + + You are deleting an event type. + + + + + All events under this type will be deleted and cannot be recovered. + + + + + Cancel + button + + + + + Delete + button + + + + + QObject + + + Account settings + + + + + Account + + + + + Select items to be synced + + + + + Events + + + + + + General settings + + + + + Sync interval + + + + + + Manage calendar + + + + + Calendar account + + + + + + Event types + + + + + General + + + + + First day of week + + + + + Time + + + + + Return + + + Today + Return + I dag + + + + Return Today + + + + + Today + Return Today + I dag + + + + ScheduleTypeEditDlg + + + New event type + + + + + Edit event type + + + + + Name: + + + + + Color: + + + + + Cancel + button + + + + + Save + button + + + + + The name can not only contain whitespaces + + + + + Enter a name please + + + + + Shortcut + + + Help + + + + + Delete event + + + + + Copy + + + + + Cut + + + + + Paste + + + + + Delete + + + + + Select all + + + + + SidebarCalendarWidget + + + Y + + + + + M + + + + + TimeJumpDialog + + + Go + button + + + + + UserloginWidget + + + Sign In + button + + + + + Sign Out + button + + + + + YearFrame + + + Y + + + + + today + + + + + + + + + + Today + Today + I dag - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar-service_de.ts dde-calendar-5.10.0/translations/dde-calendar-service_de.ts --- dde-calendar-5.9.1/translations/dde-calendar-service_de.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar-service_de.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,52 +1,965 @@ - + + + - JobRemindManager + AccountItem - - One day before start - Einen Tag vor Beginn + Sync successful + + + + Network error + + + + Server exception + + + + Storage full + + + + + AccountManager + + Local account + + + + Event types + + + + + CColorPickerWidget + + Color + + + + Cancel + button + + + + Save + button + + + + + CDayMonthView + + Monday + + + + Tuesday + + + + Wednesday + + + + Thursday + + + + Friday + + + + Saturday + + + + Sunday + + + + + CDayWindow + + Y + + + + M + + + + D + + + + Lunar + + + + + CGraphicsView + + New Event + + + + + CMonthScheduleNumItem + + %1 more + + + + + CMonthView + + New event + + + + New Event + + + + + CMonthWindow + + Y + + + + + CMyScheduleView + + My Event + + + + OK + button + + + + Delete + button + + + + Edit + button + + + + + CPushButton + + New event type + + + + + CScheduleDlg + + New Event + + + + Edit Event + + + + End time must be greater than start time + + + + OK + button + + + + Never + + + + At time of event + + + + 15 minutes before + + + + 30 minutes before + + + + 1 hour before + + + + 1 day before + + + + 2 days before + + + + 1 week before + + + + On start day (9:00 AM) + + + + time(s) + + + + Enter a name please + + + + The name can not only contain whitespaces + + + + Type: + + + + Description: + + + + All Day: + - - - - + Starts: + + + + Ends: + + + + Remind Me: + + + + Repeat: + + + + End Repeat: + + + + Calendar account: + + + + Calendar account + + + + Type + + + + Description + + + + All Day + + + + Time: + + + + Time + + + + Solar + + + + Lunar + + + + Starts + + + + Ends + + + + Remind Me + + + + Repeat + + + + Daily + + + + Weekdays + + + + Weekly + + + + Monthly + + + + Yearly + + + + End Repeat + + + + After + + + + On + + + + Cancel + button + + + + Save + button + + + + + CScheduleOperation + + All occurrences of a repeating event must have the same all-day status. + + + + Do you want to change all occurrences? + + + + Cancel + button + + + + Change All + + + + You are changing the repeating rule of this event. + + + + You are deleting an event. + + + + Are you sure you want to delete this event? + + + + Delete + button + + + + Do you want to delete all occurrences of this event, or only the selected occurrence? + + + + Delete All + + + + Delete Only This Event + + + + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? + + + + Delete All Future Events + + + + You are changing a repeating event. + + + + Do you want to change only this occurrence of the event, or all occurrences? + + + + All + + + + Only This Event + + + + Do you want to change only this occurrence of the event, or this and all future occurrences? + + + + All Future Events + + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + OK + button + + + + + CScheduleSearchDateItem + + Y + + + + M + + + + D + + + + + CScheduleSearchItem + + Edit + + + + Delete + + + + All Day + + + + + CScheduleSearchView + + No search results + + + + + CScheduleView + + ALL DAY + + + + + CSettingDialog + + Sunday + + + + Monday + + + + 24-hour clock + + + + 12-hour clock + + + + Manual + + + + 15 mins + + + + 30 mins + + + + 1 hour + + + + 24 hours + + + + Sync Now + + + + Last sync + + + + + CTimeEdit + + (%1 mins) + + + + (%1 hour) + + + + (%1 hours) + + + + + CTitleWidget + + Y + + + + M + + + + W + + + + D + + + + Search events and festivals + + + + + CWeekWidget + + Sun + + + + Mon + + + + Tue + + + + Wed + + + + Thu + + + + Fri + + + + Sat + + + + + CWeekWindow + + Week + + + + Y + + + + + CYearScheduleView + + All Day + + + + No event + + + + + CYearWindow + + Y + + + + + CalendarWindow + + Calendar + + + + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. + + + + + Calendarmainwindow + + Calendar + + + + Manage + + + + Privacy Policy + + + + Syncing... + + + + Sync successful + + + + Sync failed, please try later + + + + + CenterWidget + + All Day + + + + + DAccountDataBase + + Work + Arbeit + + + Life + Leben + + + Other + Andere + + + + DAlarmManager + Close button Schließen - + One day before start + Einen Tag vor Beginn + + Remind me tomorrow Erinnere mich morgen - Remind me later Erinnere mich später - + 15 mins later + 15 Min. später + + + 1 hour later + 1 Stunde später + + + 4 hours later + 4 Stunden später + + + Tomorrow + Morgen + + Schedule Reminder Terminerinnerung - - %1 to %2 %1 bis %2 - - Today Heute + + + DragInfoGraphicsView - - - Tomorrow - Morgen + Edit + + + + Delete + + + + New event + + + + New Event + + + + + JobTypeListView + + You are deleting an event type. + + + + All events under this type will be deleted and cannot be recovered. + + + + Cancel + button + + + + Delete + button + + + + + QObject + + Account settings + + + + Account + + + + Select items to be synced + + + + Events + + + + General settings + + + + Sync interval + + + + Manage calendar + + + + Calendar account + + + + Event types + + + + General + + + + First day of week + + + + Time + + + + + Return + + Today + Return + Heute + + + + Return Today + + Today + Return Today + Heute + + + + ScheduleTypeEditDlg + + New event type + + + + Edit event type + + + + Name: + + + + Color: + + + + Cancel + button + + + + Save + button + + + + The name can not only contain whitespaces + + + + Enter a name please + + + + + Shortcut + + Help + + + + Delete event + + + + Copy + + + + Cut + + + + Paste + + + + Delete + + + + Select all + + + + + SidebarCalendarWidget + + Y + + + + M + + + + + TimeJumpDialog + + Go + button + + + + + UserloginWidget + + Sign In + button + + + + Sign Out + button + + + + + YearFrame + + Y + + + + + today + + Today + Today + Heute - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar-service_el.ts dde-calendar-5.10.0/translations/dde-calendar-service_el.ts --- dde-calendar-5.9.1/translations/dde-calendar-service_el.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar-service_el.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,52 +1,965 @@ - + + + - JobRemindManager + AccountItem - - One day before start - Μια μέρα πριν την έναρξη + Sync successful + + + + Network error + + + + Server exception + + + + Storage full + + + + + AccountManager + + Local account + + + + Event types + + + + + CColorPickerWidget + + Color + + + + Cancel + button + + + + Save + button + + + + + CDayMonthView + + Monday + + + + Tuesday + + + + Wednesday + + + + Thursday + + + + Friday + + + + Saturday + + + + Sunday + + + + + CDayWindow + + Y + + + + M + + + + D + + + + Lunar + + + + + CGraphicsView + + New Event + + + + + CMonthScheduleNumItem + + %1 more + + + + + CMonthView + + New event + + + + New Event + + + + + CMonthWindow + + Y + + + + + CMyScheduleView + + My Event + + + + OK + button + + + + Delete + button + + + + Edit + button + + + + + CPushButton + + New event type + + + + + CScheduleDlg + + New Event + + + + Edit Event + + + + End time must be greater than start time + + + + OK + button + + + + Never + + + + At time of event + + + + 15 minutes before + + + + 30 minutes before + + + + 1 hour before + + + + 1 day before + + + + 2 days before + + + + 1 week before + + + + On start day (9:00 AM) + + + + time(s) + + + + Enter a name please + + + + The name can not only contain whitespaces + + + + Type: + + + + Description: + + + + All Day: + - - - - + Starts: + + + + Ends: + + + + Remind Me: + + + + Repeat: + + + + End Repeat: + + + + Calendar account: + + + + Calendar account + + + + Type + + + + Description + + + + All Day + + + + Time: + + + + Time + + + + Solar + + + + Lunar + + + + Starts + + + + Ends + + + + Remind Me + + + + Repeat + + + + Daily + + + + Weekdays + + + + Weekly + + + + Monthly + + + + Yearly + + + + End Repeat + + + + After + + + + On + + + + Cancel + button + + + + Save + button + + + + + CScheduleOperation + + All occurrences of a repeating event must have the same all-day status. + + + + Do you want to change all occurrences? + + + + Cancel + button + + + + Change All + + + + You are changing the repeating rule of this event. + + + + You are deleting an event. + + + + Are you sure you want to delete this event? + + + + Delete + button + + + + Do you want to delete all occurrences of this event, or only the selected occurrence? + + + + Delete All + + + + Delete Only This Event + + + + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? + + + + Delete All Future Events + + + + You are changing a repeating event. + + + + Do you want to change only this occurrence of the event, or all occurrences? + + + + All + + + + Only This Event + + + + Do you want to change only this occurrence of the event, or this and all future occurrences? + + + + All Future Events + + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + OK + button + + + + + CScheduleSearchDateItem + + Y + + + + M + + + + D + + + + + CScheduleSearchItem + + Edit + + + + Delete + + + + All Day + + + + + CScheduleSearchView + + No search results + + + + + CScheduleView + + ALL DAY + + + + + CSettingDialog + + Sunday + + + + Monday + + + + 24-hour clock + + + + 12-hour clock + + + + Manual + + + + 15 mins + + + + 30 mins + + + + 1 hour + + + + 24 hours + + + + Sync Now + + + + Last sync + + + + + CTimeEdit + + (%1 mins) + + + + (%1 hour) + + + + (%1 hours) + + + + + CTitleWidget + + Y + + + + M + + + + W + + + + D + + + + Search events and festivals + + + + + CWeekWidget + + Sun + + + + Mon + + + + Tue + + + + Wed + + + + Thu + + + + Fri + + + + Sat + + + + + CWeekWindow + + Week + + + + Y + + + + + CYearScheduleView + + All Day + + + + No event + + + + + CYearWindow + + Y + + + + + CalendarWindow + + Calendar + + + + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. + + + + + Calendarmainwindow + + Calendar + + + + Manage + + + + Privacy Policy + + + + Syncing... + + + + Sync successful + + + + Sync failed, please try later + + + + + CenterWidget + + All Day + + + + + DAccountDataBase + + Work + Εργασία + + + Life + Ζωή + + + Other + Άλλο + + + + DAlarmManager + Close button Κλείσιμο - + One day before start + Μια ημέρα πριν την εκκίνηση + + Remind me tomorrow Υπενθύμισέ μου αύριο - Remind me later - Υπενθύμισέ μου αργότερα + Υπεθύμισέ μου αργότερα + + + 15 mins later + + + + 1 hour later + + + + 4 hours later + + + + Tomorrow + Αύριο - Schedule Reminder - Προγραμματισμένη υπενθύμιση + Προγραμματισμός Υπενθύμισης - - %1 to %2 %1 εως %2 - - Today Σήμερα + + + DragInfoGraphicsView + + Edit + + - - - Tomorrow - Αύριο + Delete + + + + New event + + + + New Event + + + + + JobTypeListView + + You are deleting an event type. + + + + All events under this type will be deleted and cannot be recovered. + + + + Cancel + button + + + + Delete + button + + + + + QObject + + Account settings + + + + Account + + + + Select items to be synced + + + + Events + + + + General settings + + + + Sync interval + + + + Manage calendar + + + + Calendar account + + + + Event types + + + + General + + + + First day of week + + + + Time + + + + + Return + + Today + Return + Σήμερα + + + + Return Today + + Today + Return Today + Σήμερα + + + + ScheduleTypeEditDlg + + New event type + + + + Edit event type + + + + Name: + + + + Color: + + + + Cancel + button + + + + Save + button + + + + The name can not only contain whitespaces + + + + Enter a name please + + + + + Shortcut + + Help + + + + Delete event + + + + Copy + + + + Cut + + + + Paste + + + + Delete + + + + Select all + + + + + SidebarCalendarWidget + + Y + + + + M + + + + + TimeJumpDialog + + Go + button + + + + + UserloginWidget + + Sign In + button + + + + Sign Out + button + + + + + YearFrame + + Y + + + + + today + + Today + Today + Σήμερα - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar-service_en_AU.ts dde-calendar-5.10.0/translations/dde-calendar-service_en_AU.ts --- dde-calendar-5.9.1/translations/dde-calendar-service_en_AU.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar-service_en_AU.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,52 +1,1231 @@ - + + + - JobRemindManager + AccountItem - - One day before start - One day before start + + Sync successful + + + + + Network error + + + + + Server exception + + + + + Storage full + + + + + AccountManager + + + Local account + + + + + Event types + + + + + CColorPickerWidget + + + Color + + + + + Cancel + button + + + + + Save + button + + + + + CDayMonthView + + + Monday + + + + + Tuesday + + + + + Wednesday + + + + + Thursday + + + + + Friday + + + + + Saturday + + + + + Sunday + + + + + CDayWindow + + + Y + + + + + M + + + + + D + + + + + Lunar + + + + + CGraphicsView + + + New Event + + + + + CMonthScheduleNumItem + + + %1 more + + + + + CMonthView + + + New event + + + + + New Event + + + + + CMonthWindow + + + Y + + + + + CMyScheduleView + + + My Event + + + + + OK + button + + + + + Delete + button + + + + + Edit + button + + + + + CPushButton + + + New event type + + + + + CScheduleDlg + + + + + New Event + + + + + Edit Event + + + + + End time must be greater than start time + + + + + OK + button + + + + + + + + + + Never + + + + + At time of event + + + + + 15 minutes before + + + + + 30 minutes before + + + + + 1 hour before + + + + + + 1 day before + + + + + + 2 days before + + + + + + 1 week before + + + + + On start day (9:00 AM) + + + + + + + + time(s) + + + + + Enter a name please + + + + + The name can not only contain whitespaces + + + + + + Type: + + + + + + Description: + + + + + + All Day: + - - - - + + + Starts: + + + + + + Ends: + + + + + + Remind Me: + + + + + + Repeat: + + + + + + End Repeat: + + + + + Calendar account: + + + + + Calendar account + + + + + Type + + + + + Description + + + + + All Day + + + + + Time: + + + + + Time + + + + + Solar + + + + + Lunar + + + + + Starts + + + + + Ends + + + + + Remind Me + + + + + Repeat + + + + + + Daily + + + + + + Weekdays + + + + + + Weekly + + + + + + + Monthly + + + + + + + Yearly + + + + + End Repeat + + + + + After + + + + + On + + + + + Cancel + button + + + + + Save + button + + + + + CScheduleOperation + + + All occurrences of a repeating event must have the same all-day status. + + + + + + Do you want to change all occurrences? + + + + + + + + + + + Cancel + button + + + + + + Change All + + + + + You are changing the repeating rule of this event. + + + + + + + You are deleting an event. + + + + + Are you sure you want to delete this event? + + + + + Delete + button + + + + + Do you want to delete all occurrences of this event, or only the selected occurrence? + + + + + Delete All + + + + + + Delete Only This Event + + + + + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? + + + + + Delete All Future Events + + + + + + You are changing a repeating event. + + + + + Do you want to change only this occurrence of the event, or all occurrences? + + + + + All + + + + + + Only This Event + + + + + Do you want to change only this occurrence of the event, or this and all future occurrences? + + + + + All Future Events + + + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + + OK + button + + + + + CScheduleSearchDateItem + + + Y + + + + + M + + + + + D + + + + + CScheduleSearchItem + + + Edit + + + + + Delete + + + + + All Day + + + + + CScheduleSearchView + + + No search results + + + + + CScheduleView + + + ALL DAY + + + + + CSettingDialog + + + Sunday + + + + + Monday + + + + + 24-hour clock + + + + + 12-hour clock + + + + + Manual + + + + + 15 mins + + + + + 30 mins + + + + + 1 hour + + + + + 24 hours + + + + + Sync Now + + + + + Last sync + + + + + CTimeEdit + + + (%1 mins) + + + + + (%1 hour) + + + + + (%1 hours) + + + + + CTitleWidget + + + Y + + + + + M + + + + + W + + + + + D + + + + + + Search events and festivals + + + + + CWeekWidget + + + Sun + + + + + Mon + + + + + Tue + + + + + Wed + + + + + Thu + + + + + Fri + + + + + Sat + + + + + CWeekWindow + + + Week + + + + + Y + + + + + CYearScheduleView + + + + All Day + + + + + No event + + + + + CYearWindow + + + Y + + + + + CalendarWindow + + + Calendar + + + + + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. + + + + + Calendarmainwindow + + + Calendar + + + + + Manage + + + + + Privacy Policy + + + + + Syncing... + + + + + Sync successful + + + + + Sync failed, please try later + + + + + CenterWidget + + + All Day + + + + + DAccountDataBase + + + Work + + + + + Life + + + + + Other + + + + + DAlarmManager + + + + + Close button - Close + Close - + + One day before start + One day before start + + + Remind me tomorrow - Remind me tomorrow + Remind me tomorrow - + Remind me later - Remind me later + Remind me later + + + + 15 mins later + + + + + 1 hour later + + + + + 4 hours later + - + + + + Tomorrow + Tomorrow + + + Schedule Reminder - Schedule Reminder + Schedule Reminder - - + + %1 to %2 - + - - + + Today - Today + Today + + + + DragInfoGraphicsView + + + Edit + - - - Tomorrow - Tomorrow + + Delete + + + + + New event + + + + + New Event + + + + + JobTypeListView + + + You are deleting an event type. + + + + + All events under this type will be deleted and cannot be recovered. + + + + + Cancel + button + + + + + Delete + button + + + + + QObject + + + Account settings + + + + + Account + + + + + Select items to be synced + + + + + Events + + + + + + General settings + + + + + Sync interval + + + + + + Manage calendar + + + + + Calendar account + + + + + + Event types + + + + + General + + + + + First day of week + + + + + Time + + + + + Return + + + Today + Return + Today + + + + Return Today + + + + + Today + Return Today + Today + + + + ScheduleTypeEditDlg + + + New event type + + + + + Edit event type + + + + + Name: + + + + + Color: + + + + + Cancel + button + + + + + Save + button + + + + + The name can not only contain whitespaces + + + + + Enter a name please + + + + + Shortcut + + + Help + + + + + Delete event + + + + + Copy + + + + + Cut + + + + + Paste + + + + + Delete + + + + + Select all + + + + + SidebarCalendarWidget + + + Y + + + + + M + + + + + TimeJumpDialog + + + Go + button + + + + + UserloginWidget + + + Sign In + button + + + + + Sign Out + button + + + + + YearFrame + + + Y + + + + + today + + + + + + + + + + Today + Today + Today - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar-service_en.ts dde-calendar-5.10.0/translations/dde-calendar-service_en.ts --- dde-calendar-5.9.1/translations/dde-calendar-service_en.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar-service_en.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,86 +1,965 @@ - + + + - JobRemindManager + AccountItem - - One day before start - One day before start + Sync successful + + + + Network error + + + + Server exception + + + + Storage full + + + + + AccountManager + + Local account + + + + Event types + + + + + CColorPickerWidget + + Color + + + + Cancel + button + + + + Save + button + + + + + CDayMonthView + + Monday + + + + Tuesday + + + + Wednesday + + + + Thursday + + + + Friday + + + + Saturday + + + + Sunday + + + + + CDayWindow + + Y + + + + M + + + + D + + + + Lunar + + + + + CGraphicsView + + New Event + + + + + CMonthScheduleNumItem + + %1 more + + + + + CMonthView + + New event + + + + New Event + + + + + CMonthWindow + + Y + + + + + CMyScheduleView + + My Event + + + + OK + button + + + + Delete + button + + + + Edit + button + + + + + CPushButton + + New event type + + + + + CScheduleDlg + + New Event + + + + Edit Event + + + + End time must be greater than start time + + + + OK + button + + + + Never + + + + At time of event + + + + 15 minutes before + + + + 30 minutes before + + + + 1 hour before + + + + 1 day before + + + + 2 days before + + + + 1 week before + + + + On start day (9:00 AM) + + + + time(s) + + + + Enter a name please + + + + The name can not only contain whitespaces + + + + Type: + + + + Description: + + + + All Day: + + + + Starts: + + + + Ends: + + + + Remind Me: + + + + Repeat: + + + + End Repeat: + + + + Calendar account: + + + + Calendar account + + + + Type + + + + Description + + + + All Day + + + + Time: + + + + Time + + + + Solar + + + + Lunar + + + + Starts + + + + Ends + + + + Remind Me + + + + Repeat + + + + Daily + + + + Weekdays + + + + Weekly + + + + Monthly + + + + Yearly + + + + End Repeat + + + + After + + + + On + + + + Cancel + button + + + + Save + button + + + + + CScheduleOperation + + All occurrences of a repeating event must have the same all-day status. + - - - - + Do you want to change all occurrences? + + + + Cancel + button + + + + Change All + + + + You are changing the repeating rule of this event. + + + + You are deleting an event. + + + + Are you sure you want to delete this event? + + + + Delete + button + + + + Do you want to delete all occurrences of this event, or only the selected occurrence? + + + + Delete All + + + + Delete Only This Event + + + + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? + + + + Delete All Future Events + + + + You are changing a repeating event. + + + + Do you want to change only this occurrence of the event, or all occurrences? + + + + All + + + + Only This Event + + + + Do you want to change only this occurrence of the event, or this and all future occurrences? + + + + All Future Events + + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + OK + button + + + + + CScheduleSearchDateItem + + Y + + + + M + + + + D + + + + + CScheduleSearchItem + + Edit + + + + Delete + + + + All Day + + + + + CScheduleSearchView + + No search results + + + + + CScheduleView + + ALL DAY + + + + + CSettingDialog + + Sunday + + + + Monday + + + + 24-hour clock + + + + 12-hour clock + + + + Manual + + + + 15 mins + + + + 30 mins + + + + 1 hour + + + + 24 hours + + + + Sync Now + + + + Last sync + + + + + CTimeEdit + + (%1 mins) + + + + (%1 hour) + + + + (%1 hours) + + + + + CTitleWidget + + Y + + + + M + + + + W + + + + D + + + + Search events and festivals + + + + + CWeekWidget + + Sun + + + + Mon + + + + Tue + + + + Wed + + + + Thu + + + + Fri + + + + Sat + + + + + CWeekWindow + + Week + + + + Y + + + + + CYearScheduleView + + All Day + + + + No event + + + + + CYearWindow + + Y + + + + + CalendarWindow + + Calendar + + + + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. + + + + + Calendarmainwindow + + Calendar + + + + Manage + + + + Privacy Policy + + + + Syncing... + + + + Sync successful + + + + Sync failed, please try later + + + + + CenterWidget + + All Day + + + + + DAccountDataBase + + Work + Work + + + Life + Life + + + Other + Other + + + + DAlarmManager + Close button Close - + One day before start + One day before start + + Remind me tomorrow Remind me tomorrow - Remind me later Remind me later - 15 mins later 15 mins later - 1 hour later 1 hour later - 4 hours later 4 hours later - + Tomorrow + Tomorrow + + Schedule Reminder Schedule Reminder - - %1 to %2 %1 to %2 - - Today Today + + + DragInfoGraphicsView - - - - Tomorrow - Tomorrow + Edit + + + + Delete + + + + New event + + + + New Event + - SchedulerDatabase + JobTypeListView - - Work - Work + You are deleting an event type. + - - Life - Life + All events under this type will be deleted and cannot be recovered. + - - Other - Other + Cancel + button + + + + Delete + button + + + + + QObject + + Account settings + + + + Account + + + + Select items to be synced + + + + Events + + + + General settings + + + + Sync interval + + + + Manage calendar + + + + Calendar account + + + + Event types + + + + General + + + + First day of week + + + + Time + + + + + Return + + Today + Return + Today + + + + Return Today + + Today + Return Today + Today + + + + ScheduleTypeEditDlg + + New event type + + + + Edit event type + + + + Name: + + + + Color: + + + + Cancel + button + + + + Save + button + + + + The name can not only contain whitespaces + + + + Enter a name please + + + + + Shortcut + + Help + + + + Delete event + + + + Copy + + + + Cut + + + + Paste + + + + Delete + + + + Select all + + + + + SidebarCalendarWidget + + Y + + + + M + + + + + TimeJumpDialog + + Go + button + + + + + UserloginWidget + + Sign In + button + + + + Sign Out + button + + + + + YearFrame + + Y + + + + + today + + Today + Today + Today - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar-service_en_US.ts dde-calendar-5.10.0/translations/dde-calendar-service_en_US.ts --- dde-calendar-5.9.1/translations/dde-calendar-service_en_US.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar-service_en_US.ts 2023-04-07 06:02:09.000000000 +0000 @@ -2,87 +2,964 @@ - JobRemindManager + AccountItem - - One day before start - One day before start + Sync successful + + + + Network error + + + + Server exception + + + + Storage full + + + + + AccountManager + + Local account + + + + Event types + + + + + CColorPickerWidget + + Color + + + + Cancel + button + + + + Save + button + + + + + CDayMonthView + + Monday + + + + Tuesday + + + + Wednesday + + + + Thursday + + + + Friday + + + + Saturday + + + + Sunday + + + + + CDayWindow + + Y + + + + M + + + + D + + + + Lunar + + + + + CGraphicsView + + New Event + + + + + CMonthScheduleNumItem + + %1 more + + + + + CMonthView + + New event + + + + New Event + + + + + CMonthWindow + + Y + + + + + CMyScheduleView + + My Event + + + + OK + button + + + + Delete + button + + + + Edit + button + + + + + CPushButton + + New event type + + + + + CScheduleDlg + + New Event + + + + Edit Event + + + + End time must be greater than start time + + + + OK + button + + + + Never + + + + At time of event + + + + 15 minutes before + + + + 30 minutes before + + + + 1 hour before + + + + 1 day before + + + + 2 days before + + + + 1 week before + + + + On start day (9:00 AM) + + + + time(s) + + + + Enter a name please + + + + The name can not only contain whitespaces + + + + Type: + + + + Description: + + + + All Day: + + + + Starts: + + + + Ends: + + + + Remind Me: + + + + Repeat: + + + + End Repeat: + + + + Calendar account: + + + + Calendar account + + + + Type + + + + Description + + + + All Day + + + + Time: + + + + Time + + + + Solar + + + + Lunar + + + + Starts + + + + Ends + + + + Remind Me + + + + Repeat + + + + Daily + + + + Weekdays + + + + Weekly + + + + Monthly + + + + Yearly + + + + End Repeat + + + + After + + + + On + + + + Cancel + button + + + + Save + button + + + + + CScheduleOperation + + All occurrences of a repeating event must have the same all-day status. + + + + Do you want to change all occurrences? + + + + Cancel + button + + + + Change All + + + + You are changing the repeating rule of this event. + + + + You are deleting an event. + + + + Are you sure you want to delete this event? + + + + Delete + button + + + + Do you want to delete all occurrences of this event, or only the selected occurrence? + + + + Delete All + + + + Delete Only This Event + + + + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? + + + + Delete All Future Events + + + + You are changing a repeating event. + + + + Do you want to change only this occurrence of the event, or all occurrences? + + + + All + + + + Only This Event + + + + Do you want to change only this occurrence of the event, or this and all future occurrences? + + + + All Future Events + + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + OK + button + + + + + CScheduleSearchDateItem + + Y + + + + M + + + + D + + + + + CScheduleSearchItem + + Edit + + + + Delete + + + + All Day + + + + + CScheduleSearchView + + No search results + + + + + CScheduleView + + ALL DAY + + + + + CSettingDialog + + Sunday + + + + Monday + + + + 24-hour clock + + + + 12-hour clock + + + + Manual + + + + 15 mins + + + + 30 mins + + + + 1 hour + + + + 24 hours + + + + Sync Now + + + + Last sync + + + + + CTimeEdit + + (%1 mins) + + + + (%1 hour) + + + + (%1 hours) + + + + + CTitleWidget + + Y + + + + M + + + + W + + + + D + + + + Search events and festivals + + + + CWeekWidget + + Sun + + + + Mon + + + + Tue + + + + Wed + + + + Thu + + + + Fri + + + + Sat + + + + + CWeekWindow + + Week + + + + Y + + + + + CYearScheduleView + + All Day + + + + No event + + + + + CYearWindow + + Y + + + + + CalendarWindow + + Calendar + + + + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. + + + + + Calendarmainwindow + + Calendar + + + + Manage + + + + Privacy Policy + + + + Syncing... + + + + Sync successful + + + + Sync failed, please try later + + + + + CenterWidget + + All Day + + + + + DAccountDataBase + + Work + Work + + + Life + Life + + + Other + Other + + + + DAlarmManager - - - - Close button Close - + One day before start + One day before start + + Remind me tomorrow Remind me tomorrow - Remind me later Remind me later - 15 mins later - + 15 mins later - 1 hour later - + 1 hour later - 4 hours later - + 4 hours later + + + Tomorrow + Tomorrow - Schedule Reminder Schedule Reminder - - %1 to %2 %1 to %2 - - Today Today + + + DragInfoGraphicsView - - - - Tomorrow - Tomorrow + Edit + + + + Delete + + + + New event + + + + New Event + - SchedulerDatabase + JobTypeListView - - Work + You are deleting an event type. - - Life + All events under this type will be deleted and cannot be recovered. - - Other + Cancel + button + + + + Delete + button + + + + + QObject + + Account settings + + Account + + + + Select items to be synced + + + + Events + + + + General settings + + + + Sync interval + + + + Manage calendar + + + + Calendar account + + + + Event types + + + + General + + + + First day of week + + + + Time + + + + + Return + + Today + Return + Today + + + + Return Today + + Today + Return Today + Today + + + + ScheduleTypeEditDlg + + New event type + + + + Edit event type + + + + Name: + + + + Color: + + + + Cancel + button + + + + Save + button + + + + The name can not only contain whitespaces + + + + Enter a name please + + + + + Shortcut + + Help + + + + Delete event + + + + Copy + + + + Cut + + + + Paste + + + + Delete + + + + Select all + + + + + SidebarCalendarWidget + + Y + + + + M + + + + + TimeJumpDialog + + Go + button + + + + + UserloginWidget + + Sign In + button + + + + Sign Out + button + + + + + YearFrame + + Y + + + + + today + + Today + Today + Today + diff -Nru dde-calendar-5.9.1/translations/dde-calendar-service_es.ts dde-calendar-5.10.0/translations/dde-calendar-service_es.ts --- dde-calendar-5.9.1/translations/dde-calendar-service_es.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar-service_es.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,52 +1,965 @@ - + + + - JobRemindManager + AccountItem - - One day before start - El día anterior al evento + Sync successful + + + + Network error + + + + Server exception + + + + Storage full + + + + + AccountManager + + Local account + + + + Event types + + + + + CColorPickerWidget + + Color + + + + Cancel + button + + + + Save + button + + + + + CDayMonthView + + Monday + + + + Tuesday + + + + Wednesday + + + + Thursday + + + + Friday + + + + Saturday + + + + Sunday + + + + + CDayWindow + + Y + + + + M + + + + D + + + + Lunar + + + + + CGraphicsView + + New Event + + + + + CMonthScheduleNumItem + + %1 more + + + + + CMonthView + + New event + + + + New Event + + + + + CMonthWindow + + Y + + + + + CMyScheduleView + + My Event + + + + OK + button + + + + Delete + button + + + + Edit + button + + + + + CPushButton + + New event type + + + + + CScheduleDlg + + New Event + + + + Edit Event + + + + End time must be greater than start time + + + + OK + button + + + + Never + + + + At time of event + + + + 15 minutes before + + + + 30 minutes before + + + + 1 hour before + + + + 1 day before + + + + 2 days before + + + + 1 week before + + + + On start day (9:00 AM) + + + + time(s) + + + + Enter a name please + + + + The name can not only contain whitespaces + + + + Type: + + + + Description: + + + + All Day: + - - - - + Starts: + + + + Ends: + + + + Remind Me: + + + + Repeat: + + + + End Repeat: + + + + Calendar account: + + + + Calendar account + + + + Type + + + + Description + + + + All Day + + + + Time: + + + + Time + + + + Solar + + + + Lunar + + + + Starts + + + + Ends + + + + Remind Me + + + + Repeat + + + + Daily + + + + Weekdays + + + + Weekly + + + + Monthly + + + + Yearly + + + + End Repeat + + + + After + + + + On + + + + Cancel + button + + + + Save + button + + + + + CScheduleOperation + + All occurrences of a repeating event must have the same all-day status. + + + + Do you want to change all occurrences? + + + + Cancel + button + + + + Change All + + + + You are changing the repeating rule of this event. + + + + You are deleting an event. + + + + Are you sure you want to delete this event? + + + + Delete + button + + + + Do you want to delete all occurrences of this event, or only the selected occurrence? + + + + Delete All + + + + Delete Only This Event + + + + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? + + + + Delete All Future Events + + + + You are changing a repeating event. + + + + Do you want to change only this occurrence of the event, or all occurrences? + + + + All + + + + Only This Event + + + + Do you want to change only this occurrence of the event, or this and all future occurrences? + + + + All Future Events + + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + OK + button + + + + + CScheduleSearchDateItem + + Y + + + + M + + + + D + + + + + CScheduleSearchItem + + Edit + + + + Delete + + + + All Day + + + + + CScheduleSearchView + + No search results + + + + + CScheduleView + + ALL DAY + + + + + CSettingDialog + + Sunday + + + + Monday + + + + 24-hour clock + + + + 12-hour clock + + + + Manual + + + + 15 mins + + + + 30 mins + + + + 1 hour + + + + 24 hours + + + + Sync Now + + + + Last sync + + + + + CTimeEdit + + (%1 mins) + + + + (%1 hour) + + + + (%1 hours) + + + + + CTitleWidget + + Y + + + + M + + + + W + + + + D + + + + Search events and festivals + + + + + CWeekWidget + + Sun + + + + Mon + + + + Tue + + + + Wed + + + + Thu + + + + Fri + + + + Sat + + + + + CWeekWindow + + Week + + + + Y + + + + + CYearScheduleView + + All Day + + + + No event + + + + + CYearWindow + + Y + + + + + CalendarWindow + + Calendar + + + + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. + + + + + Calendarmainwindow + + Calendar + + + + Manage + + + + Privacy Policy + + + + Syncing... + + + + Sync successful + + + + Sync failed, please try later + + + + + CenterWidget + + All Day + + + + + DAccountDataBase + + Work + Trabajo + + + Life + Vida + + + Other + Otro + + + + DAlarmManager + Close button Cerrar - + One day before start + El día anterior al evento + + Remind me tomorrow - Recuérdeme mañana + Recuérdame mañana - Remind me later - Recuérdeme más tarde + Recuérdame luego + + + 15 mins later + 15 minutos después + + + 1 hour later + 1 hora después + + + 4 hours later + 4 horas después + + + Tomorrow + Mañana - Schedule Reminder - Programar recordatorio + Programar Recordatorio - - %1 to %2 %1 a %2 - - Today Hoy + + + DragInfoGraphicsView - - - Tomorrow - Mañana + Edit + + + + Delete + + + + New event + + + + New Event + + + + + JobTypeListView + + You are deleting an event type. + + + + All events under this type will be deleted and cannot be recovered. + + + + Cancel + button + + + + Delete + button + + + + + QObject + + Account settings + + + + Account + + + + Select items to be synced + + + + Events + + + + General settings + + + + Sync interval + + + + Manage calendar + + + + Calendar account + + + + Event types + + + + General + + + + First day of week + + + + Time + + + + + Return + + Today + Return + Hoy + + + + Return Today + + Today + Return Today + Hoy + + + + ScheduleTypeEditDlg + + New event type + + + + Edit event type + + + + Name: + + + + Color: + + + + Cancel + button + + + + Save + button + + + + The name can not only contain whitespaces + + + + Enter a name please + + + + + Shortcut + + Help + + + + Delete event + + + + Copy + + + + Cut + + + + Paste + + + + Delete + + + + Select all + + + + + SidebarCalendarWidget + + Y + + + + M + + + + + TimeJumpDialog + + Go + button + + + + + UserloginWidget + + Sign In + button + + + + Sign Out + button + + + + + YearFrame + + Y + + + + + today + + Today + Today + Hoy - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar-service_fa.ts dde-calendar-5.10.0/translations/dde-calendar-service_fa.ts --- dde-calendar-5.9.1/translations/dde-calendar-service_fa.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar-service_fa.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,52 +1,1231 @@ - + + + - JobRemindManager + AccountItem - - One day before start - یک روز قبل از شروع + + Sync successful + + + + + Network error + + + + + Server exception + + + + + Storage full + + + + + AccountManager + + + Local account + + + + + Event types + + + + + CColorPickerWidget + + + Color + + + + + Cancel + button + + + + + Save + button + + + + + CDayMonthView + + + Monday + + + + + Tuesday + + + + + Wednesday + + + + + Thursday + + + + + Friday + + + + + Saturday + + + + + Sunday + + + + + CDayWindow + + + Y + + + + + M + + + + + D + + + + + Lunar + + + + + CGraphicsView + + + New Event + + + + + CMonthScheduleNumItem + + + %1 more + + + + + CMonthView + + + New event + + + + + New Event + + + + + CMonthWindow + + + Y + + + + + CMyScheduleView + + + My Event + + + + + OK + button + + + + + Delete + button + + + + + Edit + button + + + + + CPushButton + + + New event type + + + + + CScheduleDlg + + + + + New Event + + + + + Edit Event + + + + + End time must be greater than start time + + + + + OK + button + + + + + + + + + + Never + + + + + At time of event + + + + + 15 minutes before + + + + + 30 minutes before + + + + + 1 hour before + + + + + + 1 day before + + + + + + 2 days before + + + + + + 1 week before + + + + + On start day (9:00 AM) + + + + + + + + time(s) + + + + + Enter a name please + + + + + The name can not only contain whitespaces + + + + + + Type: + + + + + + Description: + + + + + + All Day: + - - - - + + + Starts: + + + + + + Ends: + + + + + + Remind Me: + + + + + + Repeat: + + + + + + End Repeat: + + + + + Calendar account: + + + + + Calendar account + + + + + Type + + + + + Description + + + + + All Day + + + + + Time: + + + + + Time + + + + + Solar + + + + + Lunar + + + + + Starts + + + + + Ends + + + + + Remind Me + + + + + Repeat + + + + + + Daily + + + + + + Weekdays + + + + + + Weekly + + + + + + + Monthly + + + + + + + Yearly + + + + + End Repeat + + + + + After + + + + + On + + + + + Cancel + button + + + + + Save + button + + + + + CScheduleOperation + + + All occurrences of a repeating event must have the same all-day status. + + + + + + Do you want to change all occurrences? + + + + + + + + + + + Cancel + button + + + + + + Change All + + + + + You are changing the repeating rule of this event. + + + + + + + You are deleting an event. + + + + + Are you sure you want to delete this event? + + + + + Delete + button + + + + + Do you want to delete all occurrences of this event, or only the selected occurrence? + + + + + Delete All + + + + + + Delete Only This Event + + + + + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? + + + + + Delete All Future Events + + + + + + You are changing a repeating event. + + + + + Do you want to change only this occurrence of the event, or all occurrences? + + + + + All + + + + + + Only This Event + + + + + Do you want to change only this occurrence of the event, or this and all future occurrences? + + + + + All Future Events + + + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + + OK + button + + + + + CScheduleSearchDateItem + + + Y + + + + + M + + + + + D + + + + + CScheduleSearchItem + + + Edit + + + + + Delete + + + + + All Day + + + + + CScheduleSearchView + + + No search results + + + + + CScheduleView + + + ALL DAY + + + + + CSettingDialog + + + Sunday + + + + + Monday + + + + + 24-hour clock + + + + + 12-hour clock + + + + + Manual + + + + + 15 mins + + + + + 30 mins + + + + + 1 hour + + + + + 24 hours + + + + + Sync Now + + + + + Last sync + + + + + CTimeEdit + + + (%1 mins) + + + + + (%1 hour) + + + + + (%1 hours) + + + + + CTitleWidget + + + Y + + + + + M + + + + + W + + + + + D + + + + + + Search events and festivals + + + + + CWeekWidget + + + Sun + + + + + Mon + + + + + Tue + + + + + Wed + + + + + Thu + + + + + Fri + + + + + Sat + + + + + CWeekWindow + + + Week + + + + + Y + + + + + CYearScheduleView + + + + All Day + + + + + No event + + + + + CYearWindow + + + Y + + + + + CalendarWindow + + + Calendar + + + + + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. + + + + + Calendarmainwindow + + + Calendar + + + + + Manage + + + + + Privacy Policy + + + + + Syncing... + + + + + Sync successful + + + + + Sync failed, please try later + + + + + CenterWidget + + + All Day + + + + + DAccountDataBase + + + Work + + + + + Life + + + + + Other + + + + + DAlarmManager + + + + + Close button - بستن + بستن - + + One day before start + یک روز قبل از شروع + + + Remind me tomorrow - فردا یادم بنداز + فردا یادم بنداز - + Remind me later - بعدا ً به من یادآوری کن + بعدا ً به من یادآوری کن + + + + 15 mins later + + + + + 1 hour later + + + + + 4 hours later + - + + + + Tomorrow + فردا + + + Schedule Reminder - یادآور برنامه + یادآور برنامه - - + + %1 to %2 - + - - + + Today - امروز + امروز + + + + DragInfoGraphicsView + + + Edit + - - - Tomorrow - فردا + + Delete + + + + + New event + + + + + New Event + + + + + JobTypeListView + + + You are deleting an event type. + + + + + All events under this type will be deleted and cannot be recovered. + + + + + Cancel + button + + + + + Delete + button + + + + + QObject + + + Account settings + + + + + Account + + + + + Select items to be synced + + + + + Events + + + + + + General settings + + + + + Sync interval + + + + + + Manage calendar + + + + + Calendar account + + + + + + Event types + + + + + General + + + + + First day of week + + + + + Time + + + + + Return + + + Today + Return + امروز + + + + Return Today + + + + + Today + Return Today + امروز + + + + ScheduleTypeEditDlg + + + New event type + + + + + Edit event type + + + + + Name: + + + + + Color: + + + + + Cancel + button + + + + + Save + button + + + + + The name can not only contain whitespaces + + + + + Enter a name please + + + + + Shortcut + + + Help + + + + + Delete event + + + + + Copy + + + + + Cut + + + + + Paste + + + + + Delete + + + + + Select all + + + + + SidebarCalendarWidget + + + Y + + + + + M + + + + + TimeJumpDialog + + + Go + button + + + + + UserloginWidget + + + Sign In + button + + + + + Sign Out + button + + + + + YearFrame + + + Y + + + + + today + + + + + + + + + + Today + Today + امروز - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar-service_fi.ts dde-calendar-5.10.0/translations/dde-calendar-service_fi.ts --- dde-calendar-5.9.1/translations/dde-calendar-service_fi.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar-service_fi.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,52 +1,965 @@ - + + + - JobRemindManager + AccountItem - - One day before start - Yksi päivä ennen alkua + Sync successful + + + + Network error + + + + Server exception + + + + Storage full + + + + + AccountManager + + Local account + + + + Event types + + + + + CColorPickerWidget + + Color + + + + Cancel + button + + + + Save + button + + + + + CDayMonthView + + Monday + + + + Tuesday + + + + Wednesday + + + + Thursday + + + + Friday + + + + Saturday + + + + Sunday + + + + + CDayWindow + + Y + + + + M + + + + D + + + + Lunar + + + + + CGraphicsView + + New Event + + + + + CMonthScheduleNumItem + + %1 more + + + + + CMonthView + + New event + + + + New Event + + + + + CMonthWindow + + Y + + + + + CMyScheduleView + + My Event + + + + OK + button + + + + Delete + button + + + + Edit + button + + + + + CPushButton + + New event type + + + + + CScheduleDlg + + New Event + + + + Edit Event + + + + End time must be greater than start time + + + + OK + button + + + + Never + + + + At time of event + + + + 15 minutes before + + + + 30 minutes before + + + + 1 hour before + + + + 1 day before + + + + 2 days before + + + + 1 week before + + + + On start day (9:00 AM) + + + + time(s) + + + + Enter a name please + + + + The name can not only contain whitespaces + + + + Type: + + + + Description: + + + + All Day: + - - - - + Starts: + + + + Ends: + + + + Remind Me: + + + + Repeat: + + + + End Repeat: + + + + Calendar account: + + + + Calendar account + + + + Type + + + + Description + + + + All Day + + + + Time: + + + + Time + + + + Solar + + + + Lunar + + + + Starts + + + + Ends + + + + Remind Me + + + + Repeat + + + + Daily + + + + Weekdays + + + + Weekly + + + + Monthly + + + + Yearly + + + + End Repeat + + + + After + + + + On + + + + Cancel + button + + + + Save + button + + + + + CScheduleOperation + + All occurrences of a repeating event must have the same all-day status. + + + + Do you want to change all occurrences? + + + + Cancel + button + + + + Change All + + + + You are changing the repeating rule of this event. + + + + You are deleting an event. + + + + Are you sure you want to delete this event? + + + + Delete + button + + + + Do you want to delete all occurrences of this event, or only the selected occurrence? + + + + Delete All + + + + Delete Only This Event + + + + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? + + + + Delete All Future Events + + + + You are changing a repeating event. + + + + Do you want to change only this occurrence of the event, or all occurrences? + + + + All + + + + Only This Event + + + + Do you want to change only this occurrence of the event, or this and all future occurrences? + + + + All Future Events + + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + OK + button + + + + + CScheduleSearchDateItem + + Y + + + + M + + + + D + + + + + CScheduleSearchItem + + Edit + + + + Delete + + + + All Day + + + + + CScheduleSearchView + + No search results + + + + + CScheduleView + + ALL DAY + + + + + CSettingDialog + + Sunday + + + + Monday + + + + 24-hour clock + + + + 12-hour clock + + + + Manual + + + + 15 mins + + + + 30 mins + + + + 1 hour + + + + 24 hours + + + + Sync Now + + + + Last sync + + + + + CTimeEdit + + (%1 mins) + + + + (%1 hour) + + + + (%1 hours) + + + + + CTitleWidget + + Y + + + + M + + + + W + + + + D + + + + Search events and festivals + + + + + CWeekWidget + + Sun + + + + Mon + + + + Tue + + + + Wed + + + + Thu + + + + Fri + + + + Sat + + + + + CWeekWindow + + Week + + + + Y + + + + + CYearScheduleView + + All Day + + + + No event + + + + + CYearWindow + + Y + + + + + CalendarWindow + + Calendar + + + + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. + + + + + Calendarmainwindow + + Calendar + + + + Manage + + + + Privacy Policy + + + + Syncing... + + + + Sync successful + + + + Sync failed, please try later + + + + + CenterWidget + + All Day + + + + + DAccountDataBase + + Work + Työ + + + Life + Oma + + + Other + Muu + + + + DAlarmManager + Close button Sulje - + One day before start + Päivä ennen alkua + + Remind me tomorrow Muistuta huomenna - Remind me later Muistuta myöhemmin - + 15 mins later + 15 min myöhemmin + + + 1 hour later + 1 tunnin kuluttua + + + 4 hours later + 4 tunnin kuluttua + + + Tomorrow + Huomenna + + Schedule Reminder Ajasta muistutus - - %1 to %2 %1 - %2 - - Today Tänään + + + DragInfoGraphicsView + + Edit + + - - - Tomorrow - Huomenna + Delete + + + + New event + + + + New Event + + + + + JobTypeListView + + You are deleting an event type. + + + + All events under this type will be deleted and cannot be recovered. + + + + Cancel + button + + + + Delete + button + + + + + QObject + + Account settings + + + + Account + + + + Select items to be synced + + + + Events + + + + General settings + + + + Sync interval + + + + Manage calendar + + + + Calendar account + + + + Event types + + + + General + + + + First day of week + + + + Time + + + + + Return + + Today + Return + Tänään + + + + Return Today + + Today + Return Today + Tänään + + + + ScheduleTypeEditDlg + + New event type + + + + Edit event type + + + + Name: + + + + Color: + + + + Cancel + button + + + + Save + button + + + + The name can not only contain whitespaces + + + + Enter a name please + + + + + Shortcut + + Help + + + + Delete event + + + + Copy + + + + Cut + + + + Paste + + + + Delete + + + + Select all + + + + + SidebarCalendarWidget + + Y + + + + M + + + + + TimeJumpDialog + + Go + button + + + + + UserloginWidget + + Sign In + button + + + + Sign Out + button + + + + + YearFrame + + Y + + + + + today + + Today + Today + Tänään - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar-service_fr.ts dde-calendar-5.10.0/translations/dde-calendar-service_fr.ts --- dde-calendar-5.9.1/translations/dde-calendar-service_fr.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar-service_fr.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,52 +1,965 @@ - + + + - JobRemindManager + AccountItem - - One day before start - Un jour avant le départ + Sync successful + + + + Network error + + + + Server exception + + + + Storage full + + + + + AccountManager + + Local account + + + + Event types + + + + + CColorPickerWidget + + Color + + + + Cancel + button + + + + Save + button + + + + + CDayMonthView + + Monday + + + + Tuesday + + + + Wednesday + + + + Thursday + + + + Friday + + + + Saturday + + + + Sunday + + + + + CDayWindow + + Y + + + + M + + + + D + + + + Lunar + + + + + CGraphicsView + + New Event + + + + + CMonthScheduleNumItem + + %1 more + + + + + CMonthView + + New event + + + + New Event + + + + + CMonthWindow + + Y + + + + + CMyScheduleView + + My Event + + + + OK + button + + + + Delete + button + + + + Edit + button + + + + + CPushButton + + New event type + + + + + CScheduleDlg + + New Event + + + + Edit Event + + + + End time must be greater than start time + + + + OK + button + + + + Never + + + + At time of event + + + + 15 minutes before + + + + 30 minutes before + + + + 1 hour before + + + + 1 day before + + + + 2 days before + + + + 1 week before + + + + On start day (9:00 AM) + + + + time(s) + + + + Enter a name please + + + + The name can not only contain whitespaces + + + + Type: + + + + Description: + + + + All Day: + - - - - + Starts: + + + + Ends: + + + + Remind Me: + + + + Repeat: + + + + End Repeat: + + + + Calendar account: + + + + Calendar account + + + + Type + + + + Description + + + + All Day + + + + Time: + + + + Time + + + + Solar + + + + Lunar + + + + Starts + + + + Ends + + + + Remind Me + + + + Repeat + + + + Daily + + + + Weekdays + + + + Weekly + + + + Monthly + + + + Yearly + + + + End Repeat + + + + After + + + + On + + + + Cancel + button + + + + Save + button + + + + + CScheduleOperation + + All occurrences of a repeating event must have the same all-day status. + + + + Do you want to change all occurrences? + + + + Cancel + button + + + + Change All + + + + You are changing the repeating rule of this event. + + + + You are deleting an event. + + + + Are you sure you want to delete this event? + + + + Delete + button + + + + Do you want to delete all occurrences of this event, or only the selected occurrence? + + + + Delete All + + + + Delete Only This Event + + + + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? + + + + Delete All Future Events + + + + You are changing a repeating event. + + + + Do you want to change only this occurrence of the event, or all occurrences? + + + + All + + + + Only This Event + + + + Do you want to change only this occurrence of the event, or this and all future occurrences? + + + + All Future Events + + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + OK + button + + + + + CScheduleSearchDateItem + + Y + + + + M + + + + D + + + + + CScheduleSearchItem + + Edit + + + + Delete + + + + All Day + + + + + CScheduleSearchView + + No search results + + + + + CScheduleView + + ALL DAY + + + + + CSettingDialog + + Sunday + + + + Monday + + + + 24-hour clock + + + + 12-hour clock + + + + Manual + + + + 15 mins + + + + 30 mins + + + + 1 hour + + + + 24 hours + + + + Sync Now + + + + Last sync + + + + + CTimeEdit + + (%1 mins) + + + + (%1 hour) + + + + (%1 hours) + + + + + CTitleWidget + + Y + + + + M + + + + W + + + + D + + + + Search events and festivals + + + + + CWeekWidget + + Sun + + + + Mon + + + + Tue + + + + Wed + + + + Thu + + + + Fri + + + + Sat + + + + + CWeekWindow + + Week + + + + Y + + + + + CYearScheduleView + + All Day + + + + No event + + + + + CYearWindow + + Y + + + + + CalendarWindow + + Calendar + + + + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. + + + + + Calendarmainwindow + + Calendar + + + + Manage + + + + Privacy Policy + + + + Syncing... + + + + Sync successful + + + + Sync failed, please try later + + + + + CenterWidget + + All Day + + + + + DAccountDataBase + + Work + Travail + + + Life + Vie + + + Other + Autre + + + + DAlarmManager + Close button Fermer - + One day before start + Un jour avant le début + + Remind me tomorrow - Rappelez-le moi demain + Rappellez-le moi demain - Remind me later Rappelez-le moi plus tard - + 15 mins later + 15 minutes plus tard + + + 1 hour later + 1 heure plus tard + + + 4 hours later + 4 heures plus tard + + + Tomorrow + Demain + + Schedule Reminder - Rappel de planification + Rappel de programme - - %1 to %2 %1 à %2 - - Today Aujourd'hui + + + DragInfoGraphicsView + + Edit + + - - - Tomorrow - Demain + Delete + + + + New event + + + + New Event + + + + + JobTypeListView + + You are deleting an event type. + + + + All events under this type will be deleted and cannot be recovered. + + + + Cancel + button + + + + Delete + button + + + + + QObject + + Account settings + + + + Account + + + + Select items to be synced + + + + Events + + + + General settings + + + + Sync interval + + + + Manage calendar + + + + Calendar account + + + + Event types + + + + General + + + + First day of week + + + + Time + + + + + Return + + Today + Return + Aujourd'hui + + + + Return Today + + Today + Return Today + Aujourd'hui + + + + ScheduleTypeEditDlg + + New event type + + + + Edit event type + + + + Name: + + + + Color: + + + + Cancel + button + + + + Save + button + + + + The name can not only contain whitespaces + + + + Enter a name please + + + + + Shortcut + + Help + + + + Delete event + + + + Copy + + + + Cut + + + + Paste + + + + Delete + + + + Select all + + + + + SidebarCalendarWidget + + Y + + + + M + + + + + TimeJumpDialog + + Go + button + + + + + UserloginWidget + + Sign In + button + + + + Sign Out + button + + + + + YearFrame + + Y + + + + + today + + Today + Today + Aujourd'hui - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar-service_gl_ES.ts dde-calendar-5.10.0/translations/dde-calendar-service_gl_ES.ts --- dde-calendar-5.9.1/translations/dde-calendar-service_gl_ES.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar-service_gl_ES.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,52 +1,965 @@ - + + + - JobRemindManager + AccountItem - - One day before start - Un día antes do comezo + Sync successful + + + + Network error + + + + Server exception + + + + Storage full + + + + + AccountManager + + Local account + + + + Event types + + + + + CColorPickerWidget + + Color + + + + Cancel + button + + + + Save + button + + + + + CDayMonthView + + Monday + + + + Tuesday + + + + Wednesday + + + + Thursday + + + + Friday + + + + Saturday + + + + Sunday + + + + + CDayWindow + + Y + + + + M + + + + D + + + + Lunar + + + + + CGraphicsView + + New Event + + + + + CMonthScheduleNumItem + + %1 more + + + + + CMonthView + + New event + + + + New Event + + + + + CMonthWindow + + Y + + + + + CMyScheduleView + + My Event + + + + OK + button + + + + Delete + button + + + + Edit + button + + + + + CPushButton + + New event type + + + + + CScheduleDlg + + New Event + + + + Edit Event + + + + End time must be greater than start time + + + + OK + button + + + + Never + + + + At time of event + + + + 15 minutes before + + + + 30 minutes before + + + + 1 hour before + + + + 1 day before + + + + 2 days before + + + + 1 week before + + + + On start day (9:00 AM) + + + + time(s) + + + + Enter a name please + + + + The name can not only contain whitespaces + + + + Type: + + + + Description: + + + + All Day: + - - - - + Starts: + + + + Ends: + + + + Remind Me: + + + + Repeat: + + + + End Repeat: + + + + Calendar account: + + + + Calendar account + + + + Type + + + + Description + + + + All Day + + + + Time: + + + + Time + + + + Solar + + + + Lunar + + + + Starts + + + + Ends + + + + Remind Me + + + + Repeat + + + + Daily + + + + Weekdays + + + + Weekly + + + + Monthly + + + + Yearly + + + + End Repeat + + + + After + + + + On + + + + Cancel + button + + + + Save + button + + + + + CScheduleOperation + + All occurrences of a repeating event must have the same all-day status. + + + + Do you want to change all occurrences? + + + + Cancel + button + + + + Change All + + + + You are changing the repeating rule of this event. + + + + You are deleting an event. + + + + Are you sure you want to delete this event? + + + + Delete + button + + + + Do you want to delete all occurrences of this event, or only the selected occurrence? + + + + Delete All + + + + Delete Only This Event + + + + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? + + + + Delete All Future Events + + + + You are changing a repeating event. + + + + Do you want to change only this occurrence of the event, or all occurrences? + + + + All + + + + Only This Event + + + + Do you want to change only this occurrence of the event, or this and all future occurrences? + + + + All Future Events + + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + OK + button + + + + + CScheduleSearchDateItem + + Y + + + + M + + + + D + + + + + CScheduleSearchItem + + Edit + + + + Delete + + + + All Day + + + + + CScheduleSearchView + + No search results + + + + + CScheduleView + + ALL DAY + + + + + CSettingDialog + + Sunday + + + + Monday + + + + 24-hour clock + + + + 12-hour clock + + + + Manual + + + + 15 mins + + + + 30 mins + + + + 1 hour + + + + 24 hours + + + + Sync Now + + + + Last sync + + + + + CTimeEdit + + (%1 mins) + + + + (%1 hour) + + + + (%1 hours) + + + + + CTitleWidget + + Y + + + + M + + + + W + + + + D + + + + Search events and festivals + + + + + CWeekWidget + + Sun + + + + Mon + + + + Tue + + + + Wed + + + + Thu + + + + Fri + + + + Sat + + + + + CWeekWindow + + Week + + + + Y + + + + + CYearScheduleView + + All Day + + + + No event + + + + + CYearWindow + + Y + + + + + CalendarWindow + + Calendar + + + + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. + + + + + Calendarmainwindow + + Calendar + + + + Manage + + + + Privacy Policy + + + + Syncing... + + + + Sync successful + + + + Sync failed, please try later + + + + + CenterWidget + + All Day + + + + + DAccountDataBase + + Work + Traballo + + + Life + Persoal + + + Other + Outros + + + + DAlarmManager + Close button Pechar - + One day before start + Un día antes do comezo + + Remind me tomorrow Lembrarme mañá - Remind me later Lembrarme máis tarde - + 15 mins later + + + + 1 hour later + + + + 4 hours later + + + + Tomorrow + Mañá + + Schedule Reminder Programar recordatorio - - %1 to %2 %1 a %2 - - Today Hoxe + + + DragInfoGraphicsView - - - Tomorrow - Mañá + Edit + + + + Delete + + + + New event + + + + New Event + + + + + JobTypeListView + + You are deleting an event type. + + + + All events under this type will be deleted and cannot be recovered. + + + + Cancel + button + + + + Delete + button + + + + + QObject + + Account settings + + + + Account + + + + Select items to be synced + + + + Events + + + + General settings + + + + Sync interval + + + + Manage calendar + + + + Calendar account + + + + Event types + + + + General + + + + First day of week + + + + Time + + + + + Return + + Today + Return + Hoxe + + + + Return Today + + Today + Return Today + Hoxe + + + + ScheduleTypeEditDlg + + New event type + + + + Edit event type + + + + Name: + + + + Color: + + + + Cancel + button + + + + Save + button + + + + The name can not only contain whitespaces + + + + Enter a name please + + + + + Shortcut + + Help + + + + Delete event + + + + Copy + + + + Cut + + + + Paste + + + + Delete + + + + Select all + + + + + SidebarCalendarWidget + + Y + + + + M + + + + + TimeJumpDialog + + Go + button + + + + + UserloginWidget + + Sign In + button + + + + Sign Out + button + + + + + YearFrame + + Y + + + + + today + + Today + Today + Hoxe - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar-service_hi_IN.ts dde-calendar-5.10.0/translations/dde-calendar-service_hi_IN.ts --- dde-calendar-5.9.1/translations/dde-calendar-service_hi_IN.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar-service_hi_IN.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,52 +1,965 @@ - + + + - JobRemindManager + AccountItem - - One day before start - आरंभ से पूर्व एक दिन + Sync successful + + + + Network error + + + + Server exception + + + + Storage full + + + + + AccountManager + + Local account + + + + Event types + + + + + CColorPickerWidget + + Color + + + + Cancel + button + + + + Save + button + + + + + CDayMonthView + + Monday + + + + Tuesday + + + + Wednesday + + + + Thursday + + + + Friday + + + + Saturday + + + + Sunday + + + + + CDayWindow + + Y + + + + M + + + + D + + + + Lunar + + + + + CGraphicsView + + New Event + + + + + CMonthScheduleNumItem + + %1 more + + + + + CMonthView + + New event + + + + New Event + + + + + CMonthWindow + + Y + + + + + CMyScheduleView + + My Event + + + + OK + button + + + + Delete + button + + + + Edit + button + + + + + CPushButton + + New event type + + + + + CScheduleDlg + + New Event + + + + Edit Event + + + + End time must be greater than start time + + + + OK + button + + + + Never + + + + At time of event + + + + 15 minutes before + + + + 30 minutes before + + + + 1 hour before + + + + 1 day before + + + + 2 days before + + + + 1 week before + + + + On start day (9:00 AM) + + + + time(s) + + + + Enter a name please + + + + The name can not only contain whitespaces + + + + Type: + + + + Description: + + + + All Day: + - - - - + Starts: + + + + Ends: + + + + Remind Me: + + + + Repeat: + + + + End Repeat: + + + + Calendar account: + + + + Calendar account + + + + Type + + + + Description + + + + All Day + + + + Time: + + + + Time + + + + Solar + + + + Lunar + + + + Starts + + + + Ends + + + + Remind Me + + + + Repeat + + + + Daily + + + + Weekdays + + + + Weekly + + + + Monthly + + + + Yearly + + + + End Repeat + + + + After + + + + On + + + + Cancel + button + + + + Save + button + + + + + CScheduleOperation + + All occurrences of a repeating event must have the same all-day status. + + + + Do you want to change all occurrences? + + + + Cancel + button + + + + Change All + + + + You are changing the repeating rule of this event. + + + + You are deleting an event. + + + + Are you sure you want to delete this event? + + + + Delete + button + + + + Do you want to delete all occurrences of this event, or only the selected occurrence? + + + + Delete All + + + + Delete Only This Event + + + + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? + + + + Delete All Future Events + + + + You are changing a repeating event. + + + + Do you want to change only this occurrence of the event, or all occurrences? + + + + All + + + + Only This Event + + + + Do you want to change only this occurrence of the event, or this and all future occurrences? + + + + All Future Events + + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + OK + button + + + + + CScheduleSearchDateItem + + Y + + + + M + + + + D + + + + + CScheduleSearchItem + + Edit + + + + Delete + + + + All Day + + + + + CScheduleSearchView + + No search results + + + + + CScheduleView + + ALL DAY + + + + + CSettingDialog + + Sunday + + + + Monday + + + + 24-hour clock + + + + 12-hour clock + + + + Manual + + + + 15 mins + + + + 30 mins + + + + 1 hour + + + + 24 hours + + + + Sync Now + + + + Last sync + + + + + CTimeEdit + + (%1 mins) + + + + (%1 hour) + + + + (%1 hours) + + + + + CTitleWidget + + Y + + + + M + + + + W + + + + D + + + + Search events and festivals + + + + + CWeekWidget + + Sun + + + + Mon + + + + Tue + + + + Wed + + + + Thu + + + + Fri + + + + Sat + + + + + CWeekWindow + + Week + + + + Y + + + + + CYearScheduleView + + All Day + + + + No event + + + + + CYearWindow + + Y + + + + + CalendarWindow + + Calendar + + + + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. + + + + + Calendarmainwindow + + Calendar + + + + Manage + + + + Privacy Policy + + + + Syncing... + + + + Sync successful + + + + Sync failed, please try later + + + + + CenterWidget + + All Day + + + + + DAccountDataBase + + Work + + + + Life + जीवन + + + Other + अन्य + + + + DAlarmManager + Close button बंद करें - + One day before start + आरंभ से पूर्व एक दिन + + Remind me tomorrow कल पुनः सूचित करें - Remind me later बाद में पुनः सूचित करें - + 15 mins later + + + + 1 hour later + + + + 4 hours later + + + + Tomorrow + आने वाला कल + + Schedule Reminder कार्यक्रम अनुस्मारक - - %1 to %2 %1 से %2 तक - - Today - आज + आज + + + DragInfoGraphicsView - - - Tomorrow - आने वाला कल + Edit + + + + Delete + + + + New event + + + + New Event + + + + + JobTypeListView + + You are deleting an event type. + + + + All events under this type will be deleted and cannot be recovered. + + + + Cancel + button + + + + Delete + button + + + + + QObject + + Account settings + + + + Account + + + + Select items to be synced + + + + Events + + + + General settings + + + + Sync interval + + + + Manage calendar + + + + Calendar account + + + + Event types + + + + General + + + + First day of week + + + + Time + + + + + Return + + Today + Return + आज + + + + Return Today + + Today + Return Today + आज + + + + ScheduleTypeEditDlg + + New event type + + + + Edit event type + + + + Name: + + + + Color: + + + + Cancel + button + + + + Save + button + + + + The name can not only contain whitespaces + + + + Enter a name please + + + + + Shortcut + + Help + + + + Delete event + + + + Copy + + + + Cut + + + + Paste + + + + Delete + + + + Select all + + + + + SidebarCalendarWidget + + Y + + + + M + + + + + TimeJumpDialog + + Go + button + + + + + UserloginWidget + + Sign In + button + + + + Sign Out + button + + + + + YearFrame + + Y + + + + + today + + Today + Today + आज - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar-service_hr.ts dde-calendar-5.10.0/translations/dde-calendar-service_hr.ts --- dde-calendar-5.9.1/translations/dde-calendar-service_hr.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar-service_hr.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,86 +1,965 @@ - + + + - JobRemindManager + AccountItem - - One day before start - Dan prije početka + Sync successful + + + + Network error + + + + Server exception + + + + Storage full + + + + + AccountManager + + Local account + + + + Event types + + + + + CColorPickerWidget + + Color + + + + Cancel + button + + + + Save + button + + + + + CDayMonthView + + Monday + + + + Tuesday + + + + Wednesday + + + + Thursday + + + + Friday + + + + Saturday + + + + Sunday + + + + + CDayWindow + + Y + + + + M + + + + D + + + + Lunar + + + + + CGraphicsView + + New Event + + + + + CMonthScheduleNumItem + + %1 more + + + + + CMonthView + + New event + + + + New Event + + + + + CMonthWindow + + Y + + + + + CMyScheduleView + + My Event + + + + OK + button + + + + Delete + button + + + + Edit + button + + + + + CPushButton + + New event type + + + + + CScheduleDlg + + New Event + + + + Edit Event + + + + End time must be greater than start time + + + + OK + button + + + + Never + + + + At time of event + + + + 15 minutes before + + + + 30 minutes before + + + + 1 hour before + + + + 1 day before + + + + 2 days before + + + + 1 week before + + + + On start day (9:00 AM) + + + + time(s) + + + + Enter a name please + + + + The name can not only contain whitespaces + + + + Type: + + + + Description: + + + + All Day: + - - - - + Starts: + + + + Ends: + + + + Remind Me: + + + + Repeat: + + + + End Repeat: + + + + Calendar account: + + + + Calendar account + + + + Type + + + + Description + + + + All Day + + + + Time: + + + + Time + + + + Solar + + + + Lunar + + + + Starts + + + + Ends + + + + Remind Me + + + + Repeat + + + + Daily + + + + Weekdays + + + + Weekly + + + + Monthly + + + + Yearly + + + + End Repeat + + + + After + + + + On + + + + Cancel + button + + + + Save + button + + + + + CScheduleOperation + + All occurrences of a repeating event must have the same all-day status. + + + + Do you want to change all occurrences? + + + + Cancel + button + + + + Change All + + + + You are changing the repeating rule of this event. + + + + You are deleting an event. + + + + Are you sure you want to delete this event? + + + + Delete + button + + + + Do you want to delete all occurrences of this event, or only the selected occurrence? + + + + Delete All + + + + Delete Only This Event + + + + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? + + + + Delete All Future Events + + + + You are changing a repeating event. + + + + Do you want to change only this occurrence of the event, or all occurrences? + + + + All + + + + Only This Event + + + + Do you want to change only this occurrence of the event, or this and all future occurrences? + + + + All Future Events + + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + OK + button + + + + + CScheduleSearchDateItem + + Y + + + + M + + + + D + + + + + CScheduleSearchItem + + Edit + + + + Delete + + + + All Day + + + + + CScheduleSearchView + + No search results + + + + + CScheduleView + + ALL DAY + + + + + CSettingDialog + + Sunday + + + + Monday + + + + 24-hour clock + + + + 12-hour clock + + + + Manual + + + + 15 mins + + + + 30 mins + + + + 1 hour + + + + 24 hours + + + + Sync Now + + + + Last sync + + + + + CTimeEdit + + (%1 mins) + + + + (%1 hour) + + + + (%1 hours) + + + + + CTitleWidget + + Y + + + + M + + + + W + + + + D + + + + Search events and festivals + + + + + CWeekWidget + + Sun + + + + Mon + + + + Tue + + + + Wed + + + + Thu + + + + Fri + + + + Sat + + + + + CWeekWindow + + Week + + + + Y + + + + + CYearScheduleView + + All Day + + + + No event + + + + + CYearWindow + + Y + + + + + CalendarWindow + + Calendar + + + + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. + + + + + Calendarmainwindow + + Calendar + + + + Manage + + + + Privacy Policy + + + + Syncing... + + + + Sync successful + + + + Sync failed, please try later + + + + + CenterWidget + + All Day + + + + + DAccountDataBase + + Work + Posao + + + Life + Život + + + Other + Ostalo + + + + DAlarmManager + Close button Zatvori - + One day before start + Jedan dan prije početka + + Remind me tomorrow Podsjeti me sutra - Remind me later Podsjeti me kasnije - 15 mins later 15 minuta kasnije - 1 hour later 1 sat kasnije - 4 hours later 4 sata kasnije - + Tomorrow + Sutra + + Schedule Reminder Podsjetnik rasporeda - - %1 to %2 %1 do %2 - - Today Danas + + + DragInfoGraphicsView - - - - Tomorrow - Sutra + Edit + + + + Delete + + + + New event + + + + New Event + - SchedulerDatabase + JobTypeListView - - Work - Posao + You are deleting an event type. + - - Life - Život + All events under this type will be deleted and cannot be recovered. + - - Other - Ostalo + Cancel + button + + + + Delete + button + + + + + QObject + + Account settings + + + + Account + + + + Select items to be synced + + + + Events + + + + General settings + + + + Sync interval + + + + Manage calendar + + + + Calendar account + + + + Event types + + + + General + + + + First day of week + + + + Time + + + + + Return + + Today + Return + Danas + + + + Return Today + + Today + Return Today + Danas + + + + ScheduleTypeEditDlg + + New event type + + + + Edit event type + + + + Name: + + + + Color: + + + + Cancel + button + + + + Save + button + + + + The name can not only contain whitespaces + + + + Enter a name please + + + + + Shortcut + + Help + + + + Delete event + + + + Copy + + + + Cut + + + + Paste + + + + Delete + + + + Select all + + + + + SidebarCalendarWidget + + Y + + + + M + + + + + TimeJumpDialog + + Go + button + + + + + UserloginWidget + + Sign In + button + + + + Sign Out + button + + + + + YearFrame + + Y + + + + + today + + Today + Today + Danas - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar-service_hu.ts dde-calendar-5.10.0/translations/dde-calendar-service_hu.ts --- dde-calendar-5.9.1/translations/dde-calendar-service_hu.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar-service_hu.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,86 +1,965 @@ - + + + - JobRemindManager + AccountItem - - One day before start - Egy nappal kezdés előtt + Sync successful + + + + Network error + + + + Server exception + + + + Storage full + + + + + AccountManager + + Local account + + + + Event types + + + + + CColorPickerWidget + + Color + + + + Cancel + button + + + + Save + button + + + + + CDayMonthView + + Monday + + + + Tuesday + + + + Wednesday + - - - - + Thursday + + + + Friday + + + + Saturday + + + + Sunday + + + + + CDayWindow + + Y + + + + M + + + + D + + + + Lunar + + + + + CGraphicsView + + New Event + + + + + CMonthScheduleNumItem + + %1 more + + + + + CMonthView + + New event + + + + New Event + + + + + CMonthWindow + + Y + + + + + CMyScheduleView + + My Event + + + + OK + button + + + + Delete + button + + + + Edit + button + + + + + CPushButton + + New event type + + + + + CScheduleDlg + + New Event + + + + Edit Event + + + + End time must be greater than start time + + + + OK + button + + + + Never + + + + At time of event + + + + 15 minutes before + + + + 30 minutes before + + + + 1 hour before + + + + 1 day before + + + + 2 days before + + + + 1 week before + + + + On start day (9:00 AM) + + + + time(s) + + + + Enter a name please + + + + The name can not only contain whitespaces + + + + Type: + + + + Description: + + + + All Day: + + + + Starts: + + + + Ends: + + + + Remind Me: + + + + Repeat: + + + + End Repeat: + + + + Calendar account: + + + + Calendar account + + + + Type + + + + Description + + + + All Day + + + + Time: + + + + Time + + + + Solar + + + + Lunar + + + + Starts + + + + Ends + + + + Remind Me + + + + Repeat + + + + Daily + + + + Weekdays + + + + Weekly + + + + Monthly + + + + Yearly + + + + End Repeat + + + + After + + + + On + + + + Cancel + button + + + + Save + button + + + + + CScheduleOperation + + All occurrences of a repeating event must have the same all-day status. + + + + Do you want to change all occurrences? + + + + Cancel + button + + + + Change All + + + + You are changing the repeating rule of this event. + + + + You are deleting an event. + + + + Are you sure you want to delete this event? + + + + Delete + button + + + + Do you want to delete all occurrences of this event, or only the selected occurrence? + + + + Delete All + + + + Delete Only This Event + + + + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? + + + + Delete All Future Events + + + + You are changing a repeating event. + + + + Do you want to change only this occurrence of the event, or all occurrences? + + + + All + + + + Only This Event + + + + Do you want to change only this occurrence of the event, or this and all future occurrences? + + + + All Future Events + + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + OK + button + + + + + CScheduleSearchDateItem + + Y + + + + M + + + + D + + + + + CScheduleSearchItem + + Edit + + + + Delete + + + + All Day + + + + + CScheduleSearchView + + No search results + + + + + CScheduleView + + ALL DAY + + + + + CSettingDialog + + Sunday + + + + Monday + + + + 24-hour clock + + + + 12-hour clock + + + + Manual + + + + 15 mins + + + + 30 mins + + + + 1 hour + + + + 24 hours + + + + Sync Now + + + + Last sync + + + + + CTimeEdit + + (%1 mins) + + + + (%1 hour) + + + + (%1 hours) + + + + + CTitleWidget + + Y + + + + M + + + + W + + + + D + + + + Search events and festivals + + + + + CWeekWidget + + Sun + + + + Mon + + + + Tue + + + + Wed + + + + Thu + + + + Fri + + + + Sat + + + + + CWeekWindow + + Week + + + + Y + + + + + CYearScheduleView + + All Day + + + + No event + + + + + CYearWindow + + Y + + + + + CalendarWindow + + Calendar + + + + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. + + + + + Calendarmainwindow + + Calendar + + + + Manage + + + + Privacy Policy + + + + Syncing... + + + + Sync successful + + + + Sync failed, please try later + + + + + CenterWidget + + All Day + + + + + DAccountDataBase + + Work + Munka + + + Life + Magánélet + + + Other + Egyéb + + + + DAlarmManager + Close button Bezárás - + One day before start + Egy nappal kezdés előtt + + Remind me tomorrow Emlékeztessen holnap - Remind me later Emlékeztessen később - 15 mins later 15 perc múlva - 1 hour later 1 óra múlva - 4 hours later 4 óra múlva - + Tomorrow + Holnap + + Schedule Reminder Ütemezési emlékeztető - - %1 to %2 %1-től %2-ig - - Today Ma + + + DragInfoGraphicsView - - - - Tomorrow - Holnap + Edit + + + + Delete + + + + New event + + + + New Event + - SchedulerDatabase + JobTypeListView - - Work - Munka + You are deleting an event type. + - - Life - Magénélet + All events under this type will be deleted and cannot be recovered. + - - Other - Egyéb + Cancel + button + + + + Delete + button + + + + + QObject + + Account settings + + + + Account + + + + Select items to be synced + + + + Events + + + + General settings + + + + Sync interval + + + + Manage calendar + + + + Calendar account + + + + Event types + + + + General + + + + First day of week + + + + Time + + + + + Return + + Today + Return + Ma + + + + Return Today + + Today + Return Today + Ma + + + + ScheduleTypeEditDlg + + New event type + + + + Edit event type + + + + Name: + + + + Color: + + + + Cancel + button + + + + Save + button + + + + The name can not only contain whitespaces + + + + Enter a name please + + + + + Shortcut + + Help + + + + Delete event + + + + Copy + + + + Cut + + + + Paste + + + + Delete + + + + Select all + + + + + SidebarCalendarWidget + + Y + + + + M + + + + + TimeJumpDialog + + Go + button + + + + + UserloginWidget + + Sign In + button + + + + Sign Out + button + + + + + YearFrame + + Y + + + + + today + + Today + Today + Ma - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar-service_it.ts dde-calendar-5.10.0/translations/dde-calendar-service_it.ts --- dde-calendar-5.9.1/translations/dde-calendar-service_it.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar-service_it.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,52 +1,965 @@ - + + + - JobRemindManager + AccountItem - - One day before start - Un giorno prima dell'inizio + Sync successful + + + + Network error + + + + Server exception + + + + Storage full + + + + + AccountManager + + Local account + + + + Event types + + + + + CColorPickerWidget + + Color + + + + Cancel + button + + + + Save + button + + + + + CDayMonthView + + Monday + + + + Tuesday + + + + Wednesday + + + + Thursday + + + + Friday + + + + Saturday + + + + Sunday + + + + + CDayWindow + + Y + + + + M + + + + D + + + + Lunar + + + + + CGraphicsView + + New Event + + + + + CMonthScheduleNumItem + + %1 more + + + + + CMonthView + + New event + + + + New Event + + + + + CMonthWindow + + Y + + + + + CMyScheduleView + + My Event + + + + OK + button + + + + Delete + button + + + + Edit + button + + + + + CPushButton + + New event type + + + + + CScheduleDlg + + New Event + + + + Edit Event + + + + End time must be greater than start time + + + + OK + button + + + + Never + + + + At time of event + + + + 15 minutes before + + + + 30 minutes before + + + + 1 hour before + + + + 1 day before + + + + 2 days before + + + + 1 week before + + + + On start day (9:00 AM) + + + + time(s) + + + + Enter a name please + + + + The name can not only contain whitespaces + + + + Type: + + + + Description: + + + + All Day: + - - - - + Starts: + + + + Ends: + + + + Remind Me: + + + + Repeat: + + + + End Repeat: + + + + Calendar account: + + + + Calendar account + + + + Type + + + + Description + + + + All Day + + + + Time: + + + + Time + + + + Solar + + + + Lunar + + + + Starts + + + + Ends + + + + Remind Me + + + + Repeat + + + + Daily + + + + Weekdays + + + + Weekly + + + + Monthly + + + + Yearly + + + + End Repeat + + + + After + + + + On + + + + Cancel + button + + + + Save + button + + + + + CScheduleOperation + + All occurrences of a repeating event must have the same all-day status. + + + + Do you want to change all occurrences? + + + + Cancel + button + + + + Change All + + + + You are changing the repeating rule of this event. + + + + You are deleting an event. + + + + Are you sure you want to delete this event? + + + + Delete + button + + + + Do you want to delete all occurrences of this event, or only the selected occurrence? + + + + Delete All + + + + Delete Only This Event + + + + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? + + + + Delete All Future Events + + + + You are changing a repeating event. + + + + Do you want to change only this occurrence of the event, or all occurrences? + + + + All + + + + Only This Event + + + + Do you want to change only this occurrence of the event, or this and all future occurrences? + + + + All Future Events + + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + OK + button + + + + + CScheduleSearchDateItem + + Y + + + + M + + + + D + + + + + CScheduleSearchItem + + Edit + + + + Delete + + + + All Day + + + + + CScheduleSearchView + + No search results + + + + + CScheduleView + + ALL DAY + + + + + CSettingDialog + + Sunday + + + + Monday + + + + 24-hour clock + + + + 12-hour clock + + + + Manual + + + + 15 mins + + + + 30 mins + + + + 1 hour + + + + 24 hours + + + + Sync Now + + + + Last sync + + + + + CTimeEdit + + (%1 mins) + + + + (%1 hour) + + + + (%1 hours) + + + + + CTitleWidget + + Y + + + + M + + + + W + + + + D + + + + Search events and festivals + + + + + CWeekWidget + + Sun + + + + Mon + + + + Tue + + + + Wed + + + + Thu + + + + Fri + + + + Sat + + + + + CWeekWindow + + Week + + + + Y + + + + + CYearScheduleView + + All Day + + + + No event + + + + + CYearWindow + + Y + + + + + CalendarWindow + + Calendar + + + + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. + + + + + Calendarmainwindow + + Calendar + + + + Manage + + + + Privacy Policy + + + + Syncing... + + + + Sync successful + + + + Sync failed, please try later + + + + + CenterWidget + + All Day + + + + + DAccountDataBase + + Work + Lavoro + + + Life + Personale + + + Other + Altro + + + + DAlarmManager + Close button Chiudi - + One day before start + Un giorno prima di iniziare + + Remind me tomorrow Ricordamelo domani - Remind me later - Ricordamelo più tardi + Ricordamelo piu tardi + + + 15 mins later + Dopo 15 minuti + + + 1 hour later + Dopo 1 ora + + + 4 hours later + Dopo 4 ore + + + Tomorrow + Domani - Schedule Reminder Pianifica promemoria - - %1 to %2 - dalle %1 alle %2 + %1 a %2 - - Today Oggi + + + DragInfoGraphicsView + + Edit + + - - - Tomorrow - Domani + Delete + + + + New event + + + + New Event + + + + + JobTypeListView + + You are deleting an event type. + + + + All events under this type will be deleted and cannot be recovered. + + + + Cancel + button + + + + Delete + button + + + + + QObject + + Account settings + + + + Account + + + + Select items to be synced + + + + Events + + + + General settings + + + + Sync interval + + + + Manage calendar + + + + Calendar account + + + + Event types + + + + General + + + + First day of week + + + + Time + + + + + Return + + Today + Return + Oggi + + + + Return Today + + Today + Return Today + Oggi + + + + ScheduleTypeEditDlg + + New event type + + + + Edit event type + + + + Name: + + + + Color: + + + + Cancel + button + + + + Save + button + + + + The name can not only contain whitespaces + + + + Enter a name please + + + + + Shortcut + + Help + + + + Delete event + + + + Copy + + + + Cut + + + + Paste + + + + Delete + + + + Select all + + + + + SidebarCalendarWidget + + Y + + + + M + + + + + TimeJumpDialog + + Go + button + + + + + UserloginWidget + + Sign In + button + + + + Sign Out + button + + + + + YearFrame + + Y + + + + + today + + Today + Today + Oggi - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar-service_kab.ts dde-calendar-5.10.0/translations/dde-calendar-service_kab.ts --- dde-calendar-5.9.1/translations/dde-calendar-service_kab.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar-service_kab.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,52 +1,965 @@ - + + + - JobRemindManager + AccountItem - - One day before start - Yiwen wass send beddu + Sync successful + + + + Network error + + + + Server exception + + + + Storage full + + + + + AccountManager + + Local account + + + + Event types + + + + + CColorPickerWidget + + Color + + + + Cancel + button + + + + Save + button + + + + + CDayMonthView + + Monday + + + + Tuesday + + + + Wednesday + + + + Thursday + + + + Friday + + + + Saturday + + + + Sunday + + + + + CDayWindow + + Y + + + + M + + + + D + + + + Lunar + + + + + CGraphicsView + + New Event + + + + + CMonthScheduleNumItem + + %1 more + + + + + CMonthView + + New event + + + + New Event + + + + + CMonthWindow + + Y + + + + + CMyScheduleView + + My Event + + + + OK + button + + + + Delete + button + + + + Edit + button + + + + + CPushButton + + New event type + + + + + CScheduleDlg + + New Event + + + + Edit Event + + + + End time must be greater than start time + + + + OK + button + + + + Never + + + + At time of event + + + + 15 minutes before + + + + 30 minutes before + + + + 1 hour before + + + + 1 day before + + + + 2 days before + + + + 1 week before + + + + On start day (9:00 AM) + + + + time(s) + + + + Enter a name please + + + + The name can not only contain whitespaces + + + + Type: + + + + Description: + + + + All Day: + - - - - + Starts: + + + + Ends: + + + + Remind Me: + + + + Repeat: + + + + End Repeat: + + + + Calendar account: + + + + Calendar account + + + + Type + + + + Description + + + + All Day + + + + Time: + + + + Time + + + + Solar + + + + Lunar + + + + Starts + + + + Ends + + + + Remind Me + + + + Repeat + + + + Daily + + + + Weekdays + + + + Weekly + + + + Monthly + + + + Yearly + + + + End Repeat + + + + After + + + + On + + + + Cancel + button + + + + Save + button + + + + + CScheduleOperation + + All occurrences of a repeating event must have the same all-day status. + + + + Do you want to change all occurrences? + + + + Cancel + button + + + + Change All + + + + You are changing the repeating rule of this event. + + + + You are deleting an event. + + + + Are you sure you want to delete this event? + + + + Delete + button + + + + Do you want to delete all occurrences of this event, or only the selected occurrence? + + + + Delete All + + + + Delete Only This Event + + + + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? + + + + Delete All Future Events + + + + You are changing a repeating event. + + + + Do you want to change only this occurrence of the event, or all occurrences? + + + + All + + + + Only This Event + + + + Do you want to change only this occurrence of the event, or this and all future occurrences? + + + + All Future Events + + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + OK + button + + + + + CScheduleSearchDateItem + + Y + + + + M + + + + D + + + + + CScheduleSearchItem + + Edit + + + + Delete + + + + All Day + + + + + CScheduleSearchView + + No search results + + + + + CScheduleView + + ALL DAY + + + + + CSettingDialog + + Sunday + + + + Monday + + + + 24-hour clock + + + + 12-hour clock + + + + Manual + + + + 15 mins + + + + 30 mins + + + + 1 hour + + + + 24 hours + + + + Sync Now + + + + Last sync + + + + + CTimeEdit + + (%1 mins) + + + + (%1 hour) + + + + (%1 hours) + + + + + CTitleWidget + + Y + + + + M + + + + W + + + + D + + + + Search events and festivals + + + + + CWeekWidget + + Sun + + + + Mon + + + + Tue + + + + Wed + + + + Thu + + + + Fri + + + + Sat + + + + + CWeekWindow + + Week + + + + Y + + + + + CYearScheduleView + + All Day + + + + No event + + + + + CYearWindow + + Y + + + + + CalendarWindow + + Calendar + + + + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. + + + + + Calendarmainwindow + + Calendar + + + + Manage + + + + Privacy Policy + + + + Syncing... + + + + Sync successful + + + + Sync failed, please try later + + + + + CenterWidget + + All Day + + + + + DAccountDataBase + + Work + Amahil + + + Life + Tudert + + + Other + Wayeḍ + + + + DAlarmManager + Close button Mdel - + One day before start + Yiwen wass send beddu + + Remind me tomorrow Smekti-yi-d azekka - Remind me later Smekti-yi-d ticki - + 15 mins later + + + + 1 hour later + + + + 4 hours later + + + + Tomorrow + Azekka + + Schedule Reminder Asmekti s usɣiwes - - %1 to %2 %1 ɣer %2 - - Today Ass-a + + + DragInfoGraphicsView - - - Tomorrow - Azekka + Edit + + + + Delete + + + + New event + + + + New Event + + + + + JobTypeListView + + You are deleting an event type. + + + + All events under this type will be deleted and cannot be recovered. + + + + Cancel + button + + + + Delete + button + + + + + QObject + + Account settings + + + + Account + + + + Select items to be synced + + + + Events + + + + General settings + + + + Sync interval + + + + Manage calendar + + + + Calendar account + + + + Event types + + + + General + + + + First day of week + + + + Time + + + + + Return + + Today + Return + Ass-a + + + + Return Today + + Today + Return Today + Ass-a + + + + ScheduleTypeEditDlg + + New event type + + + + Edit event type + + + + Name: + + + + Color: + + + + Cancel + button + + + + Save + button + + + + The name can not only contain whitespaces + + + + Enter a name please + + + + + Shortcut + + Help + + + + Delete event + + + + Copy + + + + Cut + + + + Paste + + + + Delete + + + + Select all + + + + + SidebarCalendarWidget + + Y + + + + M + + + + + TimeJumpDialog + + Go + button + + + + + UserloginWidget + + Sign In + button + + + + Sign Out + button + + + + + YearFrame + + Y + + + + + today + + Today + Today + Ass-a - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar-service_ka.ts dde-calendar-5.10.0/translations/dde-calendar-service_ka.ts --- dde-calendar-5.9.1/translations/dde-calendar-service_ka.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar-service_ka.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,52 +1,965 @@ - + + + - JobRemindManager + AccountItem - - One day before start - დაწყებამდე 1 დღით ადრე + Sync successful + + + + Network error + + + + Server exception + + + + Storage full + + + + + AccountManager + + Local account + + + + Event types + + + + + CColorPickerWidget + + Color + + + + Cancel + button + + + + Save + button + + + + + CDayMonthView + + Monday + + + + Tuesday + + + + Wednesday + + + + Thursday + + + + Friday + + + + Saturday + + + + Sunday + + + + + CDayWindow + + Y + + + + M + + + + D + + + + Lunar + + + + + CGraphicsView + + New Event + + + + + CMonthScheduleNumItem + + %1 more + + + + + CMonthView + + New event + + + + New Event + + + + + CMonthWindow + + Y + + + + + CMyScheduleView + + My Event + + + + OK + button + + + + Delete + button + + + + Edit + button + + + + + CPushButton + + New event type + + + + + CScheduleDlg + + New Event + + + + Edit Event + + + + End time must be greater than start time + + + + OK + button + + + + Never + + + + At time of event + + + + 15 minutes before + + + + 30 minutes before + + + + 1 hour before + + + + 1 day before + + + + 2 days before + + + + 1 week before + + + + On start day (9:00 AM) + + + + time(s) + + + + Enter a name please + + + + The name can not only contain whitespaces + + + + Type: + + + + Description: + + + + All Day: + - - - - + Starts: + + + + Ends: + + + + Remind Me: + + + + Repeat: + + + + End Repeat: + + + + Calendar account: + + + + Calendar account + + + + Type + + + + Description + + + + All Day + + + + Time: + + + + Time + + + + Solar + + + + Lunar + + + + Starts + + + + Ends + + + + Remind Me + + + + Repeat + + + + Daily + + + + Weekdays + + + + Weekly + + + + Monthly + + + + Yearly + + + + End Repeat + + + + After + + + + On + + + + Cancel + button + + + + Save + button + + + + + CScheduleOperation + + All occurrences of a repeating event must have the same all-day status. + + + + Do you want to change all occurrences? + + + + Cancel + button + + + + Change All + + + + You are changing the repeating rule of this event. + + + + You are deleting an event. + + + + Are you sure you want to delete this event? + + + + Delete + button + + + + Do you want to delete all occurrences of this event, or only the selected occurrence? + + + + Delete All + + + + Delete Only This Event + + + + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? + + + + Delete All Future Events + + + + You are changing a repeating event. + + + + Do you want to change only this occurrence of the event, or all occurrences? + + + + All + + + + Only This Event + + + + Do you want to change only this occurrence of the event, or this and all future occurrences? + + + + All Future Events + + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + OK + button + + + + + CScheduleSearchDateItem + + Y + + + + M + + + + D + + + + + CScheduleSearchItem + + Edit + + + + Delete + + + + All Day + + + + + CScheduleSearchView + + No search results + + + + + CScheduleView + + ALL DAY + + + + + CSettingDialog + + Sunday + + + + Monday + + + + 24-hour clock + + + + 12-hour clock + + + + Manual + + + + 15 mins + + + + 30 mins + + + + 1 hour + + + + 24 hours + + + + Sync Now + + + + Last sync + + + + + CTimeEdit + + (%1 mins) + + + + (%1 hour) + + + + (%1 hours) + + + + + CTitleWidget + + Y + + + + M + + + + W + + + + D + + + + Search events and festivals + + + + + CWeekWidget + + Sun + + + + Mon + + + + Tue + + + + Wed + + + + Thu + + + + Fri + + + + Sat + + + + + CWeekWindow + + Week + + + + Y + + + + + CYearScheduleView + + All Day + + + + No event + + + + + CYearWindow + + Y + + + + + CalendarWindow + + Calendar + + + + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. + + + + + Calendarmainwindow + + Calendar + + + + Manage + + + + Privacy Policy + + + + Syncing... + + + + Sync successful + + + + Sync failed, please try later + + + + + CenterWidget + + All Day + + + + + DAccountDataBase + + Work + სამსახური + + + Life + ცხოვრება + + + Other + სხვა + + + + DAlarmManager + Close button დახურვა - + One day before start + დაწყებამდე 1 დღით ადრე + + Remind me tomorrow შემახსენე ხვალ - Remind me later შემახსენე მოგვიანებით - + 15 mins later + + + + 1 hour later + + + + 4 hours later + + + + Tomorrow + ხვალ + + Schedule Reminder შეხსენების დაგეგმვა - - %1 to %2 %1 დან %2 - - Today დღეს + + + DragInfoGraphicsView - - - Tomorrow - ხვალ + Edit + + + + Delete + + + + New event + + + + New Event + + + + + JobTypeListView + + You are deleting an event type. + + + + All events under this type will be deleted and cannot be recovered. + + + + Cancel + button + + + + Delete + button + + + + + QObject + + Account settings + + + + Account + + + + Select items to be synced + + + + Events + + + + General settings + + + + Sync interval + + + + Manage calendar + + + + Calendar account + + + + Event types + + + + General + + + + First day of week + + + + Time + + + + + Return + + Today + Return + დღეს + + + + Return Today + + Today + Return Today + დღეს + + + + ScheduleTypeEditDlg + + New event type + + + + Edit event type + + + + Name: + + + + Color: + + + + Cancel + button + + + + Save + button + + + + The name can not only contain whitespaces + + + + Enter a name please + + + + + Shortcut + + Help + + + + Delete event + + + + Copy + + + + Cut + + + + Paste + + + + Delete + + + + Select all + + + + + SidebarCalendarWidget + + Y + + + + M + + + + + TimeJumpDialog + + Go + button + + + + + UserloginWidget + + Sign In + button + + + + Sign Out + button + + + + + YearFrame + + Y + + + + + today + + Today + Today + დღეს - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar-service_ko.ts dde-calendar-5.10.0/translations/dde-calendar-service_ko.ts --- dde-calendar-5.9.1/translations/dde-calendar-service_ko.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar-service_ko.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,52 +1,1231 @@ - + + + - JobRemindManager + AccountItem - - One day before start - 시작 하루 전 + + Sync successful + + + + + Network error + + + + + Server exception + + + + + Storage full + + + + + AccountManager + + + Local account + + + + + Event types + + + + + CColorPickerWidget + + + Color + + + + + Cancel + button + + + + + Save + button + + + + + CDayMonthView + + + Monday + + + + + Tuesday + + + + + Wednesday + + + + + Thursday + + + + + Friday + + + + + Saturday + + + + + Sunday + + + + + CDayWindow + + + Y + + + + + M + + + + + D + + + + + Lunar + + + + + CGraphicsView + + + New Event + + + + + CMonthScheduleNumItem + + + %1 more + + + + + CMonthView + + + New event + + + + + New Event + + + + + CMonthWindow + + + Y + + + + + CMyScheduleView + + + My Event + + + + + OK + button + + + + + Delete + button + + + + + Edit + button + + + + + CPushButton + + + New event type + + + + + CScheduleDlg + + + + + New Event + + + + + Edit Event + + + + + End time must be greater than start time + + + + + OK + button + + + + + + + + + + Never + + + + + At time of event + + + + + 15 minutes before + + + + + 30 minutes before + + + + + 1 hour before + + + + + + 1 day before + + + + + + 2 days before + + + + + + 1 week before + + + + + On start day (9:00 AM) + + + + + + + + time(s) + + + + + Enter a name please + + + + + The name can not only contain whitespaces + + + + + + Type: + + + + + + Description: + + + + + + All Day: + - - - - + + + Starts: + + + + + + Ends: + + + + + + Remind Me: + + + + + + Repeat: + + + + + + End Repeat: + + + + + Calendar account: + + + + + Calendar account + + + + + Type + + + + + Description + + + + + All Day + + + + + Time: + + + + + Time + + + + + Solar + + + + + Lunar + + + + + Starts + + + + + Ends + + + + + Remind Me + + + + + Repeat + + + + + + Daily + + + + + + Weekdays + + + + + + Weekly + + + + + + + Monthly + + + + + + + Yearly + + + + + End Repeat + + + + + After + + + + + On + + + + + Cancel + button + + + + + Save + button + + + + + CScheduleOperation + + + All occurrences of a repeating event must have the same all-day status. + + + + + + Do you want to change all occurrences? + + + + + + + + + + + Cancel + button + + + + + + Change All + + + + + You are changing the repeating rule of this event. + + + + + + + You are deleting an event. + + + + + Are you sure you want to delete this event? + + + + + Delete + button + + + + + Do you want to delete all occurrences of this event, or only the selected occurrence? + + + + + Delete All + + + + + + Delete Only This Event + + + + + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? + + + + + Delete All Future Events + + + + + + You are changing a repeating event. + + + + + Do you want to change only this occurrence of the event, or all occurrences? + + + + + All + + + + + + Only This Event + + + + + Do you want to change only this occurrence of the event, or this and all future occurrences? + + + + + All Future Events + + + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + + OK + button + + + + + CScheduleSearchDateItem + + + Y + + + + + M + + + + + D + + + + + CScheduleSearchItem + + + Edit + + + + + Delete + + + + + All Day + + + + + CScheduleSearchView + + + No search results + + + + + CScheduleView + + + ALL DAY + + + + + CSettingDialog + + + Sunday + + + + + Monday + + + + + 24-hour clock + + + + + 12-hour clock + + + + + Manual + + + + + 15 mins + + + + + 30 mins + + + + + 1 hour + + + + + 24 hours + + + + + Sync Now + + + + + Last sync + + + + + CTimeEdit + + + (%1 mins) + + + + + (%1 hour) + + + + + (%1 hours) + + + + + CTitleWidget + + + Y + + + + + M + + + + + W + + + + + D + + + + + + Search events and festivals + + + + + CWeekWidget + + + Sun + + + + + Mon + + + + + Tue + + + + + Wed + + + + + Thu + + + + + Fri + + + + + Sat + + + + + CWeekWindow + + + Week + + + + + Y + + + + + CYearScheduleView + + + + All Day + + + + + No event + + + + + CYearWindow + + + Y + + + + + CalendarWindow + + + Calendar + + + + + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. + + + + + Calendarmainwindow + + + Calendar + + + + + Manage + + + + + Privacy Policy + + + + + Syncing... + + + + + Sync successful + + + + + Sync failed, please try later + + + + + CenterWidget + + + All Day + + + + + DAccountDataBase + + + Work + + + + + Life + + + + + Other + + + + + DAlarmManager + + + + + Close button - 닫기 + 닫기 - + + One day before start + 시작 하루 전 + + + Remind me tomorrow - 내일 알림 + 내일 알림 - + Remind me later - 나중에 알림 + 나중에 알림 + + + + 15 mins later + + + + + 1 hour later + + + + + 4 hours later + - + + + + Tomorrow + 내일 + + + Schedule Reminder - 일정 알림 + 일정 알림 - - + + %1 to %2 - + - - + + Today - 오늘 + 오늘 + + + + DragInfoGraphicsView + + + Edit + - - - Tomorrow - 내일 + + Delete + + + + + New event + + + + + New Event + + + + + JobTypeListView + + + You are deleting an event type. + + + + + All events under this type will be deleted and cannot be recovered. + + + + + Cancel + button + + + + + Delete + button + + + + + QObject + + + Account settings + + + + + Account + + + + + Select items to be synced + + + + + Events + + + + + + General settings + + + + + Sync interval + + + + + + Manage calendar + + + + + Calendar account + + + + + + Event types + + + + + General + + + + + First day of week + + + + + Time + + + + + Return + + + Today + Return + 오늘 + + + + Return Today + + + + + Today + Return Today + 오늘 + + + + ScheduleTypeEditDlg + + + New event type + + + + + Edit event type + + + + + Name: + + + + + Color: + + + + + Cancel + button + + + + + Save + button + + + + + The name can not only contain whitespaces + + + + + Enter a name please + + + + + Shortcut + + + Help + + + + + Delete event + + + + + Copy + + + + + Cut + + + + + Paste + + + + + Delete + + + + + Select all + + + + + SidebarCalendarWidget + + + Y + + + + + M + + + + + TimeJumpDialog + + + Go + button + + + + + UserloginWidget + + + Sign In + button + + + + + Sign Out + button + + + + + YearFrame + + + Y + + + + + today + + + + + + + + + + Today + Today + 오늘 - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar-service_lt.ts dde-calendar-5.10.0/translations/dde-calendar-service_lt.ts --- dde-calendar-5.9.1/translations/dde-calendar-service_lt.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar-service_lt.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,52 +1,965 @@ - + + + - JobRemindManager + AccountItem - - One day before start - Vieną dieną prieš pradžią + Sync successful + + + + Network error + + + + Server exception + + + + Storage full + + + + + AccountManager + + Local account + + + + Event types + + + + + CColorPickerWidget + + Color + + + + Cancel + button + + + + Save + button + + + + + CDayMonthView + + Monday + + + + Tuesday + + + + Wednesday + + + + Thursday + + + + Friday + + + + Saturday + + + + Sunday + + + + + CDayWindow + + Y + + + + M + + + + D + + + + Lunar + + + + + CGraphicsView + + New Event + + + + + CMonthScheduleNumItem + + %1 more + + + + + CMonthView + + New event + + + + New Event + + + + + CMonthWindow + + Y + + + + + CMyScheduleView + + My Event + + + + OK + button + + + + Delete + button + + + + Edit + button + + + + + CPushButton + + New event type + + + + + CScheduleDlg + + New Event + + + + Edit Event + + + + End time must be greater than start time + + + + OK + button + + + + Never + + + + At time of event + + + + 15 minutes before + + + + 30 minutes before + + + + 1 hour before + + + + 1 day before + + + + 2 days before + + + + 1 week before + + + + On start day (9:00 AM) + + + + time(s) + + + + Enter a name please + + + + The name can not only contain whitespaces + + + + Type: + + + + Description: + + + + All Day: + - - - - + Starts: + + + + Ends: + + + + Remind Me: + + + + Repeat: + + + + End Repeat: + + + + Calendar account: + + + + Calendar account + + + + Type + + + + Description + + + + All Day + + + + Time: + + + + Time + + + + Solar + + + + Lunar + + + + Starts + + + + Ends + + + + Remind Me + + + + Repeat + + + + Daily + + + + Weekdays + + + + Weekly + + + + Monthly + + + + Yearly + + + + End Repeat + + + + After + + + + On + + + + Cancel + button + + + + Save + button + + + + + CScheduleOperation + + All occurrences of a repeating event must have the same all-day status. + + + + Do you want to change all occurrences? + + + + Cancel + button + + + + Change All + + + + You are changing the repeating rule of this event. + + + + You are deleting an event. + + + + Are you sure you want to delete this event? + + + + Delete + button + + + + Do you want to delete all occurrences of this event, or only the selected occurrence? + + + + Delete All + + + + Delete Only This Event + + + + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? + + + + Delete All Future Events + + + + You are changing a repeating event. + + + + Do you want to change only this occurrence of the event, or all occurrences? + + + + All + + + + Only This Event + + + + Do you want to change only this occurrence of the event, or this and all future occurrences? + + + + All Future Events + + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + OK + button + + + + + CScheduleSearchDateItem + + Y + + + + M + + + + D + + + + + CScheduleSearchItem + + Edit + + + + Delete + + + + All Day + + + + + CScheduleSearchView + + No search results + + + + + CScheduleView + + ALL DAY + + + + + CSettingDialog + + Sunday + + + + Monday + + + + 24-hour clock + + + + 12-hour clock + + + + Manual + + + + 15 mins + + + + 30 mins + + + + 1 hour + + + + 24 hours + + + + Sync Now + + + + Last sync + + + + + CTimeEdit + + (%1 mins) + + + + (%1 hour) + + + + (%1 hours) + + + + + CTitleWidget + + Y + + + + M + + + + W + + + + D + + + + Search events and festivals + + + + + CWeekWidget + + Sun + + + + Mon + + + + Tue + + + + Wed + + + + Thu + + + + Fri + + + + Sat + + + + + CWeekWindow + + Week + + + + Y + + + + + CYearScheduleView + + All Day + + + + No event + + + + + CYearWindow + + Y + + + + + CalendarWindow + + Calendar + + + + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. + + + + + Calendarmainwindow + + Calendar + + + + Manage + + + + Privacy Policy + + + + Syncing... + + + + Sync successful + + + + Sync failed, please try later + + + + + CenterWidget + + All Day + + + + + DAccountDataBase + + Work + Darbas + + + Life + Gyvenimas + + + Other + Kita + + + + DAlarmManager + Close button Užverti - + One day before start + Vieną dieną prieš įvykį + + Remind me tomorrow Priminti rytoj - Remind me later Priminti vėliau - + 15 mins later + + + + 1 hour later + + + + 4 hours later + + + + Tomorrow + Rytojus + + Schedule Reminder Planuoti priminimą - - %1 to %2 %1 iki %2 - - Today Šiandien + + + DragInfoGraphicsView + + Edit + + - - - Tomorrow - Rytoj + Delete + + + + New event + + + + New Event + + + + + JobTypeListView + + You are deleting an event type. + + + + All events under this type will be deleted and cannot be recovered. + + + + Cancel + button + + + + Delete + button + + + + + QObject + + Account settings + + + + Account + + + + Select items to be synced + + + + Events + + + + General settings + + + + Sync interval + + + + Manage calendar + + + + Calendar account + + + + Event types + + + + General + + + + First day of week + + + + Time + + + + + Return + + Today + Return + Šiandien + + + + Return Today + + Today + Return Today + Šiandien + + + + ScheduleTypeEditDlg + + New event type + + + + Edit event type + + + + Name: + + + + Color: + + + + Cancel + button + + + + Save + button + + + + The name can not only contain whitespaces + + + + Enter a name please + + + + + Shortcut + + Help + + + + Delete event + + + + Copy + + + + Cut + + + + Paste + + + + Delete + + + + Select all + + + + + SidebarCalendarWidget + + Y + + + + M + + + + + TimeJumpDialog + + Go + button + + + + + UserloginWidget + + Sign In + button + + + + Sign Out + button + + + + + YearFrame + + Y + + + + + today + + Today + Today + Šiandien - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar-service_ms.ts dde-calendar-5.10.0/translations/dde-calendar-service_ms.ts --- dde-calendar-5.9.1/translations/dde-calendar-service_ms.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar-service_ms.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,52 +1,965 @@ - + + + - JobRemindManager + AccountItem - - One day before start - Satu hari sebelum mula + Sync successful + + + + Network error + + + + Server exception + + + + Storage full + + + + + AccountManager + + Local account + + + + Event types + + + + + CColorPickerWidget + + Color + + + + Cancel + button + + + + Save + button + + + + + CDayMonthView + + Monday + + + + Tuesday + + + + Wednesday + + + + Thursday + + + + Friday + + + + Saturday + + + + Sunday + + + + + CDayWindow + + Y + + + + M + + + + D + + + + Lunar + + + + + CGraphicsView + + New Event + + + + + CMonthScheduleNumItem + + %1 more + + + + + CMonthView + + New event + + + + New Event + + + + + CMonthWindow + + Y + + + + + CMyScheduleView + + My Event + + + + OK + button + + + + Delete + button + + + + Edit + button + + + + + CPushButton + + New event type + + + + + CScheduleDlg + + New Event + + + + Edit Event + + + + End time must be greater than start time + + + + OK + button + + + + Never + + + + At time of event + + + + 15 minutes before + + + + 30 minutes before + + + + 1 hour before + + + + 1 day before + + + + 2 days before + + + + 1 week before + + + + On start day (9:00 AM) + + + + time(s) + + + + Enter a name please + + + + The name can not only contain whitespaces + + + + Type: + + + + Description: + + + + All Day: + - - - - + Starts: + + + + Ends: + + + + Remind Me: + + + + Repeat: + + + + End Repeat: + + + + Calendar account: + + + + Calendar account + + + + Type + + + + Description + + + + All Day + + + + Time: + + + + Time + + + + Solar + + + + Lunar + + + + Starts + + + + Ends + + + + Remind Me + + + + Repeat + + + + Daily + + + + Weekdays + + + + Weekly + + + + Monthly + + + + Yearly + + + + End Repeat + + + + After + + + + On + + + + Cancel + button + + + + Save + button + + + + + CScheduleOperation + + All occurrences of a repeating event must have the same all-day status. + + + + Do you want to change all occurrences? + + + + Cancel + button + + + + Change All + + + + You are changing the repeating rule of this event. + + + + You are deleting an event. + + + + Are you sure you want to delete this event? + + + + Delete + button + + + + Do you want to delete all occurrences of this event, or only the selected occurrence? + + + + Delete All + + + + Delete Only This Event + + + + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? + + + + Delete All Future Events + + + + You are changing a repeating event. + + + + Do you want to change only this occurrence of the event, or all occurrences? + + + + All + + + + Only This Event + + + + Do you want to change only this occurrence of the event, or this and all future occurrences? + + + + All Future Events + + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + OK + button + + + + + CScheduleSearchDateItem + + Y + + + + M + + + + D + + + + + CScheduleSearchItem + + Edit + + + + Delete + + + + All Day + + + + + CScheduleSearchView + + No search results + + + + + CScheduleView + + ALL DAY + + + + + CSettingDialog + + Sunday + + + + Monday + + + + 24-hour clock + + + + 12-hour clock + + + + Manual + + + + 15 mins + + + + 30 mins + + + + 1 hour + + + + 24 hours + + + + Sync Now + + + + Last sync + + + + + CTimeEdit + + (%1 mins) + + + + (%1 hour) + + + + (%1 hours) + + + + + CTitleWidget + + Y + + + + M + + + + W + + + + D + + + + Search events and festivals + + + + + CWeekWidget + + Sun + + + + Mon + + + + Tue + + + + Wed + + + + Thu + + + + Fri + + + + Sat + + + + + CWeekWindow + + Week + + + + Y + + + + + CYearScheduleView + + All Day + + + + No event + + + + + CYearWindow + + Y + + + + + CalendarWindow + + Calendar + + + + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. + + + + + Calendarmainwindow + + Calendar + + + + Manage + + + + Privacy Policy + + + + Syncing... + + + + Sync successful + + + + Sync failed, please try later + + + + + CenterWidget + + All Day + + + + + DAccountDataBase + + Work + Kerja + + + Life + Lapang + + + Other + Lain-lain + + + + DAlarmManager + Close button Tutup - + One day before start + Satu hari sebelum mula + + Remind me tomorrow Ingatkan saya esok hari - Remind me later Ingatkan saya kemudian - + 15 mins later + + + + 1 hour later + + + + 4 hours later + + + + Tomorrow + Esok + + Schedule Reminder Peringatan Berjadual - - %1 to %2 %1 hingga %2 - - Today Hari ini + + + DragInfoGraphicsView - - - Tomorrow - Esok + Edit + + + + Delete + + + + New event + + + + New Event + + + + + JobTypeListView + + You are deleting an event type. + + + + All events under this type will be deleted and cannot be recovered. + + + + Cancel + button + + + + Delete + button + + + + + QObject + + Account settings + + + + Account + + + + Select items to be synced + + + + Events + + + + General settings + + + + Sync interval + + + + Manage calendar + + + + Calendar account + + + + Event types + + + + General + + + + First day of week + + + + Time + + + + + Return + + Today + Return + Hari ini + + + + Return Today + + Today + Return Today + Hari ini + + + + ScheduleTypeEditDlg + + New event type + + + + Edit event type + + + + Name: + + + + Color: + + + + Cancel + button + + + + Save + button + + + + The name can not only contain whitespaces + + + + Enter a name please + + + + + Shortcut + + Help + + + + Delete event + + + + Copy + + + + Cut + + + + Paste + + + + Delete + + + + Select all + + + + + SidebarCalendarWidget + + Y + + + + M + + + + + TimeJumpDialog + + Go + button + + + + + UserloginWidget + + Sign In + button + + + + Sign Out + button + + + + + YearFrame + + Y + + + + + today + + Today + Today + Hari ini - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar-service_nl.ts dde-calendar-5.10.0/translations/dde-calendar-service_nl.ts --- dde-calendar-5.9.1/translations/dde-calendar-service_nl.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar-service_nl.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,86 +1,965 @@ - + + + - JobRemindManager + AccountItem - - One day before start - Eén dag van tevoren + Sync successful + + + + Network error + + + + Server exception + + + + Storage full + + + + + AccountManager + + Local account + + + + Event types + + + + + CColorPickerWidget + + Color + + + + Cancel + button + + + + Save + button + + + + + CDayMonthView + + Monday + + + + Tuesday + + + + Wednesday + - - - - + Thursday + + + + Friday + + + + Saturday + + + + Sunday + + + + + CDayWindow + + Y + + + + M + + + + D + + + + Lunar + + + + + CGraphicsView + + New Event + + + + + CMonthScheduleNumItem + + %1 more + + + + + CMonthView + + New event + + + + New Event + + + + + CMonthWindow + + Y + + + + + CMyScheduleView + + My Event + + + + OK + button + + + + Delete + button + + + + Edit + button + + + + + CPushButton + + New event type + + + + + CScheduleDlg + + New Event + + + + Edit Event + + + + End time must be greater than start time + + + + OK + button + + + + Never + + + + At time of event + + + + 15 minutes before + + + + 30 minutes before + + + + 1 hour before + + + + 1 day before + + + + 2 days before + + + + 1 week before + + + + On start day (9:00 AM) + + + + time(s) + + + + Enter a name please + + + + The name can not only contain whitespaces + + + + Type: + + + + Description: + + + + All Day: + + + + Starts: + + + + Ends: + + + + Remind Me: + + + + Repeat: + + + + End Repeat: + + + + Calendar account: + + + + Calendar account + + + + Type + + + + Description + + + + All Day + + + + Time: + + + + Time + + + + Solar + + + + Lunar + + + + Starts + + + + Ends + + + + Remind Me + + + + Repeat + + + + Daily + + + + Weekdays + + + + Weekly + + + + Monthly + + + + Yearly + + + + End Repeat + + + + After + + + + On + + + + Cancel + button + + + + Save + button + + + + + CScheduleOperation + + All occurrences of a repeating event must have the same all-day status. + + + + Do you want to change all occurrences? + + + + Cancel + button + + + + Change All + + + + You are changing the repeating rule of this event. + + + + You are deleting an event. + + + + Are you sure you want to delete this event? + + + + Delete + button + + + + Do you want to delete all occurrences of this event, or only the selected occurrence? + + + + Delete All + + + + Delete Only This Event + + + + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? + + + + Delete All Future Events + + + + You are changing a repeating event. + + + + Do you want to change only this occurrence of the event, or all occurrences? + + + + All + + + + Only This Event + + + + Do you want to change only this occurrence of the event, or this and all future occurrences? + + + + All Future Events + + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + OK + button + + + + + CScheduleSearchDateItem + + Y + + + + M + + + + D + + + + + CScheduleSearchItem + + Edit + + + + Delete + + + + All Day + + + + + CScheduleSearchView + + No search results + + + + + CScheduleView + + ALL DAY + + + + + CSettingDialog + + Sunday + + + + Monday + + + + 24-hour clock + + + + 12-hour clock + + + + Manual + + + + 15 mins + + + + 30 mins + + + + 1 hour + + + + 24 hours + + + + Sync Now + + + + Last sync + + + + + CTimeEdit + + (%1 mins) + + + + (%1 hour) + + + + (%1 hours) + + + + + CTitleWidget + + Y + + + + M + + + + W + + + + D + + + + Search events and festivals + + + + + CWeekWidget + + Sun + + + + Mon + + + + Tue + + + + Wed + + + + Thu + + + + Fri + + + + Sat + + + + + CWeekWindow + + Week + + + + Y + + + + + CYearScheduleView + + All Day + + + + No event + + + + + CYearWindow + + Y + + + + + CalendarWindow + + Calendar + + + + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. + + + + + Calendarmainwindow + + Calendar + + + + Manage + + + + Privacy Policy + + + + Syncing... + + + + Sync successful + + + + Sync failed, please try later + + + + + CenterWidget + + All Day + + + + + DAccountDataBase + + Work + Werk + + + Life + Privé + + + Other + Overig + + + + DAlarmManager + Close button Sluiten - + One day before start + Eén dag van tevoren + + Remind me tomorrow Herinner me morgen - Remind me later Herinner me later - 15 mins later 15 min. later - 1 hour later 1 uur later - 4 hours later 4 uur later - + Tomorrow + Morgen + + Schedule Reminder Herinnering inplannen - - %1 to %2 van %1 tot %2 - - Today Vandaag + + + DragInfoGraphicsView - - - - Tomorrow - Morgen + Edit + + + + Delete + + + + New event + + + + New Event + - SchedulerDatabase + JobTypeListView - - Work - Zakelijk + You are deleting an event type. + - - Life - Privé + All events under this type will be deleted and cannot be recovered. + - - Other - Overig + Cancel + button + + + + Delete + button + + + + + QObject + + Account settings + + + + Account + + + + Select items to be synced + + + + Events + + + + General settings + + + + Sync interval + + + + Manage calendar + + + + Calendar account + + + + Event types + + + + General + + + + First day of week + + + + Time + + + + + Return + + Today + Return + Vandaag + + + + Return Today + + Today + Return Today + Vandaag + + + + ScheduleTypeEditDlg + + New event type + + + + Edit event type + + + + Name: + + + + Color: + + + + Cancel + button + + + + Save + button + + + + The name can not only contain whitespaces + + + + Enter a name please + + + + + Shortcut + + Help + + + + Delete event + + + + Copy + + + + Cut + + + + Paste + + + + Delete + + + + Select all + + + + + SidebarCalendarWidget + + Y + + + + M + + + + + TimeJumpDialog + + Go + button + + + + + UserloginWidget + + Sign In + button + + + + Sign Out + button + + + + + YearFrame + + Y + + + + + today + + Today + Today + Vandaag - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar-service_pl.ts dde-calendar-5.10.0/translations/dde-calendar-service_pl.ts --- dde-calendar-5.9.1/translations/dde-calendar-service_pl.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar-service_pl.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,86 +1,965 @@ - + + + - JobRemindManager + AccountItem - - One day before start - Dzień przed startem + Sync successful + + + + Network error + + + + Server exception + + + + Storage full + + + + + AccountManager + + Local account + + + + Event types + + + + + CColorPickerWidget + + Color + + + + Cancel + button + + + + Save + button + + + + + CDayMonthView + + Monday + + + + Tuesday + + + + Wednesday + + + + Thursday + + + + Friday + + + + Saturday + + + + Sunday + + + + + CDayWindow + + Y + + + + M + + + + D + + + + Lunar + + + + + CGraphicsView + + New Event + + + + + CMonthScheduleNumItem + + %1 more + + + + + CMonthView + + New event + + + + New Event + + + + + CMonthWindow + + Y + + + + + CMyScheduleView + + My Event + + + + OK + button + + + + Delete + button + + + + Edit + button + + + + + CPushButton + + New event type + + + + + CScheduleDlg + + New Event + + + + Edit Event + + + + End time must be greater than start time + + + + OK + button + + + + Never + + + + At time of event + + + + 15 minutes before + + + + 30 minutes before + + + + 1 hour before + + + + 1 day before + + + + 2 days before + + + + 1 week before + + + + On start day (9:00 AM) + + + + time(s) + + + + Enter a name please + + + + The name can not only contain whitespaces + + + + Type: + + + + Description: + + + + All Day: + - - - - + Starts: + + + + Ends: + + + + Remind Me: + + + + Repeat: + + + + End Repeat: + + + + Calendar account: + + + + Calendar account + + + + Type + + + + Description + + + + All Day + + + + Time: + + + + Time + + + + Solar + + + + Lunar + + + + Starts + + + + Ends + + + + Remind Me + + + + Repeat + + + + Daily + + + + Weekdays + + + + Weekly + + + + Monthly + + + + Yearly + + + + End Repeat + + + + After + + + + On + + + + Cancel + button + + + + Save + button + + + + + CScheduleOperation + + All occurrences of a repeating event must have the same all-day status. + + + + Do you want to change all occurrences? + + + + Cancel + button + + + + Change All + + + + You are changing the repeating rule of this event. + + + + You are deleting an event. + + + + Are you sure you want to delete this event? + + + + Delete + button + + + + Do you want to delete all occurrences of this event, or only the selected occurrence? + + + + Delete All + + + + Delete Only This Event + + + + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? + + + + Delete All Future Events + + + + You are changing a repeating event. + + + + Do you want to change only this occurrence of the event, or all occurrences? + + + + All + + + + Only This Event + + + + Do you want to change only this occurrence of the event, or this and all future occurrences? + + + + All Future Events + + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + OK + button + + + + + CScheduleSearchDateItem + + Y + + + + M + + + + D + + + + + CScheduleSearchItem + + Edit + + + + Delete + + + + All Day + + + + + CScheduleSearchView + + No search results + + + + + CScheduleView + + ALL DAY + + + + + CSettingDialog + + Sunday + + + + Monday + + + + 24-hour clock + + + + 12-hour clock + + + + Manual + + + + 15 mins + + + + 30 mins + + + + 1 hour + + + + 24 hours + + + + Sync Now + + + + Last sync + + + + + CTimeEdit + + (%1 mins) + + + + (%1 hour) + + + + (%1 hours) + + + + + CTitleWidget + + Y + + + + M + + + + W + + + + D + + + + Search events and festivals + + + + + CWeekWidget + + Sun + + + + Mon + + + + Tue + + + + Wed + + + + Thu + + + + Fri + + + + Sat + + + + + CWeekWindow + + Week + + + + Y + + + + + CYearScheduleView + + All Day + + + + No event + + + + + CYearWindow + + Y + + + + + CalendarWindow + + Calendar + + + + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. + + + + + Calendarmainwindow + + Calendar + + + + Manage + + + + Privacy Policy + + + + Syncing... + + + + Sync successful + + + + Sync failed, please try later + + + + + CenterWidget + + All Day + + + + + DAccountDataBase + + Work + Praca + + + Life + Życie + + + Other + Inne + + + + DAlarmManager + Close button Zamknij - + One day before start + Dzień przed rozpoczęciem + + Remind me tomorrow Przypomnij mi jutro - Remind me later Przypomnij mi później - 15 mins later 15 minut później - 1 hour later 1 godzinę później - 4 hours later 4 godziny później - + Tomorrow + Jutro + + Schedule Reminder Zaplanuj przypomnienie - - %1 to %2 %1 do %2 - - Today Dzisiaj + + + DragInfoGraphicsView - - - - Tomorrow - Jutro + Edit + + + + Delete + + + + New event + + + + New Event + - SchedulerDatabase + JobTypeListView - - Work - Praca + You are deleting an event type. + - - Life - Życie + All events under this type will be deleted and cannot be recovered. + - - Other - Inne + Cancel + button + + + + Delete + button + + + + + QObject + + Account settings + + + + Account + + + + Select items to be synced + + + + Events + + + + General settings + + + + Sync interval + + + + Manage calendar + + + + Calendar account + + + + Event types + + + + General + + + + First day of week + + + + Time + + + + + Return + + Today + Return + Dzisiaj + + + + Return Today + + Today + Return Today + Dzisiaj + + + + ScheduleTypeEditDlg + + New event type + + + + Edit event type + + + + Name: + + + + Color: + + + + Cancel + button + + + + Save + button + + + + The name can not only contain whitespaces + + + + Enter a name please + + + + + Shortcut + + Help + + + + Delete event + + + + Copy + + + + Cut + + + + Paste + + + + Delete + + + + Select all + + + + + SidebarCalendarWidget + + Y + + + + M + + + + + TimeJumpDialog + + Go + button + + + + + UserloginWidget + + Sign In + button + + + + Sign Out + button + + + + + YearFrame + + Y + + + + + today + + Today + Today + Dzisiaj - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar-service_pt_BR.ts dde-calendar-5.10.0/translations/dde-calendar-service_pt_BR.ts --- dde-calendar-5.9.1/translations/dde-calendar-service_pt_BR.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar-service_pt_BR.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,52 +1,965 @@ - + + + - JobRemindManager + AccountItem - - One day before start - Um dia antes do início + Sync successful + + + + Network error + + + + Server exception + + + + Storage full + + + + + AccountManager + + Local account + + + + Event types + + + + + CColorPickerWidget + + Color + + + + Cancel + button + + + + Save + button + + + + + CDayMonthView + + Monday + + + + Tuesday + + + + Wednesday + + + + Thursday + + + + Friday + + + + Saturday + + + + Sunday + + + + + CDayWindow + + Y + + + + M + + + + D + + + + Lunar + + + + + CGraphicsView + + New Event + + + + + CMonthScheduleNumItem + + %1 more + + + + + CMonthView + + New event + + + + New Event + + + + + CMonthWindow + + Y + + + + + CMyScheduleView + + My Event + + + + OK + button + + + + Delete + button + + + + Edit + button + + + + + CPushButton + + New event type + + + + + CScheduleDlg + + New Event + + + + Edit Event + + + + End time must be greater than start time + + + + OK + button + + + + Never + + + + At time of event + + + + 15 minutes before + + + + 30 minutes before + + + + 1 hour before + + + + 1 day before + + + + 2 days before + + + + 1 week before + + + + On start day (9:00 AM) + + + + time(s) + + + + Enter a name please + + + + The name can not only contain whitespaces + + + + Type: + + + + Description: + + + + All Day: + - - - - + Starts: + + + + Ends: + + + + Remind Me: + + + + Repeat: + + + + End Repeat: + + + + Calendar account: + + + + Calendar account + + + + Type + + + + Description + + + + All Day + + + + Time: + + + + Time + + + + Solar + + + + Lunar + + + + Starts + + + + Ends + + + + Remind Me + + + + Repeat + + + + Daily + + + + Weekdays + + + + Weekly + + + + Monthly + + + + Yearly + + + + End Repeat + + + + After + + + + On + + + + Cancel + button + + + + Save + button + + + + + CScheduleOperation + + All occurrences of a repeating event must have the same all-day status. + + + + Do you want to change all occurrences? + + + + Cancel + button + + + + Change All + + + + You are changing the repeating rule of this event. + + + + You are deleting an event. + + + + Are you sure you want to delete this event? + + + + Delete + button + + + + Do you want to delete all occurrences of this event, or only the selected occurrence? + + + + Delete All + + + + Delete Only This Event + + + + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? + + + + Delete All Future Events + + + + You are changing a repeating event. + + + + Do you want to change only this occurrence of the event, or all occurrences? + + + + All + + + + Only This Event + + + + Do you want to change only this occurrence of the event, or this and all future occurrences? + + + + All Future Events + + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + OK + button + + + + + CScheduleSearchDateItem + + Y + + + + M + + + + D + + + + + CScheduleSearchItem + + Edit + + + + Delete + + + + All Day + + + + + CScheduleSearchView + + No search results + + + + + CScheduleView + + ALL DAY + + + + + CSettingDialog + + Sunday + + + + Monday + + + + 24-hour clock + + + + 12-hour clock + + + + Manual + + + + 15 mins + + + + 30 mins + + + + 1 hour + + + + 24 hours + + + + Sync Now + + + + Last sync + + + + + CTimeEdit + + (%1 mins) + + + + (%1 hour) + + + + (%1 hours) + + + + + CTitleWidget + + Y + + + + M + + + + W + + + + D + + + + Search events and festivals + + + + + CWeekWidget + + Sun + + + + Mon + + + + Tue + + + + Wed + + + + Thu + + + + Fri + + + + Sat + + + + + CWeekWindow + + Week + + + + Y + + + + + CYearScheduleView + + All Day + + + + No event + + + + + CYearWindow + + Y + + + + + CalendarWindow + + Calendar + + + + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. + + + + + Calendarmainwindow + + Calendar + + + + Manage + + + + Privacy Policy + + + + Syncing... + + + + Sync successful + + + + Sync failed, please try later + + + + + CenterWidget + + All Day + + + + + DAccountDataBase + + Work + Trabalho + + + Life + Social + + + Other + Outro + + + + DAlarmManager + Close button Fechar - + One day before start + Um dia antes do início + + Remind me tomorrow Lembre-me amanhã - Remind me later Lembre-me mais tarde - + 15 mins later + 15 minutos depois + + + 1 hour later + 1 hora depois + + + 4 hours later + 4 horas depois + + + Tomorrow + Amanhã + + Schedule Reminder Agendar Lembrete - - %1 to %2 %1 às %2 - - Today Hoje + + + DragInfoGraphicsView - - - Tomorrow - Amanhã + Edit + + + + Delete + + + + New event + + + + New Event + + + + + JobTypeListView + + You are deleting an event type. + + + + All events under this type will be deleted and cannot be recovered. + + + + Cancel + button + + + + Delete + button + + + + + QObject + + Account settings + + + + Account + + + + Select items to be synced + + + + Events + + + + General settings + + + + Sync interval + + + + Manage calendar + + + + Calendar account + + + + Event types + + + + General + + + + First day of week + + + + Time + + + + + Return + + Today + Return + Hoje + + + + Return Today + + Today + Return Today + Hoje + + + + ScheduleTypeEditDlg + + New event type + + + + Edit event type + + + + Name: + + + + Color: + + + + Cancel + button + + + + Save + button + + + + The name can not only contain whitespaces + + + + Enter a name please + + + + + Shortcut + + Help + + + + Delete event + + + + Copy + + + + Cut + + + + Paste + + + + Delete + + + + Select all + + + + + SidebarCalendarWidget + + Y + + + + M + + + + + TimeJumpDialog + + Go + button + + + + + UserloginWidget + + Sign In + button + + + + Sign Out + button + + + + + YearFrame + + Y + + + + + today + + Today + Today + Hoje - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar-service_pt.ts dde-calendar-5.10.0/translations/dde-calendar-service_pt.ts --- dde-calendar-5.9.1/translations/dde-calendar-service_pt.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar-service_pt.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,52 +1,965 @@ - + + + - JobRemindManager + AccountItem - - One day before start - Um dia antes do início + Sync successful + + + + Network error + + + + Server exception + + + + Storage full + + + + + AccountManager + + Local account + + + + Event types + + + + + CColorPickerWidget + + Color + + + + Cancel + button + + + + Save + button + + + + + CDayMonthView + + Monday + + + + Tuesday + + + + Wednesday + + + + Thursday + + + + Friday + + + + Saturday + + + + Sunday + + + + + CDayWindow + + Y + + + + M + + + + D + + + + Lunar + + + + + CGraphicsView + + New Event + + + + + CMonthScheduleNumItem + + %1 more + + + + + CMonthView + + New event + + + + New Event + + + + + CMonthWindow + + Y + + + + + CMyScheduleView + + My Event + + + + OK + button + + + + Delete + button + + + + Edit + button + + + + + CPushButton + + New event type + + + + + CScheduleDlg + + New Event + + + + Edit Event + + + + End time must be greater than start time + + + + OK + button + + + + Never + + + + At time of event + + + + 15 minutes before + + + + 30 minutes before + + + + 1 hour before + + + + 1 day before + + + + 2 days before + + + + 1 week before + + + + On start day (9:00 AM) + + + + time(s) + + + + Enter a name please + + + + The name can not only contain whitespaces + + + + Type: + + + + Description: + + + + All Day: + - - - - + Starts: + + + + Ends: + + + + Remind Me: + + + + Repeat: + + + + End Repeat: + + + + Calendar account: + + + + Calendar account + + + + Type + + + + Description + + + + All Day + + + + Time: + + + + Time + + + + Solar + + + + Lunar + + + + Starts + + + + Ends + + + + Remind Me + + + + Repeat + + + + Daily + + + + Weekdays + + + + Weekly + + + + Monthly + + + + Yearly + + + + End Repeat + + + + After + + + + On + + + + Cancel + button + + + + Save + button + + + + + CScheduleOperation + + All occurrences of a repeating event must have the same all-day status. + + + + Do you want to change all occurrences? + + + + Cancel + button + + + + Change All + + + + You are changing the repeating rule of this event. + + + + You are deleting an event. + + + + Are you sure you want to delete this event? + + + + Delete + button + + + + Do you want to delete all occurrences of this event, or only the selected occurrence? + + + + Delete All + + + + Delete Only This Event + + + + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? + + + + Delete All Future Events + + + + You are changing a repeating event. + + + + Do you want to change only this occurrence of the event, or all occurrences? + + + + All + + + + Only This Event + + + + Do you want to change only this occurrence of the event, or this and all future occurrences? + + + + All Future Events + + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + OK + button + + + + + CScheduleSearchDateItem + + Y + + + + M + + + + D + + + + + CScheduleSearchItem + + Edit + + + + Delete + + + + All Day + + + + + CScheduleSearchView + + No search results + + + + + CScheduleView + + ALL DAY + + + + + CSettingDialog + + Sunday + + + + Monday + + + + 24-hour clock + + + + 12-hour clock + + + + Manual + + + + 15 mins + + + + 30 mins + + + + 1 hour + + + + 24 hours + + + + Sync Now + + + + Last sync + + + + + CTimeEdit + + (%1 mins) + + + + (%1 hour) + + + + (%1 hours) + + + + + CTitleWidget + + Y + + + + M + + + + W + + + + D + + + + Search events and festivals + + + + + CWeekWidget + + Sun + + + + Mon + + + + Tue + + + + Wed + + + + Thu + + + + Fri + + + + Sat + + + + + CWeekWindow + + Week + + + + Y + + + + + CYearScheduleView + + All Day + + + + No event + + + + + CYearWindow + + Y + + + + + CalendarWindow + + Calendar + + + + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. + + + + + Calendarmainwindow + + Calendar + + + + Manage + + + + Privacy Policy + + + + Syncing... + + + + Sync successful + + + + Sync failed, please try later + + + + + CenterWidget + + All Day + + + + + DAccountDataBase + + Work + Trabalho + + + Life + Vida + + + Other + Outro + + + + DAlarmManager + Close button Fechar - + One day before start + Um dia antes do início + + Remind me tomorrow Lembra-me amanhã - Remind me later Lembrar-me mais tarde - + 15 mins later + 15 mins depois + + + 1 hour later + 1 hora depois + + + 4 hours later + 4 horas depois + + + Tomorrow + Amanhã + + Schedule Reminder Agendar lembrete - - %1 to %2 %1 até %2 - - Today Hoje + + + DragInfoGraphicsView - - - Tomorrow - Amanhã + Edit + + + + Delete + + + + New event + + + + New Event + + + + + JobTypeListView + + You are deleting an event type. + + + + All events under this type will be deleted and cannot be recovered. + + + + Cancel + button + + + + Delete + button + + + + + QObject + + Account settings + + + + Account + + + + Select items to be synced + + + + Events + + + + General settings + + + + Sync interval + + + + Manage calendar + + + + Calendar account + + + + Event types + + + + General + + + + First day of week + + + + Time + + + + + Return + + Today + Return + Hoje + + + + Return Today + + Today + Return Today + Hoje + + + + ScheduleTypeEditDlg + + New event type + + + + Edit event type + + + + Name: + + + + Color: + + + + Cancel + button + + + + Save + button + + + + The name can not only contain whitespaces + + + + Enter a name please + + + + + Shortcut + + Help + + + + Delete event + + + + Copy + + + + Cut + + + + Paste + + + + Delete + + + + Select all + + + + + SidebarCalendarWidget + + Y + + + + M + + + + + TimeJumpDialog + + Go + button + + + + + UserloginWidget + + Sign In + button + + + + Sign Out + button + + + + + YearFrame + + Y + + + + + today + + Today + Today + Hoje - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar-service_ro.ts dde-calendar-5.10.0/translations/dde-calendar-service_ro.ts --- dde-calendar-5.9.1/translations/dde-calendar-service_ro.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar-service_ro.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,52 +1,965 @@ - + + + - JobRemindManager + AccountItem - - One day before start - O zi înainte de a începe + Sync successful + + + + Network error + + + + Server exception + + + + Storage full + + + + + AccountManager + + Local account + + + + Event types + + + + + CColorPickerWidget + + Color + + + + Cancel + button + + + + Save + button + + + + + CDayMonthView + + Monday + + + + Tuesday + + + + Wednesday + + + + Thursday + + + + Friday + + + + Saturday + + + + Sunday + + + + + CDayWindow + + Y + + + + M + + + + D + + + + Lunar + + + + + CGraphicsView + + New Event + + + + + CMonthScheduleNumItem + + %1 more + + + + + CMonthView + + New event + + + + New Event + + + + + CMonthWindow + + Y + + + + + CMyScheduleView + + My Event + + + + OK + button + + + + Delete + button + + + + Edit + button + + + + + CPushButton + + New event type + + + + + CScheduleDlg + + New Event + + + + Edit Event + + + + End time must be greater than start time + + + + OK + button + + + + Never + + + + At time of event + + + + 15 minutes before + + + + 30 minutes before + + + + 1 hour before + + + + 1 day before + + + + 2 days before + + + + 1 week before + + + + On start day (9:00 AM) + + + + time(s) + + + + Enter a name please + + + + The name can not only contain whitespaces + + + + Type: + + + + Description: + + + + All Day: + - - - - + Starts: + + + + Ends: + + + + Remind Me: + + + + Repeat: + + + + End Repeat: + + + + Calendar account: + + + + Calendar account + + + + Type + + + + Description + + + + All Day + + + + Time: + + + + Time + + + + Solar + + + + Lunar + + + + Starts + + + + Ends + + + + Remind Me + + + + Repeat + + + + Daily + + + + Weekdays + + + + Weekly + + + + Monthly + + + + Yearly + + + + End Repeat + + + + After + + + + On + + + + Cancel + button + + + + Save + button + + + + + CScheduleOperation + + All occurrences of a repeating event must have the same all-day status. + + + + Do you want to change all occurrences? + + + + Cancel + button + + + + Change All + + + + You are changing the repeating rule of this event. + + + + You are deleting an event. + + + + Are you sure you want to delete this event? + + + + Delete + button + + + + Do you want to delete all occurrences of this event, or only the selected occurrence? + + + + Delete All + + + + Delete Only This Event + + + + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? + + + + Delete All Future Events + + + + You are changing a repeating event. + + + + Do you want to change only this occurrence of the event, or all occurrences? + + + + All + + + + Only This Event + + + + Do you want to change only this occurrence of the event, or this and all future occurrences? + + + + All Future Events + + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + OK + button + + + + + CScheduleSearchDateItem + + Y + + + + M + + + + D + + + + + CScheduleSearchItem + + Edit + + + + Delete + + + + All Day + + + + + CScheduleSearchView + + No search results + + + + + CScheduleView + + ALL DAY + + + + + CSettingDialog + + Sunday + + + + Monday + + + + 24-hour clock + + + + 12-hour clock + + + + Manual + + + + 15 mins + + + + 30 mins + + + + 1 hour + + + + 24 hours + + + + Sync Now + + + + Last sync + + + + + CTimeEdit + + (%1 mins) + + + + (%1 hour) + + + + (%1 hours) + + + + + CTitleWidget + + Y + + + + M + + + + W + + + + D + + + + Search events and festivals + + + + + CWeekWidget + + Sun + + + + Mon + + + + Tue + + + + Wed + + + + Thu + + + + Fri + + + + Sat + + + + + CWeekWindow + + Week + + + + Y + + + + + CYearScheduleView + + All Day + + + + No event + + + + + CYearWindow + + Y + + + + + CalendarWindow + + Calendar + + + + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. + + + + + Calendarmainwindow + + Calendar + + + + Manage + + + + Privacy Policy + + + + Syncing... + + + + Sync successful + + + + Sync failed, please try later + + + + + CenterWidget + + All Day + + + + + DAccountDataBase + + Work + Serviciu + + + Life + Viaţă + + + Other + Altul + + + + DAlarmManager + Close button Închidere - + One day before start + O zi înainte de a începe + + Remind me tomorrow Reaminteşte mâine - Remind me later Reaminteşte mai târziu - + 15 mins later + + + + 1 hour later + + + + 4 hours later + + + + Tomorrow + Mâine + + Schedule Reminder Programare Reminder - - %1 to %2 %1 la %2 - - Today - Azi + Astăzi + + + DragInfoGraphicsView - - - Tomorrow - Mâine + Edit + + + + Delete + + + + New event + + + + New Event + + + + + JobTypeListView + + You are deleting an event type. + + + + All events under this type will be deleted and cannot be recovered. + + + + Cancel + button + + + + Delete + button + + + + + QObject + + Account settings + + + + Account + + + + Select items to be synced + + + + Events + + + + General settings + + + + Sync interval + + + + Manage calendar + + + + Calendar account + + + + Event types + + + + General + + + + First day of week + + + + Time + + + + + Return + + Today + Return + Astăzi + + + + Return Today + + Today + Return Today + Astăzi + + + + ScheduleTypeEditDlg + + New event type + + + + Edit event type + + + + Name: + + + + Color: + + + + Cancel + button + + + + Save + button + + + + The name can not only contain whitespaces + + + + Enter a name please + + + + + Shortcut + + Help + + + + Delete event + + + + Copy + + + + Cut + + + + Paste + + + + Delete + + + + Select all + + + + + SidebarCalendarWidget + + Y + + + + M + + + + + TimeJumpDialog + + Go + button + + + + + UserloginWidget + + Sign In + button + + + + Sign Out + button + + + + + YearFrame + + Y + + + + + today + + Today + Today + Astăzi - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar-service_ru.ts dde-calendar-5.10.0/translations/dde-calendar-service_ru.ts --- dde-calendar-5.9.1/translations/dde-calendar-service_ru.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar-service_ru.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,52 +1,965 @@ - + + + - JobRemindManager + AccountItem - - One day before start - За день до начала + Sync successful + + + + Network error + + + + Server exception + + + + Storage full + + + + + AccountManager + + Local account + + + + Event types + + + + + CColorPickerWidget + + Color + + + + Cancel + button + + + + Save + button + + + + + CDayMonthView + + Monday + + + + Tuesday + + + + Wednesday + + + + Thursday + + + + Friday + + + + Saturday + + + + Sunday + + + + + CDayWindow + + Y + + + + M + + + + D + + + + Lunar + + + + + CGraphicsView + + New Event + + + + + CMonthScheduleNumItem + + %1 more + + + + + CMonthView + + New event + + + + New Event + + + + + CMonthWindow + + Y + + + + + CMyScheduleView + + My Event + + + + OK + button + + + + Delete + button + + + + Edit + button + + + + + CPushButton + + New event type + + + + + CScheduleDlg + + New Event + + + + Edit Event + + + + End time must be greater than start time + + + + OK + button + + + + Never + + + + At time of event + + + + 15 minutes before + + + + 30 minutes before + + + + 1 hour before + + + + 1 day before + + + + 2 days before + + + + 1 week before + + + + On start day (9:00 AM) + + + + time(s) + + + + Enter a name please + + + + The name can not only contain whitespaces + + + + Type: + + + + Description: + + + + All Day: + - - - - + Starts: + + + + Ends: + + + + Remind Me: + + + + Repeat: + + + + End Repeat: + + + + Calendar account: + + + + Calendar account + + + + Type + + + + Description + + + + All Day + + + + Time: + + + + Time + + + + Solar + + + + Lunar + + + + Starts + + + + Ends + + + + Remind Me + + + + Repeat + + + + Daily + + + + Weekdays + + + + Weekly + + + + Monthly + + + + Yearly + + + + End Repeat + + + + After + + + + On + + + + Cancel + button + + + + Save + button + + + + + CScheduleOperation + + All occurrences of a repeating event must have the same all-day status. + + + + Do you want to change all occurrences? + + + + Cancel + button + + + + Change All + + + + You are changing the repeating rule of this event. + + + + You are deleting an event. + + + + Are you sure you want to delete this event? + + + + Delete + button + + + + Do you want to delete all occurrences of this event, or only the selected occurrence? + + + + Delete All + + + + Delete Only This Event + + + + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? + + + + Delete All Future Events + + + + You are changing a repeating event. + + + + Do you want to change only this occurrence of the event, or all occurrences? + + + + All + + + + Only This Event + + + + Do you want to change only this occurrence of the event, or this and all future occurrences? + + + + All Future Events + + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + OK + button + + + + + CScheduleSearchDateItem + + Y + + + + M + + + + D + + + + + CScheduleSearchItem + + Edit + + + + Delete + + + + All Day + + + + + CScheduleSearchView + + No search results + + + + + CScheduleView + + ALL DAY + + + + + CSettingDialog + + Sunday + + + + Monday + + + + 24-hour clock + + + + 12-hour clock + + + + Manual + + + + 15 mins + + + + 30 mins + + + + 1 hour + + + + 24 hours + + + + Sync Now + + + + Last sync + + + + + CTimeEdit + + (%1 mins) + + + + (%1 hour) + + + + (%1 hours) + + + + + CTitleWidget + + Y + + + + M + + + + W + + + + D + + + + Search events and festivals + + + + + CWeekWidget + + Sun + + + + Mon + + + + Tue + + + + Wed + + + + Thu + + + + Fri + + + + Sat + + + + + CWeekWindow + + Week + + + + Y + + + + + CYearScheduleView + + All Day + + + + No event + + + + + CYearWindow + + Y + + + + + CalendarWindow + + Calendar + + + + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. + + + + + Calendarmainwindow + + Calendar + + + + Manage + + + + Privacy Policy + + + + Syncing... + + + + Sync successful + + + + Sync failed, please try later + + + + + CenterWidget + + All Day + + + + + DAccountDataBase + + Work + Работа + + + Life + Жизнь + + + Other + Остальное + + + + DAlarmManager + Close button Закрыть - + One day before start + За день до начала + + Remind me tomorrow - Напомни мне завтра + Напомнить завтра - Remind me later - Напомни мне позже + Напомнить позже + + + 15 mins later + Спустя 15 минут + + + 1 hour later + Спустя 1 час + + + 4 hours later + Спустя 4 часа + + + Tomorrow + Завтра - Schedule Reminder Напоминание о расписании - - %1 to %2 от 1% до %2 - - Today Сегодня + + + DragInfoGraphicsView - - - Tomorrow - Завтра + Edit + + + + Delete + + + + New event + + + + New Event + + + + + JobTypeListView + + You are deleting an event type. + + + + All events under this type will be deleted and cannot be recovered. + + + + Cancel + button + + + + Delete + button + + + + + QObject + + Account settings + + + + Account + + + + Select items to be synced + + + + Events + + + + General settings + + + + Sync interval + + + + Manage calendar + + + + Calendar account + + + + Event types + + + + General + + + + First day of week + + + + Time + + + + + Return + + Today + Return + Сегодня + + + + Return Today + + Today + Return Today + Сегодня + + + + ScheduleTypeEditDlg + + New event type + + + + Edit event type + + + + Name: + + + + Color: + + + + Cancel + button + + + + Save + button + + + + The name can not only contain whitespaces + + + + Enter a name please + + + + + Shortcut + + Help + + + + Delete event + + + + Copy + + + + Cut + + + + Paste + + + + Delete + + + + Select all + + + + + SidebarCalendarWidget + + Y + + + + M + + + + + TimeJumpDialog + + Go + button + + + + + UserloginWidget + + Sign In + button + + + + Sign Out + button + + + + + YearFrame + + Y + + + + + today + + Today + Today + Сегодня - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar-service_si.ts dde-calendar-5.10.0/translations/dde-calendar-service_si.ts --- dde-calendar-5.9.1/translations/dde-calendar-service_si.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar-service_si.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,52 +1,1231 @@ - + + + - JobRemindManager + AccountItem - - One day before start - ආරම්භ කිරීමට ඇත්තේ එක් දිනක් පමණි + + Sync successful + + + + + Network error + + + + + Server exception + + + + + Storage full + + + + + AccountManager + + + Local account + + + + + Event types + + + + + CColorPickerWidget + + + Color + + + + + Cancel + button + + + + + Save + button + + + + + CDayMonthView + + + Monday + + + + + Tuesday + + + + + Wednesday + + + + + Thursday + + + + + Friday + + + + + Saturday + + + + + Sunday + + + + + CDayWindow + + + Y + + + + + M + + + + + D + + + + + Lunar + + + + + CGraphicsView + + + New Event + + + + + CMonthScheduleNumItem + + + %1 more + + + + + CMonthView + + + New event + + + + + New Event + + + + + CMonthWindow + + + Y + + + + + CMyScheduleView + + + My Event + + + + + OK + button + + + + + Delete + button + + + + + Edit + button + + + + + CPushButton + + + New event type + + + + + CScheduleDlg + + + + + New Event + + + + + Edit Event + + + + + End time must be greater than start time + + + + + OK + button + + + + + + + + + + Never + + + + + At time of event + + + + + 15 minutes before + + + + + 30 minutes before + + + + + 1 hour before + + + + + + 1 day before + + + + + + 2 days before + + + + + + 1 week before + + + + + On start day (9:00 AM) + + + + + + + + time(s) + + + + + Enter a name please + + + + + The name can not only contain whitespaces + + + + + + Type: + + + + + + Description: + + + + + + All Day: + - - - - + + + Starts: + + + + + + Ends: + + + + + + Remind Me: + + + + + + Repeat: + + + + + + End Repeat: + + + + + Calendar account: + + + + + Calendar account + + + + + Type + + + + + Description + + + + + All Day + + + + + Time: + + + + + Time + + + + + Solar + + + + + Lunar + + + + + Starts + + + + + Ends + + + + + Remind Me + + + + + Repeat + + + + + + Daily + + + + + + Weekdays + + + + + + Weekly + + + + + + + Monthly + + + + + + + Yearly + + + + + End Repeat + + + + + After + + + + + On + + + + + Cancel + button + + + + + Save + button + + + + + CScheduleOperation + + + All occurrences of a repeating event must have the same all-day status. + + + + + + Do you want to change all occurrences? + + + + + + + + + + + Cancel + button + + + + + + Change All + + + + + You are changing the repeating rule of this event. + + + + + + + You are deleting an event. + + + + + Are you sure you want to delete this event? + + + + + Delete + button + + + + + Do you want to delete all occurrences of this event, or only the selected occurrence? + + + + + Delete All + + + + + + Delete Only This Event + + + + + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? + + + + + Delete All Future Events + + + + + + You are changing a repeating event. + + + + + Do you want to change only this occurrence of the event, or all occurrences? + + + + + All + + + + + + Only This Event + + + + + Do you want to change only this occurrence of the event, or this and all future occurrences? + + + + + All Future Events + + + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + + OK + button + + + + + CScheduleSearchDateItem + + + Y + + + + + M + + + + + D + + + + + CScheduleSearchItem + + + Edit + + + + + Delete + + + + + All Day + + + + + CScheduleSearchView + + + No search results + + + + + CScheduleView + + + ALL DAY + + + + + CSettingDialog + + + Sunday + + + + + Monday + + + + + 24-hour clock + + + + + 12-hour clock + + + + + Manual + + + + + 15 mins + + + + + 30 mins + + + + + 1 hour + + + + + 24 hours + + + + + Sync Now + + + + + Last sync + + + + + CTimeEdit + + + (%1 mins) + + + + + (%1 hour) + + + + + (%1 hours) + + + + + CTitleWidget + + + Y + + + + + M + + + + + W + + + + + D + + + + + + Search events and festivals + + + + + CWeekWidget + + + Sun + + + + + Mon + + + + + Tue + + + + + Wed + + + + + Thu + + + + + Fri + + + + + Sat + + + + + CWeekWindow + + + Week + + + + + Y + + + + + CYearScheduleView + + + + All Day + + + + + No event + + + + + CYearWindow + + + Y + + + + + CalendarWindow + + + Calendar + + + + + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. + + + + + Calendarmainwindow + + + Calendar + + + + + Manage + + + + + Privacy Policy + + + + + Syncing... + + + + + Sync successful + + + + + Sync failed, please try later + + + + + CenterWidget + + + All Day + + + + + DAccountDataBase + + + Work + + + + + Life + + + + + Other + + + + + DAlarmManager + + + + + Close button - වසා දමන්න + වසා දමන්න - + + One day before start + ආරම්භ කිරීමට ඇත්තේ එක් දිනක් පමණි + + + Remind me tomorrow - මට හෙට මතක් කරන්න + මට හෙට මතක් කරන්න - + Remind me later - මට පසුව මතක් කරන්න + මට පසුව මතක් කරන්න + + + + 15 mins later + + + + + 1 hour later + + + + + 4 hours later + - + + + + Tomorrow + හෙට + + + Schedule Reminder - මතක් කිරීමක් සකසන්න + මතක් කිරීමක් සකසන්න - - + + %1 to %2 - + - - + + Today - අද + අද + + + + DragInfoGraphicsView + + + Edit + - - - Tomorrow - හෙට + + Delete + + + + + New event + + + + + New Event + + + + + JobTypeListView + + + You are deleting an event type. + + + + + All events under this type will be deleted and cannot be recovered. + + + + + Cancel + button + + + + + Delete + button + + + + + QObject + + + Account settings + + + + + Account + + + + + Select items to be synced + + + + + Events + + + + + + General settings + + + + + Sync interval + + + + + + Manage calendar + + + + + Calendar account + + + + + + Event types + + + + + General + + + + + First day of week + + + + + Time + + + + + Return + + + Today + Return + අද + + + + Return Today + + + + + Today + Return Today + අද + + + + ScheduleTypeEditDlg + + + New event type + + + + + Edit event type + + + + + Name: + + + + + Color: + + + + + Cancel + button + + + + + Save + button + + + + + The name can not only contain whitespaces + + + + + Enter a name please + + + + + Shortcut + + + Help + + + + + Delete event + + + + + Copy + + + + + Cut + + + + + Paste + + + + + Delete + + + + + Select all + + + + + SidebarCalendarWidget + + + Y + + + + + M + + + + + TimeJumpDialog + + + Go + button + + + + + UserloginWidget + + + Sign In + button + + + + + Sign Out + button + + + + + YearFrame + + + Y + + + + + today + + + + + + + + + + Today + Today + අද - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar-service_sk.ts dde-calendar-5.10.0/translations/dde-calendar-service_sk.ts --- dde-calendar-5.9.1/translations/dde-calendar-service_sk.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar-service_sk.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,52 +1,1231 @@ - + + + - JobRemindManager + AccountItem - - One day before start - Jeden deň pred začiatkom + + Sync successful + + + + + Network error + + + + + Server exception + + + + + Storage full + + + + + AccountManager + + + Local account + + + + + Event types + + + + + CColorPickerWidget + + + Color + + + + + Cancel + button + + + + + Save + button + + + + + CDayMonthView + + + Monday + + + + + Tuesday + + + + + Wednesday + + + + + Thursday + + + + + Friday + + + + + Saturday + + + + + Sunday + + + + + CDayWindow + + + Y + + + + + M + + + + + D + + + + + Lunar + + + + + CGraphicsView + + + New Event + + + + + CMonthScheduleNumItem + + + %1 more + + + + + CMonthView + + + New event + + + + + New Event + + + + + CMonthWindow + + + Y + + + + + CMyScheduleView + + + My Event + + + + + OK + button + + + + + Delete + button + + + + + Edit + button + + + + + CPushButton + + + New event type + + + + + CScheduleDlg + + + + + New Event + + + + + Edit Event + + + + + End time must be greater than start time + + + + + OK + button + + + + + + + + + + Never + + + + + At time of event + + + + + 15 minutes before + + + + + 30 minutes before + + + + + 1 hour before + + + + + + 1 day before + + + + + + 2 days before + + + + + + 1 week before + + + + + On start day (9:00 AM) + + + + + + + + time(s) + + + + + Enter a name please + + + + + The name can not only contain whitespaces + + + + + + Type: + + + + + + Description: + + + + + + All Day: + - - - - + + + Starts: + + + + + + Ends: + + + + + + Remind Me: + + + + + + Repeat: + + + + + + End Repeat: + + + + + Calendar account: + + + + + Calendar account + + + + + Type + + + + + Description + + + + + All Day + + + + + Time: + + + + + Time + + + + + Solar + + + + + Lunar + + + + + Starts + + + + + Ends + + + + + Remind Me + + + + + Repeat + + + + + + Daily + + + + + + Weekdays + + + + + + Weekly + + + + + + + Monthly + + + + + + + Yearly + + + + + End Repeat + + + + + After + + + + + On + + + + + Cancel + button + + + + + Save + button + + + + + CScheduleOperation + + + All occurrences of a repeating event must have the same all-day status. + + + + + + Do you want to change all occurrences? + + + + + + + + + + + Cancel + button + + + + + + Change All + + + + + You are changing the repeating rule of this event. + + + + + + + You are deleting an event. + + + + + Are you sure you want to delete this event? + + + + + Delete + button + + + + + Do you want to delete all occurrences of this event, or only the selected occurrence? + + + + + Delete All + + + + + + Delete Only This Event + + + + + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? + + + + + Delete All Future Events + + + + + + You are changing a repeating event. + + + + + Do you want to change only this occurrence of the event, or all occurrences? + + + + + All + + + + + + Only This Event + + + + + Do you want to change only this occurrence of the event, or this and all future occurrences? + + + + + All Future Events + + + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + + OK + button + + + + + CScheduleSearchDateItem + + + Y + + + + + M + + + + + D + + + + + CScheduleSearchItem + + + Edit + + + + + Delete + + + + + All Day + + + + + CScheduleSearchView + + + No search results + + + + + CScheduleView + + + ALL DAY + + + + + CSettingDialog + + + Sunday + + + + + Monday + + + + + 24-hour clock + + + + + 12-hour clock + + + + + Manual + + + + + 15 mins + + + + + 30 mins + + + + + 1 hour + + + + + 24 hours + + + + + Sync Now + + + + + Last sync + + + + + CTimeEdit + + + (%1 mins) + + + + + (%1 hour) + + + + + (%1 hours) + + + + + CTitleWidget + + + Y + + + + + M + + + + + W + + + + + D + + + + + + Search events and festivals + + + + + CWeekWidget + + + Sun + + + + + Mon + + + + + Tue + + + + + Wed + + + + + Thu + + + + + Fri + + + + + Sat + + + + + CWeekWindow + + + Week + + + + + Y + + + + + CYearScheduleView + + + + All Day + + + + + No event + + + + + CYearWindow + + + Y + + + + + CalendarWindow + + + Calendar + + + + + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. + + + + + Calendarmainwindow + + + Calendar + + + + + Manage + + + + + Privacy Policy + + + + + Syncing... + + + + + Sync successful + + + + + Sync failed, please try later + + + + + CenterWidget + + + All Day + + + + + DAccountDataBase + + + Work + + + + + Life + + + + + Other + + + + + DAlarmManager + + + + + Close button - Zavrieť + Zavrieť - + + One day before start + Jeden deň pred začiatkom + + + Remind me tomorrow - Pripomenúť zajtra + Pripomenúť zajtra - + Remind me later - Pripomenúť neskôr + Pripomenúť neskôr + + + + 15 mins later + + + + + 1 hour later + + + + + 4 hours later + - + + + + Tomorrow + Zajtra + + + Schedule Reminder - Nastaviť pripomienku + Nastaviť pripomienku - - + + %1 to %2 - + - - + + Today - Dnes + Dnes + + + + DragInfoGraphicsView + + + Edit + - - - Tomorrow - Zajtra + + Delete + + + + + New event + + + + + New Event + + + + + JobTypeListView + + + You are deleting an event type. + + + + + All events under this type will be deleted and cannot be recovered. + + + + + Cancel + button + + + + + Delete + button + + + + + QObject + + + Account settings + + + + + Account + + + + + Select items to be synced + + + + + Events + + + + + + General settings + + + + + Sync interval + + + + + + Manage calendar + + + + + Calendar account + + + + + + Event types + + + + + General + + + + + First day of week + + + + + Time + + + + + Return + + + Today + Return + Dnes + + + + Return Today + + + + + Today + Return Today + Dnes + + + + ScheduleTypeEditDlg + + + New event type + + + + + Edit event type + + + + + Name: + + + + + Color: + + + + + Cancel + button + + + + + Save + button + + + + + The name can not only contain whitespaces + + + + + Enter a name please + + + + + Shortcut + + + Help + + + + + Delete event + + + + + Copy + + + + + Cut + + + + + Paste + + + + + Delete + + + + + Select all + + + + + SidebarCalendarWidget + + + Y + + + + + M + + + + + TimeJumpDialog + + + Go + button + + + + + UserloginWidget + + + Sign In + button + + + + + Sign Out + button + + + + + YearFrame + + + Y + + + + + today + + + + + + + + + + Today + Today + Dnes - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar-service_sl.ts dde-calendar-5.10.0/translations/dde-calendar-service_sl.ts --- dde-calendar-5.9.1/translations/dde-calendar-service_sl.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar-service_sl.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,52 +1,965 @@ - + + + - JobRemindManager + AccountItem - - One day before start - Dan pred začetkom + Sync successful + + + + Network error + + + + Server exception + + + + Storage full + + + + + AccountManager + + Local account + + + + Event types + + + + + CColorPickerWidget + + Color + + + + Cancel + button + + + + Save + button + + + + + CDayMonthView + + Monday + + + + Tuesday + + + + Wednesday + + + + Thursday + + + + Friday + + + + Saturday + + + + Sunday + + + + + CDayWindow + + Y + + + + M + + + + D + + + + Lunar + + + + + CGraphicsView + + New Event + + + + + CMonthScheduleNumItem + + %1 more + + + + + CMonthView + + New event + + + + New Event + + + + + CMonthWindow + + Y + + + + + CMyScheduleView + + My Event + + + + OK + button + + + + Delete + button + + + + Edit + button + + + + + CPushButton + + New event type + + + + + CScheduleDlg + + New Event + + + + Edit Event + + + + End time must be greater than start time + + + + OK + button + + + + Never + + + + At time of event + + + + 15 minutes before + + + + 30 minutes before + + + + 1 hour before + + + + 1 day before + + + + 2 days before + + + + 1 week before + + + + On start day (9:00 AM) + + + + time(s) + + + + Enter a name please + + + + The name can not only contain whitespaces + + + + Type: + + + + Description: + + + + All Day: + - - - - + Starts: + + + + Ends: + + + + Remind Me: + + + + Repeat: + + + + End Repeat: + + + + Calendar account: + + + + Calendar account + + + + Type + + + + Description + + + + All Day + + + + Time: + + + + Time + + + + Solar + + + + Lunar + + + + Starts + + + + Ends + + + + Remind Me + + + + Repeat + + + + Daily + + + + Weekdays + + + + Weekly + + + + Monthly + + + + Yearly + + + + End Repeat + + + + After + + + + On + + + + Cancel + button + + + + Save + button + + + + + CScheduleOperation + + All occurrences of a repeating event must have the same all-day status. + + + + Do you want to change all occurrences? + + + + Cancel + button + + + + Change All + + + + You are changing the repeating rule of this event. + + + + You are deleting an event. + + + + Are you sure you want to delete this event? + + + + Delete + button + + + + Do you want to delete all occurrences of this event, or only the selected occurrence? + + + + Delete All + + + + Delete Only This Event + + + + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? + + + + Delete All Future Events + + + + You are changing a repeating event. + + + + Do you want to change only this occurrence of the event, or all occurrences? + + + + All + + + + Only This Event + + + + Do you want to change only this occurrence of the event, or this and all future occurrences? + + + + All Future Events + + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + OK + button + + + + + CScheduleSearchDateItem + + Y + + + + M + + + + D + + + + + CScheduleSearchItem + + Edit + + + + Delete + + + + All Day + + + + + CScheduleSearchView + + No search results + + + + + CScheduleView + + ALL DAY + + + + + CSettingDialog + + Sunday + + + + Monday + + + + 24-hour clock + + + + 12-hour clock + + + + Manual + + + + 15 mins + + + + 30 mins + + + + 1 hour + + + + 24 hours + + + + Sync Now + + + + Last sync + + + + + CTimeEdit + + (%1 mins) + + + + (%1 hour) + + + + (%1 hours) + + + + + CTitleWidget + + Y + + + + M + + + + W + + + + D + + + + Search events and festivals + + + + + CWeekWidget + + Sun + + + + Mon + + + + Tue + + + + Wed + + + + Thu + + + + Fri + + + + Sat + + + + + CWeekWindow + + Week + + + + Y + + + + + CYearScheduleView + + All Day + + + + No event + + + + + CYearWindow + + Y + + + + + CalendarWindow + + Calendar + + + + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. + + + + + Calendarmainwindow + + Calendar + + + + Manage + + + + Privacy Policy + + + + Syncing... + + + + Sync successful + + + + Sync failed, please try later + + + + + CenterWidget + + All Day + + + + + DAccountDataBase + + Work + o + + + Life + ivljenje + + + Other + Ostalo + + + + DAlarmManager + Close button Zapri - + One day before start + Dan pred pričetkom + + Remind me tomorrow - Spomni me jutri + Opomni me jutri - Remind me later - Spomni me kasneje + Opomni me kasneje + + + 15 mins later + + + + 1 hour later + + + + 4 hours later + + + + Tomorrow + Jutri - Schedule Reminder - Terminski opomnik + Nastavi opomnik - - %1 to %2 %1 do %2 - - Today Danes + + + DragInfoGraphicsView + + Edit + + - - - Tomorrow - Jutri + Delete + + + + New event + + + + New Event + + + + + JobTypeListView + + You are deleting an event type. + + + + All events under this type will be deleted and cannot be recovered. + + + + Cancel + button + + + + Delete + button + + + + + QObject + + Account settings + + + + Account + + + + Select items to be synced + + + + Events + + + + General settings + + + + Sync interval + + + + Manage calendar + + + + Calendar account + + + + Event types + + + + General + + + + First day of week + + + + Time + + + + + Return + + Today + Return + Danes + + + + Return Today + + Today + Return Today + Danes + + + + ScheduleTypeEditDlg + + New event type + + + + Edit event type + + + + Name: + + + + Color: + + + + Cancel + button + + + + Save + button + + + + The name can not only contain whitespaces + + + + Enter a name please + + + + + Shortcut + + Help + + + + Delete event + + + + Copy + + + + Cut + + + + Paste + + + + Delete + + + + Select all + + + + + SidebarCalendarWidget + + Y + + + + M + + + + + TimeJumpDialog + + Go + button + + + + + UserloginWidget + + Sign In + button + + + + Sign Out + button + + + + + YearFrame + + Y + + + + + today + + Today + Today + Danes - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar-service_sq.ts dde-calendar-5.10.0/translations/dde-calendar-service_sq.ts --- dde-calendar-5.9.1/translations/dde-calendar-service_sq.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar-service_sq.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,52 +1,965 @@ - + + + - JobRemindManager + AccountItem - - One day before start - Një ditë para fillimit + Sync successful + + + + Network error + + + + Server exception + + + + Storage full + + + + + AccountManager + + Local account + + + + Event types + + + + + CColorPickerWidget + + Color + + + + Cancel + button + + + + Save + button + + + + + CDayMonthView + + Monday + + + + Tuesday + + + + Wednesday + + + + Thursday + + + + Friday + + + + Saturday + + + + Sunday + + + + + CDayWindow + + Y + + + + M + + + + D + + + + Lunar + + + + + CGraphicsView + + New Event + + + + + CMonthScheduleNumItem + + %1 more + + + + + CMonthView + + New event + + + + New Event + + + + + CMonthWindow + + Y + + + + + CMyScheduleView + + My Event + + + + OK + button + + + + Delete + button + + + + Edit + button + + + + + CPushButton + + New event type + + + + + CScheduleDlg + + New Event + + + + Edit Event + + + + End time must be greater than start time + + + + OK + button + + + + Never + + + + At time of event + + + + 15 minutes before + + + + 30 minutes before + + + + 1 hour before + + + + 1 day before + + + + 2 days before + + + + 1 week before + + + + On start day (9:00 AM) + + + + time(s) + + + + Enter a name please + + + + The name can not only contain whitespaces + + + + Type: + + + + Description: + + + + All Day: + - - - - + Starts: + + + + Ends: + + + + Remind Me: + + + + Repeat: + + + + End Repeat: + + + + Calendar account: + + + + Calendar account + + + + Type + + + + Description + + + + All Day + + + + Time: + + + + Time + + + + Solar + + + + Lunar + + + + Starts + + + + Ends + + + + Remind Me + + + + Repeat + + + + Daily + + + + Weekdays + + + + Weekly + + + + Monthly + + + + Yearly + + + + End Repeat + + + + After + + + + On + + + + Cancel + button + + + + Save + button + + + + + CScheduleOperation + + All occurrences of a repeating event must have the same all-day status. + + + + Do you want to change all occurrences? + + + + Cancel + button + + + + Change All + + + + You are changing the repeating rule of this event. + + + + You are deleting an event. + + + + Are you sure you want to delete this event? + + + + Delete + button + + + + Do you want to delete all occurrences of this event, or only the selected occurrence? + + + + Delete All + + + + Delete Only This Event + + + + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? + + + + Delete All Future Events + + + + You are changing a repeating event. + + + + Do you want to change only this occurrence of the event, or all occurrences? + + + + All + + + + Only This Event + + + + Do you want to change only this occurrence of the event, or this and all future occurrences? + + + + All Future Events + + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + OK + button + + + + + CScheduleSearchDateItem + + Y + + + + M + + + + D + + + + + CScheduleSearchItem + + Edit + + + + Delete + + + + All Day + + + + + CScheduleSearchView + + No search results + + + + + CScheduleView + + ALL DAY + + + + + CSettingDialog + + Sunday + + + + Monday + + + + 24-hour clock + + + + 12-hour clock + + + + Manual + + + + 15 mins + + + + 30 mins + + + + 1 hour + + + + 24 hours + + + + Sync Now + + + + Last sync + + + + + CTimeEdit + + (%1 mins) + + + + (%1 hour) + + + + (%1 hours) + + + + + CTitleWidget + + Y + + + + M + + + + W + + + + D + + + + Search events and festivals + + + + + CWeekWidget + + Sun + + + + Mon + + + + Tue + + + + Wed + + + + Thu + + + + Fri + + + + Sat + + + + + CWeekWindow + + Week + + + + Y + + + + + CYearScheduleView + + All Day + + + + No event + + + + + CYearWindow + + Y + + + + + CalendarWindow + + Calendar + + + + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. + + + + + Calendarmainwindow + + Calendar + + + + Manage + + + + Privacy Policy + + + + Syncing... + + + + Sync successful + + + + Sync failed, please try later + + + + + CenterWidget + + All Day + + + + + DAccountDataBase + + Work + Pune + + + Life + Shtëpie + + + Other + Tjetër + + + + DAlarmManager + Close button Mbylle - + One day before start + Një ditë para fillimit + + Remind me tomorrow Kujtoma nesër - Remind me later Kujtoma më vonë - + 15 mins later + pas 15 minutash + + + 1 hour later + pas 1 ore + + + 4 hours later + pas 4 orësh + + + Tomorrow + Nesër + + Schedule Reminder Kujtues Planesh - - %1 to %2 %1 deri më %2 - - Today Sot + + + DragInfoGraphicsView - - - Tomorrow - Nesër + Edit + + + + Delete + + + + New event + + + + New Event + + + + + JobTypeListView + + You are deleting an event type. + + + + All events under this type will be deleted and cannot be recovered. + + + + Cancel + button + + + + Delete + button + + + + + QObject + + Account settings + + + + Account + + + + Select items to be synced + + + + Events + + + + General settings + + + + Sync interval + + + + Manage calendar + + + + Calendar account + + + + Event types + + + + General + + + + First day of week + + + + Time + + + + + Return + + Today + Return + Sot + + + + Return Today + + Today + Return Today + Sot + + + + ScheduleTypeEditDlg + + New event type + + + + Edit event type + + + + Name: + + + + Color: + + + + Cancel + button + + + + Save + button + + + + The name can not only contain whitespaces + + + + Enter a name please + + + + + Shortcut + + Help + + + + Delete event + + + + Copy + + + + Cut + + + + Paste + + + + Delete + + + + Select all + + + + + SidebarCalendarWidget + + Y + + + + M + + + + + TimeJumpDialog + + Go + button + + + + + UserloginWidget + + Sign In + button + + + + Sign Out + button + + + + + YearFrame + + Y + + + + + today + + Today + Today + Sot - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar-service_sr.ts dde-calendar-5.10.0/translations/dde-calendar-service_sr.ts --- dde-calendar-5.9.1/translations/dde-calendar-service_sr.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar-service_sr.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,52 +1,965 @@ - + + + - JobRemindManager + AccountItem - - One day before start - Један дан пре пчетка + Sync successful + + + + Network error + + + + Server exception + + + + Storage full + + + + + AccountManager + + Local account + + + + Event types + + + + + CColorPickerWidget + + Color + + + + Cancel + button + + + + Save + button + + + + + CDayMonthView + + Monday + + + + Tuesday + + + + Wednesday + + + + Thursday + + + + Friday + + + + Saturday + + + + Sunday + + + + + CDayWindow + + Y + + + + M + + + + D + + + + Lunar + + + + + CGraphicsView + + New Event + + + + + CMonthScheduleNumItem + + %1 more + + + + + CMonthView + + New event + + + + New Event + + + + + CMonthWindow + + Y + + + + + CMyScheduleView + + My Event + + + + OK + button + + + + Delete + button + + + + Edit + button + + + + + CPushButton + + New event type + + + + + CScheduleDlg + + New Event + + + + Edit Event + + + + End time must be greater than start time + + + + OK + button + + + + Never + + + + At time of event + + + + 15 minutes before + + + + 30 minutes before + + + + 1 hour before + + + + 1 day before + + + + 2 days before + + + + 1 week before + + + + On start day (9:00 AM) + + + + time(s) + + + + Enter a name please + + + + The name can not only contain whitespaces + + + + Type: + + + + Description: + + + + All Day: + - - - - + Starts: + + + + Ends: + + + + Remind Me: + + + + Repeat: + + + + End Repeat: + + + + Calendar account: + + + + Calendar account + + + + Type + + + + Description + + + + All Day + + + + Time: + + + + Time + + + + Solar + + + + Lunar + + + + Starts + + + + Ends + + + + Remind Me + + + + Repeat + + + + Daily + + + + Weekdays + + + + Weekly + + + + Monthly + + + + Yearly + + + + End Repeat + + + + After + + + + On + + + + Cancel + button + + + + Save + button + + + + + CScheduleOperation + + All occurrences of a repeating event must have the same all-day status. + + + + Do you want to change all occurrences? + + + + Cancel + button + + + + Change All + + + + You are changing the repeating rule of this event. + + + + You are deleting an event. + + + + Are you sure you want to delete this event? + + + + Delete + button + + + + Do you want to delete all occurrences of this event, or only the selected occurrence? + + + + Delete All + + + + Delete Only This Event + + + + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? + + + + Delete All Future Events + + + + You are changing a repeating event. + + + + Do you want to change only this occurrence of the event, or all occurrences? + + + + All + + + + Only This Event + + + + Do you want to change only this occurrence of the event, or this and all future occurrences? + + + + All Future Events + + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + OK + button + + + + + CScheduleSearchDateItem + + Y + + + + M + + + + D + + + + + CScheduleSearchItem + + Edit + + + + Delete + + + + All Day + + + + + CScheduleSearchView + + No search results + + + + + CScheduleView + + ALL DAY + + + + + CSettingDialog + + Sunday + + + + Monday + + + + 24-hour clock + + + + 12-hour clock + + + + Manual + + + + 15 mins + + + + 30 mins + + + + 1 hour + + + + 24 hours + + + + Sync Now + + + + Last sync + + + + + CTimeEdit + + (%1 mins) + + + + (%1 hour) + + + + (%1 hours) + + + + + CTitleWidget + + Y + + + + M + + + + W + + + + D + + + + Search events and festivals + + + + + CWeekWidget + + Sun + + + + Mon + + + + Tue + + + + Wed + + + + Thu + + + + Fri + + + + Sat + + + + + CWeekWindow + + Week + + + + Y + + + + + CYearScheduleView + + All Day + + + + No event + + + + + CYearWindow + + Y + + + + + CalendarWindow + + Calendar + + + + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. + + + + + Calendarmainwindow + + Calendar + + + + Manage + + + + Privacy Policy + + + + Syncing... + + + + Sync successful + + + + Sync failed, please try later + + + + + CenterWidget + + All Day + + + + + DAccountDataBase + + Work + Посао + + + Life + Живот + + + Other + Остало + + + + DAlarmManager + Close button Затвори - + One day before start + Један дан пре пчетка + + Remind me tomorrow Подсети ме сутра - Remind me later Подсети касније - + 15 mins later + + + + 1 hour later + + + + 4 hours later + + + + Tomorrow + Сутра + + Schedule Reminder Подсетник догађаја - - %1 to %2 %1 до %2 - - Today Данас + + + DragInfoGraphicsView - - - Tomorrow - Сутра + Edit + + + + Delete + + + + New event + + + + New Event + + + + + JobTypeListView + + You are deleting an event type. + + + + All events under this type will be deleted and cannot be recovered. + + + + Cancel + button + + + + Delete + button + + + + + QObject + + Account settings + + + + Account + + + + Select items to be synced + + + + Events + + + + General settings + + + + Sync interval + + + + Manage calendar + + + + Calendar account + + + + Event types + + + + General + + + + First day of week + + + + Time + + + + + Return + + Today + Return + Данас + + + + Return Today + + Today + Return Today + Данас + + + + ScheduleTypeEditDlg + + New event type + + + + Edit event type + + + + Name: + + + + Color: + + + + Cancel + button + + + + Save + button + + + + The name can not only contain whitespaces + + + + Enter a name please + + + + + Shortcut + + Help + + + + Delete event + + + + Copy + + + + Cut + + + + Paste + + + + Delete + + + + Select all + + + + + SidebarCalendarWidget + + Y + + + + M + + + + + TimeJumpDialog + + Go + button + + + + + UserloginWidget + + Sign In + button + + + + Sign Out + button + + + + + YearFrame + + Y + + + + + today + + Today + Today + Данас - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar-service_tr.ts dde-calendar-5.10.0/translations/dde-calendar-service_tr.ts --- dde-calendar-5.9.1/translations/dde-calendar-service_tr.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar-service_tr.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,86 +1,965 @@ - + + + - JobRemindManager + AccountItem - - One day before start - Başlamadan bir gün önce + Sync successful + + + + Network error + + + + Server exception + + + + Storage full + + + + + AccountManager + + Local account + + + + Event types + + + + + CColorPickerWidget + + Color + + + + Cancel + button + + + + Save + button + + + + + CDayMonthView + + Monday + + + + Tuesday + + + + Wednesday + - - - - + Thursday + + + + Friday + + + + Saturday + + + + Sunday + + + + + CDayWindow + + Y + + + + M + + + + D + + + + Lunar + + + + + CGraphicsView + + New Event + + + + + CMonthScheduleNumItem + + %1 more + + + + + CMonthView + + New event + + + + New Event + + + + + CMonthWindow + + Y + + + + + CMyScheduleView + + My Event + + + + OK + button + + + + Delete + button + + + + Edit + button + + + + + CPushButton + + New event type + + + + + CScheduleDlg + + New Event + + + + Edit Event + + + + End time must be greater than start time + + + + OK + button + + + + Never + + + + At time of event + + + + 15 minutes before + + + + 30 minutes before + + + + 1 hour before + + + + 1 day before + + + + 2 days before + + + + 1 week before + + + + On start day (9:00 AM) + + + + time(s) + + + + Enter a name please + + + + The name can not only contain whitespaces + + + + Type: + + + + Description: + + + + All Day: + + + + Starts: + + + + Ends: + + + + Remind Me: + + + + Repeat: + + + + End Repeat: + + + + Calendar account: + + + + Calendar account + + + + Type + + + + Description + + + + All Day + + + + Time: + + + + Time + + + + Solar + + + + Lunar + + + + Starts + + + + Ends + + + + Remind Me + + + + Repeat + + + + Daily + + + + Weekdays + + + + Weekly + + + + Monthly + + + + Yearly + + + + End Repeat + + + + After + + + + On + + + + Cancel + button + + + + Save + button + + + + + CScheduleOperation + + All occurrences of a repeating event must have the same all-day status. + + + + Do you want to change all occurrences? + + + + Cancel + button + + + + Change All + + + + You are changing the repeating rule of this event. + + + + You are deleting an event. + + + + Are you sure you want to delete this event? + + + + Delete + button + + + + Do you want to delete all occurrences of this event, or only the selected occurrence? + + + + Delete All + + + + Delete Only This Event + + + + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? + + + + Delete All Future Events + + + + You are changing a repeating event. + + + + Do you want to change only this occurrence of the event, or all occurrences? + + + + All + + + + Only This Event + + + + Do you want to change only this occurrence of the event, or this and all future occurrences? + + + + All Future Events + + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + OK + button + + + + + CScheduleSearchDateItem + + Y + + + + M + + + + D + + + + + CScheduleSearchItem + + Edit + + + + Delete + + + + All Day + + + + + CScheduleSearchView + + No search results + + + + + CScheduleView + + ALL DAY + + + + + CSettingDialog + + Sunday + + + + Monday + + + + 24-hour clock + + + + 12-hour clock + + + + Manual + + + + 15 mins + + + + 30 mins + + + + 1 hour + + + + 24 hours + + + + Sync Now + + + + Last sync + + + + + CTimeEdit + + (%1 mins) + + + + (%1 hour) + + + + (%1 hours) + + + + + CTitleWidget + + Y + + + + M + + + + W + + + + D + + + + Search events and festivals + + + + + CWeekWidget + + Sun + + + + Mon + + + + Tue + + + + Wed + + + + Thu + + + + Fri + + + + Sat + + + + + CWeekWindow + + Week + + + + Y + + + + + CYearScheduleView + + All Day + + + + No event + + + + + CYearWindow + + Y + + + + + CalendarWindow + + Calendar + + + + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. + + + + + Calendarmainwindow + + Calendar + + + + Manage + + + + Privacy Policy + + + + Syncing... + + + + Sync successful + + + + Sync failed, please try later + + + + + CenterWidget + + All Day + + + + + DAccountDataBase + + Work + Çalışma + + + Life + Yaşam + + + Other + Diğer + + + + DAlarmManager + Close button Kapat - + One day before start + Başlamadan bir gün önce + + Remind me tomorrow Bana yarın hatırlat - Remind me later - Sonra hatırlat + Bana daha sonra hatırlat - 15 mins later - 15 dakika sonra + 15 Dakika sonra - 1 hour later - 1 saat sonra + 1 Saat sonra - 4 hours later - 4 saat sonra + 4 Saat sonra + + + Tomorrow + Yarın - Schedule Reminder - Zamanlamalı Hatırlatıcı + Zamanlama hatırlatıcısı - - %1 to %2 - %1 ile %2 + %1 ila %2 - - Today Bugün + + + DragInfoGraphicsView - - - - Tomorrow - Yarın + Edit + + + + Delete + + + + New event + + + + New Event + - SchedulerDatabase + JobTypeListView - - Work - İş + You are deleting an event type. + - - Life - Yaşam + All events under this type will be deleted and cannot be recovered. + - - Other - Diğer + Cancel + button + + + + Delete + button + + + + + QObject + + Account settings + + + + Account + + + + Select items to be synced + + + + Events + + + + General settings + + + + Sync interval + + + + Manage calendar + + + + Calendar account + + + + Event types + + + + General + + + + First day of week + + + + Time + + + + + Return + + Today + Return + Bugün + + + + Return Today + + Today + Return Today + Bugün + + + + ScheduleTypeEditDlg + + New event type + + + + Edit event type + + + + Name: + + + + Color: + + + + Cancel + button + + + + Save + button + + + + The name can not only contain whitespaces + + + + Enter a name please + + + + + Shortcut + + Help + + + + Delete event + + + + Copy + + + + Cut + + + + Paste + + + + Delete + + + + Select all + + + + + SidebarCalendarWidget + + Y + + + + M + + + + + TimeJumpDialog + + Go + button + + + + + UserloginWidget + + Sign In + button + + + + Sign Out + button + + + + + YearFrame + + Y + + + + + today + + Today + Today + Bugün - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar-service_ug.ts dde-calendar-5.10.0/translations/dde-calendar-service_ug.ts --- dde-calendar-5.9.1/translations/dde-calendar-service_ug.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar-service_ug.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,52 +1,965 @@ - + + + - JobRemindManager + AccountItem - - One day before start - 1 كۈن بۇرۇن ئەسكەرتىش + Sync successful + + + + Network error + + + + Server exception + + + + Storage full + + + + + AccountManager + + Local account + + + + Event types + + + + + CColorPickerWidget + + Color + + + + Cancel + button + + + + Save + button + + + + + CDayMonthView + + Monday + + + + Tuesday + + + + Wednesday + + + + Thursday + + + + Friday + + + + Saturday + + + + Sunday + + + + + CDayWindow + + Y + + + + M + + + + D + + + + Lunar + + + + + CGraphicsView + + New Event + + + + + CMonthScheduleNumItem + + %1 more + + + + + CMonthView + + New event + + + + New Event + + + + + CMonthWindow + + Y + + + + + CMyScheduleView + + My Event + + + + OK + button + + + + Delete + button + + + + Edit + button + + + + + CPushButton + + New event type + + + + + CScheduleDlg + + New Event + + + + Edit Event + + + + End time must be greater than start time + + + + OK + button + + + + Never + + + + At time of event + + + + 15 minutes before + + + + 30 minutes before + + + + 1 hour before + + + + 1 day before + + + + 2 days before + + + + 1 week before + + + + On start day (9:00 AM) + + + + time(s) + + + + Enter a name please + + + + The name can not only contain whitespaces + + + + Type: + + + + Description: + + + + All Day: + - - - - + Starts: + + + + Ends: + + + + Remind Me: + + + + Repeat: + + + + End Repeat: + + + + Calendar account: + + + + Calendar account + + + + Type + + + + Description + + + + All Day + + + + Time: + + + + Time + + + + Solar + + + + Lunar + + + + Starts + + + + Ends + + + + Remind Me + + + + Repeat + + + + Daily + + + + Weekdays + + + + Weekly + + + + Monthly + + + + Yearly + + + + End Repeat + + + + After + + + + On + + + + Cancel + button + + + + Save + button + + + + + CScheduleOperation + + All occurrences of a repeating event must have the same all-day status. + + + + Do you want to change all occurrences? + + + + Cancel + button + + + + Change All + + + + You are changing the repeating rule of this event. + + + + You are deleting an event. + + + + Are you sure you want to delete this event? + + + + Delete + button + + + + Do you want to delete all occurrences of this event, or only the selected occurrence? + + + + Delete All + + + + Delete Only This Event + + + + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? + + + + Delete All Future Events + + + + You are changing a repeating event. + + + + Do you want to change only this occurrence of the event, or all occurrences? + + + + All + + + + Only This Event + + + + Do you want to change only this occurrence of the event, or this and all future occurrences? + + + + All Future Events + + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + OK + button + + + + + CScheduleSearchDateItem + + Y + + + + M + + + + D + + + + + CScheduleSearchItem + + Edit + + + + Delete + + + + All Day + + + + + CScheduleSearchView + + No search results + + + + + CScheduleView + + ALL DAY + + + + + CSettingDialog + + Sunday + + + + Monday + + + + 24-hour clock + + + + 12-hour clock + + + + Manual + + + + 15 mins + + + + 30 mins + + + + 1 hour + + + + 24 hours + + + + Sync Now + + + + Last sync + + + + + CTimeEdit + + (%1 mins) + + + + (%1 hour) + + + + (%1 hours) + + + + + CTitleWidget + + Y + + + + M + + + + W + + + + D + + + + Search events and festivals + + + + + CWeekWidget + + Sun + + + + Mon + + + + Tue + + + + Wed + + + + Thu + + + + Fri + + + + Sat + + + + + CWeekWindow + + Week + + + + Y + + + + + CYearScheduleView + + All Day + + + + No event + + + + + CYearWindow + + Y + + + + + CalendarWindow + + Calendar + + + + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. + + + + + Calendarmainwindow + + Calendar + + + + Manage + + + + Privacy Policy + + + + Syncing... + + + + Sync successful + + + + Sync failed, please try later + + + + + CenterWidget + + All Day + + + + + DAccountDataBase + + Work + Work + + + Life + Life + + + Other + Other + + + + DAlarmManager + Close button تاقاش - + One day before start + 1 كۈن بۇرۇن ئەسكەرتىش + + Remind me tomorrow ئەتە ئەسكەرتسۇن - Remind me later - ھېلىغىچە ئەسكەرتسۇن + بىر ئازدىن كېيىن ئەسكەرتىش + + + 15 mins later + + + + 1 hour later + + + + 4 hours later + + + + Tomorrow + ئەتە - Schedule Reminder كۈنتەرتىپ ئەسكەرتىشى - - %1 to %2 %1 دىن %2 گىچە - - Today - بۈگۈن + Today + + + DragInfoGraphicsView - - - Tomorrow - ئەتە + Edit + + + + Delete + + + + New event + + + + New Event + + + + + JobTypeListView + + You are deleting an event type. + + + + All events under this type will be deleted and cannot be recovered. + + + + Cancel + button + + + + Delete + button + + + + + QObject + + Account settings + + + + Account + + + + Select items to be synced + + + + Events + + + + General settings + + + + Sync interval + + + + Manage calendar + + + + Calendar account + + + + Event types + + + + General + + + + First day of week + + + + Time + + + + + Return + + Today + Return + Today + + + + Return Today + + Today + Return Today + Today + + + + ScheduleTypeEditDlg + + New event type + + + + Edit event type + + + + Name: + + + + Color: + + + + Cancel + button + + + + Save + button + + + + The name can not only contain whitespaces + + + + Enter a name please + + + + + Shortcut + + Help + + + + Delete event + + + + Copy + + + + Cut + + + + Paste + + + + Delete + + + + Select all + + + + + SidebarCalendarWidget + + Y + + + + M + + + + + TimeJumpDialog + + Go + button + + + + + UserloginWidget + + Sign In + button + + + + Sign Out + button + + + + + YearFrame + + Y + + + + + today + + Today + Today + Today - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar-service_uk.ts dde-calendar-5.10.0/translations/dde-calendar-service_uk.ts --- dde-calendar-5.9.1/translations/dde-calendar-service_uk.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar-service_uk.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,86 +1,965 @@ - + + + - JobRemindManager + AccountItem - - One day before start - За день до початку + Sync successful + + + + Network error + + + + Server exception + + + + Storage full + + + + + AccountManager + + Local account + + + + Event types + + + + + CColorPickerWidget + + Color + + + + Cancel + button + + + + Save + button + + + + + CDayMonthView + + Monday + + + + Tuesday + + + + Wednesday + - - - - + Thursday + + + + Friday + + + + Saturday + + + + Sunday + + + + + CDayWindow + + Y + + + + M + + + + D + + + + Lunar + + + + + CGraphicsView + + New Event + + + + + CMonthScheduleNumItem + + %1 more + + + + + CMonthView + + New event + + + + New Event + + + + + CMonthWindow + + Y + + + + + CMyScheduleView + + My Event + + + + OK + button + + + + Delete + button + + + + Edit + button + + + + + CPushButton + + New event type + + + + + CScheduleDlg + + New Event + + + + Edit Event + + + + End time must be greater than start time + + + + OK + button + + + + Never + + + + At time of event + + + + 15 minutes before + + + + 30 minutes before + + + + 1 hour before + + + + 1 day before + + + + 2 days before + + + + 1 week before + + + + On start day (9:00 AM) + + + + time(s) + + + + Enter a name please + + + + The name can not only contain whitespaces + + + + Type: + + + + Description: + + + + All Day: + + + + Starts: + + + + Ends: + + + + Remind Me: + + + + Repeat: + + + + End Repeat: + + + + Calendar account: + + + + Calendar account + + + + Type + + + + Description + + + + All Day + + + + Time: + + + + Time + + + + Solar + + + + Lunar + + + + Starts + + + + Ends + + + + Remind Me + + + + Repeat + + + + Daily + + + + Weekdays + + + + Weekly + + + + Monthly + + + + Yearly + + + + End Repeat + + + + After + + + + On + + + + Cancel + button + + + + Save + button + + + + + CScheduleOperation + + All occurrences of a repeating event must have the same all-day status. + + + + Do you want to change all occurrences? + + + + Cancel + button + + + + Change All + + + + You are changing the repeating rule of this event. + + + + You are deleting an event. + + + + Are you sure you want to delete this event? + + + + Delete + button + + + + Do you want to delete all occurrences of this event, or only the selected occurrence? + + + + Delete All + + + + Delete Only This Event + + + + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? + + + + Delete All Future Events + + + + You are changing a repeating event. + + + + Do you want to change only this occurrence of the event, or all occurrences? + + + + All + + + + Only This Event + + + + Do you want to change only this occurrence of the event, or this and all future occurrences? + + + + All Future Events + + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + OK + button + + + + + CScheduleSearchDateItem + + Y + + + + M + + + + D + + + + + CScheduleSearchItem + + Edit + + + + Delete + + + + All Day + + + + + CScheduleSearchView + + No search results + + + + + CScheduleView + + ALL DAY + + + + + CSettingDialog + + Sunday + + + + Monday + + + + 24-hour clock + + + + 12-hour clock + + + + Manual + + + + 15 mins + + + + 30 mins + + + + 1 hour + + + + 24 hours + + + + Sync Now + + + + Last sync + + + + + CTimeEdit + + (%1 mins) + + + + (%1 hour) + + + + (%1 hours) + + + + + CTitleWidget + + Y + + + + M + + + + W + + + + D + + + + Search events and festivals + + + + + CWeekWidget + + Sun + + + + Mon + + + + Tue + + + + Wed + + + + Thu + + + + Fri + + + + Sat + + + + + CWeekWindow + + Week + + + + Y + + + + + CYearScheduleView + + All Day + + + + No event + + + + + CYearWindow + + Y + + + + + CalendarWindow + + Calendar + + + + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. + + + + + Calendarmainwindow + + Calendar + + + + Manage + + + + Privacy Policy + + + + Syncing... + + + + Sync successful + + + + Sync failed, please try later + + + + + CenterWidget + + All Day + + + + + DAccountDataBase + + Work + Робота + + + Life + Життя + + + Other + Інше + + + + DAlarmManager + Close button Закрити - + One day before start + За день до початку + + Remind me tomorrow Нагадати мені завтра - Remind me later Нагадати мені пізніше - 15 mins later За 15 хвилин - 1 hour later За 1 годину - 4 hours later За 4 години - + Tomorrow + Завтра + + Schedule Reminder - Планування нагадування + Розклад нагадування - - %1 to %2 з %1 до %2 - - Today Сьогодні + + + DragInfoGraphicsView - - - - Tomorrow - Взавтра + Edit + + + + Delete + + + + New event + + + + New Event + - SchedulerDatabase + JobTypeListView - - Work - Робота + You are deleting an event type. + - - Life - Життя + All events under this type will be deleted and cannot be recovered. + - - Other - Інше + Cancel + button + + + + Delete + button + + + + + QObject + + Account settings + + + + Account + + + + Select items to be synced + + + + Events + + + + General settings + + + + Sync interval + + + + Manage calendar + + + + Calendar account + + + + Event types + + + + General + + + + First day of week + + + + Time + + + + + Return + + Today + Return + Сьогодні + + + + Return Today + + Today + Return Today + Сьогодні + + + + ScheduleTypeEditDlg + + New event type + + + + Edit event type + + + + Name: + + + + Color: + + + + Cancel + button + + + + Save + button + + + + The name can not only contain whitespaces + + + + Enter a name please + + + + + Shortcut + + Help + + + + Delete event + + + + Copy + + + + Cut + + + + Paste + + + + Delete + + + + Select all + + + + + SidebarCalendarWidget + + Y + + + + M + + + + + TimeJumpDialog + + Go + button + + + + + UserloginWidget + + Sign In + button + + + + Sign Out + button + + + + + YearFrame + + Y + + + + + today + + Today + Today + Сьогодні - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar-service_vi.ts dde-calendar-5.10.0/translations/dde-calendar-service_vi.ts --- dde-calendar-5.9.1/translations/dde-calendar-service_vi.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar-service_vi.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,52 +1,1231 @@ - + + + - JobRemindManager + AccountItem - - One day before start - Một ngày trước khi bắt đầu + + Sync successful + + + + + Network error + + + + + Server exception + + + + + Storage full + + + + + AccountManager + + + Local account + + + + + Event types + + + + + CColorPickerWidget + + + Color + + + + + Cancel + button + + + + + Save + button + + + + + CDayMonthView + + + Monday + + + + + Tuesday + + + + + Wednesday + + + + + Thursday + + + + + Friday + + + + + Saturday + + + + + Sunday + + + + + CDayWindow + + + Y + + + + + M + + + + + D + + + + + Lunar + + + + + CGraphicsView + + + New Event + + + + + CMonthScheduleNumItem + + + %1 more + + + + + CMonthView + + + New event + + + + + New Event + + + + + CMonthWindow + + + Y + + + + + CMyScheduleView + + + My Event + + + + + OK + button + + + + + Delete + button + + + + + Edit + button + + + + + CPushButton + + + New event type + + + + + CScheduleDlg + + + + + New Event + + + + + Edit Event + + + + + End time must be greater than start time + + + + + OK + button + + + + + + + + + + Never + + + + + At time of event + + + + + 15 minutes before + + + + + 30 minutes before + + + + + 1 hour before + + + + + + 1 day before + + + + + + 2 days before + + + + + + 1 week before + + + + + On start day (9:00 AM) + + + + + + + + time(s) + + + + + Enter a name please + + + + + The name can not only contain whitespaces + + + + + + Type: + + + + + + Description: + + + + + + All Day: + - - - - + + + Starts: + + + + + + Ends: + + + + + + Remind Me: + + + + + + Repeat: + + + + + + End Repeat: + + + + + Calendar account: + + + + + Calendar account + + + + + Type + + + + + Description + + + + + All Day + + + + + Time: + + + + + Time + + + + + Solar + + + + + Lunar + + + + + Starts + + + + + Ends + + + + + Remind Me + + + + + Repeat + + + + + + Daily + + + + + + Weekdays + + + + + + Weekly + + + + + + + Monthly + + + + + + + Yearly + + + + + End Repeat + + + + + After + + + + + On + + + + + Cancel + button + + + + + Save + button + + + + + CScheduleOperation + + + All occurrences of a repeating event must have the same all-day status. + + + + + + Do you want to change all occurrences? + + + + + + + + + + + Cancel + button + + + + + + Change All + + + + + You are changing the repeating rule of this event. + + + + + + + You are deleting an event. + + + + + Are you sure you want to delete this event? + + + + + Delete + button + + + + + Do you want to delete all occurrences of this event, or only the selected occurrence? + + + + + Delete All + + + + + + Delete Only This Event + + + + + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? + + + + + Delete All Future Events + + + + + + You are changing a repeating event. + + + + + Do you want to change only this occurrence of the event, or all occurrences? + + + + + All + + + + + + Only This Event + + + + + Do you want to change only this occurrence of the event, or this and all future occurrences? + + + + + All Future Events + + + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + + OK + button + + + + + CScheduleSearchDateItem + + + Y + + + + + M + + + + + D + + + + + CScheduleSearchItem + + + Edit + + + + + Delete + + + + + All Day + + + + + CScheduleSearchView + + + No search results + + + + + CScheduleView + + + ALL DAY + + + + + CSettingDialog + + + Sunday + + + + + Monday + + + + + 24-hour clock + + + + + 12-hour clock + + + + + Manual + + + + + 15 mins + + + + + 30 mins + + + + + 1 hour + + + + + 24 hours + + + + + Sync Now + + + + + Last sync + + + + + CTimeEdit + + + (%1 mins) + + + + + (%1 hour) + + + + + (%1 hours) + + + + + CTitleWidget + + + Y + + + + + M + + + + + W + + + + + D + + + + + + Search events and festivals + + + + + CWeekWidget + + + Sun + + + + + Mon + + + + + Tue + + + + + Wed + + + + + Thu + + + + + Fri + + + + + Sat + + + + + CWeekWindow + + + Week + + + + + Y + + + + + CYearScheduleView + + + + All Day + + + + + No event + + + + + CYearWindow + + + Y + + + + + CalendarWindow + + + Calendar + + + + + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. + + + + + Calendarmainwindow + + + Calendar + + + + + Manage + + + + + Privacy Policy + + + + + Syncing... + + + + + Sync successful + + + + + Sync failed, please try later + + + + + CenterWidget + + + All Day + + + + + DAccountDataBase + + + Work + + + + + Life + + + + + Other + + + + + DAlarmManager + + + + + Close button - Đóng lại + Đóng lại - + + One day before start + Một ngày trước khi bắt đầu + + + Remind me tomorrow - Nhắc tôi ngày mai + Nhắc tôi ngày mai - + Remind me later - Nhắc tôi sau + Nhắc tôi sau + + + + 15 mins later + + + + + 1 hour later + + + + + 4 hours later + - + + + + Tomorrow + Ngày mai + + + Schedule Reminder - Lịch trình nhắc nhở + Lịch trình nhắc nhở - - + + %1 to %2 - + - - + + Today - Hôm nay + Hôm nay + + + + DragInfoGraphicsView + + + Edit + - - - Tomorrow - Ngày mai + + Delete + + + + + New event + + + + + New Event + + + + + JobTypeListView + + + You are deleting an event type. + + + + + All events under this type will be deleted and cannot be recovered. + + + + + Cancel + button + + + + + Delete + button + + + + + QObject + + + Account settings + + + + + Account + + + + + Select items to be synced + + + + + Events + + + + + + General settings + + + + + Sync interval + + + + + + Manage calendar + + + + + Calendar account + + + + + + Event types + + + + + General + + + + + First day of week + + + + + Time + + + + + Return + + + Today + Return + Hôm nay + + + + Return Today + + + + + Today + Return Today + Hôm nay + + + + ScheduleTypeEditDlg + + + New event type + + + + + Edit event type + + + + + Name: + + + + + Color: + + + + + Cancel + button + + + + + Save + button + + + + + The name can not only contain whitespaces + + + + + Enter a name please + + + + + Shortcut + + + Help + + + + + Delete event + + + + + Copy + + + + + Cut + + + + + Paste + + + + + Delete + + + + + Select all + + + + + SidebarCalendarWidget + + + Y + + + + + M + + + + + TimeJumpDialog + + + Go + button + + + + + UserloginWidget + + + Sign In + button + + + + + Sign Out + button + + + + + YearFrame + + + Y + + + + + today + + + + + + + + + + Today + Today + Hôm nay - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar-service_zh_CN.ts dde-calendar-5.10.0/translations/dde-calendar-service_zh_CN.ts --- dde-calendar-5.9.1/translations/dde-calendar-service_zh_CN.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar-service_zh_CN.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,86 +1,965 @@ - + + + - JobRemindManager + AccountItem - - One day before start - 提前1天提醒 + Sync successful + + + + Network error + + + + Server exception + + + + Storage full + + + + + AccountManager + + Local account + + + + Event types + + + + + CColorPickerWidget + + Color + + + + Cancel + button + + + + Save + button + + + + + CDayMonthView + + Monday + + + + Tuesday + + + + Wednesday + + + + Thursday + + + + Friday + + + + Saturday + + + + Sunday + + + + + CDayWindow + + Y + + + + M + + + + D + + + + Lunar + + + + + CGraphicsView + + New Event + + + + + CMonthScheduleNumItem + + %1 more + + + + + CMonthView + + New event + + + + New Event + + + + + CMonthWindow + + Y + + + + + CMyScheduleView + + My Event + + + + OK + button + + + + Delete + button + + + + Edit + button + + + + + CPushButton + + New event type + + + + + CScheduleDlg + + New Event + + + + Edit Event + + + + End time must be greater than start time + + + + OK + button + + + + Never + + + + At time of event + + + + 15 minutes before + + + + 30 minutes before + + + + 1 hour before + + + + 1 day before + + + + 2 days before + + + + 1 week before + + + + On start day (9:00 AM) + + + + time(s) + + + + Enter a name please + + + + The name can not only contain whitespaces + + + + Type: + + + + Description: + + + + All Day: + + + + Starts: + + + + Ends: + + + + Remind Me: + + + + Repeat: + + + + End Repeat: + + + + Calendar account: + + + + Calendar account + + + + Type + + + + Description + + + + All Day + + + + Time: + + + + Time + + + + Solar + + + + Lunar + + + + Starts + + + + Ends + + + + Remind Me + + + + Repeat + + + + Daily + + + + Weekdays + + + + Weekly + + + + Monthly + + + + Yearly + + + + End Repeat + + + + After + + + + On + + + + Cancel + button + + + + Save + button + + + + + CScheduleOperation + + All occurrences of a repeating event must have the same all-day status. + - - - - + Do you want to change all occurrences? + + + + Cancel + button + + + + Change All + + + + You are changing the repeating rule of this event. + + + + You are deleting an event. + + + + Are you sure you want to delete this event? + + + + Delete + button + + + + Do you want to delete all occurrences of this event, or only the selected occurrence? + + + + Delete All + + + + Delete Only This Event + + + + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? + + + + Delete All Future Events + + + + You are changing a repeating event. + + + + Do you want to change only this occurrence of the event, or all occurrences? + + + + All + + + + Only This Event + + + + Do you want to change only this occurrence of the event, or this and all future occurrences? + + + + All Future Events + + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + OK + button + + + + + CScheduleSearchDateItem + + Y + + + + M + + + + D + + + + + CScheduleSearchItem + + Edit + + + + Delete + + + + All Day + + + + + CScheduleSearchView + + No search results + + + + + CScheduleView + + ALL DAY + + + + + CSettingDialog + + Sunday + + + + Monday + + + + 24-hour clock + + + + 12-hour clock + + + + Manual + + + + 15 mins + + + + 30 mins + + + + 1 hour + + + + 24 hours + + + + Sync Now + + + + Last sync + + + + + CTimeEdit + + (%1 mins) + + + + (%1 hour) + + + + (%1 hours) + + + + + CTitleWidget + + Y + + + + M + + + + W + + + + D + + + + Search events and festivals + + + + + CWeekWidget + + Sun + + + + Mon + + + + Tue + + + + Wed + + + + Thu + + + + Fri + + + + Sat + + + + + CWeekWindow + + Week + + + + Y + + + + + CYearScheduleView + + All Day + + + + No event + + + + + CYearWindow + + Y + + + + + CalendarWindow + + Calendar + + + + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. + + + + + Calendarmainwindow + + Calendar + + + + Manage + + + + Privacy Policy + + + + Syncing... + + + + Sync successful + + + + Sync failed, please try later + + + + + CenterWidget + + All Day + + + + + DAccountDataBase + + Work + 工作 + + + Life + 生活 + + + Other + 其他 + + + + DAlarmManager + Close button 关 闭 - + One day before start + 提前1天提醒 + + Remind me tomorrow 明天提醒 - Remind me later 稍后提醒 - 15 mins later 15分钟后 - 1 hour later 1小时后 - 4 hours later 4小时后 - + Tomorrow + 明天 + + Schedule Reminder 日程提醒 - - %1 to %2 %1 至 %2 - - Today 今天 + + + DragInfoGraphicsView - - - - Tomorrow - 明天 + Edit + + + + Delete + + + + New event + + + + New Event + - SchedulerDatabase + JobTypeListView - - Work - 工作 + You are deleting an event type. + - - Life - 生活 + All events under this type will be deleted and cannot be recovered. + - - Other - 其他 + Cancel + button + + + + Delete + button + + + + + QObject + + Account settings + + + + Account + + + + Select items to be synced + + + + Events + + + + General settings + + + + Sync interval + + + + Manage calendar + + + + Calendar account + + + + Event types + + + + General + + + + First day of week + + + + Time + + + + + Return + + Today + Return + 今天 + + + + Return Today + + Today + Return Today + 今天 + + + + ScheduleTypeEditDlg + + New event type + + + + Edit event type + + + + Name: + + + + Color: + + + + Cancel + button + + + + Save + button + + + + The name can not only contain whitespaces + + + + Enter a name please + + + + + Shortcut + + Help + + + + Delete event + + + + Copy + + + + Cut + + + + Paste + + + + Delete + + + + Select all + + + + + SidebarCalendarWidget + + Y + + + + M + + + + + TimeJumpDialog + + Go + button + + + + + UserloginWidget + + Sign In + button + + + + Sign Out + button + + + + + YearFrame + + Y + + + + + today + + Today + Today + 今天 - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar-service_zh_HK.ts dde-calendar-5.10.0/translations/dde-calendar-service_zh_HK.ts --- dde-calendar-5.9.1/translations/dde-calendar-service_zh_HK.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar-service_zh_HK.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,86 +1,965 @@ - + + + - JobRemindManager + AccountItem - - One day before start - 提前1天提醒 + Sync successful + + + + Network error + + + + Server exception + + + + Storage full + + + + + AccountManager + + Local account + + + + Event types + + + + + CColorPickerWidget + + Color + + + + Cancel + button + + + + Save + button + + + + + CDayMonthView + + Monday + + + + Tuesday + + + + Wednesday + + + + Thursday + + + + Friday + + + + Saturday + + + + Sunday + + + + + CDayWindow + + Y + + + + M + + + + D + + + + Lunar + + + + + CGraphicsView + + New Event + + + + + CMonthScheduleNumItem + + %1 more + + + + + CMonthView + + New event + + + + New Event + + + + + CMonthWindow + + Y + + + + + CMyScheduleView + + My Event + + + + OK + button + + + + Delete + button + + + + Edit + button + + + + + CPushButton + + New event type + + + + + CScheduleDlg + + New Event + + + + Edit Event + + + + End time must be greater than start time + + + + OK + button + + + + Never + + + + At time of event + + + + 15 minutes before + + + + 30 minutes before + + + + 1 hour before + + + + 1 day before + + + + 2 days before + + + + 1 week before + + + + On start day (9:00 AM) + + + + time(s) + + + + Enter a name please + + + + The name can not only contain whitespaces + + + + Type: + + + + Description: + + + + All Day: + + + + Starts: + + + + Ends: + + + + Remind Me: + + + + Repeat: + + + + End Repeat: + + + + Calendar account: + + + + Calendar account + + + + Type + + + + Description + + + + All Day + + + + Time: + + + + Time + + + + Solar + + + + Lunar + + + + Starts + + + + Ends + + + + Remind Me + + + + Repeat + + + + Daily + + + + Weekdays + + + + Weekly + + + + Monthly + + + + Yearly + + + + End Repeat + + + + After + + + + On + + + + Cancel + button + + + + Save + button + + + + + CScheduleOperation + + All occurrences of a repeating event must have the same all-day status. + - - - - + Do you want to change all occurrences? + + + + Cancel + button + + + + Change All + + + + You are changing the repeating rule of this event. + + + + You are deleting an event. + + + + Are you sure you want to delete this event? + + + + Delete + button + + + + Do you want to delete all occurrences of this event, or only the selected occurrence? + + + + Delete All + + + + Delete Only This Event + + + + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? + + + + Delete All Future Events + + + + You are changing a repeating event. + + + + Do you want to change only this occurrence of the event, or all occurrences? + + + + All + + + + Only This Event + + + + Do you want to change only this occurrence of the event, or this and all future occurrences? + + + + All Future Events + + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + OK + button + + + + + CScheduleSearchDateItem + + Y + + + + M + + + + D + + + + + CScheduleSearchItem + + Edit + + + + Delete + + + + All Day + + + + + CScheduleSearchView + + No search results + + + + + CScheduleView + + ALL DAY + + + + + CSettingDialog + + Sunday + + + + Monday + + + + 24-hour clock + + + + 12-hour clock + + + + Manual + + + + 15 mins + + + + 30 mins + + + + 1 hour + + + + 24 hours + + + + Sync Now + + + + Last sync + + + + + CTimeEdit + + (%1 mins) + + + + (%1 hour) + + + + (%1 hours) + + + + + CTitleWidget + + Y + + + + M + + + + W + + + + D + + + + Search events and festivals + + + + + CWeekWidget + + Sun + + + + Mon + + + + Tue + + + + Wed + + + + Thu + + + + Fri + + + + Sat + + + + + CWeekWindow + + Week + + + + Y + + + + + CYearScheduleView + + All Day + + + + No event + + + + + CYearWindow + + Y + + + + + CalendarWindow + + Calendar + + + + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. + + + + + Calendarmainwindow + + Calendar + + + + Manage + + + + Privacy Policy + + + + Syncing... + + + + Sync successful + + + + Sync failed, please try later + + + + + CenterWidget + + All Day + + + + + DAccountDataBase + + Work + 工作 + + + Life + 生活 + + + Other + 其他 + + + + DAlarmManager + Close button 關 閉 - + One day before start + 提前1天提醒 + + Remind me tomorrow 明天提醒 - Remind me later 稍後提醒 - 15 mins later 15分鐘後 - 1 hour later 1小時後 - 4 hours later 4小時後 - + Tomorrow + 明天 + + Schedule Reminder 日程提醒 - - %1 to %2 %1 至 %2 - - Today 今天 + + + DragInfoGraphicsView - - - - Tomorrow - 明天 + Edit + + + + Delete + + + + New event + + + + New Event + - SchedulerDatabase + JobTypeListView - - Work - 工作 + You are deleting an event type. + - - Life - 生活 + All events under this type will be deleted and cannot be recovered. + - - Other - 其他 + Cancel + button + + + + Delete + button + + + + + QObject + + Account settings + + + + Account + + + + Select items to be synced + + + + Events + + + + General settings + + + + Sync interval + + + + Manage calendar + + + + Calendar account + + + + Event types + + + + General + + + + First day of week + + + + Time + + + + + Return + + Today + Return + 今天 + + + + Return Today + + Today + Return Today + 今天 + + + + ScheduleTypeEditDlg + + New event type + + + + Edit event type + + + + Name: + + + + Color: + + + + Cancel + button + + + + Save + button + + + + The name can not only contain whitespaces + + + + Enter a name please + + + + + Shortcut + + Help + + + + Delete event + + + + Copy + + + + Cut + + + + Paste + + + + Delete + + + + Select all + + + + + SidebarCalendarWidget + + Y + + + + M + + + + + TimeJumpDialog + + Go + button + + + + + UserloginWidget + + Sign In + button + + + + Sign Out + button + + + + + YearFrame + + Y + + + + + today + + Today + Today + 今天 - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar-service_zh_TW.ts dde-calendar-5.10.0/translations/dde-calendar-service_zh_TW.ts --- dde-calendar-5.9.1/translations/dde-calendar-service_zh_TW.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar-service_zh_TW.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,86 +1,965 @@ - + + + - JobRemindManager + AccountItem - - One day before start - 提前1天提醒 + Sync successful + + + + Network error + + + + Server exception + + + + Storage full + + + + + AccountManager + + Local account + + + + Event types + + + + + CColorPickerWidget + + Color + + + + Cancel + button + + + + Save + button + + + + + CDayMonthView + + Monday + + + + Tuesday + + + + Wednesday + + + + Thursday + + + + Friday + + + + Saturday + + + + Sunday + + + + + CDayWindow + + Y + + + + M + + + + D + + + + Lunar + + + + + CGraphicsView + + New Event + + + + + CMonthScheduleNumItem + + %1 more + + + + + CMonthView + + New event + + + + New Event + + + + + CMonthWindow + + Y + + + + + CMyScheduleView + + My Event + + + + OK + button + + + + Delete + button + + + + Edit + button + + + + + CPushButton + + New event type + + + + + CScheduleDlg + + New Event + + + + Edit Event + + + + End time must be greater than start time + + + + OK + button + + + + Never + + + + At time of event + + + + 15 minutes before + + + + 30 minutes before + + + + 1 hour before + + + + 1 day before + + + + 2 days before + + + + 1 week before + + + + On start day (9:00 AM) + + + + time(s) + + + + Enter a name please + + + + The name can not only contain whitespaces + + + + Type: + + + + Description: + + + + All Day: + + + + Starts: + + + + Ends: + + + + Remind Me: + + + + Repeat: + + + + End Repeat: + + + + Calendar account: + + + + Calendar account + + + + Type + + + + Description + + + + All Day + + + + Time: + + + + Time + + + + Solar + + + + Lunar + + + + Starts + + + + Ends + + + + Remind Me + + + + Repeat + + + + Daily + + + + Weekdays + + + + Weekly + + + + Monthly + + + + Yearly + + + + End Repeat + + + + After + + + + On + + + + Cancel + button + + + + Save + button + + + + + CScheduleOperation + + All occurrences of a repeating event must have the same all-day status. + - - - - + Do you want to change all occurrences? + + + + Cancel + button + + + + Change All + + + + You are changing the repeating rule of this event. + + + + You are deleting an event. + + + + Are you sure you want to delete this event? + + + + Delete + button + + + + Do you want to delete all occurrences of this event, or only the selected occurrence? + + + + Delete All + + + + Delete Only This Event + + + + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? + + + + Delete All Future Events + + + + You are changing a repeating event. + + + + Do you want to change only this occurrence of the event, or all occurrences? + + + + All + + + + Only This Event + + + + Do you want to change only this occurrence of the event, or this and all future occurrences? + + + + All Future Events + + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + OK + button + + + + + CScheduleSearchDateItem + + Y + + + + M + + + + D + + + + + CScheduleSearchItem + + Edit + + + + Delete + + + + All Day + + + + + CScheduleSearchView + + No search results + + + + + CScheduleView + + ALL DAY + + + + + CSettingDialog + + Sunday + + + + Monday + + + + 24-hour clock + + + + 12-hour clock + + + + Manual + + + + 15 mins + + + + 30 mins + + + + 1 hour + + + + 24 hours + + + + Sync Now + + + + Last sync + + + + + CTimeEdit + + (%1 mins) + + + + (%1 hour) + + + + (%1 hours) + + + + + CTitleWidget + + Y + + + + M + + + + W + + + + D + + + + Search events and festivals + + + + + CWeekWidget + + Sun + + + + Mon + + + + Tue + + + + Wed + + + + Thu + + + + Fri + + + + Sat + + + + + CWeekWindow + + Week + + + + Y + + + + + CYearScheduleView + + All Day + + + + No event + + + + + CYearWindow + + Y + + + + + CalendarWindow + + Calendar + + + + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. + + + + + Calendarmainwindow + + Calendar + + + + Manage + + + + Privacy Policy + + + + Syncing... + + + + Sync successful + + + + Sync failed, please try later + + + + + CenterWidget + + All Day + + + + + DAccountDataBase + + Work + 工作 + + + Life + 生活 + + + Other + 其他 + + + + DAlarmManager + Close button 關 閉 - + One day before start + 提前1天提醒 + + Remind me tomorrow 明天提醒 - Remind me later 稍後提醒 - 15 mins later 15分鐘後 - 1 hour later 1小時後 - 4 hours later 4小時後 - + Tomorrow + 明天 + + Schedule Reminder 日程提醒 - - %1 to %2 %1 至 %2 - - Today 今天 + + + DragInfoGraphicsView - - - - Tomorrow - 明天 + Edit + + + + Delete + + + + New event + + + + New Event + - SchedulerDatabase + JobTypeListView - - Work - 工作 + You are deleting an event type. + - - Life - 生活 + All events under this type will be deleted and cannot be recovered. + - - Other - 其他 + Cancel + button + + + + Delete + button + + + + + QObject + + Account settings + + + + Account + + + + Select items to be synced + + + + Events + + + + General settings + + + + Sync interval + + + + Manage calendar + + + + Calendar account + + + + Event types + + + + General + + + + First day of week + + + + Time + + + + + Return + + Today + Return + 今天 + + + + Return Today + + Today + Return Today + 今天 + + + + ScheduleTypeEditDlg + + New event type + + + + Edit event type + + + + Name: + + + + Color: + + + + Cancel + button + + + + Save + button + + + + The name can not only contain whitespaces + + + + Enter a name please + + + + + Shortcut + + Help + + + + Delete event + + + + Copy + + + + Cut + + + + Paste + + + + Delete + + + + Select all + + + + + SidebarCalendarWidget + + Y + + + + M + + + + + TimeJumpDialog + + Go + button + + + + + UserloginWidget + + Sign In + button + + + + Sign Out + button + + + + + YearFrame + + Y + + + + + today + + Today + Today + 今天 - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar_si.ts dde-calendar-5.10.0/translations/dde-calendar_si.ts --- dde-calendar-5.9.1/translations/dde-calendar_si.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar_si.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,38 +1,96 @@ - + + + + + AccountItem + + + Sync successful + + + + + Network error + + + + + Server exception + + + + + Storage full + + + + + AccountManager + + + Local account + + + + + Event types + + + + + CColorPickerWidget + + + Color + + + + + Cancel + button + අවලංගු කරන්න + + + + Save + button + සුරකින්න + + CDayMonthView - + Monday සඳුදා - + Tuesday අඟහරුවාදා - + Wednesday බදාදා - + Thursday බ්‍රහස්පතින්දා - + Friday සිකුරාදා - + Saturday සෙනසුරාදා - + Sunday ඉරිදා @@ -40,25 +98,30 @@ CDayWindow - + Y වස - + M මස - + D දින + + + Lunar + + CGraphicsView - + New Event නව හමුවක් @@ -66,7 +129,7 @@ CMonthScheduleNumItem - + %1 more තවත් %1 @@ -74,12 +137,12 @@ CMonthView - + New event නව සිදුවීමක් - + New Event නව හමුවක් @@ -87,7 +150,7 @@ CMonthWindow - + Y වස @@ -95,258 +158,301 @@ CMyScheduleView - + My Event මගේ හමුව - + OK button හරි - + Delete button මකා දමන්න - + Edit button සංස්කරණය කරන්න + CPushButton + + + New event type + + + + CScheduleDlg - - + + + New Event නව හමුවක් - + Edit Event හමුව සංස්කරණය කරන්න - + End time must be greater than start time අවසන් කෙරෙන වේලාව ආරම්භ කෙරෙන වේලාවට වඩා වැඩි විය යුතුය - + OK button හරි - - - - + + + + + + Never කිසිදා නැත - + At time of event හමුව යොදාගත් වේලාවේදී - + 15 minutes before මිනිත්තු 15 කට පෙර - + 30 minutes before මින්ත්තු 30 කට පෙර - + 1 hour before පැය 1 කට පෙර - - + + 1 day before දින 1 කට පෙර - - + + 2 days before දින 2 කට පෙර - - + + 1 week before සති 1 කට පෙර - + On start day (9:00 AM) ඇරඹෙන දින (පෙ.ව 9.00) - - + + Enter a name please + + + + + The name can not only contain whitespaces + + + + + Type: වර්ගය: - - + + Description: විස්තරය: - - + + All Day: දිනය පුරාම: - - + + Starts: අ‍ාරම්භය: - - + + Ends: අවසානය: - - + + Remind Me: මට මතක් කරන්න: - - + + Repeat: නැවත කරන්න: - - + + End Repeat: පුනරාවර්තනය අවසන් කරන්න: - - Type - වර්ගය - - - - Work - කාර්යය + + Calendar account: + - - Life - ජීවිතය + + Calendar account + - - Other - වෙනත් + + Type + වර්ගය - + Description විස්තරය - + All Day දිනය පුරාම - + + Time: + + + + + Time + + + + + Solar + + + + + Lunar + + + + Starts ආරම්භය - + Ends අවසානය - + Remind Me මට මතක් කරන්න - + Repeat පුනරාවර්තන - + + Daily දිනපතා - + + Weekdays සතියේ දින - + + Weekly සති පතා - + + + Monthly මාසිකව - + + + Yearly වාර්ෂිකව - + End Repeat පුනරාවර්තනය අවසන් කරන්න - + After පසුව - + On මත - - - - + + + + time(s) වේලාව (න්) - + Cancel button අවලංගු කරන්න - + Save button සුරකින්න @@ -355,115 +461,126 @@ CScheduleOperation - + All occurrences of a repeating event must have the same all-day status. පුනරාවර්තන හමුවන්ගේ සියලු හමුවන් දිනය පුරා තත්වයේ තිබිය යුතුය. - - + + Do you want to change all occurrences? ඔබට සියලු පුනරාවර්ථනයන් වෙනස් කිරීමද අවශ්‍යද? - - + + Change All සියල්ල වෙනස් කරන්න - + You are changing the repeating rule of this event. ඔබ මෙම හමුවේ පුනරාවර්තන රීතීන් වෙනස් කරමින් සිටී. - - - + + + You are deleting an event. ඔබ හමුවක් මකා දමයි. - + Are you sure you want to delete this event? මෙම හමුව මකා දැමීමට අවශ්‍ය බව ඔබට විශ්වාසද? - - - - - - - + + + + + + + Cancel button අවලංගු කරන්න - + Delete button මකා දමන්න - + Do you want to delete all occurrences of this event, or only the selected occurrence? මෙම හමුවේ සියලුම පුනරාවර්තනයන් මකා දැමීමට ඔබට අවශ්‍යද, නැතහොත් තෝරාගත් හමුව පමණක්ද? - + Delete All සියල්ල මකා දමන්න - - + + Delete Only This Event මෙම හමුව පමණක් මකා දමන්න - + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? ඔබට මෙම හමුව සහ මෙම හමුවේ සැලසුම් කල සියලු හමුවන් මකා දැමීමට අවශ්‍යද, නැතහොත් මෙම තෝරාගත් හමුව පමණද? - + Delete All Future Events සියලු යොදාගත් හමුවන් මකා දමන්න - - + + You are changing a repeating event. ඔබ පුනරාවර්තන හමුවක් වෙනස් කරමින් සිටී. - + Do you want to change only this occurrence of the event, or all occurrences? ඔබට මෙම පුනරාවර්තන හමුවේ මෙම හමුව පමණක් වෙනස් කිරීමට අවශ්‍යද, නැතිනම් සියලු පුනරාවර්තනයන් වෙනස් කල යුතුද? - + All සියල්ලම - - + + Only This Event මෙම හමුව පමණි - + Do you want to change only this occurrence of the event, or this and all future occurrences? ඔබට මෙම හමුව සහ මෙම හමුවේ සැලසුම් කල සියලු හමුවන් වෙනස් කිරීමට අවශ්‍යද, නැතහොත් මෙම තෝරාගත් හමුව පමණද? - + All Future Events සියලුම අනාගත හමුවන් + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + + OK + button + හරි + CScheduleSearchDateItem @@ -486,17 +603,17 @@ CScheduleSearchItem - + Edit සංස්කරණය කරන්න - + Delete මකා දමන්න - + All Day දිනය පුරාම @@ -512,61 +629,163 @@ CScheduleView - + ALL DAY දිනය පුරාම + CSettingDialog + + + Sunday + ඉරිදා + + + + Monday + සඳුදා + + + + 24-hour clock + + + + + 12-hour clock + + + + + Manual + + + + + 15 mins + + + + + 30 mins + + + + + 1 hour + + + + + 24 hours + + + + + Sync Now + + + + + Last sync + + + + CTimeEdit - + (%1 mins) - + - + (%1 hour) - + - + (%1 hours) - + CTitleWidget - + Y වස - + M මස - + W සති - + D දින + + + + Search events and festivals + + + + + CWeekWidget + + + Sun + + + + + Mon + + + + + Tue + + + + + Wed + + + + + Thu + + + + + Fri + + + + + Sat + + CWeekWindow - + Week සතිය - + Y වර් @@ -574,13 +793,13 @@ CYearScheduleView + - All Day දිනය පුරාම - + No event හමුවන් නොමැත @@ -588,7 +807,7 @@ CYearWindow - + Y වර් @@ -596,12 +815,12 @@ CalendarWindow - + Calendar දින දසුන - + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. දින දසුන යනු දිනයන් බැලීමට මෙන්ම ජීවිතයේ සෑම දෙයක්ම සැලසුම් කිරීමට ‍භාවිත කල හැකි දෛනික සැලසුම්කරන යෙදවුමකි. @@ -609,46 +828,246 @@ Calendarmainwindow - + Calendar දින දසුන + + + Manage + + + + + Privacy Policy + + + + + Syncing... + + + + + Sync successful + + + + + Sync failed, please try later + + CenterWidget - + All Day දිනය පුරාම + DAccountDataBase + + + Work + කාර්යය + + + + Life + ජීවිතය + + + + Other + වෙනත් + + + + DAlarmManager + + + + + + Close + button + + + + + One day before start + + + + + Remind me tomorrow + + + + + Remind me later + + + + + 15 mins later + + + + + 1 hour later + + + + + 4 hours later + + + + + + + Tomorrow + + + + + Schedule Reminder + + + + + + %1 to %2 + + + + + + Today + අද + + + DragInfoGraphicsView - + Edit සංස්කරණය කරන්න - + Delete මකා දමන්න - + New event නව සිදුවීමක් - + New Event නව හමුවක් + JobTypeListView + + + You are deleting an event type. + + + + + All events under this type will be deleted and cannot be recovered. + + + + + Cancel + button + අවලංගු කරන්න + + + + Delete + button + + + + + QObject + + + Account settings + + + + + Account + + + + + Select items to be synced + + + + + Events + + + + + + General settings + + + + + Sync interval + + + + + + Manage calendar + + + + + Calendar account + + + + + + Event types + + + + + General + + + + + First day of week + + + + + Time + + + + Return - + Today Return අද @@ -657,56 +1076,138 @@ Return Today - - - + + + Today Return Today අද + ScheduleTypeEditDlg + + + New event type + + + + + Edit event type + + + + + Name: + + + + + Color: + + + + + Cancel + button + අවලංගු කරන්න + + + + Save + button + සුරකින්න + + + + The name can not only contain whitespaces + + + + + Enter a name please + + + + Shortcut - + Help උදව් - + Delete event හමුව මකා දමන්න - + Copy පිටපත් කරන්න - + Cut කපන්න - + Paste අලවන්න - + Delete මකන්න - + Select all සියල්ල ලකුණු කරන්න + SidebarCalendarWidget + + + Y + + + + + M + මස + + + + TimeJumpDialog + + + Go + button + + + + + UserloginWidget + + + Sign In + button + + + + + Sign Out + button + + + + YearFrame - + Y වර් @@ -714,17 +1215,17 @@ today - - - - - - - - + + + + + + + + Today Today අද - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar_sk.ts dde-calendar-5.10.0/translations/dde-calendar_sk.ts --- dde-calendar-5.9.1/translations/dde-calendar_sk.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar_sk.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,38 +1,96 @@ - + + + + + AccountItem + + + Sync successful + + + + + Network error + + + + + Server exception + + + + + Storage full + + + + + AccountManager + + + Local account + + + + + Event types + + + + + CColorPickerWidget + + + Color + + + + + Cancel + button + Zrušiť + + + + Save + button + Uložiť + + CDayMonthView - + Monday Pondelok - + Tuesday Utorok - + Wednesday Streda - + Thursday Štvrtok - + Friday Piatok - + Saturday Sobota - + Sunday Nedeľa @@ -40,25 +98,30 @@ CDayWindow - + Y R - + M M - + D D + + + Lunar + + CGraphicsView - + New Event Nová udalosť @@ -66,7 +129,7 @@ CMonthScheduleNumItem - + %1 more ešte %1 @@ -74,12 +137,12 @@ CMonthView - + New event Nová udalosť - + New Event Nová udalosť @@ -87,7 +150,7 @@ CMonthWindow - + Y R @@ -95,258 +158,301 @@ CMyScheduleView - + My Event Moja udalosť - + OK button OK - + Delete button Vymazať - + Edit button Upraviť + CPushButton + + + New event type + + + + CScheduleDlg - - + + + New Event Nová udalosť - + Edit Event Upraviť udalosť - + End time must be greater than start time Čas ukončenia musí byť neskôr ako čas začiatku - + OK button OK - - - - + + + + + + Never Nikdy - + At time of event V čase udalosti - + 15 minutes before 15 minút pred - + 30 minutes before 30 minút pred - + 1 hour before 1 hodinu pred - - + + 1 day before 1 deň pred - - + + 2 days before 2 dni pred - - + + 1 week before 1 týždeň pred - + On start day (9:00 AM) V deň začiatku (9:00) - - + + Enter a name please + + + + + The name can not only contain whitespaces + + + + + Type: Typ: - - + + Description: Popis: - - + + All Day: Celý deň: - - + + Starts: Začína: - - + + Ends: Končí: - - + + Remind Me: Pripomenúť - - + + Repeat: Opakovať: - - + + End Repeat: Ukončiť opakovanie: - - Type - Typ - - - - Work - Práca + + Calendar account: + - - Life - Život + + Calendar account + - - Other - Ostatné + + Type + Typ - + Description Popis - + All Day Celý deň - + + Time: + + + + + Time + + + + + Solar + + + + + Lunar + + + + Starts Začína - + Ends Končí - + Remind Me Pripomenúť - + Repeat Opakovať - + + Daily Denne - + + Weekdays Pracovné dni - + + Weekly Týždenne - + + + Monthly Mesačne - + + + Yearly Ročne - + End Repeat Ukončiť opakovanie - + After Po - + On Zapnuté - - - - + + + + time(s) krát - + Cancel button Zrušiť - + Save button Uložiť @@ -355,115 +461,126 @@ CScheduleOperation - + All occurrences of a repeating event must have the same all-day status. Všetky výskyty opakujúcej sa udalosti musia mať rovnaký celodenný stav. - - + + Do you want to change all occurrences? Chcete zmeniť všetky výskyty? - - + + Change All Zmeniť všetky - + You are changing the repeating rule of this event. Meníte pravidlo opakovania tejto udalosti. - - - + + + You are deleting an event. Odstraňujete udalosť. - + Are you sure you want to delete this event? Naozaj chcete odstrániť túto udalosť? - - - - - - - + + + + + + + Cancel button Zrušiť - + Delete button Vymazať - + Do you want to delete all occurrences of this event, or only the selected occurrence? Chcete odstrániť všetky výskyty tejto udalosti alebo iba vybratú udalosť? - + Delete All Vymazať všetko - - + + Delete Only This Event Vymazať iba túto udalosť - + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? Chcete odstrániť tento a všetky budúce výskyty tejto udalosti alebo iba vybratú udalosť? - + Delete All Future Events Vymazať všetky budúce udalosti - - + + You are changing a repeating event. Meníte opakujúcu sa udalosť. - + Do you want to change only this occurrence of the event, or all occurrences? Chcete zmeniť iba tento výskyt udalosti alebo všetky jej výskyty? - + All Všetky - - + + Only This Event Iba táto udalosť - + Do you want to change only this occurrence of the event, or this and all future occurrences? Chcete zmeniť iba tento výskyt udalosti alebo túto a aj všetky budúce udalosti? - + All Future Events Všetky budúce udalosti + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + + OK + button + OK + CScheduleSearchDateItem @@ -486,17 +603,17 @@ CScheduleSearchItem - + Edit Upraviť - + Delete Vymazať - + All Day Celý deň @@ -512,61 +629,163 @@ CScheduleView - + ALL DAY CELÝ DEŇ + CSettingDialog + + + Sunday + Nedeľa + + + + Monday + Pondelok + + + + 24-hour clock + + + + + 12-hour clock + + + + + Manual + + + + + 15 mins + + + + + 30 mins + + + + + 1 hour + + + + + 24 hours + + + + + Sync Now + + + + + Last sync + + + + CTimeEdit - + (%1 mins) - + - + (%1 hour) - + - + (%1 hours) - + CTitleWidget - + Y R - + M M - + W T - + D D + + + + Search events and festivals + + + + + CWeekWidget + + + Sun + + + + + Mon + + + + + Tue + + + + + Wed + + + + + Thu + + + + + Fri + + + + + Sat + + CWeekWindow - + Week Týždeň - + Y R @@ -574,13 +793,13 @@ CYearScheduleView + - All Day Celý deň - + No event Žiadna udalosť @@ -588,7 +807,7 @@ CYearWindow - + Y R @@ -596,12 +815,12 @@ CalendarWindow - + Calendar Kalendár - + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. Kalendár je nástroj na prezeranie dátumov a tiež inteligentný denný plánovač na plánovanie všetkých vecí v živote. @@ -609,46 +828,246 @@ Calendarmainwindow - + Calendar Kalendár + + + Manage + + + + + Privacy Policy + + + + + Syncing... + + + + + Sync successful + + + + + Sync failed, please try later + + CenterWidget - + All Day Celý deň + DAccountDataBase + + + Work + Práca + + + + Life + Život + + + + Other + Ostatné + + + + DAlarmManager + + + + + + Close + button + + + + + One day before start + + + + + Remind me tomorrow + + + + + Remind me later + + + + + 15 mins later + + + + + 1 hour later + + + + + 4 hours later + + + + + + + Tomorrow + + + + + Schedule Reminder + + + + + + %1 to %2 + + + + + + Today + Dnes + + + DragInfoGraphicsView - + Edit Upraviť - + Delete Vymazať - + New event Nová udalosť - + New Event Nová udalosť + JobTypeListView + + + You are deleting an event type. + + + + + All events under this type will be deleted and cannot be recovered. + + + + + Cancel + button + Zrušiť + + + + Delete + button + Vymazať + + + + QObject + + + Account settings + + + + + Account + + + + + Select items to be synced + + + + + Events + + + + + + General settings + + + + + Sync interval + + + + + + Manage calendar + + + + + Calendar account + + + + + + Event types + + + + + General + + + + + First day of week + + + + + Time + + + + Return - + Today Return Dnes @@ -657,56 +1076,138 @@ Return Today - - - + + + Today Return Today Dnes + ScheduleTypeEditDlg + + + New event type + + + + + Edit event type + + + + + Name: + + + + + Color: + + + + + Cancel + button + Zrušiť + + + + Save + button + Uložiť + + + + The name can not only contain whitespaces + + + + + Enter a name please + + + + Shortcut - + Help Nápoveda - + Delete event Vymazať udalosť - + Copy Kopírovať - + Cut Vystrihnúť - + Paste Prilepiť - + Delete Vymazať - + Select all Vybrať všetko + SidebarCalendarWidget + + + Y + R + + + + M + M + + + + TimeJumpDialog + + + Go + button + + + + + UserloginWidget + + + Sign In + button + + + + + Sign Out + button + + + + YearFrame - + Y R @@ -714,17 +1215,17 @@ today - - - - - - - - + + + + + + + + Today Today Dnes - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar_sl.ts dde-calendar-5.10.0/translations/dde-calendar_sl.ts --- dde-calendar-5.9.1/translations/dde-calendar_sl.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar_sl.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,38 +1,96 @@ - + + + + + AccountItem + + + Sync successful + + + + + Network error + + + + + Server exception + + + + + Storage full + + + + + AccountManager + + + Local account + + + + + Event types + + + + + CColorPickerWidget + + + Color + + + + + Cancel + button + Prekini + + + + Save + button + Shrani + + CDayMonthView - + Monday Ponedeljek - + Tuesday Torek - + Wednesday Sreda - + Thursday Četrtek - + Friday Petek - + Saturday Sobota - + Sunday Nedelja @@ -40,25 +98,30 @@ CDayWindow - + Y L - + M M - + D D + + + Lunar + + CGraphicsView - + New Event Nov dogodek @@ -66,7 +129,7 @@ CMonthScheduleNumItem - + %1 more %1 več @@ -74,12 +137,12 @@ CMonthView - + New event Nov dogodek - + New Event Nov dogodek @@ -87,7 +150,7 @@ CMonthWindow - + Y L @@ -95,258 +158,301 @@ CMyScheduleView - + My Event Moj dogodek - + OK button V redu - + Delete button Izbriši - + Edit button Uredi + CPushButton + + + New event type + + + + CScheduleDlg - - + + + New Event Nov dogodek - + Edit Event Uredi dogodek - + End time must be greater than start time Končni čas mora biti kasnejši od začetnega - + OK button V redu - - - - + + + + + + Never Nikoli - + At time of event Ob času dogodka - + 15 minutes before 15 minut prej - + 30 minutes before 30 minut prej - + 1 hour before 1 uro prej - - + + 1 day before 1 dan prej - - + + 2 days before 2 dni prej - - + + 1 week before 1 teden prej - + On start day (9:00 AM) Na dan dogodka (9:00) - - + + Enter a name please + + + + + The name can not only contain whitespaces + + + + + Type: Vrsta: - - + + Description: Opis: - - + + All Day: Cel dan: - - + + Starts: Začetek: - - + + Ends: Konec: - - + + Remind Me: Opomnik: - - + + Repeat: Ponovi: - - + + End Repeat: Konec ponavljanj: - - Type - Vrsta - - - - Work - Delo + + Calendar account: + - - Life - Življenje + + Calendar account + - - Other - Drugo + + Type + Vrsta - + Description Opis - + All Day Cel dan - + + Time: + + + + + Time + + + + + Solar + + + + + Lunar + + + + Starts Začetek - + Ends Konec - + Remind Me Opomnik - + Repeat Ponovitev - + + Daily Dnevno - + + Weekdays Ob dnevih - + + Weekly Tedensko - + + + Monthly Mesečno - + + + Yearly Letno - + End Repeat Konec ponavljanj - + After Po - + On Na - - - - + + + + time(s) čas (s) - + Cancel button Prekini - + Save button Shrani @@ -355,115 +461,126 @@ CScheduleOperation - + All occurrences of a repeating event must have the same all-day status. Vsako pojavljanje ponavljajočega dogodka mora imeti enak celodnevni status. - - + + Do you want to change all occurrences? Želite spremeniti vsa pojavljanja? - - + + Change All Spremeni vse - + You are changing the repeating rule of this event. Spreminjate ponavljajoče se pravilo za ta dogodek. - - - + + + You are deleting an event. Brišete dogodek. - + Are you sure you want to delete this event? Želite res izbrisati ta dogodek? - - - - - - - + + + + + + + Cancel button Prekini - + Delete button Izbriši - + Do you want to delete all occurrences of this event, or only the selected occurrence? Želite izbrisati vsa pojavljanja tega dogodka, ali zgolj izbrana? - + Delete All Izbriši vse - - + + Delete Only This Event Izbriši le ta dogodek - + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? Želite izbrisati to in vsa ostala pojavljanja tega dogodka ali zgolj izbrana pojavljanja? - + Delete All Future Events Izbriši vse prihodnje dogodke - - + + You are changing a repeating event. Spreminjate ponavljajoči se dogodek. - + Do you want to change only this occurrence of the event, or all occurrences? Želite spremeniti le to pojavitev dogodka ali vsa pojavljanja? - + All Vse - - + + Only This Event Zgolj ta dogodek - + Do you want to change only this occurrence of the event, or this and all future occurrences? Ali želite spremeniti le ta pojav dogodka ali vse prihodnje pojave? - + All Future Events Vse prihodnje dogodke + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + + OK + button + V redu + CScheduleSearchDateItem @@ -486,17 +603,17 @@ CScheduleSearchItem - + Edit Uredi - + Delete Izbriši - + All Day Cel dan @@ -512,61 +629,163 @@ CScheduleView - + ALL DAY CEL DAN + CSettingDialog + + + Sunday + Nedelja + + + + Monday + Ponedeljek + + + + 24-hour clock + + + + + 12-hour clock + + + + + Manual + + + + + 15 mins + + + + + 30 mins + + + + + 1 hour + + + + + 24 hours + + + + + Sync Now + + + + + Last sync + + + + CTimeEdit - + (%1 mins) - + - + (%1 hour) - + - + (%1 hours) - + CTitleWidget - + Y L - + M M - + W T - + D D + + + + Search events and festivals + + + + + CWeekWidget + + + Sun + + + + + Mon + + + + + Tue + + + + + Wed + + + + + Thu + + + + + Fri + + + + + Sat + + CWeekWindow - + Week Teden - + Y L @@ -574,13 +793,13 @@ CYearScheduleView + - All Day Cel dan - + No event Ni dogodka @@ -588,7 +807,7 @@ CYearWindow - + Y L @@ -596,12 +815,12 @@ CalendarWindow - + Calendar Koledar - + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. Koledar je orodje za prikaz datumov, a tudi pametni terminski planer za načrtovanje življenjskih dogodkov. @@ -609,46 +828,246 @@ Calendarmainwindow - + Calendar Koledar + + + Manage + + + + + Privacy Policy + + + + + Syncing... + + + + + Sync successful + + + + + Sync failed, please try later + + CenterWidget - + All Day Cel dan + DAccountDataBase + + + Work + Delo + + + + Life + Življenje + + + + Other + Drugo + + + + DAlarmManager + + + + + + Close + button + + + + + One day before start + + + + + Remind me tomorrow + + + + + Remind me later + + + + + 15 mins later + + + + + 1 hour later + + + + + 4 hours later + + + + + + + Tomorrow + + + + + Schedule Reminder + + + + + + %1 to %2 + + + + + + Today + Danes + + + DragInfoGraphicsView - + Edit Uredi - + Delete Izbriši - + New event Nov dogodek - + New Event Nov dogodek + JobTypeListView + + + You are deleting an event type. + + + + + All events under this type will be deleted and cannot be recovered. + + + + + Cancel + button + Prekini + + + + Delete + button + Izbriši + + + + QObject + + + Account settings + + + + + Account + + + + + Select items to be synced + + + + + Events + + + + + + General settings + + + + + Sync interval + + + + + + Manage calendar + + + + + Calendar account + + + + + + Event types + + + + + General + + + + + First day of week + + + + + Time + + + + Return - + Today Return Danes @@ -657,56 +1076,138 @@ Return Today - - - + + + Today Return Today Danes + ScheduleTypeEditDlg + + + New event type + + + + + Edit event type + + + + + Name: + + + + + Color: + + + + + Cancel + button + Prekini + + + + Save + button + Shrani + + + + The name can not only contain whitespaces + + + + + Enter a name please + + + + Shortcut - + Help Pomoč - + Delete event Izbriši dogodek - + Copy Kopiraj - + Cut Izreži - + Paste Prilepi - + Delete Izbriši - + Select all Izberi vse + SidebarCalendarWidget + + + Y + + + + + M + M + + + + TimeJumpDialog + + + Go + button + + + + + UserloginWidget + + + Sign In + button + + + + + Sign Out + button + + + + YearFrame - + Y Y @@ -714,17 +1215,17 @@ today - - - - - - - - + + + + + + + + Today Today Danes - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar_sq.ts dde-calendar-5.10.0/translations/dde-calendar_sq.ts --- dde-calendar-5.9.1/translations/dde-calendar_sq.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar_sq.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,66 +1,96 @@ - + + + - CColorPickerWidget + AccountItem - - Color - + + Sync successful + Njëkohësim i suksesshëm - - Cancel - button - + + Network error + Gabim rrjeti - Cancel - + + Server exception + Përjashtim në shërbyes - - Save + + Storage full + Depozitë e plotë + + + + AccountManager + + + Local account + Llogari vendore + + + + Event types + Lloje veprimtarish + + + + CColorPickerWidget + + + Color + Ngjyrë + + + + Cancel button - + Anuloje + Save - + button + Ruaje CDayMonthView - + Monday E hënë - + Tuesday E martë - + Wednesday E mërkurë - + Thursday E enjte - + Friday E premte - + Saturday E shtunë - + Sunday E diel @@ -68,25 +98,30 @@ CDayWindow - + Y V - + M M - + D D + + + Lunar + Hënor + CGraphicsView - + New Event Veprimtari e Re @@ -94,7 +129,7 @@ CMonthScheduleNumItem - + %1 more %1 më tepër @@ -102,12 +137,12 @@ CMonthView - + New event Veprimtari e re - + New Event Veprimtari e Re @@ -115,7 +150,7 @@ CMonthWindow - + Y V @@ -123,24 +158,24 @@ CMyScheduleView - + My Event Veprimtari e Imja - + OK button OK - + Delete button Fshije - + Edit button Përpunojeni @@ -149,287 +184,275 @@ CPushButton - + New event type - + Lloj i ri veprimtarie CScheduleDlg - - + + + New Event Veprimtari e Re - + Edit Event Përpunoni Veprimtari - + End time must be greater than start time Koha e përfundimit duhet të jetë më e madhe se koha e fillimit - - + OK button OK - - You have selected a leap month, and will be reminded according to the rules of the lunar calendar. - - - - - - - - - + + + + + + Never Kurrë - + At time of event Në kohën e veprimtarisë - + 15 minutes before 15 minuta para - + 30 minutes before 30 minuta para - + 1 hour before 1 orë para - - + + 1 day before 1 ditë para - - + + 2 days before 2 ditë para - - + + 1 week before 1 javë para - + On start day (9:00 AM) Ditën e fillimit (9:00 AM) - - Enter a name please - + + + + + time(s) + kohë(ra) - - The name can not only contain whitespaces - + + Enter a name please + Ju lutemi, jepni një emër - - The name already exists - + + The name can not only contain whitespaces + Emri s’mund të përmbajë vetëm hapësira të zbrazëta - - + + Type: Lloj: - - + + Description: Përshkrim: - - + + All Day: Tërë Ditën: - - + + Starts: Fillon më: - - + + Ends: Përfundon më: - - + + Remind Me: Kujtoma: - - + + Repeat: Përsërite: - - + + End Repeat: Përfundoje Përsëritjen më: - - Type - Lloj - - - Work - Pune + + Calendar account: + Llogari Kalendari: - Life - Jete + + Calendar account + Llogari Kalendari - Other - Tjetër + + Type + Lloj - + Description Përshkrim - + All Day Tërë Ditën - + Time: - + Kohë: - + Time - + Kohë - + Solar - + Diellore - + Lunar - + Hënore - + Starts Fillon më - + Ends Përfundon më - + Remind Me Kujtoma më - + Repeat Përsërite - - + + Daily Ditore - - + + Weekdays Ditë të javës - - + + Weekly Javore - - - + + + Monthly Mujore - - - + + + Yearly Vjetore - + End Repeat Përfundoje Përsëritjen Më - + After Pas - + On - - - - - time(s) - kohë(ra) - - - + Cancel button Anuloje - + Save button Ruaje @@ -438,130 +461,141 @@ CScheduleOperation - + All occurrences of a repeating event must have the same all-day status. Krejt përsëritjet e një veprimtarie që përsëritet duhet të kenë të njëjtën gjendje gjithë-ditën. - - + + Do you want to change all occurrences? Doni të ndryshohen krejt përsëritjet? - - + + + + + + + + Cancel + button + Anuloje + + + + Change All Ndryshoji Krejt - + You are changing the repeating rule of this event. Po ndryshoni rregullin e përsëritjes së kësaj veprimtarie. - - - + + + You are deleting an event. Po fshini një veprimtari. - + Are you sure you want to delete this event? Jeni i sigurt se doni të fshihet kjo veprimtari? - - - - - - - - Cancel - button - Anuloje - - - + Delete button Fshije - + Do you want to delete all occurrences of this event, or only the selected occurrence? Doni të fshihen krejt përsëritjet e kësaj veprimtarie, apo vetëm përsëritjen e përzgjedhur? - + Delete All Fshiji Krejt - - + + Delete Only This Event Fshi Vetëm Këtë Veprimtari - + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? Doni të fshihet kjo dhe krejt përsëritjet në të ardhmen të kësaj veprimtarie, apo vetëm përsëritjen e përzgjedhur? - + Delete All Future Events Fshi Krejt Veprimtaritë e Ardhshme - - + + You are changing a repeating event. Po ndryshoni një veprimtari me përsëritje. - + Do you want to change only this occurrence of the event, or all occurrences? Doni të ndryshohet vetëm kjo përsëritje e veprimtarisë, apo krejt përsëritjet? - + All Krejt - - + + Only This Event Vetëm Këtë Veprimtari - + Do you want to change only this occurrence of the event, or this and all future occurrences? Doni të ndryshohet vetëm kjo përsëritje e veprimtarisë, apo këtë dhe krejt përsëritjet në të ardhmen? - + All Future Events Krejt Veprimtaritë e Ardhshme + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + Keni përzgjedhur një muaj të brishtë dhe do t’ju kujtohet në përputhje me rregullat e kalendarit hënor. + + + + OK + button + OK + CScheduleSearchDateItem - + Y V - + M M - + D D @@ -569,17 +603,17 @@ CScheduleSearchItem - + Edit Përpunojeni - + Delete Fshije - + All Day Tërë Ditën @@ -587,7 +621,7 @@ CScheduleSearchView - + No search results S’ka përfundime kërkimi @@ -595,25 +629,83 @@ CScheduleView - + ALL DAY TËRË DITËN + CSettingDialog + + + Sunday + E diel + + + + Monday + E hënë + + + + 24-hour clock + Sahat 24-orësh + + + + 12-hour clock + Sahat 12-orësh + + + + Manual + Dorazi + + + + 15 mins + 15 min. + + + + 30 mins + 30 min. + + + + 1 hour + 1 orë + + + + 24 hours + 24 orë + + + + Sync Now + Njëkohësoje Tani + + + + Last sync + Njëkohësimi i fundit + + + CTimeEdit - + (%1 mins) - + (%1 min.) - + (%1 hour) (%1 orë) - + (%1 hours) (%1 orë) @@ -621,35 +713,79 @@ CTitleWidget - + Y V - + M M - + W J - + D D + + + + Search events and festivals + Kërkoni në veprimtari dhe festivale + + + + CWeekWidget + + + Sun + Die + + + + Mon + Hën + + + + Tue + Mar + + + + Wed + Mër + + + + Thu + Enj + + + + Fri + Pre + + + + Sat + Sht + CWeekWindow - + Week Javë - + Y V @@ -657,13 +793,13 @@ CYearScheduleView + - All Day Tërë Ditën - + No event S’ka veprimtari @@ -671,7 +807,7 @@ CYearWindow - + Y V @@ -679,12 +815,12 @@ CalendarWindow - + Calendar Kalendar - + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. Kalendari është një mjet për parje datash, dhe gjithashtu edhe një planifikues i përditshëm për të vënë në plan krejt gjërat e jetës së përditshme. @@ -692,43 +828,147 @@ Calendarmainwindow - + Calendar Kalendar - + Manage - + Administrojeni + + + + Privacy Policy + Rregulla Privatësie + + + + Syncing... + Po njëkohësohet… + + + + Sync successful + Njëkohësim i suksesshëm + + + + Sync failed, please try later + Njëkohësimi dështoi, ju lutemi, provoni më vonë CenterWidget - + All Day Tërë Ditën + DAccountDataBase + + + Work + + + + + Life + + + + + Other + + + + + DAlarmManager + + + + + + Close + button + + + + + One day before start + + + + + Remind me tomorrow + + + + + Remind me later + + + + + 15 mins later + + + + + 1 hour later + + + + + 4 hours later + + + + + + + Tomorrow + + + + + Schedule Reminder + + + + + + %1 to %2 + + + + + + Today + Sot + + + DragInfoGraphicsView - + Edit Përpunim - + Delete Fshije - + New event Veprimtari e re - + New Event Veprimtari e Re @@ -736,45 +976,98 @@ JobTypeListView - + You are deleting an event type. - + Po fshini një lloj veprimtarish. - + All events under this type will be deleted and cannot be recovered. - + Krejt veprimtaritë nën këtë lloj do të fshihen dhe s’mund të rikthehen. - + Cancel button - + Anuloje - + Delete button - + Fshije QObject - + + Manage calendar - + Administroni kalendar - + + Event types - + Lloje veprimtarish + + + + Account settings + Rregullime llogarie + + + + Account + Llogari + + + + Select items to be synced + Përzgjidhni objekte për t’u njëkohësuar + + + + Events + Veprimtari + + + + + General settings + Rregullime të përgjithshme + + + + Sync interval + Interval njëkohësimi + + + + Calendar account + Llogari Kalendari + + + + General + Të përgjithshme + + + + First day of week + Ditën e parë të javës + + + + Time + Kohë Return - + Today Return Sot @@ -783,9 +1076,9 @@ Return Today - - - + + + Today Return Today Sot @@ -794,95 +1087,127 @@ ScheduleTypeEditDlg - + New event type - + Lloj i ri veprimtarie - + Edit event type - + Përpunoni lloj veprimtarie - + Name: - + Emër: - + Color: - + Ngjyrë: - + Cancel button - + Anuloje - + Save button - - - - - Enter a name please - + Ruaje - + The name can not only contain whitespaces - + Emri s’mund të përmbajë vetëm hapësira të zbrazëta - - The name already exists - + + Enter a name please + Ju lutemi, jepni një emër Shortcut - + Help Ndihmë - + Delete event Fshije veprimtarinë - + Copy Kopjoje - + Cut Prije - + Paste Ngjite - + Delete Fshije - + Select all Përzgjidhi krejt + SidebarCalendarWidget + + + Y + Y + + + + M + M + + + + TimeJumpDialog + + + Go + button + Jepi + + + + UserloginWidget + + + Sign In + button + Hyni + + + + Sign Out + button + Dilni + + + YearFrame - + Y V @@ -890,17 +1215,17 @@ today - - - - - - - - + + + + + + + + Today Today Sot - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar_sr.ts dde-calendar-5.10.0/translations/dde-calendar_sr.ts --- dde-calendar-5.9.1/translations/dde-calendar_sr.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar_sr.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,38 +1,96 @@ - + + + + + AccountItem + + + Sync successful + + + + + Network error + + + + + Server exception + + + + + Storage full + + + + + AccountManager + + + Local account + + + + + Event types + + + + + CColorPickerWidget + + + Color + + + + + Cancel + button + Откажи + + + + Save + button + Сачувај + + CDayMonthView - + Monday Понедељак - + Tuesday Уторак - + Wednesday Среда - + Thursday Четвртак - + Friday Петак - + Saturday Субота - + Sunday Недеља @@ -40,25 +98,30 @@ CDayWindow - + Y Г - + M М - + D Д + + + Lunar + + CGraphicsView - + New Event Нови догађај @@ -66,7 +129,7 @@ CMonthScheduleNumItem - + %1 more Још %1 @@ -74,12 +137,12 @@ CMonthView - + New event Нови догађај - + New Event Нови догађај @@ -87,7 +150,7 @@ CMonthWindow - + Y Г @@ -95,258 +158,301 @@ CMyScheduleView - + My Event Мој догађај - + OK button У реду - + Delete button Обриши - + Edit button Уреди + CPushButton + + + New event type + + + + CScheduleDlg - - + + + New Event Нови догађај - + Edit Event Уреди догађај - + End time must be greater than start time Крајње време мора бити након почетног - + OK button У реду - - - - + + + + + + Never Никад - + At time of event У време догађаја - + 15 minutes before 15 минута раније - + 30 minutes before 30 минута раније - + 1 hour before 1 сат раније - - + + 1 day before 1 дан раније - - + + 2 days before 2 дана раније - - + + 1 week before 1 седмица раније - + On start day (9:00 AM) На дан почетка (9:00 АМ) - - + + Enter a name please + + + + + The name can not only contain whitespaces + + + + + Type: Врста: - - + + Description: Опис: - - + + All Day: Цео дан: - - + + Starts: Почетак: - - + + Ends: Крај: - - + + Remind Me: Подсетник: - - + + Repeat: Понови: - - + + End Repeat: Окончај: - - Type - Врста - - - - Work - Посао + + Calendar account: + - - Life - Живот + + Calendar account + - - Other - Остало + + Type + Врста - + Description Опис - + All Day Цео дан - + + Time: + + + + + Time + + + + + Solar + + + + + Lunar + + + + Starts Почетак - + Ends Крај - + Remind Me Подсетник - + Repeat Понови - + + Daily Свакодневно - + + Weekdays Радним данима - + + Weekly Седмично - + + + Monthly Месечно - + + + Yearly Годишње - + End Repeat Окончај - + After Након - + On Укључ. - - - - + + + + time(s) пут(а) - + Cancel button Откажи - + Save button Сачувај @@ -355,115 +461,126 @@ CScheduleOperation - + All occurrences of a repeating event must have the same all-day status. Све појаве понављајућег догађаја морају имати исти целодневни статус. - - + + Do you want to change all occurrences? Желите ли да промените све појаве? - - + + Change All Промени све - + You are changing the repeating rule of this event. Мењате правило понављања овог догађаја. - - - + + + You are deleting an event. Бришете догађај. - + Are you sure you want to delete this event? Заиста желите да обришете овај догађај? - - - - - - - + + + + + + + Cancel button Откажи - + Delete button Обриши - + Do you want to delete all occurrences of this event, or only the selected occurrence? Да ли желите да обришете све појаве овог догађаја или само изабрану ставку? - + Delete All Обриши све - - + + Delete Only This Event Обриши само овај догађај - + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? Желите ли да обришете ову и све будуће појаве овог догађаја или само изабрану ставку? - + Delete All Future Events Обриши све будуће догађаје - - + + You are changing a repeating event. Мењате понаљајући догађај. - + Do you want to change only this occurrence of the event, or all occurrences? Желите ли да промените само ову појаву догађаја или све? - + All Све - - + + Only This Event Само овај догађај - + Do you want to change only this occurrence of the event, or this and all future occurrences? Желите ли да промените ову појаву догађаја или ову појаву и све будуће појаве? - + All Future Events Сви будући догађаји + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + + OK + button + У реду + CScheduleSearchDateItem @@ -486,17 +603,17 @@ CScheduleSearchItem - + Edit Уреди - + Delete Обриши - + All Day Цео дан @@ -512,61 +629,163 @@ CScheduleView - + ALL DAY ЦЕО ДАН + CSettingDialog + + + Sunday + Недеља + + + + Monday + Понедељак + + + + 24-hour clock + + + + + 12-hour clock + + + + + Manual + + + + + 15 mins + + + + + 30 mins + + + + + 1 hour + + + + + 24 hours + + + + + Sync Now + + + + + Last sync + + + + CTimeEdit - + (%1 mins) - + - + (%1 hour) - + - + (%1 hours) - + CTitleWidget - + Y Г - + M М - + W С - + D Д + + + + Search events and festivals + + + + + CWeekWidget + + + Sun + + + + + Mon + + + + + Tue + + + + + Wed + + + + + Thu + + + + + Fri + + + + + Sat + + CWeekWindow - + Week Седмица - + Y Г @@ -574,13 +793,13 @@ CYearScheduleView + - All Day Цео дан - + No event Нема догађаја @@ -588,7 +807,7 @@ CYearWindow - + Y Г @@ -596,12 +815,12 @@ CalendarWindow - + Calendar Календар - + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. Календар је алат за приказ датума и паметани роковник за подсећање на све догађаје у животу. @@ -609,46 +828,246 @@ Calendarmainwindow - + Calendar Календар + + + Manage + + + + + Privacy Policy + + + + + Syncing... + + + + + Sync successful + + + + + Sync failed, please try later + + CenterWidget - + All Day Цео дан + DAccountDataBase + + + Work + Посао + + + + Life + Живот + + + + Other + Остало + + + + DAlarmManager + + + + + + Close + button + + + + + One day before start + + + + + Remind me tomorrow + + + + + Remind me later + + + + + 15 mins later + + + + + 1 hour later + + + + + 4 hours later + + + + + + + Tomorrow + + + + + Schedule Reminder + + + + + + %1 to %2 + + + + + + Today + Данас + + + DragInfoGraphicsView - + Edit Уреди - + Delete Обриши - + New event Нови догађај - + New Event Нови догађај + JobTypeListView + + + You are deleting an event type. + + + + + All events under this type will be deleted and cannot be recovered. + + + + + Cancel + button + Откажи + + + + Delete + button + Обриши + + + + QObject + + + Account settings + + + + + Account + + + + + Select items to be synced + + + + + Events + + + + + + General settings + + + + + Sync interval + + + + + + Manage calendar + + + + + Calendar account + + + + + + Event types + + + + + General + + + + + First day of week + + + + + Time + + + + Return - + Today Return Данас @@ -657,56 +1076,138 @@ Return Today - - - + + + Today Return Today Данас + ScheduleTypeEditDlg + + + New event type + + + + + Edit event type + + + + + Name: + + + + + Color: + + + + + Cancel + button + Откажи + + + + Save + button + Сачувај + + + + The name can not only contain whitespaces + + + + + Enter a name please + + + + Shortcut - + Help Помоћ - + Delete event Обриши догађај - + Copy Копирај - + Cut Исеци - + Paste Убаци - + Delete Обриши - + Select all Изабери све + SidebarCalendarWidget + + + Y + Г + + + + M + М + + + + TimeJumpDialog + + + Go + button + + + + + UserloginWidget + + + Sign In + button + + + + + Sign Out + button + + + + YearFrame - + Y Г @@ -714,17 +1215,17 @@ today - - - - - - - - + + + + + + + + Today Today Данас - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar_th.ts dde-calendar-5.10.0/translations/dde-calendar_th.ts --- dde-calendar-5.9.1/translations/dde-calendar_th.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar_th.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,38 +1,96 @@ - + + + + + AccountItem + + + Sync successful + + + + + Network error + + + + + Server exception + + + + + Storage full + + + + + AccountManager + + + Local account + + + + + Event types + + + + + CColorPickerWidget + + + Color + + + + + Cancel + button + ยกเลิก + + + + Save + button + บันทึก + + CDayMonthView - + Monday วันจันทร์ - + Tuesday วันอังคาร - + Wednesday วันพุธ - + Thursday วันพฤหัสบดี - + Friday วันศุกร์ - + Saturday วันศุกร์ - + Sunday วันอาทิตย์ @@ -40,25 +98,30 @@ CDayWindow - + Y - + M - + D + + + Lunar + + CGraphicsView - + New Event กิจกรรมใหม่ @@ -66,7 +129,7 @@ CMonthScheduleNumItem - + %1 more อีก 1% @@ -74,12 +137,12 @@ CMonthView - + New event เหตุการณ์ใหม่ - + New Event กิจกรรมใหม่ @@ -87,7 +150,7 @@ CMonthWindow - + Y @@ -95,258 +158,301 @@ CMyScheduleView - + My Event กิจกรรมของฉัน - + OK button ตกลง - + Delete button ลบ - + Edit button แก้ไข + CPushButton + + + New event type + + + + CScheduleDlg - - + + + New Event กิจกรรมใหม่ - + Edit Event แก้ไขกิจกรรม - + End time must be greater than start time เวลาสิ้นสุดต้องมากกว่าเวลาเริ่มต้น - + OK button ตกลง - - - - + + + + + + Never ไม่เคย - + At time of event ในช่วงเวลาของกิจกรรม - + 15 minutes before 15 นาทีก่อน - + 30 minutes before 30 นาทีก่อน - + 1 hour before 1 ชั่วโมงก่อน - - + + 1 day before 1 วันก่อน - - + + 2 days before 2 วันก่อน - - + + 1 week before 1 สัปดาห์ก่อน - + On start day (9:00 AM) ทําการในเวลา (09:00 น.) - - + + Enter a name please + + + + + The name can not only contain whitespaces + + + + + Type: ประเภท: - - + + Description: รายละเอียด: - - + + All Day: ทั้งวัน: - - + + Starts: เริ่ม: - - + + Ends: สิ้นสุด: - - + + Remind Me: เตือนฉัน: - - + + Repeat: ทำซ้ำ: - - + + End Repeat: สิ้นสุดการทำซ้ำ: - - Type - ประเภท - - - - Work - งาน + + Calendar account: + - - Life - ชีวิต + + Calendar account + - - Other - อื่น ๆ + + Type + ประเภท - + Description รายละเอียด - + All Day ทั้งวัน - + + Time: + + + + + Time + + + + + Solar + + + + + Lunar + + + + Starts เริ่ม - + Ends สิ้นสุด - + Remind Me เตือนฉัน - + Repeat ทำซ้ำ - + + Daily ประจำวัน - + + Weekdays วันธรรมดา - + + Weekly รายสัปดาห์ - + + + Monthly รายเดือน - + + + Yearly รายปี - + End Repeat สิ้นสุดการทำซ้ำ - + After หลังจาก - + On - + - - - - + + + + time(s) เวลา (s) - + Cancel button ยกเลิก - + Save button บันทึก @@ -355,115 +461,126 @@ CScheduleOperation - + All occurrences of a repeating event must have the same all-day status. กิจกรรมที่เกิดขึ้นซ้ำทั้งหมดต้องมีสถานะตลอดทั้งวันเหมือนกัน - - + + Do you want to change all occurrences? คุณต้องการเปลี่ยนกิจกรรมทั้งหมดหรือไม่? - - + + Change All เปลี่ยนทั้งหมด - + You are changing the repeating rule of this event. คุณกำลังเปลี่ยนกฎการทำซ้ำของกิจกรรมนี้ - - - + + + You are deleting an event. คุณกำลังลบกิจกรรม - + Are you sure you want to delete this event? คุณแน่ใจหรือไม่ว่าคุณต้องการที่จะลบกิจกรรมนี้ - - - - - - - + + + + + + + Cancel button ยกเลิก - + Delete button ลบ - + Do you want to delete all occurrences of this event, or only the selected occurrence? คุณต้องการลบกิจกรรมทั้งหมดที่เกิดขึ้นหรือเฉพาะกิจกรรมที่เลือกไว้หรือไม่ ? - + Delete All ลบทั้งหมด - - + + Delete Only This Event ลบเฉพาะกิจกรรมนี้ - + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? คุณต้องการลบกิจกรรมนี้และกิจกรรมที่จะเกิดขึ้นในอนาคตทั้งหมดหรือเฉพาะกิจกรรมที่เลือก ? - + Delete All Future Events ลบกิจกรรมในอนาคตทั้งหมด - - + + You are changing a repeating event. คุณกำลังเปลี่ยนกิจกรรมที่เกิดซ้ำ - + Do you want to change only this occurrence of the event, or all occurrences? คุณต้องการเปลี่ยนเฉพาะกิจกรรมนี้หรือกิจกรรมทั้งหมดหรือไม่ - + All ทั้งหมด - - + + Only This Event กิจกรรมนี้เท่านั้น - + Do you want to change only this occurrence of the event, or this and all future occurrences? คุณต้องการเปลี่ยนเฉพาะกิจกรรมที่เกิดขึ้นนี้หรือกิจกรรมนี้และกิจกรรมในอนาคตทั้งหมดหรือไม่ - + All Future Events กิจกรรมในอนาคตทั้งหมด + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + + OK + button + ตกลง + CScheduleSearchDateItem @@ -486,17 +603,17 @@ CScheduleSearchItem - + Edit แก้ไข - + Delete ลบ - + All Day ทั้งวัน @@ -512,61 +629,163 @@ CScheduleView - + ALL DAY ทั้งวัน + CSettingDialog + + + Sunday + วันอาทิตย์ + + + + Monday + วันจันทร์ + + + + 24-hour clock + + + + + 12-hour clock + + + + + Manual + + + + + 15 mins + + + + + 30 mins + + + + + 1 hour + + + + + 24 hours + + + + + Sync Now + + + + + Last sync + + + + CTimeEdit - + (%1 mins) - + - + (%1 hour) - + - + (%1 hours) - + CTitleWidget - + Y - + M - + W - + - + D + + + + Search events and festivals + + + + + CWeekWidget + + + Sun + + + + + Mon + + + + + Tue + + + + + Wed + + + + + Thu + + + + + Fri + + + + + Sat + + CWeekWindow - + Week สัปดาห์ - + Y @@ -574,13 +793,13 @@ CYearScheduleView + - All Day ทั้งวัน - + No event ไม่มีกิจกรรม @@ -588,7 +807,7 @@ CYearWindow - + Y @@ -596,12 +815,12 @@ CalendarWindow - + Calendar ปฏิทิน - + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. ปฏิทินเป็นเครื่องมือในการดูวันที่และยังเป็นนักวางแผนรายวันที่ชาญฉลาดเพื่อกำหนดเวลาทุกสิ่งในชีวิต @@ -609,46 +828,246 @@ Calendarmainwindow - + Calendar ปฏิทิน + + + Manage + + + + + Privacy Policy + + + + + Syncing... + + + + + Sync successful + + + + + Sync failed, please try later + + CenterWidget - + All Day ทั้งวัน + DAccountDataBase + + + Work + งาน + + + + Life + ชีวิต + + + + Other + อื่น ๆ + + + + DAlarmManager + + + + + + Close + button + + + + + One day before start + + + + + Remind me tomorrow + + + + + Remind me later + + + + + 15 mins later + + + + + 1 hour later + + + + + 4 hours later + + + + + + + Tomorrow + + + + + Schedule Reminder + + + + + + %1 to %2 + + + + + + Today + วันนี้ + + + DragInfoGraphicsView - + Edit แก้ไข - + Delete ลบ - + New event กิจกรรมใหม่ - + New Event กิจกรรมใหม่ + JobTypeListView + + + You are deleting an event type. + + + + + All events under this type will be deleted and cannot be recovered. + + + + + Cancel + button + ยกเลิก + + + + Delete + button + ลบ + + + + QObject + + + Account settings + + + + + Account + + + + + Select items to be synced + + + + + Events + + + + + + General settings + + + + + Sync interval + + + + + + Manage calendar + + + + + Calendar account + + + + + + Event types + + + + + General + + + + + First day of week + + + + + Time + + + + Return - + Today Return วันนี้ @@ -657,56 +1076,138 @@ Return Today - - - + + + Today Return Today วันนี้ + ScheduleTypeEditDlg + + + New event type + + + + + Edit event type + + + + + Name: + + + + + Color: + + + + + Cancel + button + ยกเลิก + + + + Save + button + บันทึก + + + + The name can not only contain whitespaces + + + + + Enter a name please + + + + Shortcut - + Help วิธีใช้ - + Delete event ลบกิจกรรม - + Copy ทำสำเนา - + Cut ตัด - + Paste วาง - + Delete ลบ - + Select all เลือกทั้งหมด + SidebarCalendarWidget + + + Y + + + + + M + + + + + TimeJumpDialog + + + Go + button + + + + + UserloginWidget + + + Sign In + button + + + + + Sign Out + button + + + + YearFrame - + Y @@ -714,17 +1215,17 @@ today - - - - - - - - + + + + + + + + Today Today วันนี้ - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar_tr.ts dde-calendar-5.10.0/translations/dde-calendar_tr.ts --- dde-calendar-5.9.1/translations/dde-calendar_tr.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar_tr.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,66 +1,96 @@ - + + + + + AccountItem + + + Sync successful + Senkronizasyon başarılı + + + + Network error + Ağ hatası + + + + Server exception + Sunucu istisnası + + + + Storage full + Hafıza dolu + + + + AccountManager + + + Local account + Yerel hesap + + + + Event types + Etkinlik türleri + + CColorPickerWidget - + Color Renk - + Cancel button İptal - + Save button Kaydet - - Cancel - - - - Save - - CDayMonthView - + Monday Pazartesi - + Tuesday Salı - + Wednesday Çarşamba - + Thursday Perşembe - + Friday Cuma - + Saturday Cumartesi - + Sunday Pazar @@ -68,25 +98,30 @@ CDayWindow - + Y Y - + M A - + D G + + + Lunar + Ay + CGraphicsView - + New Event Yeni Etkinlik @@ -94,7 +129,7 @@ CMonthScheduleNumItem - + %1 more %1 daha fazla @@ -102,12 +137,12 @@ CMonthView - + New event Yeni etkinlik - + New Event Yeni Etkinlik @@ -115,7 +150,7 @@ CMonthWindow - + Y Y @@ -123,24 +158,24 @@ CMyScheduleView - + My Event Etkinliğim - + OK button Tamam - + Delete button Sil - + Edit button Düzenle @@ -149,7 +184,7 @@ CPushButton - + New event type Yeni etkinlik türü @@ -157,273 +192,267 @@ CScheduleDlg - - + + + New Event Yeni Etkinlik - + Edit Event Etkinliği Düzenle - + End time must be greater than start time Bitiş zamanı başlangıç ​​zamanından büyük olmalıdır - + OK button Tamam - - - - - - + + + + + + Never Asla - + At time of event Etkinlik anında - + 15 minutes before 15 dakika önce - + 30 minutes before 30 dakika önce - + 1 hour before 1 saat önce - + 1 day before 1 gün önce - + 2 days before 2 gün önce - + 1 week before 1 hafta önce - + On start day (9:00 AM) Başlangıç ​​gününde (09:00) - + + + + + time(s) + zaman(lar) + + + Enter a name please Lütfen bir ad girin - + The name can not only contain whitespaces Ad sadece boşluk karakterlerinden oluşamaz - - The name already exists - Bu az zaten var - - - - + + Type: Tür: - - + + Description: Açıklama: - - + + All Day: Tüm Gün: - - + + Starts: Başlangıç: - - + + Ends: Bitiş: - - + + Remind Me: Hatırlat: - - + + Repeat: Tekrar: - - + + End Repeat: Tekrar Sonu: - - Type - Tür - - - Work - İş + + Calendar account: + Takvim hesabı: - Life - Yaşam + + Calendar account + Takvim hesabı - Other - Diğer + + Type + Tür - + Description Açıklama - + All Day Tüm Gün - + Time: Zaman: - + Time Zaman - + Solar Güneş - + Lunar Ay - + Starts Başlangıç - + Ends Bitiş - + Remind Me Hatırlat - + Repeat Tekrar - - + + Daily Günlük - - + + Weekdays Hafta içi - - + + Weekly Haftalık - - - + + + Monthly Aylık - - - + + + Yearly Yıllık - + End Repeat Tekrar Sonu - + After Sonra - + On Açık - - - - - time(s) - zaman(lar) - - - + Cancel button İptal - + Save button Kaydet @@ -432,141 +461,141 @@ CScheduleOperation - + All occurrences of a repeating event must have the same all-day status. Tekrarlanan bir etkinliğin tüm tekrarlamaları, tüm gün boyunca aynı duruma sahip olmalıdır. - - + + Do you want to change all occurrences? Tüm tekrarlamaları değiştirmek ister misiniz? - - + + + + + + + + Cancel + button + İptal + + + + Change All Tümünü Değiştir - + You are changing the repeating rule of this event. Bu etkinliğin tekrarlama kuralını değiştiriyorsunuz. - - - + + + You are deleting an event. Bir etkinliği siliyorsunuz. - + Are you sure you want to delete this event? Bu etkinliği silmek istediğinizden emin misiniz? - - - - - - - Cancel - button - İptal - - - Delete button Sil - + Do you want to delete all occurrences of this event, or only the selected occurrence? Bu olayın tüm tekrarlarını mı yoksa yalnızca seçilen olayı mı silmek istiyorsun? - + Delete All Tümünü Sil - - + + Delete Only This Event Yalnızca Bu Etkinliği Sil - + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? Bunu ve bu olayın gelecekteki tüm tekrarlarını mı yoksa yalnızca seçilen olayı mı silmek istiyorsunuz? - + Delete All Future Events Gelecekteki Tüm Etkinlikleri Sil - - + + You are changing a repeating event. Tekrarlanan bir etkinliği değiştiriyorsunuz. - + Do you want to change only this occurrence of the event, or all occurrences? Etkinliğin yalnızca bu tekrarlamasını mı yoksa tüm tekrarlamalarını mı değiştirmek istiyorsunuz? - + All Tümü - - + + Only This Event Sadece Bu Etkinlik - + Do you want to change only this occurrence of the event, or this and all future occurrences? Yalnızca etkinliğin bu etkinliğini mi, yoksa bunu ve gelecekteki tüm etkinlikleri değiştirmek istiyorsunuz? - + All Future Events Gelecekteki Tüm Etkinlikler - + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. - + Artık bir ay seçtiniz ve ay takvimi kurallarına göre hatırlatılacak. - + OK button - + Tamam CScheduleSearchDateItem - + Y Y - + M A - + D G @@ -574,17 +603,17 @@ CScheduleSearchItem - + Edit Düzenle - + Delete Sil - + All Day Tüm Gün @@ -592,7 +621,7 @@ CScheduleSearchView - + No search results Arama sonucu bulunamadı @@ -600,25 +629,83 @@ CScheduleView - + ALL DAY TÜM GÜN + CSettingDialog + + + Sunday + Pazar + + + + Monday + Pazartesi + + + + 24-hour clock + 24 saatlik zaman + + + + 12-hour clock + 12 saatlik zaman + + + + Manual + Manuel + + + + 15 mins + 15 Dakika + + + + 30 mins + 30 Dakika + + + + 1 hour + 1 Saat + + + + 24 hours + 24 Saat + + + + Sync Now + Şimdi senkronize et + + + + Last sync + Son senkronizasyon + + + CTimeEdit - + (%1 mins) (%1 dakika) - + (%1 hour) (%1 saat) - + (%1 hours) (%1 saat) @@ -626,35 +713,79 @@ CTitleWidget - + Y Y - + M A - + W H - + D G + + + + Search events and festivals + Etkinlikleri ve bayramları ara + + + + CWeekWidget + + + Sun + Pazar + + + + Mon + Pazartesi + + + + Tue + Salı + + + + Wed + Çarşamba + + + + Thu + Perşembe + + + + Fri + Cuma + + + + Sat + Cumartesi + CWeekWindow - + Week Hafta - + Y Y @@ -662,13 +793,13 @@ CYearScheduleView + - All Day Tüm Gün - + No event Etkinlik yok @@ -676,7 +807,7 @@ CYearWindow - + Y Y @@ -684,12 +815,12 @@ CalendarWindow - + Calendar Takvim - + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. Takvim tarihleri ​​görüntülemek için bir araçtır ve aynı zamanda hayattaki her şeyi planlamak için akıllı bir günlük planlayıcısıdır. @@ -697,43 +828,147 @@ Calendarmainwindow - + Calendar Takvim - + Manage Yönet + + + Privacy Policy + Gizlilik Politikası + + + + Syncing... + Eşitleniyor... + + + + Sync successful + Senkronizasyon başarılı + + + + Sync failed, please try later + Eşitleme başarısız, lütfen daha sonra deneyin + CenterWidget - + All Day Tüm Gün + DAccountDataBase + + + Work + + + + + Life + + + + + Other + + + + + DAlarmManager + + + + + + Close + button + + + + + One day before start + + + + + Remind me tomorrow + + + + + Remind me later + + + + + 15 mins later + + + + + 1 hour later + + + + + 4 hours later + + + + + + + Tomorrow + + + + + Schedule Reminder + + + + + + %1 to %2 + + + + + + Today + Bugün + + + DragInfoGraphicsView - + Edit Düzenle - + Delete Sil - + New event Yeni etkinlik - + New Event Yeni Etkinlik @@ -741,23 +976,23 @@ JobTypeListView - + You are deleting an event type. Bir etkinlik türünü siliyorsunuz. - + All events under this type will be deleted and cannot be recovered. Bu türün altındaki etkinlikler silinir ve geri getirilemez. - + Cancel button İptal - + Delete button Sil @@ -766,20 +1001,73 @@ QObject - + + Manage calendar Takvimi yönet - + + Event types Etkinlik türleri + + + Account settings + Hesap ayarları + + + + Account + Hesap + + + + Select items to be synced + Senkronize edilecek öğeyi seçin + + + + Events + Etkinlikler + + + + + General settings + Genel ayarlar + + + + Sync interval + Senkronizasyon aralığı + + + + Calendar account + Takvim hesabı + + + + General + Genel + + + + First day of week + Haftanın ilk günü + + + + Time + Zaman + Return - + Today Return Bugün @@ -788,9 +1076,9 @@ Return Today - - - + + + Today Return Today Bugün @@ -799,95 +1087,127 @@ ScheduleTypeEditDlg - + New event type Yeni etkinlik türü - + Edit event type Etkinlik türünü düzenle - + Name: Ad: - + Color: Renk: - + Cancel button İptal - + Save button Kaydet - - Enter a name please - Lütfen bir ad girin - - - + The name can not only contain whitespaces Ad sadece boşluk karakterlerinden oluşamaz - - The name already exists - Bu az zaten var + + Enter a name please + Lütfen bir ad girin Shortcut - + Help Yardım - + Delete event Etkinliği sil - + Copy Kopyala - + Cut Kes - + Paste Yapıştır - + Delete Sil - + Select all Tümünü seç + SidebarCalendarWidget + + + Y + Y + + + + M + A + + + + TimeJumpDialog + + + Go + button + Git + + + + UserloginWidget + + + Sign In + button + Giriş + + + + Sign Out + button + Çıkış + + + YearFrame - + Y Y @@ -895,17 +1215,17 @@ today - - - - - - - - + + + + + + + + Today Today Bugün - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar_ug.ts dde-calendar-5.10.0/translations/dde-calendar_ug.ts --- dde-calendar-5.9.1/translations/dde-calendar_ug.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar_ug.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,38 +1,96 @@ - + + + + + AccountItem + + + Sync successful + + + + + Network error + + + + + Server exception + + + + + Storage full + + + + + AccountManager + + + Local account + + + + + Event types + + + + + CColorPickerWidget + + + Color + + + + + Cancel + button + بىكار قىلىش + + + + Save + button + ساقلاش + + CDayMonthView - + Monday دۈشەنبە - + Tuesday سەيشەنبە - + Wednesday چارشەنبە - + Thursday پەيشەنبە - + Friday جۈمە - + Saturday شەنبە - + Sunday يەكشەنبە @@ -40,25 +98,30 @@ CDayWindow - + Y يىلى - + M ئاي - + D كۈنى + + + Lunar + + CGraphicsView - + New Event يېڭى كۈنتەرتىپ قۇرۇش @@ -66,7 +129,7 @@ CMonthScheduleNumItem - + %1 more يەنە %1 تۈر بار @@ -74,12 +137,12 @@ CMonthView - + New event كۈنتەرتىپ قۇرۇش - + New Event يېڭى كۈنتەرتىپ قۇرۇش @@ -87,7 +150,7 @@ CMonthWindow - + Y يىلى @@ -95,258 +158,301 @@ CMyScheduleView - + My Event كۈنتەرتىپىم - + OK button تامام - + Delete button ئۆچۈرۈش - + Edit button تەھرىرلەش + CPushButton + + + New event type + + + + CScheduleDlg - - + + + New Event كۈنتەرتىپ قۇرۇش - + Edit Event كۈنتەرتىپنى تەھرىرلەش - + End time must be greater than start time ئاخىرلىشىش ۋاقتى باشلىنىش ۋاقتىدىن كېيىن بولۇشى كېرەك - + OK button تامام - - - - + + + + + + Never ھەرگىز - + At time of event كۈتەرتىپ باشلانغاندا - + 15 minutes before 15 مىنۇت بۇرۇن - + 30 minutes before 30 مىنۇت بۇرۇن - + 1 hour before 1 سائەت بۇرۇن - - + + 1 day before 1 كۈن بۇرۇن - - + + 2 days before 2 كۈن بۇرۇن - - + + 1 week before 1 ھەپتە بۇرۇن - + On start day (9:00 AM) كۈنتەرتىپ باشلانغان كۈن (چۈشتىن بۇرۇن 9 دا) - - + + Enter a name please + + + + + The name can not only contain whitespaces + + + + + Type: تىپى: - - + + Description: مەزمۇنى: - - + + All Day: پۈتۈن كۈن: - - + + Starts: باشلىنىدىغان ۋاقىت: - - + + Ends: ئاخىرلىشىدىغان ۋاقىت: - - + + Remind Me: ئەسكەرتىش: - - + + Repeat: قايتىلاش: - - + + End Repeat: قايتىلاشنى ئاخىرلاشتۇرۇش: - - Type - تىپ - - - - Work - خىزمەت + + Calendar account: + - - Life - تۇرمۇش + + Calendar account + - - Other - باشقا + + Type + تىپ - + Description مەزمۇن - + All Day پۈتۈن كۈن - + + Time: + + + + + Time + + + + + Solar + + + + + Lunar + + + + Starts باشلىنىدىغان ۋاقىت - + Ends ئاخىرلىشىدىغان ۋاقىت - + Remind Me ئەسكەرتىش - + Repeat قايتىلاش - + + Daily ھەر كۈنى - + + Weekdays خىزمەت كۈنى - + + Weekly ھەر ھەپتە - + + + Monthly ھەر ئاي - + + + Yearly ھەر يىلى - + End Repeat قايتىلاشنى ئاخىرلاشتۇرۇش - + After دىن - + On غىچە ۋاقىت - - - - + + + + time(s) ۋاقىت - + Cancel button بىكار قىلىش - + Save button ساقلاش @@ -355,115 +461,126 @@ CScheduleOperation - + All occurrences of a repeating event must have the same all-day status. تەكرارلانغان كۈنتەرتىپتىكى بارلىق تەكرارلىنىش چوقۇم پۈتۈن كۈنلۈك ھالەتتە بولۇشى كېرەك. - - + + Do you want to change all occurrences? بارلىق تەكرارلاشلارنى ئۆزگەرتمەكچىمۇ؟ - - + + Change All ھەممىنى ئۆزگەرتىش - + You are changing the repeating rule of this event. كۈنتەرتىپنىڭ تەكرارلىنىش قائىدىسىنى ئۆزگەرتىۋاتىسىز. - - - + + + You are deleting an event. كۈنتەرتىپنى ئۆچۈرۈۋاتىسىز. - + Are you sure you want to delete this event? بۇ كۈنتەرتىپنى ئۆچۈرمەكچىمۇ؟ - - - - - - - + + + + + + + Cancel button بىكار قىلىش - + Delete button ئۆچۈرۈش - + Do you want to delete all occurrences of this event, or only the selected occurrence? بۇ كۈنتەرتىپتىكى بارلىق تەكرارلىنىشىنى ئۆچۈرەمسىز ياكى پەقەت تاللانغان تەكرارلاشلارنىلا ئۆچۈرەمسىز؟ - + Delete All ھەممىنى ئۆچۈرۈش - - + + Delete Only This Event مۇشۇنىلا ئۆچۈرۈرش - + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? بۇ كۈنتەرتىپتىكى تەكرارلانغان ۋە كەلگۈسىدە تەكرارلىنىدىغانلىرى ئۆچۈرەمسىز ياكى تاللانغان تەكرارلاشنىلا ئۆچۈرەمسىز؟ - + Delete All Future Events بارلىق كۈنتەرتىپنى ئۆچۈرۈش - - + + You are changing a repeating event. قايتىلىنىدىغان كۈنتەرتىپنى ئۆزگەرتىۋاتىسىز. - + Do you want to change only this occurrence of the event, or all occurrences? بۇ كۈنتەرتىپتىكى بارلىق تەكرارلىنىشىنى ئۆزگەرتەمسىز ياكى پەقەت تاللانغان تەكرارلاشلارنىلا ئۆزگەرتەمسىز؟ - + All ھەممىنى - - + + Only This Event تاللانغىنىنى - + Do you want to change only this occurrence of the event, or this and all future occurrences? بۇ كۈنتەرتىپتىكى تەكرارلانغان ۋە كەلگۈسىدە تەكرارلىنىدىغانلىرى ئۆزگەرتەمسىز ياكى تاللانغان تەكرارلاشنىلا ئۆزگەرتەمسىز؟ - + All Future Events بارلىق كۈنتەرتىپلەر + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + + OK + button + تامام + CScheduleSearchDateItem @@ -486,17 +603,17 @@ CScheduleSearchItem - + Edit تەھرىرلەش - + Delete ئۆچۈرۈش - + All Day پۈتۈن كۈن @@ -512,61 +629,163 @@ CScheduleView - + ALL DAY پۈتۈن كۈن + CSettingDialog + + + Sunday + يەكشەنبە + + + + Monday + دۈشەنبە + + + + 24-hour clock + + + + + 12-hour clock + + + + + Manual + + + + + 15 mins + + + + + 30 mins + + + + + 1 hour + + + + + 24 hours + + + + + Sync Now + + + + + Last sync + + + + CTimeEdit - + (%1 mins) - + - + (%1 hour) - + - + (%1 hours) - + CTitleWidget - + Y يىل - + M ئاي - + W ھەپتە - + D كۈن + + + + Search events and festivals + + + + + CWeekWidget + + + Sun + + + + + Mon + + + + + Tue + + + + + Wed + + + + + Thu + + + + + Fri + + + + + Sat + + CWeekWindow - + Week ھەپتە - + Y يىلى @@ -574,13 +793,13 @@ CYearScheduleView + - All Day پۈتۈن كۈن - + No event كۈنتەرتىپ يوق @@ -588,7 +807,7 @@ CYearWindow - + Y يىلى @@ -596,12 +815,12 @@ CalendarWindow - + Calendar كالېندار - + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. كالېندار چېسلا كۆرۈش، كۈنتەرتىپ باشقۇرۇشتا ئىشلىتىلىدىغان كىچىك قورال. @@ -609,46 +828,246 @@ Calendarmainwindow - + Calendar كالېندار + + + Manage + + + + + Privacy Policy + + + + + Syncing... + + + + + Sync successful + + + + + Sync failed, please try later + + CenterWidget - + All Day پۈتۈن كۈن + DAccountDataBase + + + Work + خىزمەت + + + + Life + تۇرمۇش + + + + Other + باشقا + + + + DAlarmManager + + + + + + Close + button + + + + + One day before start + + + + + Remind me tomorrow + + + + + Remind me later + + + + + 15 mins later + + + + + 1 hour later + + + + + 4 hours later + + + + + + + Tomorrow + + + + + Schedule Reminder + + + + + + %1 to %2 + + + + + + Today + + + + DragInfoGraphicsView - + Edit تەھرىرلەش - + Delete ئۆچۈرۈش - + New event يېڭى كۈنتەرتىپ قۇرۇش - + New Event كۈنتەرتىپ قۇرۇش + JobTypeListView + + + You are deleting an event type. + + + + + All events under this type will be deleted and cannot be recovered. + + + + + Cancel + button + بىكار قىلىش + + + + Delete + button + ئۆچۈرۈش + + + + QObject + + + Account settings + + + + + Account + + + + + Select items to be synced + + + + + Events + + + + + + General settings + + + + + Sync interval + + + + + + Manage calendar + + + + + Calendar account + + + + + + Event types + + + + + General + + + + + First day of week + + + + + Time + + + + Return - + Today Return بۈگۈنگە قايتىش @@ -657,56 +1076,138 @@ Return Today - - - + + + Today Return Today بۈگۈنگە قايتىش + ScheduleTypeEditDlg + + + New event type + + + + + Edit event type + + + + + Name: + + + + + Color: + + + + + Cancel + button + بىكار قىلىش + + + + Save + button + ساقلاش + + + + The name can not only contain whitespaces + + + + + Enter a name please + + + + Shortcut - + Help ياردەم - + Delete event كۈنتەرتىپنى ئۆچۈرۈش - + Copy كۆچۈرۈش - + Cut كېسىش - + Paste چاپلاش - + Delete ئۆچۈرۈش - + Select all ھەممىنى تاللاش + SidebarCalendarWidget + + + Y + + + + + M + ئاي + + + + TimeJumpDialog + + + Go + button + + + + + UserloginWidget + + + Sign In + button + + + + + Sign Out + button + + + + YearFrame - + Y يىلى @@ -714,17 +1215,17 @@ today - - - - - - - - + + + + + + + + Today Today بۈگۈن - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar_uk.ts dde-calendar-5.10.0/translations/dde-calendar_uk.ts --- dde-calendar-5.9.1/translations/dde-calendar_uk.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar_uk.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,66 +1,96 @@ - + + + + + AccountItem + + + Sync successful + Успішна синхронізація + + + + Network error + Помилка мережі + + + + Server exception + Виключення сервера + + + + Storage full + Переповнено сховище даних + + + + AccountManager + + + Local account + Локальний обліковий запис + + + + Event types + Типи подій + + CColorPickerWidget - + Color Колір - + Cancel button Скасувати - + Save button Зберегти - - Cancel - - - - Save - - CDayMonthView - + Monday Понеділок - + Tuesday Вівторок - + Wednesday Середа - + Thursday Четвер - + Friday П'ятниця - + Saturday Субота - + Sunday Неділя @@ -68,25 +98,30 @@ CDayWindow - + Y Р - + M М - + D Д + + + Lunar + Місячний + CGraphicsView - + New Event Нова подія @@ -94,7 +129,7 @@ CMonthScheduleNumItem - + %1 more і ще %1 @@ -102,12 +137,12 @@ CMonthView - + New event Нова подія - + New Event Нова подія @@ -115,7 +150,7 @@ CMonthWindow - + Y Р @@ -123,24 +158,24 @@ CMyScheduleView - + My Event Моя подія - + OK button Гаразд - + Delete button Вилучити - + Edit button Змінити @@ -149,7 +184,7 @@ CPushButton - + New event type Новий тип події @@ -157,273 +192,267 @@ CScheduleDlg - - + + + New Event Нова подія - + Edit Event Редагування події - + End time must be greater than start time Кінцевий час не повинен передувати початковому часу - + OK button Гаразд - - - - - - + + + + + + Never Ніколи - + At time of event У момент події - + 15 minutes before За 15 хвилин до події - + 30 minutes before За 30 хвилин до події - + 1 hour before За годину до події - + 1 day before За день до події - + 2 days before За 2 дні до події - + 1 week before За тиждень до події - + On start day (9:00 AM) У день початку (9:00) - + + + + + time(s) + раз(ів) + + + Enter a name please Будь ласка, введіть назву - + The name can not only contain whitespaces Назва не може складатися лише з пробілів - - The name already exists - Така назва вже існує - - - - + + Type: Тип: - - + + Description: Опис: - - + + All Day: Весь день: - - + + Starts: Починається: - - + + Ends: Завершується: - - + + Remind Me: Нагадати мені: - - + + Repeat: Повторення: - - + + End Repeat: Завершити повтори: - - Type - Тип + + Calendar account: + Обліковий запис календаря: - Work - Робота + + Calendar account + Обліковий запис календаря - Life - Життя - - - Other - Інше + + Type + Тип - + Description Опис - + All Day Весь день - + Time: Час: - + Time Час - + Solar Сонячний - + Lunar Місячний - + Starts Починається - + Ends Кінці - + Remind Me Нагадати мені - + Repeat Повторення - - + + Daily Щодня - - + + Weekdays Дні тижня - - + + Weekly Щотижня - - - + + + Monthly Щомісяця - - - + + + Yearly Щорічно - + End Repeat Завершити повтори - + After Після - + On У - - - - - time(s) - раз(ів) - - - + Cancel button Скасувати - + Save button Зберегти @@ -432,141 +461,141 @@ CScheduleOperation - + All occurrences of a repeating event must have the same all-day status. В усіх повторень події має бути однаковий стан щодо заповнення подією усього дня. - - + + Do you want to change all occurrences? Хочете змінити усі повторення? - - + + + + + + + + Cancel + button + Скасувати + + + + Change All Змінити усі - + You are changing the repeating rule of this event. Ви змінюєте правило повторення цієї події. - - - + + + You are deleting an event. Ви вилучаєте запис події. - + Are you sure you want to delete this event? Ви впевнені, що бажаєте вилучити цей запис події? - - - - - - - Cancel - button - Скасувати - - - Delete button Вилучити - + Do you want to delete all occurrences of this event, or only the selected occurrence? Ви хочете вилучити усі повторення цієї події чи лише позначений запис? - + Delete All Вилучити всі - - + + Delete Only This Event Вилучити лише цей запис - + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? Ви хочете вилучити усі майбутні повторення цієї події чи лише позначені записи? - + Delete All Future Events Вилучити усі майбутні повторення - - + + You are changing a repeating event. Ви вносите зміни до повторюваної події. - + Do you want to change only this occurrence of the event, or all occurrences? Хочете змінити лише це повторення події чи усі повторення? - + All Усі - - + + Only This Event Лише цей запис - + Do you want to change only this occurrence of the event, or this and all future occurrences? Хочете змінити лише це повторення події чи усі майбутні повторення? - + All Future Events Усі майбутні повторення - + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. - + Вами вибрано високосний місяць. Вас буде попереджено відповідно до правил місячного календаря. - + OK button - + Гаразд CScheduleSearchDateItem - + Y Р - + M М - + D Д @@ -574,17 +603,17 @@ CScheduleSearchItem - + Edit Змінити - + Delete Вилучити - + All Day Весь день @@ -592,7 +621,7 @@ CScheduleSearchView - + No search results Нічого не знайдено @@ -600,25 +629,83 @@ CScheduleView - + ALL DAY УВЕСЬ ДЕНЬ + CSettingDialog + + + Sunday + Неділя + + + + Monday + Понеділок + + + + 24-hour clock + 24-годинний формат часу + + + + 12-hour clock + 12-годинний формат часу + + + + Manual + Вручну + + + + 15 mins + 15 хвилин + + + + 30 mins + 30 хвилин + + + + 1 hour + 1 година + + + + 24 hours + 24 години + + + + Sync Now + Синхронізувати зараз + + + + Last sync + Остання синхронізація + + + CTimeEdit - + (%1 mins) (%1 хв.) - + (%1 hour) (%1 год.) - + (%1 hours) (%1 год.) @@ -626,35 +713,79 @@ CTitleWidget - + Y Р - + M М - + W Т - + D Д + + + + Search events and festivals + Шукати події та свята + + + + CWeekWidget + + + Sun + Нд + + + + Mon + Пн + + + + Tue + Вт + + + + Wed + Ср + + + + Thu + Чт + + + + Fri + Пт + + + + Sat + Сб + CWeekWindow - + Week Тиждень - + Y Р @@ -662,13 +793,13 @@ CYearScheduleView + - All Day Весь день - + No event Немає події @@ -676,7 +807,7 @@ CYearWindow - + Y Р @@ -684,12 +815,12 @@ CalendarWindow - + Calendar Календар - + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. «Календар» — інструмент для перегляду календаря дат, також чудовий планувальник для створення розкладів на кожен день. @@ -697,43 +828,147 @@ Calendarmainwindow - + Calendar Календар - + Manage Керувати + + + Privacy Policy + Правила конфіденційності + + + + Syncing... + Синхронізація... + + + + Sync successful + Успішна синхронізація + + + + Sync failed, please try later + Помилка синхронізації. Будь ласка, повторіть спробу пізніше + CenterWidget - + All Day Весь день + DAccountDataBase + + + Work + + + + + Life + + + + + Other + + + + + DAlarmManager + + + + + + Close + button + + + + + One day before start + + + + + Remind me tomorrow + + + + + Remind me later + + + + + 15 mins later + + + + + 1 hour later + + + + + 4 hours later + + + + + + + Tomorrow + + + + + Schedule Reminder + + + + + + %1 to %2 + + + + + + Today + Сьогодні + + + DragInfoGraphicsView - + Edit Редагувати - + Delete Видалити - + New event Нова подія - + New Event Нова подія @@ -741,23 +976,23 @@ JobTypeListView - + You are deleting an event type. Ви вилучаєте тип події. - + All events under this type will be deleted and cannot be recovered. Усі події цього типу буде вилучено, їх не можна буде відновити. - + Cancel button Скасувати - + Delete button Вилучити @@ -766,20 +1001,73 @@ QObject - + + Manage calendar Керувати календарем - + + Event types Типи подій + + + Account settings + Параметри облікового запису + + + + Account + Обліковий запис + + + + Select items to be synced + Виберіть записи для синхронізації + + + + Events + Події + + + + + General settings + Загальні параметри + + + + Sync interval + Інтервал синхронізації + + + + Calendar account + Обліковий запис календаря + + + + General + Загальне + + + + First day of week + Перший день тижня + + + + Time + Час + Return - + Today Return Сьогодні @@ -788,9 +1076,9 @@ Return Today - - - + + + Today Return Today Сьогодні @@ -799,95 +1087,127 @@ ScheduleTypeEditDlg - + New event type Новий тип події - + Edit event type Редагувати тип події - + Name: Назва: - + Color: Колір: - + Cancel button Скасувати - + Save button Зберегти - - Enter a name please - Будь ласка, введіть назву - - - + The name can not only contain whitespaces Назва не може складатися лише з пробілів - - The name already exists - Така назва вже існує + + Enter a name please + Будь ласка, введіть назву Shortcut - + Help Допомога - + Delete event Вилучити подію - + Copy Копіювати - + Cut Вирізати - + Paste Вставити - + Delete Вилучити - + Select all Вибрати все + SidebarCalendarWidget + + + Y + Р + + + + M + М + + + + TimeJumpDialog + + + Go + button + Перейти + + + + UserloginWidget + + + Sign In + button + Увійти + + + + Sign Out + button + Вийти + + + YearFrame - + Y Р @@ -895,17 +1215,17 @@ today - - - - - - - - + + + + + + + + Today Today Сьогодні - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar_vi.ts dde-calendar-5.10.0/translations/dde-calendar_vi.ts --- dde-calendar-5.9.1/translations/dde-calendar_vi.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar_vi.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,38 +1,96 @@ - + + + + + AccountItem + + + Sync successful + + + + + Network error + + + + + Server exception + + + + + Storage full + + + + + AccountManager + + + Local account + + + + + Event types + + + + + CColorPickerWidget + + + Color + + + + + Cancel + button + Hủy + + + + Save + button + Lưu + + CDayMonthView - + Monday Thứ hai - + Tuesday Thứ ba - + Wednesday Thứ tư - + Thursday Thứ năm - + Friday Thứ sáu - + Saturday Thứ bảy - + Sunday Chủ nhật @@ -40,25 +98,30 @@ CDayWindow - + Y Y - + M M - + D D + + + Lunar + + CGraphicsView - + New Event Sự kiện mới @@ -66,7 +129,7 @@ CMonthScheduleNumItem - + %1 more thêm %1 @@ -74,12 +137,12 @@ CMonthView - + New event Sự kiện mới - + New Event Sự kiện mới @@ -87,7 +150,7 @@ CMonthWindow - + Y Y @@ -95,258 +158,301 @@ CMyScheduleView - + My Event Sự kiện của Tôi - + OK button OK - + Delete button Xóa - + Edit button Chỉnh sửa + CPushButton + + + New event type + + + + CScheduleDlg - - + + + New Event Sự kiện mới - + Edit Event Chỉnh sửa Sự kiện - + End time must be greater than start time Thời gian kết thúc phải lớn hơn thời gian bắt đầu - + OK button OK - - - - + + + + + + Never Không bao giờ - + At time of event Vào thời điểm sự kiện - + 15 minutes before trước 15 phút - + 30 minutes before trước 30 phút - + 1 hour before 1 giờ trước - - + + 1 day before 1 ngày trước - - + + 2 days before 2 ngày trước - - + + 1 week before 1 tuần trước - + On start day (9:00 AM) Bắt đầu lúc (9:00 AM) - - + + Enter a name please + + + + + The name can not only contain whitespaces + + + + + Type: Loại: - - + + Description: Mô tả: - - + + All Day: Tất cả các ngày: - - + + Starts: Bắt đầu: - - + + Ends: Kết thúc: - - + + Remind Me: Nhắc nhở tôi: - - + + Repeat: Lặp lại: - - + + End Repeat: Kết thúc lặp lại: - - Type - Loại - - - - Work - Công việc + + Calendar account: + - - Life - Cuộc sống + + Calendar account + - - Other - Khác + + Type + Loại - + Description Mô tả - + All Day Tất cả các ngày - + + Time: + + + + + Time + + + + + Solar + + + + + Lunar + + + + Starts Bắt đầu - + Ends Kết thúc - + Remind Me Nhắc nhở tôi - + Repeat Lặp lại - + + Daily Hằng ngày - + + Weekdays Các ngày trong tuần - + + Weekly Hàng tuần - + + + Monthly Hàng tháng - + + + Yearly Hàng năm - + End Repeat Kết thúc lặp lại - + After Sau - + On Mở - - - - + + + + time(s) thời gian(s) - + Cancel button Hủy - + Save button Lưu @@ -355,115 +461,126 @@ CScheduleOperation - + All occurrences of a repeating event must have the same all-day status. Tất cả các lần xuất hiện của một sự kiện lặp lại phải có cùng trạng thái ngày. - - + + Do you want to change all occurrences? Bạn có muốn thay đổi tất cả các lần xuất hiện? - - + + Change All Thay đổi tất cả - + You are changing the repeating rule of this event. Bạn đang thay đổi quy tắc lặp lại của sự kiện này. - - - + + + You are deleting an event. Bạn đã xóa một sự kiện - + Are you sure you want to delete this event? Bạn có muốn xóa sự kiện này không - - - - - - - + + + + + + + Cancel button Hủy - + Delete button Xóa - + Do you want to delete all occurrences of this event, or only the selected occurrence? Bạn có muốn xóa tất cả các lần xuất hiện của sự kiện này hay chỉ xảy ra sự kiện đã chọn? - + Delete All Xóa tất cả - - + + Delete Only This Event Chỉ xóa sự kiện này - + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? Bạn có muốn xóa sự kiện này và tất cả các lần xuất hiện trong tương lai của sự kiện này hay chỉ xảy ra sự kiện đã chọn? - + Delete All Future Events Xóa tất cả các sự kiện trong tương lai - - + + You are changing a repeating event. Bạn đang thay đổi một sự kiện lặp lại. - + Do you want to change only this occurrence of the event, or all occurrences? Bạn có muốn chỉ thay đổi sự xuất hiện của sự kiện này hay tất cả các sự kiện? - + All Tất cả - - + + Only This Event Chỉ sự kiện này - + Do you want to change only this occurrence of the event, or this and all future occurrences? Bạn có muốn chỉ thay đổi sự xuất hiện của sự kiện này, hoặc tất cả các lần xuất hiện trong tương lai? - + All Future Events Tất cả các sự kiện trong tương lai + + + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. + + + + + OK + button + OK + CScheduleSearchDateItem @@ -486,17 +603,17 @@ CScheduleSearchItem - + Edit Chỉnh sửa - + Delete Xóa - + All Day Tất cả các ngày @@ -512,61 +629,163 @@ CScheduleView - + ALL DAY Tất cả các ngày + CSettingDialog + + + Sunday + Chủ nhật + + + + Monday + Thứ hai + + + + 24-hour clock + + + + + 12-hour clock + + + + + Manual + + + + + 15 mins + + + + + 30 mins + + + + + 1 hour + + + + + 24 hours + + + + + Sync Now + + + + + Last sync + + + + CTimeEdit - + (%1 mins) - + - + (%1 hour) - + - + (%1 hours) - + CTitleWidget - + Y Y - + M M - + W W - + D D + + + + Search events and festivals + + + + + CWeekWidget + + + Sun + + + + + Mon + + + + + Tue + + + + + Wed + + + + + Thu + + + + + Fri + + + + + Sat + + CWeekWindow - + Week Tuần - + Y Y @@ -574,13 +793,13 @@ CYearScheduleView + - All Day Tất cả các ngày - + No event Không có sự kiện nào @@ -588,7 +807,7 @@ CYearWindow - + Y Y @@ -596,12 +815,12 @@ CalendarWindow - + Calendar Lịch - + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. Lịch là một công cụ để xem ngày, và cũng là công cụ sắp xếp kế hoạch, sự kiện hàng ngày thông minh. @@ -609,46 +828,246 @@ Calendarmainwindow - + Calendar Lịch + + + Manage + + + + + Privacy Policy + + + + + Syncing... + + + + + Sync successful + + + + + Sync failed, please try later + + CenterWidget - + All Day Tất cả các ngày + DAccountDataBase + + + Work + Công việc + + + + Life + Cuộc sống + + + + Other + Khác + + + + DAlarmManager + + + + + + Close + button + + + + + One day before start + + + + + Remind me tomorrow + + + + + Remind me later + + + + + 15 mins later + + + + + 1 hour later + + + + + 4 hours later + + + + + + + Tomorrow + + + + + Schedule Reminder + + + + + + %1 to %2 + + + + + + Today + Hôm nay + + + DragInfoGraphicsView - + Edit Chỉnh sửa - + Delete Xóa - + New event Sự kiện mới - + New Event Sự kiện mới + JobTypeListView + + + You are deleting an event type. + + + + + All events under this type will be deleted and cannot be recovered. + + + + + Cancel + button + Hủy + + + + Delete + button + Xóa + + + + QObject + + + Account settings + + + + + Account + + + + + Select items to be synced + + + + + Events + + + + + + General settings + + + + + Sync interval + + + + + + Manage calendar + + + + + Calendar account + + + + + + Event types + + + + + General + + + + + First day of week + + + + + Time + + + + Return - + Today Return Hôm nay @@ -657,56 +1076,138 @@ Return Today - - - + + + Today Return Today Hôm nay + ScheduleTypeEditDlg + + + New event type + + + + + Edit event type + + + + + Name: + + + + + Color: + + + + + Cancel + button + Hủy + + + + Save + button + Lưu + + + + The name can not only contain whitespaces + + + + + Enter a name please + + + + Shortcut - + Help Giúp đỡ - + Delete event Xóa sự kiện - + Copy Sao chép - + Cut Cắt - + Paste Dán - + Delete Xóa - + Select all Chọn tất cả + SidebarCalendarWidget + + + Y + Y + + + + M + M + + + + TimeJumpDialog + + + Go + button + + + + + UserloginWidget + + + Sign In + button + + + + + Sign Out + button + + + + YearFrame - + Y Y @@ -714,17 +1215,17 @@ today - - - - - - - - + + + + + + + + Today Today Hôm nay - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar_zh_CN.ts dde-calendar-5.10.0/translations/dde-calendar_zh_CN.ts --- dde-calendar-5.9.1/translations/dde-calendar_zh_CN.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar_zh_CN.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,66 +1,96 @@ - + + + + + AccountItem + + + Sync successful + 同步成功 + + + + Network error + 网络异常 + + + + Server exception + 服务器异常 + + + + Storage full + 存储已满 + + + + AccountManager + + + Local account + 本地帐户 + + + + Event types + 日程类型 + + CColorPickerWidget - + Color 颜色 - + Cancel button 取 消 - + Save button 保 存 - - Cancel - - - - Save - - CDayMonthView - + Monday 星期一 - + Tuesday 星期二 - + Wednesday 星期三 - + Thursday 星期四 - + Friday 星期五 - + Saturday 星期六 - + Sunday 星期日 @@ -68,25 +98,30 @@ CDayWindow - + Y - + M - + D + + + Lunar + 农历 + CGraphicsView - + New Event 新建日程 @@ -94,7 +129,7 @@ CMonthScheduleNumItem - + %1 more 还有%1项 @@ -102,12 +137,12 @@ CMonthView - + New event 新建日程 - + New Event 新建日程 @@ -115,7 +150,7 @@ CMonthWindow - + Y @@ -123,24 +158,24 @@ CMyScheduleView - + My Event 我的日程 - + OK button 确 定 - + Delete button 删 除 - + Edit button 编 辑 @@ -149,7 +184,7 @@ CPushButton - + New event type 新增日程类型 @@ -157,273 +192,267 @@ CScheduleDlg - - + + + New Event 新建日程 - + Edit Event 编辑日程 - + End time must be greater than start time 结束时间需晚于开始时间 - + OK button 确 定 - - - - - - + + + + + + Never 从不 - + At time of event 日程开始时 - + 15 minutes before 15分钟前 - + 30 minutes before 30分钟前 - + 1 hour before 1小时前 - + 1 day before 1天前 - + 2 days before 2天前 - + 1 week before 1周前 - + On start day (9:00 AM) 日程发生当天(上午9点) - + + + + + time(s) + 次后 + + + Enter a name please 名称不能为空 - + The name can not only contain whitespaces 名称不能设置为全空格,请修改 - - The name already exists - 名称不能重复,请修改 - - - - + + Type: 类型: - - + + Description: 内容: - - + + All Day: 全天: - - + + Starts: 开始时间: - - + + Ends: 结束时间: - - + + Remind Me: 提醒: - - + + Repeat: 重复: - - + + End Repeat: 结束重复: - - Type - 类型 + + Calendar account: + 日历帐户: - Work - 工作 - - - Life - 生活 + + Calendar account + 日历帐户 - Other - 其他 + + Type + 类型 - + Description 内容 - + All Day 全天 - + Time: 时间: - + Time 时间 - + Solar 公历 - + Lunar 农历 - + Starts 开始时间 - + Ends 结束时间 - + Remind Me 提醒 - + Repeat 重复 - - + + Daily 每天 - - + + Weekdays 工作日 - - + + Weekly 每周 - - - + + + Monthly 每月 - - - + + + Yearly 每年 - + End Repeat 结束重复 - + After - + On 于日期 - - - - - time(s) - 次后 - - - + Cancel button 取 消 - + Save button 保 存 @@ -432,122 +461,122 @@ CScheduleOperation - + All occurrences of a repeating event must have the same all-day status. 重复日程的所有重复必须具有相同的全天状态。 - - + + Do you want to change all occurrences? 您要更改所有重复吗? - - + + + + + + + + Cancel + button + 取 消 + + + + Change All 全部更改 - + You are changing the repeating rule of this event. 您正在更改日程的重复规则。 - - - + + + You are deleting an event. 您正在删除日程。 - + Are you sure you want to delete this event? 您确定要删除此日程吗? - - - - - - - Cancel - button - 取 消 - - - Delete button 删 除 - + Do you want to delete all occurrences of this event, or only the selected occurrence? 您要删除此日程的所有重复,还是只删除所选重复? - + Delete All 全部删除 - - + + Delete Only This Event 仅删除此日程 - + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? 您要删除此日程的这个重复和所有将来重复,还是只删除所选重复? - + Delete All Future Events 删除所有将来日程 - - + + You are changing a repeating event. 您正在更改重复日程。 - + Do you want to change only this occurrence of the event, or all occurrences? 您要更改此日程的仅这一个重复,还是更改它的所有重复? - + All 全部日程 - - + + Only This Event 仅此日程 - + Do you want to change only this occurrence of the event, or this and all future occurrences? 您要更改此日程的这个重复和所有将来重复,还是只更改所选重复? - + All Future Events 所有将来日程 - + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. 您选择的是闰月,将按照农历规则提醒 - + OK button 确 定 @@ -556,17 +585,17 @@ CScheduleSearchDateItem - + Y - + M - + D @@ -574,17 +603,17 @@ CScheduleSearchItem - + Edit 编辑 - + Delete 删除 - + All Day 全天 @@ -592,7 +621,7 @@ CScheduleSearchView - + No search results 无搜索结果 @@ -600,25 +629,83 @@ CScheduleView - + ALL DAY 全天 + CSettingDialog + + + Sunday + 周日 + + + + Monday + 周一 + + + + 24-hour clock + 24小时制 + + + + 12-hour clock + 12小时制 + + + + Manual + 手动 + + + + 15 mins + 每15分钟 + + + + 30 mins + 每30分钟 + + + + 1 hour + 每1小时 + + + + 24 hours + 每24小时 + + + + Sync Now + 立即同步 + + + + Last sync + 最近同步时间 + + + CTimeEdit - + (%1 mins) (%1分钟) - + (%1 hour) (%1小时) - + (%1 hours) (%1小时) @@ -626,35 +713,79 @@ CTitleWidget - + Y - + M - + W - + D + + + + Search events and festivals + 搜索日程/节日 + + + + CWeekWidget + + + Sun + + + + + Mon + + + + + Tue + + + + + Wed + + + + + Thu + + + + + Fri + + + + + Sat + + CWeekWindow - + Week - + Y @@ -662,13 +793,13 @@ CYearScheduleView + - All Day 全天 - + No event 无日程 @@ -676,7 +807,7 @@ CYearWindow - + Y @@ -684,12 +815,12 @@ CalendarWindow - + Calendar 日历 - + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. 日历是一款查看日期、管理日程的小工具。 @@ -697,43 +828,147 @@ Calendarmainwindow - + Calendar 日历 - + Manage 管理 + + + Privacy Policy + 隐私政策 + + + + Syncing... + 正在同步... + + + + Sync successful + 同步成功 + + + + Sync failed, please try later + 同步失败,请稍后再试 + CenterWidget - + All Day 全天 + DAccountDataBase + + + Work + + + + + Life + + + + + Other + + + + + DAlarmManager + + + + + + Close + button + + + + + One day before start + + + + + Remind me tomorrow + + + + + Remind me later + + + + + 15 mins later + + + + + 1 hour later + + + + + 4 hours later + + + + + + + Tomorrow + + + + + Schedule Reminder + + + + + + %1 to %2 + + + + + + Today + + + + DragInfoGraphicsView - + Edit 编辑 - + Delete 删除 - + New event 新建日程 - + New Event 新建日程 @@ -741,23 +976,23 @@ JobTypeListView - + You are deleting an event type. 您正在删除日程类型。 - + All events under this type will be deleted and cannot be recovered. 此日程类型下的所有日程都会删除且不可恢复。 - + Cancel button 取 消 - + Delete button 删 除 @@ -766,20 +1001,73 @@ QObject - + + Manage calendar 日历管理 - + + Event types 日程类型 + + + Account settings + 帐户设置 + + + + Account + 帐户 + + + + Select items to be synced + 设置您的同步项 + + + + Events + 日程 + + + + + General settings + 通用设置 + + + + Sync interval + 同步频率 + + + + Calendar account + 日历帐户 + + + + General + 通用 + + + + First day of week + 每星期开始于 + + + + Time + 时间 + Return - + Today Return 返回今天 @@ -788,9 +1076,9 @@ Return Today - - - + + + Today Return Today 返回今天 @@ -799,95 +1087,127 @@ ScheduleTypeEditDlg - + New event type 新增日程类型 - + Edit event type 编辑日程类型 - + Name: 名称: - + Color: 颜色: - + Cancel button 取 消 - + Save button 保 存 - - Enter a name please - 名称不能为空 - - - + The name can not only contain whitespaces 名称不能设置为全空格,请修改 - - The name already exists - 名称不能重复,请修改 + + Enter a name please + 名称不能为空 Shortcut - + Help 帮助 - + Delete event 删除日程 - + Copy 复制 - + Cut 剪切 - + Paste 粘贴 - + Delete 删除 - + Select all 全选 + SidebarCalendarWidget + + + Y + + + + + M + + + + + TimeJumpDialog + + + Go + button + 跳 转 + + + + UserloginWidget + + + Sign In + button + 登 录 + + + + Sign Out + button + 退出登录 + + + YearFrame - + Y @@ -895,17 +1215,17 @@ today - - - - - - - - + + + + + + + + Today Today 今天 - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar_zh_HK.ts dde-calendar-5.10.0/translations/dde-calendar_zh_HK.ts --- dde-calendar-5.9.1/translations/dde-calendar_zh_HK.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar_zh_HK.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,66 +1,96 @@ - + + + + + AccountItem + + + Sync successful + 同步成功 + + + + Network error + 網絡異常 + + + + Server exception + 伺服器異常 + + + + Storage full + 存儲已滿 + + + + AccountManager + + + Local account + 本地帳戶 + + + + Event types + 日程類型 + + CColorPickerWidget - + Color 顏色 - + Cancel button 取 消 - + Save button 保 存 - - Cancel - - - - Save - - CDayMonthView - + Monday 星期一 - + Tuesday 星期二 - + Wednesday 星期三 - + Thursday 星期四 - + Friday 星期五 - + Saturday 星期六 - + Sunday 星期日 @@ -68,25 +98,30 @@ CDayWindow - + Y - + M - + D + + + Lunar + 農曆 + CGraphicsView - + New Event 新建日程 @@ -94,7 +129,7 @@ CMonthScheduleNumItem - + %1 more 還有%1項 @@ -102,12 +137,12 @@ CMonthView - + New event 新建日程 - + New Event 新建日程 @@ -115,7 +150,7 @@ CMonthWindow - + Y @@ -123,24 +158,24 @@ CMyScheduleView - + My Event 我的日程 - + OK button 確 定 - + Delete button 刪 除 - + Edit button 更 改 @@ -149,7 +184,7 @@ CPushButton - + New event type 新增日程類型 @@ -157,273 +192,267 @@ CScheduleDlg - - + + + New Event 新建日程 - + Edit Event 更改日程 - + End time must be greater than start time 結束時間需晚於開始時間 - + OK button 確 定 - - - - - - + + + + + + Never 永不 - + At time of event 日程開始時 - + 15 minutes before 15分鐘前 - + 30 minutes before 30分鐘前 - + 1 hour before 1小時前 - + 1 day before 1天前 - + 2 days before 2天前 - + 1 week before 1週前 - + On start day (9:00 AM) 日程發生當天(上午9點) - + + + + + time(s) + 次後 + + + Enter a name please 名稱不能為空 - + The name can not only contain whitespaces 名稱不能設置為全空格,請修改 - - The name already exists - 名稱不能重複,請修改 - - - - + + Type: 類型: - - + + Description: 描述: - - + + All Day: 全天: - - + + Starts: 開始時間: - - + + Ends: 結束時間: - - + + Remind Me: 提醒: - - + + Repeat: 重複: - - + + End Repeat: 結束重複: - - Type - 類型 + + Calendar account: + 日曆帳戶: - Work - 工作 - - - Life - 生活 + + Calendar account + 日曆帳戶 - Other - 其他 + + Type + 類型 - + Description 描述 - + All Day 全天 - + Time: 時間: - + Time 時間 - + Solar 公曆 - + Lunar 農曆 - + Starts 開始時間 - + Ends 結束時間 - + Remind Me 提醒 - + Repeat 重複 - - + + Daily 每天 - - + + Weekdays 工作日 - - + + Weekly 每週 - - - + + + Monthly 每月 - - - + + + Yearly 每年 - + End Repeat 結束重複 - + After - + On 於日期 - - - - - time(s) - 次後 - - - + Cancel button 取 消 - + Save button 保 存 @@ -432,122 +461,122 @@ CScheduleOperation - + All occurrences of a repeating event must have the same all-day status. 重複日程的所有重複必須具有相同的全天狀態。 - - + + Do you want to change all occurrences? 您要更改所有重複嗎? - - + + + + + + + + Cancel + button + 取 消 + + + + Change All 全部更改 - + You are changing the repeating rule of this event. 您正在更改日程的重複規則。 - - - + + + You are deleting an event. 您正在刪除日程。 - + Are you sure you want to delete this event? 您確定要刪除此日程嗎? - - - - - - - Cancel - button - 取 消 - - - Delete button 刪 除 - + Do you want to delete all occurrences of this event, or only the selected occurrence? 您要刪除此日程的所有重複,還是只刪除所選重複? - + Delete All 全部刪除 - - + + Delete Only This Event 僅刪除此日程 - + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? 您要刪除此日程的這個重複和所有將來重複,還是只刪除所選重複? - + Delete All Future Events 刪除所有將來日程 - - + + You are changing a repeating event. 您正在更改重複日程。 - + Do you want to change only this occurrence of the event, or all occurrences? 您要更改此日程的僅這一個重複,還是更改它的所有重複? - + All 全部日程 - - + + Only This Event 僅此日程 - + Do you want to change only this occurrence of the event, or this and all future occurrences? 您要更改此日程的這個重複和所有將來重複,還是只更改所選重複? - + All Future Events 所有將來日程 - + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. 您選擇的是閏月,將按照農曆規則提醒 - + OK button 確 定 @@ -556,17 +585,17 @@ CScheduleSearchDateItem - + Y - + M - + D @@ -574,17 +603,17 @@ CScheduleSearchItem - + Edit 更改 - + Delete 刪除 - + All Day 全天 @@ -592,7 +621,7 @@ CScheduleSearchView - + No search results 無搜索結果 @@ -600,25 +629,83 @@ CScheduleView - + ALL DAY 全天 + CSettingDialog + + + Sunday + 週日 + + + + Monday + 週一 + + + + 24-hour clock + 24小時制 + + + + 12-hour clock + 12小時制 + + + + Manual + 手動 + + + + 15 mins + 每15分鐘 + + + + 30 mins + 每30分鐘 + + + + 1 hour + 每1小時 + + + + 24 hours + 每24小時 + + + + Sync Now + 立即同步 + + + + Last sync + 最近同步時間 + + + CTimeEdit - + (%1 mins) (%1分鐘) - + (%1 hour) (%1小時) - + (%1 hours) (%1小時) @@ -626,35 +713,79 @@ CTitleWidget - + Y - + M - + W - + D + + + + Search events and festivals + 搜索日程/節日 + + + + CWeekWidget + + + Sun + + + + + Mon + + + + + Tue + + + + + Wed + + + + + Thu + + + + + Fri + + + + + Sat + + CWeekWindow - + Week - + Y @@ -662,13 +793,13 @@ CYearScheduleView + - All Day 全天 - + No event 無日程 @@ -676,7 +807,7 @@ CYearWindow - + Y @@ -684,12 +815,12 @@ CalendarWindow - + Calendar 日曆 - + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. 日曆是一款查看日期、管理日程的小工具。 @@ -697,43 +828,147 @@ Calendarmainwindow - + Calendar 日曆 - + Manage 管理 + + + Privacy Policy + 私隱政策 + + + + Syncing... + 正在同步... + + + + Sync successful + 同步成功 + + + + Sync failed, please try later + 同步失敗,請稍後再試 + CenterWidget - + All Day 全天 + DAccountDataBase + + + Work + + + + + Life + + + + + Other + + + + + DAlarmManager + + + + + + Close + button + + + + + One day before start + + + + + Remind me tomorrow + + + + + Remind me later + + + + + 15 mins later + + + + + 1 hour later + + + + + 4 hours later + + + + + + + Tomorrow + + + + + Schedule Reminder + + + + + + %1 to %2 + + + + + + Today + 今天 + + + DragInfoGraphicsView - + Edit 更改 - + Delete 删除 - + New event 新建日程 - + New Event 新建日程 @@ -741,23 +976,23 @@ JobTypeListView - + You are deleting an event type. 您正在刪除日程類型。 - + All events under this type will be deleted and cannot be recovered. 此日程類型下的所有日程都會刪除且不可恢復。 - + Cancel button 取 消 - + Delete button 刪 除 @@ -766,20 +1001,73 @@ QObject - + + Manage calendar 日曆管理 - + + Event types 日程類型 + + + Account settings + 帳戶設置 + + + + Account + 帳戶 + + + + Select items to be synced + 設置您的同步項 + + + + Events + 日程 + + + + + General settings + 通用設置 + + + + Sync interval + 同步頻率 + + + + Calendar account + 日曆帳戶 + + + + General + 通用 + + + + First day of week + 每星期開始於 + + + + Time + 時間 + Return - + Today Return 今天 @@ -788,9 +1076,9 @@ Return Today - - - + + + Today Return Today 今天 @@ -799,95 +1087,127 @@ ScheduleTypeEditDlg - + New event type 新增日程類型 - + Edit event type 編輯日程類型 - + Name: 名稱: - + Color: 顏色: - + Cancel button 取 消 - + Save button 保 存 - - Enter a name please - 名稱不能為空 - - - + The name can not only contain whitespaces 名稱不能設置為全空格,請修改 - - The name already exists - 名稱不能重複,請修改 + + Enter a name please + 名稱不能為空 Shortcut - + Help 幫助 - + Delete event 刪除日程 - + Copy 複製 - + Cut 剪下 - + Paste 黏貼 - + Delete 刪除 - + Select all 選擇全部 + SidebarCalendarWidget + + + Y + + + + + M + + + + + TimeJumpDialog + + + Go + button + 跳 轉 + + + + UserloginWidget + + + Sign In + button + 登 錄 + + + + Sign Out + button + 退出登錄 + + + YearFrame - + Y @@ -895,17 +1215,17 @@ today - - - - - - - - + + + + + + + + Today Today 今天 - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/dde-calendar_zh_TW.ts dde-calendar-5.10.0/translations/dde-calendar_zh_TW.ts --- dde-calendar-5.9.1/translations/dde-calendar_zh_TW.ts 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/translations/dde-calendar_zh_TW.ts 2023-04-07 06:02:09.000000000 +0000 @@ -1,66 +1,96 @@ - + + + + + AccountItem + + + Sync successful + 同步成功 + + + + Network error + 網路異常 + + + + Server exception + 伺服器異常 + + + + Storage full + 儲存已滿 + + + + AccountManager + + + Local account + 本機帳戶 + + + + Event types + 日程類型 + + CColorPickerWidget - + Color 顏色 - + Cancel button 取 消 - + Save button 儲 存 - - Cancel - - - - Save - - CDayMonthView - + Monday 星期一 - + Tuesday 星期二 - + Wednesday 星期三 - + Thursday 星期四 - + Friday 星期五 - + Saturday 星期六 - + Sunday 星期日 @@ -68,25 +98,30 @@ CDayWindow - + Y - + M - + D + + + Lunar + 農曆 + CGraphicsView - + New Event 建立日程 @@ -94,7 +129,7 @@ CMonthScheduleNumItem - + %1 more 還有%1項 @@ -102,12 +137,12 @@ CMonthView - + New event 建立日程 - + New Event 建立日程 @@ -115,7 +150,7 @@ CMonthWindow - + Y @@ -123,24 +158,24 @@ CMyScheduleView - + My Event 我的日程 - + OK button 確 定 - + Delete button 刪 除 - + Edit button 編 輯 @@ -149,7 +184,7 @@ CPushButton - + New event type 新增日程類型 @@ -157,273 +192,267 @@ CScheduleDlg - - + + + New Event 建立日程 - + Edit Event 編輯日程 - + End time must be greater than start time 結束時間需晚於開始時間 - + OK button 確 定 - - - - - - + + + + + + Never 從不 - + At time of event 日程開始時 - + 15 minutes before 15分鐘前 - + 30 minutes before 30分鐘前 - + 1 hour before 1小時前 - + 1 day before 1天前 - + 2 days before 2天前 - + 1 week before 1週前 - + On start day (9:00 AM) 日程發生當天(上午9點) - + + + + + time(s) + 次後 + + + Enter a name please 名稱不能為空 - + The name can not only contain whitespaces 名稱不能設置為全空格,請修改 - - The name already exists - 名稱不能重複,請修改 - - - - + + Type: 類型: - - + + Description: 內容: - - + + All Day: 全天: - - + + Starts: 開始時間: - - + + Ends: 結束時間: - - + + Remind Me: 提醒: - - + + Repeat: 重複: - - + + End Repeat: 結束重複: - - Type - 類型 + + Calendar account: + 日曆帳戶: - Work - 工作 - - - Life - 生活 + + Calendar account + 日曆帳戶 - Other - 其他 + + Type + 類型 - + Description 內容 - + All Day 全天 - + Time: 時間: - + Time 時間 - + Solar 公曆 - + Lunar 農曆 - + Starts 開始時間 - + Ends 結束時間 - + Remind Me 提醒 - + Repeat 重複 - - + + Daily 每天 - - + + Weekdays 工作日 - - + + Weekly 每週 - - - + + + Monthly 每月 - - - + + + Yearly 每年 - + End Repeat 結束重複 - + After - + On 於日期 - - - - - time(s) - 次後 - - - + Cancel button 取 消 - + Save button 儲 存 @@ -432,122 +461,122 @@ CScheduleOperation - + All occurrences of a repeating event must have the same all-day status. 重複日程的所有重複必須具有相同的全天狀態。 - - + + Do you want to change all occurrences? 您要更改所有重複嗎? - - + + + + + + + + Cancel + button + 取 消 + + + + Change All 全部更改 - + You are changing the repeating rule of this event. 您正在更改日程的重複規則。 - - - + + + You are deleting an event. 您正在刪除日程。 - + Are you sure you want to delete this event? 您確定要刪除此日程嗎? - - - - - - - Cancel - button - 取 消 - - - Delete button 刪 除 - + Do you want to delete all occurrences of this event, or only the selected occurrence? 您要刪除此日程的所有重複,還是只刪除所選重複? - + Delete All 全部刪除 - - + + Delete Only This Event 僅刪除此日程 - + Do you want to delete this and all future occurrences of this event, or only the selected occurrence? 您要刪除此日程的這個重複和所有將來重複,還是只刪除所選重複? - + Delete All Future Events 刪除所有將來日程 - - + + You are changing a repeating event. 您正在更改重複日程。 - + Do you want to change only this occurrence of the event, or all occurrences? 您要更改此日程的僅這一個重複,還是更改它的所有重複? - + All 全部日程 - - + + Only This Event 僅此日程 - + Do you want to change only this occurrence of the event, or this and all future occurrences? 您要更改此日程的這個重複和所有將來重複,還是只更改所選重複? - + All Future Events 所有將來日程 - + You have selected a leap month, and will be reminded according to the rules of the lunar calendar. 您選擇的是閏月,將按照農曆規則提醒 - + OK button 確 定 @@ -556,17 +585,17 @@ CScheduleSearchDateItem - + Y - + M - + D @@ -574,17 +603,17 @@ CScheduleSearchItem - + Edit 編輯 - + Delete 刪除 - + All Day 全天 @@ -592,7 +621,7 @@ CScheduleSearchView - + No search results 找不到結果 @@ -600,25 +629,83 @@ CScheduleView - + ALL DAY 全天 + CSettingDialog + + + Sunday + 週日 + + + + Monday + 週一 + + + + 24-hour clock + 24小時制 + + + + 12-hour clock + 12小時制 + + + + Manual + 手動 + + + + 15 mins + 每15分鐘 + + + + 30 mins + 每30分鐘 + + + + 1 hour + 每1小時 + + + + 24 hours + 每24小時 + + + + Sync Now + 立即同步 + + + + Last sync + 最近同步時間 + + + CTimeEdit - + (%1 mins) (%1分鐘) - + (%1 hour) (%1小時) - + (%1 hours) (%1小時) @@ -626,35 +713,79 @@ CTitleWidget - + Y - + M - + W - + D + + + + Search events and festivals + 搜尋日程/節日 + + + + CWeekWidget + + + Sun + + + + + Mon + + + + + Tue + + + + + Wed + + + + + Thu + + + + + Fri + + + + + Sat + + CWeekWindow - + Week - + Y @@ -662,13 +793,13 @@ CYearScheduleView + - All Day 全天 - + No event 無日程 @@ -676,7 +807,7 @@ CYearWindow - + Y @@ -684,12 +815,12 @@ CalendarWindow - + Calendar 日曆 - + Calendar is a tool to view dates, and also a smart daily planner to schedule all things in life. 日曆是一款查看日期、管理日程的小工具。 @@ -697,43 +828,147 @@ Calendarmainwindow - + Calendar 日曆 - + Manage 管理 + + + Privacy Policy + 隱私政策 + + + + Syncing... + 正在同步... + + + + Sync successful + 同步成功 + + + + Sync failed, please try later + 同步失敗,請稍後再試 + CenterWidget - + All Day 全天 + DAccountDataBase + + + Work + + + + + Life + + + + + Other + + + + + DAlarmManager + + + + + + Close + button + + + + + One day before start + + + + + Remind me tomorrow + + + + + Remind me later + + + + + 15 mins later + + + + + 1 hour later + + + + + 4 hours later + + + + + + + Tomorrow + + + + + Schedule Reminder + + + + + + %1 to %2 + + + + + + Today + 今天 + + + DragInfoGraphicsView - + Edit 編輯 - + Delete 刪除 - + New event 建立日程 - + New Event 建立日程 @@ -741,23 +976,23 @@ JobTypeListView - + You are deleting an event type. 您正在刪除日程類型。 - + All events under this type will be deleted and cannot be recovered. 此日程類型下的所有日程都會刪除且不可恢復。 - + Cancel button 取 消 - + Delete button 刪 除 @@ -766,20 +1001,73 @@ QObject - + + Manage calendar 日曆管理 - + + Event types 日程類型 + + + Account settings + 帳戶設定 + + + + Account + 帳戶 + + + + Select items to be synced + 設定您的同步項 + + + + Events + 日程 + + + + + General settings + 一般設定 + + + + Sync interval + 同步頻率 + + + + Calendar account + 日曆帳戶 + + + + General + 通用 + + + + First day of week + 每星期開始於 + + + + Time + 時間 + Return - + Today Return 今天 @@ -788,9 +1076,9 @@ Return Today - - - + + + Today Return Today 今天 @@ -799,95 +1087,127 @@ ScheduleTypeEditDlg - + New event type 新增日程類型 - + Edit event type 編輯日程類型 - + Name: 名稱: - + Color: 顏色: - + Cancel button 取 消 - + Save button 儲 存 - - Enter a name please - 名稱不能為空 - - - + The name can not only contain whitespaces 名稱不能設置為全空格,請修改 - - The name already exists - 名稱不能重複,請修改 + + Enter a name please + 名稱不能為空 Shortcut - + Help 說明 - + Delete event 刪除日程 - + Copy 複製 - + Cut 剪下 - + Paste 貼上 - + Delete 刪除 - + Select all 全選 + SidebarCalendarWidget + + + Y + + + + + M + + + + + TimeJumpDialog + + + Go + button + 跳 轉 + + + + UserloginWidget + + + Sign In + button + 登 入 + + + + Sign Out + button + 退出登入 + + + YearFrame - + Y @@ -895,17 +1215,17 @@ today - - - - - - - - + + + + + + + + Today Today 今天 - \ No newline at end of file + diff -Nru dde-calendar-5.9.1/translations/release.sh dde-calendar-5.10.0/translations/release.sh --- dde-calendar-5.9.1/translations/release.sh 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/translations/release.sh 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,11 @@ +#!/bin/bash +# this file is used to auto-generate .qm file from .ts file. +# author: shibowen at linuxdeepin.com + +ts_list=(`ls *.ts`) + +for ts in "${ts_list[@]}" +do + printf "\nprocess ${ts}\n" + lrelease "${ts}" +done diff -Nru dde-calendar-5.9.1/translations/update.sh dde-calendar-5.10.0/translations/update.sh --- dde-calendar-5.9.1/translations/update.sh 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/translations/update.sh 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1,2 @@ +#!/bin/bash +lupdate ../ -ts -no-obsolete *.ts diff -Nru dde-calendar-5.9.1/.tx/config dde-calendar-5.10.0/.tx/config --- dde-calendar-5.9.1/.tx/config 2022-04-29 02:06:06.000000000 +0000 +++ dde-calendar-5.10.0/.tx/config 2023-04-07 06:02:09.000000000 +0000 @@ -3,19 +3,19 @@ minimum_perc = 80 mode = developer -[deepin-desktop-environment.dde-calendar] +[o:linuxdeepin:p:deepin-desktop-environment:r:dde-calendar] file_filter = translations/dde-calendar_.ts source_file = translations/dde-calendar_en_US.ts source_lang = en_US type = QT -[deepin-desktop-environment.dde-calendar_desktop] +[o:linuxdeepin:p:deepin-desktop-environment:r:dde-calendar_desktop] file_filter = translations/desktop/desktop_.ts source_file = translations/desktop/desktop.ts source_lang = en type = QT -[deepin-desktop-environment.dde-calendar-service] +[o:linuxdeepin:p:deepin-desktop-environment:r:dde-calendar-service] file_filter = translations/dde-calendar-service_.ts source_file = translations/dde-calendar-service_en_US.ts source_lang = en_US diff -Nru dde-calendar-5.9.1/.tx/deepin.conf dde-calendar-5.10.0/.tx/deepin.conf --- dde-calendar-5.9.1/.tx/deepin.conf 1970-01-01 00:00:00.000000000 +0000 +++ dde-calendar-5.10.0/.tx/deepin.conf 2023-04-07 06:02:09.000000000 +0000 @@ -0,0 +1 @@ +[transifex] \ No newline at end of file