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

Reply via email to