achauvel added a comment.

  I think it’s better than what I proposed (without knowing about yours) in 
D17727 <https://phabricator.kde.org/D17727>.

INLINE COMMENTS

> krun.cpp:1421-1431
> +
> +        // If a default browser isn't set in kdeglobals, fall back to 
> mimeapps.list
> +        if (d->m_externalBrowser.isEmpty()) {
> +            KSharedConfig::Ptr profile = 
> KSharedConfig::openConfig(QStringLiteral("mimeapps.list"), 
> KConfig::NoGlobals, QStandardPaths::GenericConfigLocation);
> +            KConfigGroup defaultApps(profile, "Default Applications");
> +
> +            d->m_externalBrowser = 
> defaultApps.readEntry("x-scheme-handler/https");

I personally would have gone for

  // If a default browser isn't set in kdeglobals, fall back to mimeapps.list
  if (!d->m_externalBrowser.isEmpty()) {
      return;
  }
  KSharedConfig::Ptr profile = 
KSharedConfig::openConfig(QStringLiteral("mimeapps.list"), KConfig::NoGlobals, 
QStandardPaths::GenericConfigLocation);
  KConfigGroup defaultApps(profile, "Default Applications");
  
  d->m_externalBrowser = defaultApps.readEntry("x-scheme-handler/https");
  if (d->m_externalBrowser.isEmpty()) {
      d->m_externalBrowser = defaultApps.readEntry("x-scheme-handler/http");
  }

to avoid too much nesting.

REPOSITORY
  R241 KIO

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

To: ngraham, #frameworks, broulik, cfeck, elvisangelaccio
Cc: achauvel, kde-frameworks-devel, michaelh, ngraham, bruns

Reply via email to