Make not supported errors static
This commit is contained in:
parent
c83b8d4043
commit
10b169f9f6
|
@ -148,14 +148,14 @@ bool Inhibited() {
|
||||||
const QDBusReply<QVariant> reply = QDBusConnection::sessionBus().call(
|
const QDBusReply<QVariant> reply = QDBusConnection::sessionBus().call(
|
||||||
message);
|
message);
|
||||||
|
|
||||||
const auto notSupportedErrors = {
|
static const auto NotSupportedErrors = {
|
||||||
QDBusError::ServiceUnknown,
|
QDBusError::ServiceUnknown,
|
||||||
QDBusError::InvalidArgs,
|
QDBusError::InvalidArgs,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (reply.isValid()) {
|
if (reply.isValid()) {
|
||||||
return reply.value().toBool();
|
return reply.value().toBool();
|
||||||
} else if (ranges::contains(notSupportedErrors, reply.error().type())) {
|
} else if (ranges::contains(NotSupportedErrors, reply.error().type())) {
|
||||||
InhibitedNotSupported = true;
|
InhibitedNotSupported = true;
|
||||||
} else {
|
} else {
|
||||||
if (reply.error().type() == QDBusError::AccessDenied) {
|
if (reply.error().type() == QDBusError::AccessDenied) {
|
||||||
|
|
|
@ -488,22 +488,22 @@ std::optional<crl::time> LastUserInputTime() {
|
||||||
const QDBusReply<uint> reply = QDBusConnection::sessionBus().call(
|
const QDBusReply<uint> reply = QDBusConnection::sessionBus().call(
|
||||||
Message);
|
Message);
|
||||||
|
|
||||||
const auto notSupportedErrors = {
|
static const auto NotSupportedErrors = {
|
||||||
QDBusError::ServiceUnknown,
|
QDBusError::ServiceUnknown,
|
||||||
QDBusError::NotSupported,
|
QDBusError::NotSupported,
|
||||||
};
|
};
|
||||||
|
|
||||||
const auto notSupportedErrorsToLog = {
|
static const auto NotSupportedErrorsToLog = {
|
||||||
QDBusError::Disconnected,
|
QDBusError::Disconnected,
|
||||||
QDBusError::AccessDenied,
|
QDBusError::AccessDenied,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (reply.isValid()) {
|
if (reply.isValid()) {
|
||||||
return (crl::now() - static_cast<crl::time>(reply.value()));
|
return (crl::now() - static_cast<crl::time>(reply.value()));
|
||||||
} else if (ranges::contains(notSupportedErrors, reply.error().type())) {
|
} else if (ranges::contains(NotSupportedErrors, reply.error().type())) {
|
||||||
NotSupported = true;
|
NotSupported = true;
|
||||||
} else {
|
} else {
|
||||||
if (ranges::contains(notSupportedErrorsToLog, reply.error().type())) {
|
if (ranges::contains(NotSupportedErrorsToLog, reply.error().type())) {
|
||||||
NotSupported = true;
|
NotSupported = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue