MPRIS control: fix instance indicator with multiple app instances

Not sure what operator+ overload has been used exactly for the int,
in any case it does not work as intended and needs e.g. an explicit
QString::number() invocation.

Also start with number 2 for duplicated instances.

Test Plan:
Start multiple instances of an MPRIS player (e.g. Gwenview). Before the
second instance would get labelled with "Name []", with this patch it is
labelled with "Name [2]".

Reviewers: #kde_connect, mtijink

Reviewed By: #kde_connect, mtijink

Subscribers: mtijink, nicolasfella

Tags: #kde_connect

Differential Revision:
parent bb3ab8b6
......@@ -96,8 +96,8 @@ void MprisControlPlugin::addPlayer(const QString& service)
QString uniqueName = identity;
for (int i = 1; playerList.contains(uniqueName); ++i) {
uniqueName = identity + " [" + i + "]";
for (int i = 2; playerList.contains(uniqueName); ++i) {
uniqueName = identity + QLatin1String(" [") + QString::number(i) + QLatin1Char(']');
MprisPlayer player(service, mediaPlayerObjectPath, QDBusConnection::sessionBus());
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment