Changeset View
Changeset View
Standalone View
Standalone View
src/core/slavebase.cpp
Show First 20 Lines • Show All 1451 Lines • ▼ Show 20 Line(s) | 1435 | { | |||
---|---|---|---|---|---|
1452 | 1452 | | |||
1453 | info.setHostName(hostName); | 1453 | info.setHostName(hostName); | ||
1454 | info.setAddresses(addresses); | 1454 | info.setAddresses(addresses); | ||
1455 | info.setError(QHostInfo::HostInfoError(error)); | 1455 | info.setError(QHostInfo::HostInfoError(error)); | ||
1456 | info.setErrorString(errorString); | 1456 | info.setErrorString(errorString); | ||
1457 | 1457 | | |||
1458 | return result; | 1458 | return result; | ||
1459 | } | 1459 | } | ||
1460 | | ||||
1461 | bool SlaveBase::isPrivilegeOperationAllowed() | ||||
dfaure: Oh, indeed, can't be const, because it's not a getter, it's a method that asks for the status… | |||||
1462 | { | ||||
1463 | QByteArray buffer = "0"; | ||||
1464 | send(MSG_PRIVILEGE_EXEC); | ||||
dfaure: Better in one line: const QByteArray buffer = "0"; | |||||
1465 | waitForAnswer(MSG_PRIVILEGE_EXEC, 0, buffer); | ||||
1466 | return buffer.toInt(); | ||||
1467 | } | ||||
Not needed, just return KIO::PrivilegeOperationStatus(buffer.toInt()) (constructor-like syntax - or static_cast if that doesn't work). If you think casting is evil, hardcoding 1/2/3 is even more evil ;-) And in this case casting is not evil at all, we simply serialize/deserialize the enum using its integral value. dfaure: Not needed, just return KIO::PrivilegeOperationStatus(buffer.toInt()) (constructor-like… |
Oh, indeed, can't be const, because it's not a getter, it's a method that asks for the status via communication with the app.
That means the naming could be improved.
Maybe something like queryPrivilegeOperationStatus() or requestPrivilegeOperation().