D13194: Use the new drag handle in the Language KCM

Vlad Zagorodniy noreply at phabricator.kde.org
Wed May 30 18:07:45 UTC 2018


zzag added inline comments.

INLINE COMMENTS

> translations.cpp:97
>  
> -    for (const QString& lang : m_translationsModel->missingLanguages()) {
> +    for (const QString& lang : m_selectedTranslationsModel->missingLanguages()) {
>          m_configuredLanguages.removeOne(lang);

Maybe,

  const auto missingLanguages = m_selectedTransationsModel->missingLanguages();
  for (const QString& lang : missingLanguages) {
     // ...
  }

(to avoid detach)

> translationsmodel.cpp:103
> +            return QLocale(QStringLiteral("pt_PT")).nativeLanguageName();
> +        } else {
> +            qWarning() << "Language code morphed into another existing language code, please report!" << languageCode << locale.name();

Coding style nitpick: don't use `else` after `return`.

References:

- https://releases.llvm.org/2.7/docs/CodingStandards.html#hl_else_after_return (Kdelibs coding style doesn't say anything about early returns)

> translationsmodel.cpp:197
>  
> -    m_selectedLanguages.move(from, to);
> +    int modelTo = to + (to > from ? 1 : 0);
>  

Can be const.

> translationsmodel.cpp:218
>  
> -    emit selectedLanguagesChanged();
> +    if (index != -1) {
> +        beginRemoveRows(QModelIndex(), index, index);

How about early return? E.g.

  if (index < 0) {
      return;
  }
  
  // ...

> translationsmodel.cpp:254
> +
> +    return TranslationsModel::data(index, role);
> +}

Dead code.

REPOSITORY
  R119 Plasma Desktop

REVISION DETAIL
  https://phabricator.kde.org/D13194

To: hein, mart, davidedmundson
Cc: zzag, plasma-devel, ragreen, Pitel, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20180530/757d0eb4/attachment-0001.html>


More information about the Plasma-devel mailing list