D7563: Add privilegeExecution field to file protocol description
Harald Sitter
noreply at phabricator.kde.org
Thu Aug 6 09:53:15 BST 2020
sitter added inline comments.
INLINE COMMENTS
> file_unix.cpp:1372
> + break;
> + default:
> + Q_UNREACHABLE();
I'd advise handling default cases. The compiler can no longer warn of unhandled enum values when default is used. Instead I'd convert the entire switch into a helper function `static QString actionTypeToString(ActionType action)` and in there switch like so:
switch (action) {
case ActionType::CHMOD:
return QStringLiteral("Authentication is required to change this file's permissions.");
case ActionType::CHOWN:
...
}
// any values not explicitly handled gets here making this the de-facto default handling
Q_UNREACHABLE()
return QString()
}
This then makes the code here less repetitive as the entire switch gets squashed down to `details.insert(KAuth::Action::AuthDetail::DetailMessage, actionTypeToString(action));`
REPOSITORY
R241 KIO
REVISION DETAIL
https://phabricator.kde.org/D7563
To: cblack, #frameworks, dfaure, chinmoyr, sitter, ngraham
Cc: cblack, sitter, kkong, kde-frameworks-devel, feverfew, mreeves, mati865, ngraham, elvisangelaccio, LeGast00n, michaelh, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20200806/71ca02d8/attachment.htm>
More information about the Kde-frameworks-devel
mailing list