D21878: Rewrite servicemenu helper utility in C++

Elvis Angelaccio noreply at phabricator.kde.org
Wed Jul 3 20:56:19 BST 2019


elvisangelaccio added inline comments.

INLINE COMMENTS

> servicemenuinstaller.cpp:35-42
> +    QProcess process;
> +    auto args = QStringList{"--passivepopup", i18n("Dolphin service menu installation failed"), "15"};
> +    process.start("kdialog", args, QIODevice::ReadOnly);
> +    if (!process.waitForStarted()) {
> +        qFatal("Failed to run kdialog");
> +    }
> +

Since we are in a Qt program now, we could just open a KMessageBox rather than spawn another process just to show an error dialog (and `kdialog` might not even be installed).

> servicemenuinstaller.cpp:71-77
> +    QString result;
> +    QString errorText;
> +    if (evaluateShell("xdg-mime", QStringList{"query", "filetype", path}, result, errorText)) {
> +        return result;
> +    } else {
> +        fail(i18n("Failed to run xdg-mime %1: %2", path, errorText));
> +    }

Same here. We should use `QMimeDatabase` rather than run `xdg-mime`.

REPOSITORY
  R318 Dolphin

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

To: aspotashev, sitter, elvisangelaccio, ngraham
Cc: cfeck, kfm-devel, fprice, fbampaloukas, alexde, feverfew, meven, spoorun, navarromorales, firef, andrebarros, emmanuelp, mikesomov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.kde.org/mailman/private/kfm-devel/attachments/20190703/317f4653/attachment.htm>


More information about the kfm-devel mailing list