D9027: Make it compile with QT_NO_CAST_FROM_ASCII

David Faure noreply at phabricator.kde.org
Tue Nov 28 07:36:02 UTC 2017


dfaure requested changes to this revision.
dfaure added inline comments.
This revision now requires changes to proceed.

INLINE COMMENTS

> knotificationmanager.cpp:87
>          if (!runtimeDir.isEmpty()) {
> -            inSandbox = QFileInfo::exists(QFile::encodeName(runtimeDir) + QLatin1String("/flatpak-info"));
> +            inSandbox = QFileInfo::exists(QString::fromUtf8(QFile::encodeName(QString::fromUtf8(runtimeDir))) + QLatin1String("/flatpak-info"));
>          }

Ouch that's a lot of conversions.

Remove it all, and fix the `encodeName` to `decodeName` as it should have been.

> kstatusnotifieritem.cpp:48
>  
> -static const char s_statusNotifierWatcherServiceName[] = "org.kde.StatusNotifierWatcher";
> +static const QString s_statusNotifierWatcherServiceName = QStringLiteral("org.kde.StatusNotifierWatcher");
>  static const int s_legacyTrayIconSize = 24;

static QStrings create startup code. Leave it as a char[], do the conversions at runtime.

> notifybyflatpak.cpp:40
>  
> -static const char portalDbusServiceName[] = "org.freedesktop.portal.Desktop";
> -static const char portalDbusInterfaceName[] = "org.freedesktop.portal.Notification";
> -static const char portalDbusPath[] = "/org/freedesktop/portal/desktop";
> +static const QString portalDbusServiceName = QStringLiteral("org.freedesktop.portal.Desktop");
> +static const QString portalDbusInterfaceName = QStringLiteral("org.freedesktop.portal.Notification");

same

> notifybypopup.cpp:61
>  
> -static const char dbusServiceName[] = "org.freedesktop.Notifications";
> -static const char dbusInterfaceName[] = "org.freedesktop.Notifications";
> -static const char dbusPath[] = "/org/freedesktop/Notifications";
> +static const QString dbusServiceName = QStringLiteral("org.freedesktop.Notifications");
> +static const QString dbusInterfaceName = QStringLiteral("org.freedesktop.Notifications");

same

> knotificationdbustest.cpp:29
>  
> -static const char dbusServiceName[] = "org.freedesktop.Notifications";
> -static const char dbusInterfaceName[] = "org.freedesktop.Notifications";
> -static const char dbusPath[] = "/org/freedesktop/Notifications";
> +static const QString dbusServiceName = QStringLiteral("org.freedesktop.Notifications");
> +static const QString dbusInterfaceName = QStringLiteral("org.freedesktop.Notifications");

same

Alternatively, if they are used only once, maybe just move each QStringLiteral to where it's used.

REPOSITORY
  R289 KNotifications

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

To: mlaurent, dfaure
Cc: #frameworks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20171128/78f4de5c/attachment-0001.html>


More information about the Kde-frameworks-devel mailing list