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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions src/plugin-qt/power/session/powermanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1297,9 +1297,9 @@ void PowerManager::onNotifyActionInvoked(uint id, const QString &actionKey)
qDebug(logPowerSession) << "Notification action invoked: id=" << id << " key=" << actionKey;
if (id != m_shutdownNotifyId) return;
int nextStatus;
if (actionKey == "cancel") {
if (actionKey == "Cancle") {
nextStatus = SchedCancel;
} else if (actionKey == "shutdown") {
} else if (actionKey == "Shutdown") {
nextStatus = SchedShutdown;
} else {
nextStatus = SchedCancel;
Expand Down Expand Up @@ -1362,7 +1362,7 @@ void PowerManager::shutdownCountdownNotify(int count, bool playSound)
{
QString body = tr("The system will shut down automatically after %1 s").arg(count);
QString title = tr("Scheduled Shutdown");
QStringList actions = {"cancel", tr("Cancel"), "shutdown", tr("Shut down")};
QStringList actions = {"Cancle", tr("Cancel"), "Shutdown", tr("Shut down")};
QVariantMap hints = {
{"x-deepin-PlaySound", playSound},
{"urgency", 2},
Expand Down Expand Up @@ -1515,7 +1515,7 @@ bool PowerManager::isWorkday(const QDateTime &date) const
return dow != Qt::Saturday && dow != Qt::Sunday;
}
QJsonObject root = doc.array().first().toObject();
QJsonArray list = root["List"].toArray();
QJsonArray list = root[QStringLiteral("list")].toArray();
if (list.isEmpty()) {
int dow = date.date().dayOfWeek();
return dow != Qt::Saturday && dow != Qt::Sunday;
Expand All @@ -1525,8 +1525,9 @@ bool PowerManager::isWorkday(const QDateTime &date) const
QString dateStr2 = date.toString("yyyy-MM-dd");
for (const auto &item : list) {
QJsonObject obj = item.toObject();
if (obj["Date"].toString() == dateStr1 || obj["Date"].toString() == dateStr2) {
return obj["Status"].toInt() == 2;
if (obj[QStringLiteral("date")].toString() == dateStr1
|| obj[QStringLiteral("date")].toString() == dateStr2) {
return obj[QStringLiteral("status")].toInt() == 2;
}
}
int dow = date.date().dayOfWeek();
Expand Down
2 changes: 1 addition & 1 deletion src/plugin-qt/power/session/sessiondbusproxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ void SessionDBusProxy::closeNotification(uint id)
m_notificationsInter->asyncCall("CloseNotification", id);
}

QString SessionDBusProxy::getFestivalMonth(int year, int month)
QString SessionDBusProxy::getFestivalMonth(uint year, uint month)
{
QDBusReply<QString> r = m_calendarInter->call("getFestivalMonth", year, month);
return r.isValid() ? r.value() : QString();
Expand Down
2 changes: 1 addition & 1 deletion src/plugin-qt/power/session/sessiondbusproxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class SessionDBusProxy : public QObject {
void closeNotification(uint id);

// ── Calendar ──
QString getFestivalMonth(int year, int month);
QString getFestivalMonth(uint year, uint month);

signals:
// Forwarded from org.freedesktop.DBus.PropertiesChanged by DDBusInterface.
Expand Down
Loading