D15813: Respect users prefered text editor for shared text

Kai Uwe Broulik noreply at phabricator.kde.org
Fri Sep 28 15:01:24 BST 2018


broulik added inline comments.

INLINE COMMENTS

> shareplugin.cpp:118
>              connect(proc, SIGNAL(finished(int)), proc, SLOT(deleteLater()));
> -            proc->start(QStringLiteral("kate"), QStringList(QStringLiteral("--stdin")));
> +            proc->start(defaultApp.split(QStringLiteral("."))[2], QStringList(QStringLiteral("--stdin")));
>              proc->write(text.toUtf8());

You can use `QString::section`

> shareplugin.cpp:115
> +
> +        const QString& defaultApp = KMimeTypeTrader::self()->preferredService(QStringLiteral("text/plain"))->desktopEntryName();
> +        if (defaultApp == QStringLiteral("org.kde.kate") || defaultApp == QStringLiteral("org.kde.kwrite")) {

`preferredService` can return `null`

> shareplugin.cpp:116
> +        const QString& defaultApp = KMimeTypeTrader::self()->preferredService(QStringLiteral("text/plain"))->desktopEntryName();
> +        if (defaultApp == QStringLiteral("org.kde.kate") || defaultApp == QStringLiteral("org.kde.kwrite")) {
>              QProcess* proc = new QProcess();

Compare with `QLatin1String`

REPOSITORY
  R224 KDE Connect

BRANCH
  editor2

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

To: nicolasfella, #kde_connect, broulik, apol
Cc: kdeconnect, wistak, dvalencia, rmenezes, julioc, Leptopoda, timothyc, jdvr, yannux, Danial0_0, johnq, Pitel, adeen-s, SemperPeritus, ndavis, daniel.z.tg, jeanv, seebauer, bugzy, MayeulC, menasshock, tctara, apol
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdeconnect/attachments/20180928/712f16f1/attachment-0001.html>


More information about the KDEConnect mailing list